diff options
author | xd009642 <danielmckenna93@gmail.com> | 2018-02-03 11:46:03 +0000 |
---|---|---|
committer | xd009642 <danielmckenna93@gmail.com> | 2018-02-03 11:46:03 +0000 |
commit | 445b488f830d75ca173af77440a2fe7626a4e6dc (patch) | |
tree | 4f08dd6c9be3090d4467662233585e8defedfa86 /src | |
parent | d0218ee3958306ef6c6a1790a0dcbb12ad615007 (diff) | |
download | nix-445b488f830d75ca173af77440a2fe7626a4e6dc.zip |
Updated example to be more meaningful
Example now matches something more akin to an actual usecase.
Diffstat (limited to 'src')
-rw-r--r-- | src/sys/ptrace.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/sys/ptrace.rs b/src/sys/ptrace.rs index be09974d..59ceb378 100644 --- a/src/sys/ptrace.rs +++ b/src/sys/ptrace.rs @@ -292,10 +292,17 @@ pub fn cont<T: Into<Option<Signal>>>(pid: Pid, sig: T) -> Result<()> { /// use nix::sys::ptrace::step; /// use nix::unistd::Pid; /// use nix::sys::signal::Signal; +/// use nix::sys::wait::*; /// fn main() { -/// let dummy_pid = Pid::from_raw(0); -/// -/// let _ = step(dummy_pid, Some(Signal::SIGSTOP)); +/// // 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)) => { +/// let _ = step(pid, Signal::SIGUSR1); +/// } +/// _ => {}, +/// } /// } /// ``` pub fn step<T: Into<Option<Signal>>>(pid: Pid, sig: T) -> Result<()> { |