Age | Commit message (Collapse) | Author |
|
|
|
977: Error as i32 r=asomers a=asomers
Add Error::as_errno
This method is useful when it can be statically determined that a nix::Error be an errno, which I find to be very common.
Also, fix some recently introduced compiler warnings.
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
967: Add a wrapper for lutimes(2) r=asomers a=jmmv
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2),
but unfortunately these APIs are not available on old-ish systems.
In particular, macOS Sierra and below don't implement them, making the
new APIs unusable. Whether we should care about such "old" systems is
debatable, but the problem is that, at the moment, this is the only
macOS version usable on Travis to test kexts and, thus, to test FUSE
file systems.
This should have been part of PR #946, which added a wrapper for
utimes(2) following this same rationale, but missed lutimes(2) because
I simply didn't notice it existed.
Co-authored-by: Julio Merino <julio@meroh.net>
|
|
|
|
|
|
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2),
but unfortunately these APIs are not available on old-ish systems.
In particular, macOS Sierra and below don't implement them, making the
new APIs unusable. Whether we should care about such "old" systems is
debatable, but the problem is that, at the moment, this is the only
macOS version usable on Travis to test kexts and, thus, to test FUSE
file systems.
This should have been part of PR #946, which added a wrapper for
utimes(2) following this same rationale, but missed lutimes(2) because
I simply didn't notice it existed.
|
|
This patch adds a wrapper for the acct(2) syscall, with two functions
for enabling and disabling process accounting.
|
|
* Moved ptrace API into it's own module with cfg'ed modules exported for linux/android or BSDs.
* Replicated current linux API for BSD
* Added API functions to peek and poke memory to avoid needing to replicate deprecated linux API and remaining feature complete
* Added helper function for `PTRACE_KILL` requests
* Updated tests based on new API changes
* Added addition kill calls to `test_ptrace_cont` as inferior death doesn't happen immediately on OSX which caused issues in the tests.
|
|
These are mostly to ensure that all the platforms we care about in our
CI can reference these primitives.
|
|
This also adds a test for truncate (obviously) but, while doing so, also
adds a test for the already-existing ftruncate.
|
|
|
|
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2),
but unfortunately these APIs are not available on old-ish systems.
In particular, macOS Sierra and below don't implement them, making the
new APIs unusable. Whether we should care about such "old" systems is
debatable, but the problem is that, at the moment, this is the only
macOS version usable on Travis to test kexts and, thus, to test FUSE
file systems.
|
|
|
|
- init_module and finit_module to load kernel modules
- delete_module to unload kernel modules
Signed-off-by: Pascal Bach <pascal.bach@nextrem.ch>
|
|
This macro can be used in tests to skip the test if it requires root to sucssfully run.
|
|
|
|
This avoids having both 0.4 and 0.5 (required by tempfile)
|
|
This is a lower-level interface than `std::fs::ReadDir`. Notable differences:
* can be opened from a file descriptor (as returned by `openat`, perhaps
before knowing if the path represents a file or directory). Uses
`fdopendir` for this, available on all Unix platforms as of
rust-lang/libc#1018.
* implements `AsRawFd`, so it can be passed to `fstat`, `openat`, etc.
* can be iterated through multiple times without closing and reopening the
file descriptor. Each iteration rewinds when finished.
* returns entries for `.` (current directory) and `..` (parent directory).
* returns entries' names as a `CStr` (no allocation or conversion beyond
whatever libc does).
|
|
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
|
|
|
918: Fix passing multiple file descriptors / control messages via sendmsg r=asomers a=jonas-schievink
Fixes #464
Closes #874 because it's incorporated here
Closes #756 because it adds the test from that issue (with fixes)
Co-authored-by: alecmocatta <alec@mocatta.net>
|
|
|
|
|
|
|
|
|
|
Rather than using the native implementation of these constants
on supported platforms, the native implementation was instead
emulated. This was also hidden from the user even though this
could result in data races and the functionality being broken.
Native functionality is, however, not support on macos/ios.
Rather than enable this emulation solely for this platform, it
should be removed as this is a dangerous abstraction.
|
|
|
|
This is a straight port of @abbradar's work in #276, with
two (somewhat weak) tests and a bit of documentation.
|
|
This is useful when using printf-style debugging to observe the variables of
the program.
Also includes a test.
Fixes #885.
|
|
ioctls on FreeBSD and DragonflyBSD have a separate request code generation
macro `_IOWINT` which is now exposed as `request_code_write_int`.
`ioctl_write_int` is also fixed on these platforms to use this new request
|
|
* Split `ioctl!` into separate macros. This makes documentation easier to read.
* For every `ioctl_*!` macro include a description of the macro arguments as, the
function prototype for the generated wrapper function, and an example if we have one.
* Expose `request_code_*!` in the documentation to make the `ioctl_*_bad` macros easier to use.
* Reorganize the file hierarchy to be simpler
|
|
872: Change sys::aio::lio_listio to sys::aio::LioCb::listio r=asomers a=asomers
The new LioCb structure allows us to control the exact arguments passed
to lio_listio, guaranteeing that each call gets a unique storage
location for the list argument. This prevents clients from misusing
lio_listio in a way that causes events to get dropped from a kqueue
Fixes #870
|
|
It helps deal with errors like EAGAIN, which can result in a subset of
an LioCb's operations being queued. The test is only enabled on
FreeBSD, because it requires intimate knowledge of AIO system limits.
|
|
|
|
Supporting the bytes crate was unnecessarily specific. This change
replaces from_bytes and from_bytes_mut with from_boxed_slice and
from_boxed_mut_slice, which can work with anything that implements
Borrow<[u8]> and BorrowMut<[u8]>, respectively.
|
|
The new LioCb structure allows us to control the exact arguments passed
to lio_listio, guaranteeing that each call gets a unique storage
location for the list argument. This prevents clients from misusing
lio_listio in a way that causes events to get dropped from a kqueue
Fixes #870
|
|
On Linux, if the signal trampoline code is in the C library, sigaction
sets the SA_RESTORER flag (0x04000000) in the sa_flags field of old
sigaction (see sigreturn(2)).
This is not intended for application use and is missing from SaFlags,
therefore from_bits fails and unwrapping panics the user program.
This fix just drops the bits that are not defined in SaFlags.
|
|
851: Added `getsid` in `::nix::unistd` r=asomers a=ggriffiniii
Resolves Issue #850
|
|
|
|
This module has two functions;
set: set an alarm, and
cancel: cancels a previously set alarm.
|
|
|
|
820: Change AioCb to primarily use Bytes instead of Rc<[u8]> r=Susurrus a=asomers
`Rc<[u8]>` isn't a very good buffer type to use for aio. For one thing, it lacks interior mutability. For another, a single `Rc<[u8]>` can't be carved up into smaller buffers of the same type. `Bytes` and `BytesMut` fix both problems. This PR removes the ability to construct an `AioCb` from `Rc<[u8]>` and adds the ability to construct one from `Bytes`, `BytesMut`, or raw pointers (for consumers who need even more flexibility). At this stage, the PR has the following warts:
1. A hack is necessary to force small `Bytes` buffers to allocate on the heap. I plan to fix this with an enhancement to the bytes crate.
2. The `AioCb::buffer` method is necessary due to a deficiency in the tokio-core crate. Once I fix that, then only `AioCb::into_buffer`will need to be public.
|
|
|
|
|
|
It's not actually safe to read into an `Rc<[u8]>`. It only worked
because of a coincidental `unsafe` block. Replace that type with
`BytesMut` from the bytes crate. For consistency's sake, use `Bytes`
for writing too, and completely remove methods relating to `Rc<[u8]>`.
Note that the `AioCb` will actually own the `BytesMut` object. The
caller must call `into_buffer` to get it back once the I/O is complete.
Fixes #788
|
|
|
|
`pause` will always return `-1` as a result and sets `errno` to
`EINTR`, which indicates that a signal was caught by the process. Since
this is the point of `pause` return an error here makes little sense.
Closes #827.
|
|
|
|
|
|
More Rusty to use &X and &mut X where X is a container type.
|