Age | Commit message (Collapse) | Author |
|
|
|
process_vm_readv requires it, and I'm not exactly sure which other
things do too.
|
|
|
|
`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.
|
|
|
|
|
|
|
|
The libc_bitflags! macro was replaced with a non-recursive one supporting
only public structs. I could not figure out how to make the old macro work
with the upgrade, so I reworked part of the bitflags! macro directly to suit
our needs, much as the original recursive macro was made. There are no uses
of this macro for non-public structs, so this is not a problem for internal code.
|
|
Used the libc_enum! macro to create enums for the ptrace event, request, and libc_bitflags for options constants defined in libc.
Also, replicated functionality to move from c_int to PtraceEvent enum in PR #728 as it appears to be abandoned.
Added utility function for detaching from tracee. Updated names and removed ptrace::ptrace namespace
|
|
|
|
|
|
|
|
|
|
These include:
* PTRACE_TRACEME
* PTRACE_CONT
* PTRACE_ATTACH
* PTRACE_SYSCALL
|
|
|
|
|
|
Note that ptrace isn't documented as signal-safe, but it's supposed to
just be a light syscall wrapper, so it should be fine.
|
|
Some tests were invoking non-async-signal-safe functions from the child
process after a `fork`. Since they might be invoked in parallel, this
could lead to problems.
|
|
The recommended way to trace syscalls with ptrace is to set the
PTRACE_O_TRACESYSGOOD option, to distinguish syscall stops from
receiving an actual SIGTRAP. In C, this would cause WSTOPSIG to return
SIGTRAP | 0x80, but nix wants to parse that as an actual signal.
Add another wait status type for syscall stops (in the language of the
ptrace(2) manpage, "PTRACE_EVENT stops" and "Syscall-stops" are
different things), and mask out bit 0x80 from signals before trying to
parse it.
Closes #550
|
|
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
|
|
|
|
This commit changes the name of the enum returned by `fork()` to
`ForkResult`, and changes the `Parent` variant to be struct-like.
The result can be matched like
use nix::unistd::ForkResult::*;
match fork().unwrap() {
Parent { child } => { ... }
Child => { ... }
}
using the shorthand matching syntax for struct-like enum variants.
This is a breaking change.
|
|
Replace a busy loop with a call to `pause(2)`.
|
|
|
|
* Extend the enums in WaitStatus to include all process states (signaled,
stopped, exited, continued).
* Decode status from waitpid
* Return appropate WaitStatus
* Update tests to use the new WaitStatus
* Add new tests for specific status values
|