Skip to content

Commit 8866df6

Browse files
Merge #1335
1335: Add `PTRACE_EVENT_STOP` enum variant r=asomers a=GabrielMajeri Adds the `PTRACE_EVENT_STOP` variant to the `ptrace::Event` enum. Smaller part of #1279 Closes #1334 Co-authored-by: Gabriel Majeri <[email protected]>
2 parents 7207004 + 2decd67 commit 8866df6

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
2626
(#[1422](https://github.com/nix-rust/nix/pull/1422))
2727
- Added `IP6T_SO_ORIGINAL_DST` sockopt.
2828
(#[1490](https://github.com/nix-rust/nix/pull/1490))
29+
- Added the `PTRACE_EVENT_STOP` variant to the `sys::ptrace::Event` enum
30+
(#[1335](https://github.com/nix-rust/nix/pull/1335))
2931

3032
### Changed
3133

src/sys/ptrace/linux.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ libc_enum!{
137137
/// Event for a stop before an exit. Unlike the waitpid Exit status program.
138138
/// registers can still be examined
139139
PTRACE_EVENT_EXIT,
140-
/// STop triggered by a seccomp rule on a tracee.
140+
/// Stop triggered by a seccomp rule on a tracee.
141141
PTRACE_EVENT_SECCOMP,
142-
// PTRACE_EVENT_STOP not provided by libc because it's defined in glibc 2.26
142+
/// Stop triggered by the `INTERRUPT` syscall, or a group stop,
143+
/// or when a new child is attached.
144+
PTRACE_EVENT_STOP,
143145
}
144146
}
145147

@@ -401,7 +403,7 @@ pub fn kill(pid: Pid) -> Result<()> {
401403
}
402404
}
403405

404-
/// Move the stopped tracee process forward by a single step as with
406+
/// Move the stopped tracee process forward by a single step as with
405407
/// `ptrace(PTRACE_SINGLESTEP, ...)`
406408
///
407409
/// Advances the execution of the process with PID `pid` by a single step optionally delivering a
@@ -411,11 +413,11 @@ pub fn kill(pid: Pid) -> Result<()> {
411413
/// ```rust
412414
/// use nix::sys::ptrace::step;
413415
/// use nix::unistd::Pid;
414-
/// use nix::sys::signal::Signal;
416+
/// use nix::sys::signal::Signal;
415417
/// use nix::sys::wait::*;
416418
/// fn main() {
417-
/// // If a process changes state to the stopped state because of a SIGUSR1
418-
/// // signal, this will step the process forward and forward the user
419+
/// // If a process changes state to the stopped state because of a SIGUSR1
420+
/// // signal, this will step the process forward and forward the user
419421
/// // signal to the stopped process
420422
/// match waitpid(Pid::from_raw(-1), None) {
421423
/// Ok(WaitStatus::Stopped(pid, Signal::SIGUSR1)) => {

0 commit comments

Comments
 (0)