Add waitid syscall on linux (#9335)
This commit is contained in:
committed by
Andrew Kelley
parent
13aedf09d6
commit
5582d20f04
@@ -203,6 +203,15 @@ pub const WEXITED = 4;
|
||||
pub const WCONTINUED = 8;
|
||||
pub const WNOWAIT = 0x1000000;
|
||||
|
||||
// waitid id types
|
||||
pub const P = enum(c_uint) {
|
||||
ALL = 0,
|
||||
PID = 1,
|
||||
PGID = 2,
|
||||
PIDFD = 3,
|
||||
_,
|
||||
};
|
||||
|
||||
pub usingnamespace if (is_mips)
|
||||
struct {
|
||||
pub const SA_NOCLDSTOP = 1;
|
||||
|
||||
@@ -705,6 +705,10 @@ pub fn waitpid(pid: pid_t, status: *u32, flags: u32) usize {
|
||||
return syscall4(.wait4, @bitCast(usize, @as(isize, pid)), @ptrToInt(status), flags, 0);
|
||||
}
|
||||
|
||||
pub fn waitid(id_type: P, id: i32, infop: *siginfo_t, flags: u32) usize {
|
||||
return syscall5(.waitid, @enumToInt(id_type), @bitCast(usize, @as(isize, id)), @ptrToInt(infop), flags, 0);
|
||||
}
|
||||
|
||||
pub fn fcntl(fd: fd_t, cmd: i32, arg: usize) usize {
|
||||
return syscall3(.fcntl, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, cmd)), arg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user