Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_sig.c
Show First 20 Lines • Show All 980 Lines • ▼ Show 20 Lines | execsigs(struct proc *p) | ||||
/* | /* | ||||
* Reset caught signals. Held signals remain held | * Reset caught signals. Held signals remain held | ||||
* through td_sigmask (unless they were caught, | * through td_sigmask (unless they were caught, | ||||
* and are now ignored by default). | * and are now ignored by default). | ||||
*/ | */ | ||||
PROC_LOCK_ASSERT(p, MA_OWNED); | PROC_LOCK_ASSERT(p, MA_OWNED); | ||||
ps = p->p_sigacts; | ps = p->p_sigacts; | ||||
mtx_lock(&ps->ps_mtx); | mtx_lock(&ps->ps_mtx); | ||||
while (SIGNOTEMPTY(ps->ps_sigcatch)) { | sig_drop_caught(p); | ||||
sig = sig_ffs(&ps->ps_sigcatch); | |||||
sigdflt(ps, sig); | |||||
if ((sigprop(sig) & SIGPROP_IGNORE) != 0) | |||||
sigqueue_delete_proc(p, sig); | |||||
} | |||||
/* | /* | ||||
* As CloudABI processes cannot modify signal handlers, fully | * As CloudABI processes cannot modify signal handlers, fully | ||||
* reset all signals to their default behavior. Do ignore | * reset all signals to their default behavior. Do ignore | ||||
* SIGPIPE, as it would otherwise be impossible to recover from | * SIGPIPE, as it would otherwise be impossible to recover from | ||||
* writes to broken pipes and sockets. | * writes to broken pipes and sockets. | ||||
*/ | */ | ||||
if (SV_PROC_ABI(p) == SV_ABI_CLOUDABI) { | if (SV_PROC_ABI(p) == SV_ABI_CLOUDABI) { | ||||
▲ Show 20 Lines • Show All 2,848 Lines • ▼ Show 20 Lines | sigacts_copy(struct sigacts *dest, struct sigacts *src) | ||||
mtx_unlock(&src->ps_mtx); | mtx_unlock(&src->ps_mtx); | ||||
} | } | ||||
int | int | ||||
sigacts_shared(struct sigacts *ps) | sigacts_shared(struct sigacts *ps) | ||||
{ | { | ||||
return (ps->ps_refcnt > 1); | return (ps->ps_refcnt > 1); | ||||
} | |||||
void | |||||
sig_drop_caught(struct proc *p) | |||||
{ | |||||
int sig; | |||||
struct sigacts *ps; | |||||
ps = p->p_sigacts; | |||||
kib: Add asserts that both proc lock and ps_mtx are locked. | |||||
PROC_LOCK_ASSERT((p), MA_OWNED); | |||||
Done Inline Actions() around p are not needed. kib: () around p are not needed. | |||||
mtx_assert(&ps_mtx, MA_OWNED); | |||||
while (SIGNOTEMPTY(ps->ps_sigcatch)) { | |||||
sig = sig_ffs(&ps->ps_sigcatch); | |||||
sigdflt(ps, sig); | |||||
if ((sigprop(sig) & SIGPROP_IGNORE) != 0) | |||||
sigqueue_delete_proc(p, sig); | |||||
} | |||||
} | } |
Add asserts that both proc lock and ps_mtx are locked.