aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2018-02-17 00:24:50 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2018-02-17 00:24:50 +0000
commit015cd8dc93db4dd76ee834ff12f692e7a6bbf6e9 (patch)
tree0da39a639c3fe7237e9a02db0d54afa022adbc21 /sys/kern/kern_exit.c
parent7e588b92193c4fbe5749afdba40385e6ae1309c1 (diff)
downloadsrc-015cd8dc93db4dd76ee834ff12f692e7a6bbf6e9.tar.gz
src-015cd8dc93db4dd76ee834ff12f692e7a6bbf6e9.zip
Notes
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index d19e19a75847..91375e435700 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -193,6 +193,7 @@ exit1(struct thread *td, int rval, int signo)
struct proc *p, *nq, *q, *t;
struct thread *tdt;
ksiginfo_t *ksi, *ksi1;
+ int signal_parent;
mtx_assert(&Giant, MA_NOTOWNED);
KASSERT(rval == 0 || signo == 0, ("exit1 rv %d sig %d", rval, signo));
@@ -559,6 +560,7 @@ exit1(struct thread *td, int rval, int signo)
* procdesc_exit() to serialize concurrent calls to close() and
* exit().
*/
+ signal_parent = 0;
if (p->p_procdesc == NULL || procdesc_exit(p)) {
/*
* Notify parent that we're gone. If parent has the
@@ -588,18 +590,25 @@ exit1(struct thread *td, int rval, int signo)
} else
mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx);
- if (p->p_pptr == p->p_reaper || p->p_pptr == initproc)
- childproc_exited(p);
- else if (p->p_sigparent != 0) {
- if (p->p_sigparent == SIGCHLD)
- childproc_exited(p);
- else /* LINUX thread */
- kern_psignal(p->p_pptr, p->p_sigparent);
+ if (p->p_pptr == p->p_reaper || p->p_pptr == initproc) {
+ signal_parent = 1;
+ } else if (p->p_sigparent != 0) {
+ if (p->p_sigparent == SIGCHLD) {
+ signal_parent = 1;
+ } else { /* LINUX thread */
+ signal_parent = 2;
+ }
}
} else
PROC_LOCK(p->p_pptr);
sx_xunlock(&proctree_lock);
+ if (signal_parent == 1) {
+ childproc_exited(p);
+ } else if (signal_parent == 2) {
+ kern_psignal(p->p_pptr, p->p_sigparent);
+ }
+
/* Tell the prison that we are gone. */
prison_proc_free(p->p_ucred->cr_prison);