Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Return 0 if WNOHANG and no kids.



details:   https://anonhg.NetBSD.org/src/rev/8b80e28be7d0
branches:  trunk
changeset: 348749:8b80e28be7d0
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Nov 05 02:59:22 2016 +0000

description:
Return 0 if WNOHANG and no kids.

diffstat:

 sys/kern/kern_exit.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 1f292556764e -r 8b80e28be7d0 sys/kern/kern_exit.c
--- a/sys/kern/kern_exit.c      Sat Nov 05 01:49:53 2016 +0000
+++ b/sys/kern/kern_exit.c      Sat Nov 05 02:59:22 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exit.c,v 1.263 2016/11/04 18:14:04 christos Exp $ */
+/*     $NetBSD: kern_exit.c,v 1.264 2016/11/05 02:59:22 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.263 2016/11/04 18:14:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.264 2016/11/05 02:59:22 christos Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -940,7 +940,7 @@
     struct proc **child_p, struct wrusage *wru, siginfo_t *si)
 {
        struct proc *child, *dead;
-       int error;
+       int error, nohang;
 
        KASSERT(mutex_owned(proc_lock));
 
@@ -969,6 +969,7 @@
                idtype = P_PGID;
        }
 
+       nohang = (options & WNOHANG) != 0;
        for (;;) {
                error = ECHILD;
                dead = NULL;
@@ -1052,10 +1053,9 @@
                        }
                }
 
-               if (child != NULL || error != 0 ||
-                   ((options & WNOHANG) != 0 && dead == NULL)) {
+               if (child != NULL || error != 0 || (nohang && dead == NULL)) {
                        *child_p = child;
-                       return error;
+                       return (nohang && error == ECHILD) ? 0 : error;
                }
 
                /*



Home | Main Index | Thread Index | Old Index