Module Name:    src
Committed By:   snj
Date:           Sat Nov  7 20:46:38 UTC 2015

Modified Files:
        src/sys/kern [netbsd-5-1]: kern_sig.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1980):
        sys/kern/kern_sig.c: revision 1.321
When delivering a signal, it's possible that the process's state in
p_stat is SACTIVE yet p_sflag is PS_STOPPING (while waiting for other
lwp's to stop).  In that case, we don't want to adjust the parent's
p_nstopchild count.
Found by Robert Elz.


To generate a diff of this commit:
cvs rdiff -u -r1.289.4.6.2.1 -r1.289.4.6.2.2 src/sys/kern/kern_sig.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_sig.c
diff -u src/sys/kern/kern_sig.c:1.289.4.6.2.1 src/sys/kern/kern_sig.c:1.289.4.6.2.2
--- src/sys/kern/kern_sig.c:1.289.4.6.2.1	Sat Mar 17 19:15:12 2012
+++ src/sys/kern/kern_sig.c	Sat Nov  7 20:46:37 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.289.4.6.2.1 2012/03/17 19:15:12 bouyer Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.289.4.6.2.2 2015/11/07 20:46:37 snj Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.289.4.6.2.1 2012/03/17 19:15:12 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.289.4.6.2.2 2015/11/07 20:46:37 snj Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_compat_sunos.h"
@@ -1391,14 +1391,13 @@ kpsignal2(struct proc *p, ksiginfo_t *ks
 		}
 		if ((prop & SA_CONT) != 0 || signo == SIGKILL) {
 			/*
-			 * Re-adjust p_nstopchild if the process wasn't
-			 * collected by its parent.
+			 * Re-adjust p_nstopchild if the process was
+			 * stopped but not yet collected by its parent.
 			 */
+			if (p->p_stat == SSTOP && !p->p_waited)
+				p->p_pptr->p_nstopchild--;
 			p->p_stat = SACTIVE;
 			p->p_sflag &= ~PS_STOPPING;
-			if (!p->p_waited) {
-				p->p_pptr->p_nstopchild--;
-			}
 			if (p->p_slflag & PSL_TRACED) {
 				KASSERT(signo == SIGKILL);
 				goto deliver;

Reply via email to