Commit 7c805d2a authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Add more wait related calls

parent 7ab7dbe3
[package]
name = "redox_syscall"
version = "0.1.36"
version = "0.1.37"
description = "A Rust library to access raw Redox system calls"
license = "MIT"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
......
......@@ -349,29 +349,3 @@ pub fn write(fd: usize, buf: &[u8]) -> Result<usize> {
pub fn sched_yield() -> Result<usize> {
unsafe { syscall0(SYS_YIELD) }
}
/// If wifsignaled(status), the terminating signal.
#[inline(always)]
pub fn wtermsig(status: usize) -> usize {
status & 0x7f
}
/// True if status indicates normal termination.
#[inline(always)]
pub fn wifexited(status: usize) -> bool {
wtermsig(status) == 0
}
/// True if status indicates the child is stopped.
#[inline(always)]
pub fn wifstopped(status: usize) -> bool {
(status & 0xff) == 0x7f
}
/// True if status indicates the child continued after a stop.
#[inline(always)]
pub fn wifcontinued(status: usize) -> bool {
status == 0xffff
}
/// True if STATUS indicates termination by a signal.
#[inline(always)]
pub fn wifsignaled(status: usize) -> bool {
((status & 0x7f) + 1) as i8 >= 2
}
......@@ -106,3 +106,43 @@ pub const SA_RESETHAND: usize = 0x80000000;
pub const WNOHANG: usize = 0x01;
pub const WUNTRACED: usize = 0x02;
pub const WCONTINUED: usize = 0x08;
/// True if status indicates the child is stopped.
pub fn wifstopped(status: usize) -> bool {
(status & 0xff) == 0x7f
}
/// If wifstopped(status), the signal that stopped the child.
pub fn wstopsig(status: usize) -> usize {
(status >> 8) & 0xff
}
/// True if status indicates the child continued after a stop.
pub fn wifcontinued(status: usize) -> bool {
status == 0xffff
}
/// True if STATUS indicates termination by a signal.
pub fn wifsignaled(status: usize) -> bool {
((status & 0x7f) + 1) as i8 >= 2
}
/// If wifsignaled(status), the terminating signal.
pub fn wtermsig(status: usize) -> usize {
status & 0x7f
}
/// True if status indicates normal termination.
pub fn wifexited(status: usize) -> bool {
wtermsig(status) == 0
}
/// If wifexited(status), the exit status.
pub fn wexitstatus(status: usize) -> usize {
(status >> 8) & 0xff
}
/// True if status indicates a core dump was created.
pub fn wcoredump(status: usize) -> bool {
(status & 0x80) != 0
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment