@@ -39,16 +39,52 @@ libc_bitflags!(
39
39
target_os = "android" ) ) ]
40
40
const WSTOPPED : WaitPidFlag = WUNTRACED ;
41
41
42
+ /// Possible return values from wait() or waitpid(), indicating a state
43
+ /// transition in a child process. The pid_t member / indicates which
44
+ /// process is reporting the state transition.
45
+ /// Note that there are two Linux-specific enum variants, `PtraceEvent`
46
+ /// and `PtraceSyscall`. Portable code should avoid exhaustively
47
+ /// matching on WaitStatus.
42
48
#[ derive( Eq , PartialEq , Clone , Copy , Debug ) ]
43
49
pub enum WaitStatus {
50
+ /// The process exited normally (as with `exit()` or returning from
51
+ /// `main`) with the given exit code. This case matches the C macro
52
+ /// `WIFEXITED(status)`; the second field is `WEXITSTATUS(status)`.
44
53
Exited ( pid_t , i8 ) ,
54
+ /// The process was killed by the given signal. The third element
55
+ /// indicates whether the signal generated a core dump. This case
56
+ /// matches the C macro `WIFSIGNALED(status)`; the last two fields
57
+ /// correspond to `WTERMSIG(status)` and `WCOREDUMP(status)`.
45
58
Signaled ( pid_t , Signal , bool ) ,
59
+ /// The process is alive, but was stopped by the given signal. This
60
+ /// is only reported if `WaitPidFlag::WUNTRACED` was passed. This
61
+ /// case matches the C macro `WIFSTOPPED(status)`; the second field
62
+ /// is `WSTOPSIG(status)`.
46
63
Stopped ( pid_t , Signal ) ,
64
+ /// The traced process was stopped by a `PTRACE_EVENT_*` event. See
65
+ /// [nix::sys::ptrace]1 and ptrace(2) for more information. All currently
66
+ /// defined events use SIGTRAP as the signal; the third field is the
67
+ /// `PTRACE_EVENT_*` value of the event.
68
+ ///
69
+ /// [nix::sys::ptrace]: ../ptrace/index.html
47
70
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
48
71
PtraceEvent ( pid_t , Signal , c_int ) ,
72
+ /// The traced process was stopped by execution of a system call,
73
+ /// and `PTRACE_O_TRACESYSGOOD` is in effect. See [nix::sys::ptrace] for
74
+ /// more information.
75
+ ///
76
+ /// [nix::sys::ptrace]: ../ptrace/index.html
49
77
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
50
78
PtraceSyscall ( pid_t ) ,
79
+ /// The process was previously stopped but has received a SIGCONT
80
+ /// signal and is now resuming execution. This is only reported if
81
+ /// `WaitPidFlag::WCONTINUED` was passed. This case matches the C
82
+ /// macro `WIFCONTINUED(status)`.
51
83
Continued ( pid_t ) ,
84
+ /// There are currently no state changes to report in any awaited
85
+ /// child process. This is only returned if `WaitPidFlag::WNOHANG`
86
+ /// was used (otherwise `wait()` or `waitpid()` would block until
87
+ /// there was something to report).
52
88
StillAlive
53
89
}
54
90
0 commit comments