Lines Matching refs:status
1 //! Wait for a process to change status
18 /// Do not block when there are no processes wishing to report status.
20 /// Report the status of selected processes which are stopped due to a
26 /// Report the status of selected processes which have terminated.
37 /// Report the status of selected processes that have continued from a
52 /// Don't reap, just poll status.
80 /// Each status (other than `StillAlive`) describes a state transition
91 /// `WIFEXITED(status)`; the second field is `WEXITSTATUS(status)`.
95 /// matches the C macro `WIFSIGNALED(status)`; the last two fields
96 /// correspond to `WTERMSIG(status)` and `WCOREDUMP(status)`.
100 /// case matches the C macro `WIFSTOPPED(status)`; the second field
101 /// is `WSTOPSIG(status)`.
124 /// macro `WIFCONTINUED(status)`.
148 fn exited(status: i32) -> bool {
149 libc::WIFEXITED(status)
152 fn exit_status(status: i32) -> i32 {
153 libc::WEXITSTATUS(status)
156 fn signaled(status: i32) -> bool {
157 libc::WIFSIGNALED(status)
160 fn term_signal(status: i32) -> Result<Signal> {
161 Signal::try_from(libc::WTERMSIG(status))
164 fn dumped_core(status: i32) -> bool {
165 libc::WCOREDUMP(status)
168 fn stopped(status: i32) -> bool {
169 libc::WIFSTOPPED(status)
172 fn stop_signal(status: i32) -> Result<Signal> {
173 Signal::try_from(libc::WSTOPSIG(status))
177 fn syscall_stop(status: i32) -> bool {
182 libc::WSTOPSIG(status) == libc::SIGTRAP | 0x80
186 fn stop_additional(status: i32) -> c_int {
187 (status >> 16) as c_int
190 fn continued(status: i32) -> bool {
191 libc::WIFCONTINUED(status)
199 /// Returns an `Error` corresponding to `EINVAL` for invalid status values.
209 /// let status = WaitStatus::from_raw(pid, 0x0002);
210 /// assert_eq!(status, Ok(WaitStatus::Signaled(pid, Signal::SIGINT, false)));
212 pub fn from_raw(pid: Pid, status: i32) -> Result<WaitStatus> {
213 Ok(if exited(status) {
214 WaitStatus::Exited(pid, exit_status(status))
215 } else if signaled(status) {
216 WaitStatus::Signaled(pid, term_signal(status)?, dumped_core(status))
217 } else if stopped(status) {
220 fn decode_stopped(pid: Pid, status: i32) -> Result<WaitStatus> {
221 let status_additional = stop_additional(status);
222 Ok(if syscall_stop(status) {
225 WaitStatus::Stopped(pid, stop_signal(status)?)
227 WaitStatus::PtraceEvent(pid, stop_signal(status)?,
228 stop_additional(status))
232 fn decode_stopped(pid: Pid, status: i32) -> Result<WaitStatus> {
233 Ok(WaitStatus::Stopped(pid, stop_signal(status)?))
237 return decode_stopped(pid, status);
239 assert!(continued(status));
272 let status = match siginfo.si_code {
298 Ok(status)
302 /// Wait for a process to change status
311 let mut status: i32 = 0;
321 &mut status as *mut c_int,
328 res => WaitStatus::from_raw(Pid::from_raw(res), status),
332 /// Wait for any child process to change status or a signal is received.
361 /// Wait for a process to change status