diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index ae5012de8f19..f575ee1ddd06 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.109 2000/12/22 22:59:00 jdolecek Exp $ */ +/* $NetBSD: kern_sig.c,v 1.110 2001/01/14 22:31:58 thorpej Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -381,11 +381,11 @@ sigprocmask1(p, how, nss, oss) break; case SIG_UNBLOCK: sigminusset(nss, &p->p_sigctx.ps_sigmask); - p->p_sigctx.ps_sigcheck = 1; + CHECKSIGS(p); break; case SIG_SETMASK: p->p_sigctx.ps_sigmask = *nss; - p->p_sigctx.ps_sigcheck = 1; + CHECKSIGS(p); break; default: (void)spl0(); /* XXXSMP */ @@ -480,7 +480,7 @@ sigsuspend1(p, ss) p->p_sigctx.ps_flags |= SAS_OLDMASK; (void) splsched(); /* XXXSMP */ p->p_sigctx.ps_sigmask = *ss; - p->p_sigctx.ps_sigcheck = 1; + CHECKSIGS(p); sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); (void) spl0(); /* XXXSMP */ } @@ -813,6 +813,8 @@ psignal1(p, signum, dolock) sigminusset(&contsigmask, &p->p_sigctx.ps_siglist); sigaddset(&p->p_sigctx.ps_siglist, signum); + + /* CHECKSIGS() is "inlined" here. */ p->p_sigctx.ps_sigcheck = 1; /* @@ -935,7 +937,26 @@ psignal1(p, signum, dolock) if (p->p_wchan && p->p_flag & P_SINTR) unsleep(p); goto out; +#ifdef __HAVE_AST_PERPROC + case SONPROC: + case SRUN: + case SIDL: + /* + * SONPROC: We're running, notice the signal when + * we return back to userspace. + * + * SRUN, SIDL: Notice the signal when we run again + * and return to back to userspace. + */ + signotify(p); + goto out; + default: + /* + * SDEAD, SZOMB: The signal will never be noticed. + */ + goto out; +#else /* ! __HAVE_AST_PERPROC */ case SONPROC: /* * We're running; notice the signal. @@ -949,6 +970,7 @@ psignal1(p, signum, dolock) * It will either never be noticed, or noticed very soon. */ goto out; +#endif /* __HAVE_AST_PERPROC */ } /*NOTREACHED*/ @@ -1145,7 +1167,7 @@ issignal(p) keep: sigaddset(&p->p_sigctx.ps_siglist, signum); /* leave the signal for later */ - p->p_sigctx.ps_sigcheck = 1; + CHECKSIGS(p); return (signum); } diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 156b8fcc59fa..e315876e0c04 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_synch.c,v 1.100 2001/01/01 16:02:51 sommerfeld Exp $ */ +/* $NetBSD: kern_synch.c,v 1.101 2001/01/14 22:31:59 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -919,7 +919,7 @@ setrunnable(struct proc *p) */ if ((p->p_flag & P_TRACED) != 0 && p->p_xstat != 0) { sigaddset(&p->p_sigctx.ps_siglist, p->p_xstat); - p->p_sigctx.ps_sigcheck = 1; + CHECKSIGS(p); } case SSLEEP: unsleep(p); /* e.g. when sending signals */ diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h index 46a2cbf876fd..096dd5a0aa2f 100644 --- a/sys/sys/signalvar.h +++ b/sys/sys/signalvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: signalvar.h,v 1.27 2000/12/22 22:59:01 jdolecek Exp $ */ +/* $NetBSD: signalvar.h,v 1.28 2001/01/14 22:32:01 thorpej Exp $ */ /* * Copyright (c) 1991, 1993 @@ -86,6 +86,15 @@ struct sigctx { #define SIGACTION(p, sig) (p->p_sigacts->sa_sigact[(sig)]) #define SIGACTION_PS(ps, sig) (ps->sa_sigact[(sig)]) +/* + * Mark that signals for a process need to be checked. + */ +#define CHECKSIGS(p) \ +do { \ + (p)->p_sigctx.ps_sigcheck = 1; \ + signotify(p); \ +} while (0) + /* * Determine signal that should be delivered to process p, the current * process, 0 if none. If there is a pending stop signal with default