Module Name: src
Committed By: pgoyette
Date: Tue Oct 13 00:28:22 UTC 2015
Modified Files:
src/sys/kern: kern_exit.c
Log Message:
For processes marked with PS_STOPEXIT, update the process's p_waited
value, and update its parent's p_nstopchild value when marking the
process's p_stat to SSTOP. The process needed to be SACTIVE to get
here, so this transition represents an additional process for which
the parent needs to wait.
Fixes PR kern/50308
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.246 -r1.247 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.246 src/sys/kern/kern_exit.c:1.247
--- src/sys/kern/kern_exit.c:1.246 Tue Oct 13 00:27:19 2015
+++ src/sys/kern/kern_exit.c Tue Oct 13 00:28:22 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exit.c,v 1.246 2015/10/13 00:27:19 pgoyette Exp $ */
+/* $NetBSD: kern_exit.c,v 1.247 2015/10/13 00:28:22 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.246 2015/10/13 00:27:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.247 2015/10/13 00:28:22 pgoyette Exp $");
#include "opt_ktrace.h"
#include "opt_dtrace.h"
@@ -227,8 +227,15 @@ exit1(struct lwp *l, int rv)
if (__predict_false(p->p_sflag & PS_STOPEXIT)) {
KERNEL_UNLOCK_ALL(l, &l->l_biglocks);
sigclearall(p, &contsigmask, &kq);
+
+ if (!mutex_tryenter(proc_lock)) {
+ mutex_exit(p->p_lock);
+ mutex_enter(proc_lock);
+ mutex_enter(p->p_lock);
+ }
p->p_waited = 0;
- membar_producer();
+ p->p_pptr->p_nstopchild++;
+ mutex_exit(proc_lock);
p->p_stat = SSTOP;
lwp_lock(l);
p->p_nrlwps--;