Skip to content

Commit

Permalink
Merge #1335
Browse files Browse the repository at this point in the history
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 <gabriel.majeri6@gmail.com>
  • Loading branch information
bors[bot] and GabrielMajeri committed Aug 21, 2021
2 parents 7207004 + 2decd67 commit 8866df6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -26,6 +26,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
(#[1422](https://github.com/nix-rust/nix/pull/1422))
- Added `IP6T_SO_ORIGINAL_DST` sockopt.
(#[1490](https://github.com/nix-rust/nix/pull/1490))
- Added the `PTRACE_EVENT_STOP` variant to the `sys::ptrace::Event` enum
(#[1335](https://github.com/nix-rust/nix/pull/1335))

### Changed

Expand Down
14 changes: 8 additions & 6 deletions src/sys/ptrace/linux.rs
Expand Up @@ -137,9 +137,11 @@ libc_enum!{
/// Event for a stop before an exit. Unlike the waitpid Exit status program.
/// registers can still be examined
PTRACE_EVENT_EXIT,
/// STop triggered by a seccomp rule on a tracee.
/// Stop triggered by a seccomp rule on a tracee.
PTRACE_EVENT_SECCOMP,
// PTRACE_EVENT_STOP not provided by libc because it's defined in glibc 2.26
/// Stop triggered by the `INTERRUPT` syscall, or a group stop,
/// or when a new child is attached.
PTRACE_EVENT_STOP,
}
}

Expand Down Expand Up @@ -401,7 +403,7 @@ pub fn kill(pid: Pid) -> Result<()> {
}
}

/// Move the stopped tracee process forward by a single step as with
/// Move the stopped tracee process forward by a single step as with
/// `ptrace(PTRACE_SINGLESTEP, ...)`
///
/// Advances the execution of the process with PID `pid` by a single step optionally delivering a
Expand All @@ -411,11 +413,11 @@ pub fn kill(pid: Pid) -> Result<()> {
/// ```rust
/// use nix::sys::ptrace::step;
/// use nix::unistd::Pid;
/// use nix::sys::signal::Signal;
/// use nix::sys::signal::Signal;
/// use nix::sys::wait::*;
/// fn main() {
/// // If a process changes state to the stopped state because of a SIGUSR1
/// // signal, this will step the process forward and forward the user
/// // If a process changes state to the stopped state because of a SIGUSR1
/// // signal, this will step the process forward and forward the user
/// // signal to the stopped process
/// match waitpid(Pid::from_raw(-1), None) {
/// Ok(WaitStatus::Stopped(pid, Signal::SIGUSR1)) => {
Expand Down

0 comments on commit 8866df6

Please sign in to comment.