1 /* vi: set sw=4 ts=4: */
3 * Copyright (C) 2007 Erik Andersen <andersen@uclibc.org>
5 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10 #if defined __USE_SVID || defined __USE_XOPEN
12 # include <sys/types.h>
13 # include <sys/wait.h>
14 # include <sys/syscall.h>
17 /* The waitid() POSIX interface takes 4 arguments, but the kernel function
18 * actually takes 5. The fifth is a pointer to struct rusage. Make sure
19 * we pass NULL rather than letting whatever was in the register bleed up.
21 #define __NR_waitid5 __NR_waitid
22 static _syscall5(int, waitid5, idtype_t, idtype, id_t, id, siginfo_t*, infop,
23 int, options, struct rusage*, ru)
26 int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options)
29 return waitid5(idtype, id, infop, options, NULL);
37 if (id < 0 || id == 1)
50 memset(infop, 0, sizeof *infop);
51 infop->si_pid = waitpid(id, &infop->si_status, options
56 if (infop->si_pid < 0)