Add waitid and related constants and types.
waitid() is a variation on waitpid() with a marginally more convenient way of reporting the status, and a couple of handy additional features, such as the ability to peek at an exit status without consuming it. It's in POSIX.1-2008 and should be available on all supported Unixes. Along with it come the type 'idtype_t' and the constants WEXITED, WSTOPPED, WCONTINUED, and WNOWAIT. Theconstants were alre dy defined for unix/notbsd platforms. Patch incomplete: several targets are going to have to add definitions of siginfo_t, but I'm not sure which ones yet.
This commit is contained in:
parent
3ae8c850aa
commit
9d1e4848d5
|
@ -271,6 +271,10 @@ pub const NOFLSH: ::tcflag_t = 0x80000000;
|
|||
|
||||
pub const WNOHANG: ::c_int = 0x00000001;
|
||||
pub const WUNTRACED: ::c_int = 0x00000002;
|
||||
pub const WEXITED: ::c_int = 0x00000004;
|
||||
pub const WSTOPPED: ::c_int = 0x00000008;
|
||||
pub const WCONTINUED: ::c_int = 0x00000010;
|
||||
pub const WNOWAIT: ::c_int = 0x00000020;
|
||||
|
||||
pub const RTLD_NOW: ::c_int = 0x2;
|
||||
pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
|
||||
|
|
|
@ -16,6 +16,13 @@ pub type cc_t = ::c_uchar;
|
|||
pub enum DIR {}
|
||||
pub enum locale_t {}
|
||||
|
||||
#[repr(C)]
|
||||
pub enum idtype_t {
|
||||
P_ALL = 0,
|
||||
P_PID = 1,
|
||||
P_PGID = 2,
|
||||
}
|
||||
|
||||
s! {
|
||||
pub struct group {
|
||||
pub gr_name: *mut ::c_char,
|
||||
|
@ -447,6 +454,8 @@ extern {
|
|||
link_name = "waitpid$UNIX2003")]
|
||||
pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int)
|
||||
-> pid_t;
|
||||
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
|
||||
options: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "write$UNIX2003")]
|
||||
pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
|
||||
|
|
Loading…
Reference in a new issue