Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern set the return value to the pid if we found one (fr...



details:   https://anonhg.NetBSD.org/src/rev/c85e54033e8d
branches:  trunk
changeset: 344872:c85e54033e8d
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 25 16:35:47 2016 +0000

description:
set the return value to the pid if we found one (from kre@)

diffstat:

 sys/kern/kern_exit.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r b09e968f584a -r c85e54033e8d sys/kern/kern_exit.c
--- a/sys/kern/kern_exit.c      Mon Apr 25 15:43:49 2016 +0000
+++ b/sys/kern/kern_exit.c      Mon Apr 25 16:35:47 2016 +0000
@@ -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 @@
        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)



Home | Main Index | Thread Index | Old Index