Module Name:    src
Committed By:   pgoyette
Date:           Tue Oct 13 00:27:19 UTC 2015

Modified Files:
        src/sys/kern: kern_exit.c

Log Message:
Currently, if a process is exiting and its parent has indicated no intent
of reaping the process (nor any other children), the process wil get
reparented to init.  Since the state of the exiting process at this point
is SDEAD, proc_reparent() will not update either the old or new parent's
p_nstopchild counters.

This change causes both old and new parents to be properly updated.

Fixes PR kern/50300

Pullups will be requested for:

       NetBSD-7, -6, -6-0, -6-1, -5, -5-0, -5-1, and -5-2


To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 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.245 src/sys/kern/kern_exit.c:1.246
--- src/sys/kern/kern_exit.c:1.245	Fri Oct  2 16:54:15 2015
+++ src/sys/kern/kern_exit.c	Tue Oct 13 00:27:19 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit.c,v 1.245 2015/10/02 16:54:15 christos Exp $	*/
+/*	$NetBSD: kern_exit.c,v 1.246 2015/10/13 00:27:19 pgoyette 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.245 2015/10/02 16:54:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.246 2015/10/13 00:27:19 pgoyette Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -959,7 +959,7 @@ proc_reparent(struct proc *child, struct
 	if (child->p_pptr == parent)
 		return;
 
-	if (child->p_stat == SZOMB ||
+	if (child->p_stat == SZOMB || child->p_stat == SDEAD ||
 	    (child->p_stat == SSTOP && !child->p_waited)) {
 		child->p_pptr->p_nstopchild--;
 		parent->p_nstopchild++;

Reply via email to