diff options
author | jhb <jhb@FreeBSD.org> | 2003-05-13 20:36:02 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-05-13 20:36:02 +0000 |
commit | 89a4eb17deddba4ba8bfb0cf7c6801a608731f8c (patch) | |
tree | 0e2ba79e40f08e96bb98756b67576ff96caccfbc /sys/kern/kern_exit.c | |
parent | 3b9288c6f4df2bfdc2a41de3ae161246c310e064 (diff) | |
download | FreeBSD-src-89a4eb17deddba4ba8bfb0cf7c6801a608731f8c.zip FreeBSD-src-89a4eb17deddba4ba8bfb0cf7c6801a608731f8c.tar.gz |
- Merge struct procsig with struct sigacts.
- Move struct sigacts out of the u-area and malloc() it using the
M_SUBPROC malloc bucket.
- Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(),
sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared().
- Remove the p_sigignore, p_sigacts, and p_sigcatch macros.
- Add a mutex to struct sigacts that protects all the members of the struct.
- Add sigacts locking.
- Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now
that sigacts is locked.
- Several in-kernel functions such as psignal(), tdsignal(), trapsignal(),
and thread_stopped() are now MP safe.
Reviewed by: arch@
Approved by: re (rwatson)
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r-- | sys/kern/kern_exit.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index b77c1d9..2adfa9c 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -431,9 +431,11 @@ exit1(struct thread *td, int rv) * 1 instead (and hope it will handle this situation). */ PROC_LOCK(p->p_pptr); - if (p->p_pptr->p_procsig->ps_flag & (PS_NOCLDWAIT | PS_CLDSIGIGN)) { + mtx_lock(&p->p_pptr->p_sigacts->ps_mtx); + if (p->p_pptr->p_sigacts->ps_flag & (PS_NOCLDWAIT | PS_CLDSIGIGN)) { struct proc *pp; + mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx); pp = p->p_pptr; PROC_UNLOCK(pp); proc_reparent(p, initproc); @@ -445,7 +447,8 @@ exit1(struct thread *td, int rv) */ if (LIST_EMPTY(&pp->p_children)) wakeup(pp); - } + } else + mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx); if (p->p_sigparent && p->p_pptr != initproc) psignal(p->p_pptr, p->p_sigparent); @@ -656,23 +659,14 @@ loop: (void)chgproccnt(p->p_ucred->cr_ruidinfo, -1, 0); /* - * Free up credentials. + * Free credentials, arguments, and sigacts */ crfree(p->p_ucred); - p->p_ucred = NULL; /* XXX: why? */ - - /* - * Remove unused arguments - */ + p->p_ucred = NULL; pargs_drop(p->p_args); p->p_args = NULL; - - if (--p->p_procsig->ps_refcnt == 0) { - if (p->p_sigacts != &p->p_uarea->u_sigacts) - FREE(p->p_sigacts, M_SUBPROC); - FREE(p->p_procsig, M_SUBPROC); - p->p_procsig = NULL; - } + sigacts_free(p->p_sigacts); + p->p_sigacts = NULL; /* * do any thread-system specific cleanups |