diff options
author | John Baldwin <jhb@FreeBSD.org> | 2003-04-18 20:59:05 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2003-04-18 20:59:05 +0000 |
commit | 8b94a0616d79a6f8cd2cafa72df7411bf2b2d316 (patch) | |
tree | 42892c63b1dc99e6de1566799558fe413974fa5c /sys/kern/kern_sig.c | |
parent | 9eb78fcfd9da959c8d7acdb3163a17cc18de7710 (diff) | |
download | src-8b94a0616d79a6f8cd2cafa72df7411bf2b2d316.tar.gz src-8b94a0616d79a6f8cd2cafa72df7411bf2b2d316.zip |
- Make sigonstack() a regular function instead of an inline and add a proc
lock assertion to it.
- SIGPENDING() no longer needs sched_lock, so only grab sched_lock to set
the TDF_NEEDSIGCHK and TDF_ASTPENDING flags in signotify().
- Add a proc lock assertion to tdsigwakeup().
- Since we always set TDF_OLDMASK while holding the proc lock, the proc
lock is sufficient protection to check its state in postsig() and we only
need sched_lock when clearing the actual flag.
Notes
Notes:
svn path=/head/; revision=113690
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r-- | sys/kern/kern_sig.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 53299926953d..e6a6e176cd4c 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -208,10 +208,27 @@ signotify(struct thread *td) SIGSETNAND(p->p_siglist, set); SIGSETOR(td->td_siglist, set); - mtx_lock_spin(&sched_lock); - if (SIGPENDING(td)) + if (SIGPENDING(td)) { + mtx_lock_spin(&sched_lock); td->td_flags |= TDF_NEEDSIGCHK | TDF_ASTPENDING; - mtx_unlock_spin(&sched_lock); + mtx_unlock_spin(&sched_lock); + } +} + +int +sigonstack(size_t sp) +{ + struct proc *p = curthread->td_proc; + + PROC_LOCK_ASSERT(p, MA_OWNED); + return ((p->p_flag & P_ALTSTACK) ? +#if defined(COMPAT_43) || defined(COMPAT_SUNOS) + ((p->p_sigstk.ss_size == 0) ? (p->p_sigstk.ss_flags & SS_ONSTACK) : + ((sp - (size_t)p->p_sigstk.ss_sp) < p->p_sigstk.ss_size)) +#else + ((sp - (size_t)p->p_sigstk.ss_sp) < p->p_sigstk.ss_size) +#endif + : 0); } static __inline int @@ -1809,6 +1826,7 @@ tdsigwakeup(struct thread *td, int sig, sig_t action) struct proc *p = td->td_proc; register int prop; + PROC_LOCK_ASSERT(p, MA_OWNED); mtx_assert(&sched_lock, MA_OWNED); prop = sigprop(sig); /* @@ -2144,13 +2162,13 @@ postsig(sig) * mask from before the sigsuspend is what we want * restored after the signal processing is completed. */ - mtx_lock_spin(&sched_lock); if (td->td_flags & TDF_OLDMASK) { returnmask = td->td_oldsigmask; + mtx_lock_spin(&sched_lock); td->td_flags &= ~TDF_OLDMASK; + mtx_unlock_spin(&sched_lock); } else returnmask = td->td_sigmask; - mtx_unlock_spin(&sched_lock); SIGSETOR(td->td_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]); if (!SIGISMEMBER(ps->ps_signodefer, sig)) |