1 --- waitpid.c.orig 2006-09-16 19:12:38.000000000 -0700
2 +++ waitpid.c 2006-09-16 20:38:56.000000000 -0700
4 #include <sys/resource.h>
5 #include "un-namespace.h"
9 +#endif /* __DARWIN_UNIX03 */
10 +#ifdef VARIANT_CANCELABLE
11 +int __wait4(pid_t, int *, int , struct rusage *);
12 +#else /* !VARIANT_CANCELABLE */
13 +int __wait4_nocancel(pid_t, int *, int , struct rusage *);
14 +#endif /* VARIANT_CANCELABLE */
17 __waitpid(pid_t pid, int *istat, int options)
19 - return (_wait4(pid, istat, options, (struct rusage *)0));
21 + /* POSIX: Validate waitpid() options before calling wait4() */
22 + if ((options & (WCONTINUED | WNOHANG | WUNTRACED)) != options) {
26 +#endif /* __DARWIN_UNIX03 */
28 +#ifdef VARIANT_CANCELABLE
29 + return (__wait4(pid, istat, options, (struct rusage *)0));
30 +#else /* !VARIANT_CANCELABLE */
31 + return (__wait4_nocancel(pid, istat, options, (struct rusage *)0));
32 +#endif /* VARIANT_CANCELABLE */
35 __weak_reference(__waitpid, waitpid);