summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_generic.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2020-01-16 16:35:03 +0000
committermpi <mpi@openbsd.org>2020-01-16 16:35:03 +0000
commit9566af8920ce0c73af22f6155f3428b247ad2cc0 (patch)
tree1fbe95b2ac7601abd6418ad43a6a57c6a5924bd1 /sys/kern/sys_generic.c
parentturns out there WAS something fishy in signal handling in the "generic" (diff)
downloadwireguard-openbsd-9566af8920ce0c73af22f6155f3428b247ad2cc0.tar.xz
wireguard-openbsd-9566af8920ce0c73af22f6155f3428b247ad2cc0.zip
Introduce wakeup_proc() a function to un-SSTOP/SSLEEP a thread.
This moves most of the SCHED_LOCK() related to protecting the sleepqueue and its states to kern/kern_sync.c Name suggestion from jsg@, ok kettenis@, visa@
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r--sys/kern/sys_generic.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index b2870249c99..dc050095a33 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_generic.c,v 1.127 2020/01/08 16:27:41 visa Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.128 2020/01/16 16:35:04 mpi Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@@ -767,7 +767,6 @@ void
selwakeup(struct selinfo *sip)
{
struct proc *p;
- int s;
KNOTE(&sip->si_note, NOTE_SUBMIT);
if (sip->si_seltid == 0)
@@ -780,15 +779,10 @@ selwakeup(struct selinfo *sip)
p = tfind(sip->si_seltid);
sip->si_seltid = 0;
if (p != NULL) {
- SCHED_LOCK(s);
- if (p->p_wchan == (caddr_t)&selwait) {
- if (p->p_stat == SSLEEP)
- setrunnable(p);
- else
- unsleep(p);
+ if (wakeup_proc(p, &selwait)) {
+ /* nothing else to do */
} else if (p->p_flag & P_SELECT)
atomic_clearbits_int(&p->p_flag, P_SELECT);
- SCHED_UNLOCK(s);
}
}