[−][src]Enum nix::sys::wait::WaitStatus
Possible return values from wait()
or waitpid()
.
Each status (other than StillAlive
) describes a state transition
in a child process Pid
, such as the process exiting or stopping,
plus additional data about the transition if any.
Note that there are two Linux-specific enum variants, PtraceEvent
and PtraceSyscall
. Portable code should avoid exhaustively
matching on WaitStatus
.
Variants
The process exited normally (as with exit()
or returning from
main
) with the given exit code. This case matches the C macro
WIFEXITED(status)
; the second field is WEXITSTATUS(status)
.
The process was killed by the given signal. The third field
indicates whether the signal generated a core dump. This case
matches the C macro WIFSIGNALED(status)
; the last two fields
correspond to WTERMSIG(status)
and WCOREDUMP(status)
.
The process is alive, but was stopped by the given signal. This
is only reported if WaitPidFlag::WUNTRACED
was passed. This
case matches the C macro WIFSTOPPED(status)
; the second field
is WSTOPSIG(status)
.
Continued(Pid)
The process was previously stopped but has resumed execution
after receiving a SIGCONT
signal. This is only reported if
WaitPidFlag::WCONTINUED
was passed. This case matches the C
macro WIFCONTINUED(status)
.
There are currently no state changes to report in any awaited
child process. This is only returned if WaitPidFlag::WNOHANG
was used (otherwise wait()
or waitpid()
would block until
there was something to report).
Implementations
impl WaitStatus
[src]
pub fn pid(&self) -> Option<Pid>
[src]
Extracts the PID from the WaitStatus unless it equals StillAlive.
impl WaitStatus
[src]
pub fn from_raw(pid: Pid, status: i32) -> Result<WaitStatus>
[src]
Convert a raw wstatus
as returned by waitpid
/wait
into a WaitStatus
Errors
Returns an Error
corresponding to EINVAL
for invalid status values.
Examples
Convert a wstatus
obtained from libc::waitpid
into a WaitStatus
:
use nix::sys::wait::WaitStatus; use nix::sys::signal::Signal; let pid = nix::unistd::Pid::from_raw(1); let status = WaitStatus::from_raw(pid, 0x0002); assert_eq!(status, Ok(WaitStatus::Signaled(pid, Signal::SIGINT, false)));
Trait Implementations
impl Clone for WaitStatus
[src]
fn clone(&self) -> WaitStatus
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for WaitStatus
[src]
impl Debug for WaitStatus
[src]
impl Eq for WaitStatus
[src]
impl PartialEq<WaitStatus> for WaitStatus
[src]
fn eq(&self, other: &WaitStatus) -> bool
[src]
fn ne(&self, other: &WaitStatus) -> bool
[src]
impl StructuralEq for WaitStatus
[src]
impl StructuralPartialEq for WaitStatus
[src]
Auto Trait Implementations
impl RefUnwindSafe for WaitStatus
impl Send for WaitStatus
impl Sync for WaitStatus
impl Unpin for WaitStatus
impl UnwindSafe for WaitStatus
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,