Module Name: src
Committed By: christos
Date: Mon Apr 25 16:35:47 UTC 2016
Modified Files:
src/sys/kern: kern_exit.c
Log Message:
set the return value to the pid if we found one (from kre@)
To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/kern/kern_exit.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_exit.c
diff -u src/sys/kern/kern_exit.c:1.256 src/sys/kern/kern_exit.c:1.257
--- src/sys/kern/kern_exit.c:1.256 Tue Apr 5 23:51:26 2016
+++ src/sys/kern/kern_exit.c Mon Apr 25 12:35:47 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exit.c,v 1.256 2016/04/06 03:51:26 christos Exp $ */
+/* $NetBSD: kern_exit.c,v 1.257 2016/04/25 16:35:47 christos Exp $ */
/*-
* Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.256 2016/04/06 03:51:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.257 2016/04/25 16:35:47 christos Exp $");
#include "opt_ktrace.h"
#include "opt_dtrace.h"
@@ -790,6 +790,18 @@ sys_wait6(struct lwp *l, const struct sy
error = do_sys_waitid(idtype, id, &pid, &status, SCARG(uap, options),
wrup, sip);
+ retval[0] = pid; /* tell userland who it was */
+
+#if 0
+ /*
+ * should we copyout if there was no process, hence no useful data?
+ * We don't for an old sytle wait4() (etc) but I believe
+ * FreeBSD does for wait6(), so a tossup... Go with FreeBSD for now.
+ */
+ if (pid == 0)
+ return error;
+#endif
+
if (SCARG(uap, status) != NULL && error == 0)
error = copyout(&status, SCARG(uap, status), sizeof(status));
if (SCARG(uap, wru) != NULL && error == 0)