-/* $OpenBSD: kern_sig.c,v 1.222 2018/07/11 19:28:16 bluhm Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.223 2018/07/18 16:55:17 bluhm Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
int s;
for (;;) {
- mask = SIGPENDING(p);
+ mask = p->p_siglist & ~p->p_sigmask;
if (pr->ps_flags & PS_PPWAIT)
mask &= ~stopsigmask;
if (mask == 0) /* no signal to send */
return (0);
signum = ffs((long)mask);
mask = sigmask(signum);
- if (p->p_siglist & mask)
- atomic_clearbits_int(&p->p_siglist, mask);
- else
- atomic_clearbits_int(&pr->ps_mainproc->p_siglist, mask);
+ atomic_clearbits_int(&p->p_siglist, mask);
/*
* We should see pending but ignored signals
KERNEL_UNLOCK();
}
- if (SIGPENDING(p) != 0) {
+ if (SIGPENDING(p)) {
KERNEL_LOCK();
while ((signum = CURSIG(p)) != 0)
postsig(p, signum);
-/* $OpenBSD: signalvar.h,v 1.32 2018/07/11 19:28:16 bluhm Exp $ */
+/* $OpenBSD: signalvar.h,v 1.33 2018/07/18 16:55:17 bluhm Exp $ */
/* $NetBSD: signalvar.h,v 1.17 1996/04/22 01:23:31 christos Exp $ */
/*
/*
* Check if process p has an unmasked signal pending.
*/
-#define SIGPENDING(p) \
- (((p)->p_siglist | (p)->p_p->ps_mainproc->p_siglist) & \
- ~(p)->p_sigmask)
+#define SIGPENDING(p) (((p)->p_siglist & ~(p)->p_sigmask) != 0)
/*
* Determine signal that should be delivered to process p, the current
* action, the process stops in issignal().
*/
#define CURSIG(p) \
- (((((p)->p_siglist | (p)->p_p->ps_mainproc->p_siglist) == 0) || \
- (((p)->p_p->ps_flags & PS_TRACED) == 0 && SIGPENDING(p) == 0)) \
- ? 0 : issignal(p))
+ (((p)->p_siglist == 0 || \
+ (((p)->p_p->ps_flags & PS_TRACED) == 0 && \
+ ((p)->p_siglist & ~(p)->p_sigmask) == 0)) ? \
+ 0 : issignal(p))
/*
* Clear a pending signal from a process.