Loading...
gen/FreeBSD/waitpid.c.patch /dev/null Libc-498.1.1
--- /dev/null
+++ Libc/Libc-498.1.1/gen/FreeBSD/waitpid.c.patch
@@ -0,0 +1,35 @@
+--- waitpid.c.orig	2006-09-16 19:12:38.000000000 -0700
++++ waitpid.c	2006-09-16 20:38:56.000000000 -0700
+@@ -44,10 +44,31 @@
+ #include <sys/resource.h>
+ #include "un-namespace.h"
+ 
++#if __DARWIN_UNIX03
++#include <errno.h>
++#endif /* __DARWIN_UNIX03 */
++#ifdef VARIANT_CANCELABLE
++int __wait4(pid_t, int *, int , struct rusage *);
++#else /* !VARIANT_CANCELABLE */
++int __wait4_nocancel(pid_t, int *, int , struct rusage *);
++#endif /* VARIANT_CANCELABLE */
++
+ pid_t
+ __waitpid(pid_t pid, int *istat, int options)
+ {
+-	return (_wait4(pid, istat, options, (struct rusage *)0));
++#if __DARWIN_UNIX03
++	/* POSIX: Validate waitpid() options before calling wait4() */
++	if ((options & (WCONTINUED | WNOHANG | WUNTRACED)) != options) {
++		errno = EINVAL;
++		return ((pid_t)-1);
++	}
++#endif	/* __DARWIN_UNIX03 */
++
++#ifdef VARIANT_CANCELABLE
++	return (__wait4(pid, istat, options, (struct rusage *)0));
++#else /* !VARIANT_CANCELABLE */
++	return (__wait4_nocancel(pid, istat, options, (struct rusage *)0));
++#endif /* VARIANT_CANCELABLE */
+ }
+ 
+ __weak_reference(__waitpid, waitpid);