authorgravatar for malcolm.still@gmail.comMalcolm Still <malcolm.still@gmail.com> 2021-07-10 21:56:41+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-21 12:22:03-07:00
log5582d20f044c6891038d20d6057c61a3df829714
tree6cb39206f82b8df0a46cb0c168ba37c33a2edeab
parent13aedf09d6afcd20b1fd0e2f177d77db3c2da932

Add waitid syscall on linux (#9335)


2 files changed, 13 insertions(+), 0 deletions(-)

lib/std/os/bits/linux.zig+9
......@@ -203,6 +203,15 @@ pub const WEXITED = 4;
203203pub const WCONTINUED = 8;
204204pub const WNOWAIT = 0x1000000;
205205
206// waitid id types
207pub const P = enum(c_uint) {
208 ALL = 0,
209 PID = 1,
210 PGID = 2,
211 PIDFD = 3,
212 _,
213};
214
206215pub usingnamespace if (is_mips)
207216 struct {
208217 pub const SA_NOCLDSTOP = 1;
lib/std/os/linux.zig+4
......@@ -705,6 +705,10 @@ pub fn waitpid(pid: pid_t, status: *u32, flags: u32) usize {
705705 return syscall4(.wait4, @bitCast(usize, @as(isize, pid)), @ptrToInt(status), flags, 0);
706706}
707707
708pub fn waitid(id_type: P, id: i32, infop: *siginfo_t, flags: u32) usize {
709 return syscall5(.waitid, @enumToInt(id_type), @bitCast(usize, @as(isize, id)), @ptrToInt(infop), flags, 0);
710}
711
708712pub fn fcntl(fd: fd_t, cmd: i32, arg: usize) usize {
709713 return syscall3(.fcntl, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, cmd)), arg);
710714}