Whenever ps_sigcheck is set to true, signotify() the process, and

wrap this all up in a CHECKSIGS() macro.  Also, in psignal1(),
signotify() SRUN and SIDL processes if __HAVE_AST_PERPROC is defined.

Per discussion w/ mycroft.
This commit is contained in:
thorpej 2001-01-14 22:31:58 +00:00
parent 2737c13aee
commit 7200d34a76
3 changed files with 39 additions and 8 deletions

View File

@ -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);
}

View File

@ -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 */

View File

@ -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