| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: kern_sig.c,v 1.320 2015/10/02 16:54:15 christos Exp $ */ | | 1 | /* $NetBSD: kern_sig.c,v 1.321 2015/10/13 07:00:59 pgoyette Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 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 Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -60,27 +60,27 @@ | | | @@ -60,27 +60,27 @@ |
60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
63 | * SUCH DAMAGE. | | 63 | * SUCH DAMAGE. |
64 | * | | 64 | * |
65 | * @(#)kern_sig.c 8.14 (Berkeley) 5/14/95 | | 65 | * @(#)kern_sig.c 8.14 (Berkeley) 5/14/95 |
66 | */ | | 66 | */ |
67 | | | 67 | |
68 | /* | | 68 | /* |
69 | * Signal subsystem. | | 69 | * Signal subsystem. |
70 | */ | | 70 | */ |
71 | | | 71 | |
72 | #include <sys/cdefs.h> | | 72 | #include <sys/cdefs.h> |
73 | __KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.320 2015/10/02 16:54:15 christos Exp $"); | | 73 | __KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.321 2015/10/13 07:00:59 pgoyette Exp $"); |
74 | | | 74 | |
75 | #include "opt_ptrace.h" | | 75 | #include "opt_ptrace.h" |
76 | #include "opt_dtrace.h" | | 76 | #include "opt_dtrace.h" |
77 | #include "opt_compat_sunos.h" | | 77 | #include "opt_compat_sunos.h" |
78 | #include "opt_compat_netbsd.h" | | 78 | #include "opt_compat_netbsd.h" |
79 | #include "opt_compat_netbsd32.h" | | 79 | #include "opt_compat_netbsd32.h" |
80 | #include "opt_pax.h" | | 80 | #include "opt_pax.h" |
81 | | | 81 | |
82 | #define SIGPROP /* include signal properties table */ | | 82 | #define SIGPROP /* include signal properties table */ |
83 | #include <sys/param.h> | | 83 | #include <sys/param.h> |
84 | #include <sys/signalvar.h> | | 84 | #include <sys/signalvar.h> |
85 | #include <sys/proc.h> | | 85 | #include <sys/proc.h> |
86 | #include <sys/systm.h> | | 86 | #include <sys/systm.h> |
| @@ -1349,34 +1349,33 @@ kpsignal2(struct proc *p, ksiginfo_t *ks | | | @@ -1349,34 +1349,33 @@ kpsignal2(struct proc *p, ksiginfo_t *ks |
1349 | if ((prop & SA_CONT) != 0 && action == SIG_DFL) | | 1349 | if ((prop & SA_CONT) != 0 && action == SIG_DFL) |
1350 | goto out; | | 1350 | goto out; |
1351 | } else { | | 1351 | } else { |
1352 | /* | | 1352 | /* |
1353 | * Process is stopped or stopping. | | 1353 | * Process is stopped or stopping. |
1354 | * - If traced, then no action is needed, unless killing. | | 1354 | * - If traced, then no action is needed, unless killing. |
1355 | * - Run the process only if sending SIGCONT or SIGKILL. | | 1355 | * - Run the process only if sending SIGCONT or SIGKILL. |
1356 | */ | | 1356 | */ |
1357 | if ((p->p_slflag & PSL_TRACED) != 0 && signo != SIGKILL) { | | 1357 | if ((p->p_slflag & PSL_TRACED) != 0 && signo != SIGKILL) { |
1358 | goto out; | | 1358 | goto out; |
1359 | } | | 1359 | } |
1360 | if ((prop & SA_CONT) != 0 || signo == SIGKILL) { | | 1360 | if ((prop & SA_CONT) != 0 || signo == SIGKILL) { |
1361 | /* | | 1361 | /* |
1362 | * Re-adjust p_nstopchild if the process wasn't | | 1362 | * Re-adjust p_nstopchild if the process was |
1363 | * collected by its parent. | | 1363 | * stopped but not yet collected by its parent. |
1364 | */ | | 1364 | */ |
| | | 1365 | if (p->p_stat == SSTOP && !p->p_waited) |
| | | 1366 | p->p_pptr->p_nstopchild--; |
1365 | p->p_stat = SACTIVE; | | 1367 | p->p_stat = SACTIVE; |
1366 | p->p_sflag &= ~PS_STOPPING; | | 1368 | p->p_sflag &= ~PS_STOPPING; |
1367 | if (!p->p_waited) { | | | |
1368 | p->p_pptr->p_nstopchild--; | | | |
1369 | } | | | |
1370 | if (p->p_slflag & PSL_TRACED) { | | 1369 | if (p->p_slflag & PSL_TRACED) { |
1371 | KASSERT(signo == SIGKILL); | | 1370 | KASSERT(signo == SIGKILL); |
1372 | goto deliver; | | 1371 | goto deliver; |
1373 | } | | 1372 | } |
1374 | /* | | 1373 | /* |
1375 | * Do not make signal pending if SIGCONT is default. | | 1374 | * Do not make signal pending if SIGCONT is default. |
1376 | * | | 1375 | * |
1377 | * If the process catches SIGCONT, let it handle the | | 1376 | * If the process catches SIGCONT, let it handle the |
1378 | * signal itself (if waiting on event - process runs, | | 1377 | * signal itself (if waiting on event - process runs, |
1379 | * otherwise continues sleeping). | | 1378 | * otherwise continues sleeping). |
1380 | */ | | 1379 | */ |
1381 | if ((prop & SA_CONT) != 0 && action == SIG_DFL) { | | 1380 | if ((prop & SA_CONT) != 0 && action == SIG_DFL) { |
1382 | KASSERT(signo != SIGKILL); | | 1381 | KASSERT(signo != SIGKILL); |