Age | Commit message (Collapse) | Author |
|
|
|
681: Remove feature flags r=Susurrus
These are vestiges of the initial push to get this working on Rust 1.0. These feature flags are undocumented and so hard to discover (only learned about them today!), prevent functions being included that should be and this also affects documentation on docs.rs, and none of the features are tested in CI and the `execvpe` has been broken for forever.
The solution is to conditionally compile everything supported for a given platform and do away completely with the feature flags. The `execvpe` function is completely removed as it's not available for *nix platforms in libc and is already broken, so no loss removing it. We'll add it back once it's back in libc (rust-lang/libc#670).
Closes #98.
Closes #206.
Closes #306.
Closes #308.
|
|
686: Fix special ptraces r=Susurrus
In #614 we added specializations of `ptrace()` that added more type safety. As part of this, the `UnsupportedOperation` error was introduced for the requests that are covered by specialized versions so they couldn't be used with the general `ptrace()`. Unfortunately, no tests were added with this PR and so it slipped through that you could not do those operations at all anymore: `ptrace()` reported `UnsupportedOperation` for them and `ptrace_*` called `ptrace`, not `ffi::ptrace` and so also reported `UnsupportedOperation`! Whoops!
This minimally-invasive surgery corrects this by adding tests that call all the specialized `ptrace_*` ignoring the return value save checking for `UnsupportedOperation`. It also changes the functions calls to use `ffi::ptrace()` directly to fix the bug.
As this was never a bug in a released version of `nix`, there's no need for a changelog entry here.
|
|
|
|
It was broken when enabled, and currently the libc definition is only
available for windows. This will be re-added when a new libc is released
that supports it across all available platforms
|
|
Note that this is now only available for Linux as support is missing in libc
for Android (see rust-lang/libc#671).
As part of this work the SIGUSR2 signal mutex was altered to be a general
signal mutex. This is because all signal handling is shared across all threads
in the Rust test harness, so if you alter one signal, depending on whether it's
additive or may overwrite the mask for other signals, it could break the other
ones. Instead of putting this on the user, just broaden the scope of the mutex
so that any altering of signal handling needs to use it.
|
|
|
|
638: Make aio, chdir, and wait tests thread safe r=Susurrus
Fix thread safety issues in aio, chdir, and wait tests
They have four problems:
* The chdir tests change the process's cwd, which is global. Protect them all with a mutex.
* The wait tests will reap any subprocess, and several tests create subprocesses. Protect them all with a mutex so only one subprocess-creating test will run at a time.
* When a multithreaded test forks, the child process can sometimes block in the stack unwinding code. It blocks on a mutex that was held by a different thread in the parent, but that thread doesn't exist in the child, so a deadlock results. Fix this by immediately calling `std::process:;exit` in the child processes.
* My previous attempt at thread safety in the aio tests didn't work, because anonymous MutexGuards drop immediately. Fix this by naming the SIGUSR2_MTX MutexGuards.
Fixes #251
|
|
* Make test_tcgetattr deterministic. The old version behaved
differently depending on what file descriptors were opened by the
harness or by other tests, and could race against other tests.
* Close some file descriptor leaks
Fixes #154
|
|
|
|
It isn't necessary, and can cause deadlocks in Rust's test harness
|
|
They have four problems:
* The chdir tests change the process's cwd, which is global. Protect them
all with a mutex.
* The wait tests will reap any subprocess, and several tests create
subprocesses. Protect them all with a mutex so only one
subprocess-creating test will run at a time.
* When a multithreaded test forks, the child process can sometimes block in
the stack unwinding code. It blocks on a mutex that was held by a
different thread in the parent, but that thread doesn't exist in the
child, so a deadlock results. Fix this by immediately calling
std::process:exit in the child processes.
* My previous attempt at thread safety in the aio tests didn't work, because
anonymous MutexGuards drop immediately. Fix this by naming the
SIGUSR2_MTX MutexGuards.
Fixes #251
|
|
677: PtyMaster::drop should panic on EBADF r=asomers
Fixes #659
|
|
Also, document the double-close risk with unistd::close
Fixes #659
|
|
630: Add wrappers for sysconf(3), pathconf(2), and fpathconf(2) r=asomers
|
|
|
|
|
|
This also removes the incorrect TCSASOFT definition as an enum type because it's
actually a bitfield.
|
|
|
|
660: Fix double close bugs in test_lseek and test_lseek64 r=asomers
std::fs::File closes the underlying file descriptor on Drop, without
checking for errors. test_lseek and test_lseek64 also manually close
the file descriptor. That works for single threaded test runs. But for
multithreaded runs, it causes EBADF errors in other tests. Fix the
tests by consuming the File with into_raw_fd(), so its drop method will
never be called.
|
|
std::fs::File closes the underlying file descriptor on Drop, without
checking for errors. test_lseek and test_lseek64 also manually close
the file descriptor. That works for single threaded test runs. But for
multithreaded runs, it causes EBADF errors in other tests. Fix the
tests by consuming the File with into_raw_fd(), so its drop method will
never be called.
Also, fix a potential short read bug in the same tests.
|
|
Nothing that nix currently binds is architecture-specific, and Android
supports ptrace just as much as non-Android Linux.
|
|
Newtypes for uid_t, gid_t and pid_t.
|
|
642: Handle short reads in pty tests r=Susurrus
Some pty tests would fail intermittently because read(2) occasionally
returns less data than requested.
|
|
|
|
Starting somewhere in 4.4.0 some versions of Linux have a known bug with
tmpfs in namespaces. It's unknown exactly which versions are affected
(and likely distro-dependent), but easy to detect. When open(2) returns
EOVERFLOW, skip the rest of the test.
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1659087
Fixes #610
|
|
Some pty tests would fail intermittently because read(2) occasionally
returns less data than requested.
|
|
The test_ioctl values are computed using ioctl-test.c
|
|
|
|
Seems that pretty much all aio tests fail on x64 musl builds.
|
|
|
|
|
|
|
|
|
|
* grantpt
* ptsname/ptsname_r
* posix_openpt
* unlockpt
|
|
The existing AioCb constructors work for simple programs where
everything is stored on the stack. But in more complicated programs the
borrow checker can't prove that a buffer will outlive the AioCb that
references it. Fix this problem by introducting
AioCb::from_boxed_slice, which takes a reference-counted buffer.
Fixes #575
|
|
Adds a mutex to protect access to SIGUSR2 signal handlers by the AIO
tests.
Fixes #578
|
|
|
|
|
|
|
|
|
|
revents is an output field so regardless of what value it is set to it
will be overwritten by many of the function calls that take a PollFd.
The only value that makes sense for the caller to pass in in
`EventFlags::empty()` so we just hardcode that instead of making the
caller do it.
|
|
Also, fix style bug in AIO tests
|
|
If an AioCb has any in-kernel state, AioCb.drop will print a warning and
wait for it to complete.
|
|
Prevent immutable buffers from being used with aio_read or lio_listio
with LIO_READ. AioCb.from_slice no longer needs to be unsafe.
|
|
|
|
Add POSIX AIO support
POSIX AIO is a standard for asynchronous file I/O. Read, write, and
fsync operations can all take place in the background, with completion
notification delivered by a signal, by a new thread, by kqueue, or not
at all.
The SigEvent class, used for AIO notifications among other things, is
also added.
|
|
|
|
This introduces a wrapper for fchdir(2), allowing a process to change
directory based on an open file descriptor.
The underlying function is available in libc crate since 0.2.20.
|
|
|