1 --- waitpid.c.orig 2009-11-07 14:51:38.000000000 -0800
2 +++ waitpid.c 2009-11-07 14:51:40.000000000 -0800
3 @@ -40,10 +40,31 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/wai
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);