Simplify sys___thrsigdivert a bit. cursig() always moves the pending signal
authorclaudio <claudio@openbsd.org>
Mon, 4 Oct 2021 08:48:12 +0000 (08:48 +0000)
committerclaudio <claudio@openbsd.org>
Mon, 4 Oct 2021 08:48:12 +0000 (08:48 +0000)
to p_siglist and so there is no need to check ps_siglist for the signal.
OK mpi@

sys/kern/kern_sig.c

index 24d87cd..4a76f75 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kern_sig.c,v 1.283 2021/09/28 10:00:18 claudio Exp $  */
+/*     $OpenBSD: kern_sig.c,v 1.284 2021/10/04 08:48:12 claudio Exp $  */
 /*     $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $   */
 
 /*
@@ -1752,8 +1752,6 @@ sys___thrsigdivert(struct proc *p, void *v, register_t *retval)
                syscallarg(siginfo_t *) info;
                syscallarg(const struct timespec *) timeout;
        } */ *uap = v;
-       struct process *pr = p->p_p;
-       sigset_t *m;
        sigset_t mask = SCARG(uap, sigmask) &~ sigcantmask;
        siginfo_t si;
        uint64_t nsecs = INFSLP;
@@ -1782,15 +1780,7 @@ sys___thrsigdivert(struct proc *p, void *v, register_t *retval)
                if (si.si_signo != 0) {
                        sigset_t smask = sigmask(si.si_signo);
                        if (smask & mask) {
-                               if (p->p_siglist & smask)
-                                       m = &p->p_siglist;
-                               else if (pr->ps_siglist & smask)
-                                       m = &pr->ps_siglist;
-                               else {
-                                       /* signal got eaten by someone else? */
-                                       continue;
-                               }
-                               atomic_clearbits_int(m, smask);
+                               atomic_clearbits_int(&p->p_siglist, smask);
                                error = 0;
                                break;
                        }