Skip to content

Commit

Permalink
Updated example to be more meaningful
Browse files Browse the repository at this point in the history
Example now matches something more akin to an actual usecase.
  • Loading branch information
xd009642 committed Feb 3, 2018
1 parent d0218ee commit 445b488
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/sys/ptrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand Down

0 comments on commit 445b488

Please sign in to comment.