Skip to content

Commit 592bd52

Browse files
committed
PtraveEvent Documentation
1 parent 98ad58a commit 592bd52

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/sys/wait.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ const WSTOPPED: WaitPidFlag = WUNTRACED;
5151
pub enum WaitStatus {
5252
/// Signifies that the process has exited, providing the PID and associated exit status.
5353
Exited(Pid, i8),
54-
/// Signifies that the process was killed by a signal, providing the PID and associated signal.
54+
/// Signifies that the process was killed by a signal, providing the PID, the associated
55+
/// signal, and a boolean value that is set to `true` when a core dump was produced.
5556
Signaled(Pid, Signal, bool),
56-
/// Signifies that the process was stopped by a signal, providing the PID and associated signal.
57+
/// Signifies that the process was stopped by a signal, providing the PID and associated
58+
/// signal.
5759
Stopped(Pid, Signal),
5860
#[cfg(any(target_os = "linux", target_os = "android"))]
61+
/// Signifies that the process was stopped due to a ptrace event, providing the PID, the
62+
/// associated signal, and an integer that represents the status of the event.
5963
PtraceEvent(Pid, Signal, c_int),
6064
/// Signifies that the process received a `SIGCONT` signal, and thus continued.
6165
Continued(Pid),
@@ -207,11 +211,12 @@ fn decode(pid : Pid, status: i32) -> WaitStatus {
207211
cfg_if! {
208212
if #[cfg(any(target_os = "linux", target_os = "android"))] {
209213
fn decode_stopped(pid: Pid, status: i32) -> WaitStatus {
210-
let status_additional = status::stop_additional(status);
211-
if status_additional == 0 {
212-
WaitStatus::Stopped(pid, status::stop_signal(status))
214+
let status = status::stop_additional(status);
215+
let signal = status::stop_signal(status);
216+
if status == 0 {
217+
WaitStatus::Stopped(pid, signal)
213218
} else {
214-
WaitStatus::PtraceEvent(pid, status::stop_signal(status), status::stop_additional(status))
219+
WaitStatus::PtraceEvent(pid, signal, status)
215220
}
216221
}
217222
} else {

0 commit comments

Comments
 (0)