authorgravatar for malcolm.still@gmail.comMalcolm Still <malcolm.still@gmail.com> 2021-07-10 21:56:41+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-07-10 16:56:41-04:00
loga3703745eb21923b96e807b9163d303b8e4447b7
treef926020d9b528a79b825677b44c225295c06bc18
parent9d1fb98fa87b09838310ba4ebf988617ed49a1c9
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Add waitid syscall on linux (#9335)


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

lib/std/os/bits/linux.zig+9
......@@ -204,6 +204,15 @@ pub const WEXITED = 4;
204204pub const WCONTINUED = 8;
205205pub const WNOWAIT = 0x1000000;
206206
207// waitid id types
208pub const P = enum(c_uint) {
209 ALL = 0,
210 PID = 1,
211 PGID = 2,
212 PIDFD = 3,
213 _,
214};
215
207216pub usingnamespace if (is_mips)
208217 struct {
209218 pub const SA_NOCLDSTOP = 1;
lib/std/os/linux.zig+4
......@@ -710,6 +710,10 @@ pub fn waitpid(pid: pid_t, status: *u32, flags: u32) usize {
710710 return syscall4(.wait4, @bitCast(usize, @as(isize, pid)), @ptrToInt(status), flags, 0);
711711}
712712
713pub fn waitid(id_type: P, id: i32, infop: *siginfo_t, flags: u32) usize {
714 return syscall5(.waitid, @enumToInt(id_type), @bitCast(usize, @as(isize, id)), @ptrToInt(infop), flags, 0);
715}
716
713717pub fn fcntl(fd: fd_t, cmd: i32, arg: usize) usize {
714718 return syscall3(.fcntl, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, cmd)), arg);
715719}