| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: kern_exit.c,v 1.247 2015/10/13 00:28:22 pgoyette Exp $ */ | | 1 | /* $NetBSD: kern_exit.c,v 1.248 2015/10/13 06:47:21 pgoyette Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center, and by Andrew Doran. | | 9 | * NASA Ames Research Center, and by Andrew Doran. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -57,27 +57,27 @@ | | | @@ -57,27 +57,27 @@ |
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
64 | * SUCH DAMAGE. | | 64 | * SUCH DAMAGE. |
65 | * | | 65 | * |
66 | * @(#)kern_exit.c 8.10 (Berkeley) 2/23/95 | | 66 | * @(#)kern_exit.c 8.10 (Berkeley) 2/23/95 |
67 | */ | | 67 | */ |
68 | | | 68 | |
69 | #include <sys/cdefs.h> | | 69 | #include <sys/cdefs.h> |
70 | __KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.247 2015/10/13 00:28:22 pgoyette Exp $"); | | 70 | __KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.248 2015/10/13 06:47:21 pgoyette Exp $"); |
71 | | | 71 | |
72 | #include "opt_ktrace.h" | | 72 | #include "opt_ktrace.h" |
73 | #include "opt_dtrace.h" | | 73 | #include "opt_dtrace.h" |
74 | #include "opt_perfctrs.h" | | 74 | #include "opt_perfctrs.h" |
75 | #include "opt_sysv.h" | | 75 | #include "opt_sysv.h" |
76 | | | 76 | |
77 | #include <sys/param.h> | | 77 | #include <sys/param.h> |
78 | #include <sys/systm.h> | | 78 | #include <sys/systm.h> |
79 | #include <sys/ioctl.h> | | 79 | #include <sys/ioctl.h> |
80 | #include <sys/tty.h> | | 80 | #include <sys/tty.h> |
81 | #include <sys/time.h> | | 81 | #include <sys/time.h> |
82 | #include <sys/resource.h> | | 82 | #include <sys/resource.h> |
83 | #include <sys/kernel.h> | | 83 | #include <sys/kernel.h> |
| @@ -225,28 +225,28 @@ exit1(struct lwp *l, int rv) | | | @@ -225,28 +225,28 @@ exit1(struct lwp *l, int rv) |
225 | * If we have been asked to stop on exit, do so now. | | 225 | * If we have been asked to stop on exit, do so now. |
226 | */ | | 226 | */ |
227 | if (__predict_false(p->p_sflag & PS_STOPEXIT)) { | | 227 | if (__predict_false(p->p_sflag & PS_STOPEXIT)) { |
228 | KERNEL_UNLOCK_ALL(l, &l->l_biglocks); | | 228 | KERNEL_UNLOCK_ALL(l, &l->l_biglocks); |
229 | sigclearall(p, &contsigmask, &kq); | | 229 | sigclearall(p, &contsigmask, &kq); |
230 | | | 230 | |
231 | if (!mutex_tryenter(proc_lock)) { | | 231 | if (!mutex_tryenter(proc_lock)) { |
232 | mutex_exit(p->p_lock); | | 232 | mutex_exit(p->p_lock); |
233 | mutex_enter(proc_lock); | | 233 | mutex_enter(proc_lock); |
234 | mutex_enter(p->p_lock); | | 234 | mutex_enter(p->p_lock); |
235 | } | | 235 | } |
236 | p->p_waited = 0; | | 236 | p->p_waited = 0; |
237 | p->p_pptr->p_nstopchild++; | | 237 | p->p_pptr->p_nstopchild++; |
238 | mutex_exit(proc_lock); | | | |
239 | p->p_stat = SSTOP; | | 238 | p->p_stat = SSTOP; |
| | | 239 | mutex_exit(proc_lock); |
240 | lwp_lock(l); | | 240 | lwp_lock(l); |
241 | p->p_nrlwps--; | | 241 | p->p_nrlwps--; |
242 | l->l_stat = LSSTOP; | | 242 | l->l_stat = LSSTOP; |
243 | lwp_unlock(l); | | 243 | lwp_unlock(l); |
244 | mutex_exit(p->p_lock); | | 244 | mutex_exit(p->p_lock); |
245 | lwp_lock(l); | | 245 | lwp_lock(l); |
246 | mi_switch(l); | | 246 | mi_switch(l); |
247 | KERNEL_LOCK(l->l_biglocks, l); | | 247 | KERNEL_LOCK(l->l_biglocks, l); |
248 | mutex_enter(p->p_lock); | | 248 | mutex_enter(p->p_lock); |
249 | } | | 249 | } |
250 | | | 250 | |
251 | /* | | 251 | /* |
252 | * Bin any remaining signals and mark the process as dying so it will | | 252 | * Bin any remaining signals and mark the process as dying so it will |