-/* $OpenBSD: kern_sig.c,v 1.289 2021/11/24 10:28:55 claudio Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.290 2021/11/24 10:40:15 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
void proc_stop_sweep(void *);
void *proc_stop_si;
+void postsig_done(struct proc *, int, sigset_t, int);
void postsig(struct proc *, int);
int cansignal(struct proc *, struct process *, int);
* usermode frame for delivery is formed.
*/
void
-postsig_done(struct proc *p, int signum, struct sigacts *ps)
+postsig_done(struct proc *p, int signum, sigset_t catchmask, int reset)
{
- int mask = sigmask(signum);
-
KERNEL_ASSERT_LOCKED();
p->p_ru.ru_nsignals++;
- atomic_setbits_int(&p->p_sigmask, ps->ps_catchmask[signum]);
- if ((ps->ps_sigreset & mask) != 0) {
+ atomic_setbits_int(&p->p_sigmask, catchmask);
+ if (reset != 0) {
+ sigset_t mask = sigmask(signum);
+ struct sigacts *ps = p->p_p->ps_sigacts;
+
ps->ps_sigcatch &= ~mask;
if (signum != SIGCONT && sigprop[signum] & SA_IGNORE)
ps->ps_sigignore |= mask;
(ps->ps_sigcatch & mask) != 0 &&
(p->p_sigmask & mask) == 0) {
siginfo_t si;
+ sigset_t catchmask = ps->ps_catchmask[signum];
int info = (ps->ps_siginfo & mask) != 0;
int onstack = (ps->ps_sigonstack & mask) != 0;
+ int reset = (ps->ps_sigreset & mask) != 0;
initsiginfo(&si, signum, trapno, code, sigval);
#ifdef KTRACE
sigexit(p, SIGILL);
/* NOTREACHED */
}
- postsig_done(p, signum, ps);
+ postsig_done(p, signum, catchmask, reset);
} else {
p->p_sisig = signum;
p->p_sitrapno = trapno; /* XXX for core dump/debugger */
sig_t action;
u_long trapno;
int mask, returnmask;
+ sigset_t catchmask;
siginfo_t si;
union sigval sigval;
- int s, code, info, onstack;
+ int s, code, info, onstack, reset;
KASSERT(signum != 0);
KERNEL_ASSERT_LOCKED();
mask = sigmask(signum);
atomic_clearbits_int(&p->p_siglist, mask);
action = ps->ps_sigact[signum];
+ catchmask = ps->ps_catchmask[signum];
info = (ps->ps_siginfo & mask) != 0;
onstack = (ps->ps_sigonstack & mask) != 0;
+ reset = (ps->ps_sigreset & mask) != 0;
sigval.sival_ptr = NULL;
if (p->p_sisig != signum) {
sigexit(p, SIGILL);
/* NOTREACHED */
}
- postsig_done(p, signum, ps);
+ postsig_done(p, signum, catchmask, reset);
splx(s);
}
}