Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_sig.c
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
#include <sys/refcount.h> | #include <sys/refcount.h> | ||||
#include <sys/namei.h> | #include <sys/namei.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/procdesc.h> | #include <sys/procdesc.h> | ||||
#include <sys/ptrace.h> | #include <sys/ptrace.h> | ||||
#include <sys/posix4.h> | #include <sys/posix4.h> | ||||
#include <sys/racct.h> | #include <sys/racct.h> | ||||
#include <sys/resourcevar.h> | #include <sys/resourcevar.h> | ||||
#include <sys/rseq.h> | |||||
#include <sys/sdt.h> | #include <sys/sdt.h> | ||||
#include <sys/sbuf.h> | #include <sys/sbuf.h> | ||||
#include <sys/sleepqueue.h> | #include <sys/sleepqueue.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <sys/sx.h> | #include <sys/sx.h> | ||||
#include <sys/syscallsubr.h> | #include <sys/syscallsubr.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
▲ Show 20 Lines • Show All 1,932 Lines • ▼ Show 20 Lines | trapsignal(struct thread *td, ksiginfo_t *ksi) | ||||
int code, sig; | int code, sig; | ||||
p = td->td_proc; | p = td->td_proc; | ||||
sig = ksi->ksi_signo; | sig = ksi->ksi_signo; | ||||
code = ksi->ksi_code; | code = ksi->ksi_code; | ||||
KASSERT(_SIG_VALID(sig), ("invalid signal")); | KASSERT(_SIG_VALID(sig), ("invalid signal")); | ||||
sigfastblock_fetch(td); | sigfastblock_fetch(td); | ||||
rseq_before_sig(td); | |||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
ps = p->p_sigacts; | ps = p->p_sigacts; | ||||
mtx_lock(&ps->ps_mtx); | mtx_lock(&ps->ps_mtx); | ||||
sigmask = td->td_sigmask; | sigmask = td->td_sigmask; | ||||
if (td->td_sigblock_val != 0) | if (td->td_sigblock_val != 0) | ||||
SIGSETOR(sigmask, fastblock_mask); | SIGSETOR(sigmask, fastblock_mask); | ||||
if ((p->p_flag & P_TRACED) == 0 && SIGISMEMBER(ps->ps_sigcatch, sig) && | if ((p->p_flag & P_TRACED) == 0 && SIGISMEMBER(ps->ps_sigcatch, sig) && | ||||
!SIGISMEMBER(sigmask, sig)) { | !SIGISMEMBER(sigmask, sig)) { | ||||
#ifdef KTRACE | #ifdef KTRACE | ||||
if (KTRPOINT(curthread, KTR_PSIG)) | if (KTRPOINT(curthread, KTR_PSIG)) | ||||
ktrpsig(sig, ps->ps_sigact[_SIG_IDX(sig)], | ktrpsig(sig, ps->ps_sigact[_SIG_IDX(sig)], | ||||
&td->td_sigmask, code); | &td->td_sigmask, code); | ||||
#endif | #endif | ||||
rseq_on_sig(td); | |||||
(*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)], | (*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)], | ||||
ksi, &td->td_sigmask); | ksi, &td->td_sigmask); | ||||
postsig_done(sig, td, ps); | postsig_done(sig, td, ps); | ||||
mtx_unlock(&ps->ps_mtx); | mtx_unlock(&ps->ps_mtx); | ||||
} else { | } else { | ||||
/* | /* | ||||
* Avoid a possible infinite loop if the thread | * Avoid a possible infinite loop if the thread | ||||
* masking the signal or process is ignoring the | * masking the signal or process is ignoring the | ||||
▲ Show 20 Lines • Show All 1,158 Lines • ▼ Show 20 Lines | if (td->td_pflags & TDP_OLDMASK) { | ||||
returnmask = td->td_oldsigmask; | returnmask = td->td_oldsigmask; | ||||
td->td_pflags &= ~TDP_OLDMASK; | td->td_pflags &= ~TDP_OLDMASK; | ||||
} else | } else | ||||
returnmask = td->td_sigmask; | returnmask = td->td_sigmask; | ||||
if (p->p_sig == sig) { | if (p->p_sig == sig) { | ||||
p->p_sig = 0; | p->p_sig = 0; | ||||
} | } | ||||
rseq_on_sig(td); | |||||
(*p->p_sysent->sv_sendsig)(action, &ksi, &returnmask); | (*p->p_sysent->sv_sendsig)(action, &ksi, &returnmask); | ||||
postsig_done(sig, td, ps); | postsig_done(sig, td, ps); | ||||
} | } | ||||
return (1); | return (1); | ||||
} | } | ||||
int | int | ||||
sig_ast_checksusp(struct thread *td) | sig_ast_checksusp(struct thread *td) | ||||
▲ Show 20 Lines • Show All 1,130 Lines • Show Last 20 Lines |