From: visa Date: Tue, 16 Nov 2021 13:48:23 +0000 (+0000) Subject: Use nowake when poll/select has empty fd set X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ebddda04e0f37e9ca553a381667094b050e637d1;p=openbsd Use nowake when poll/select has empty fd set When the fd set is empty, the code waits for a signal or timeout. Wakeups from the kqueue are neither expected nor wanted. OK cheloha@, millert@, anton@, mpi@ --- diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 0af21d981fa..3a449784f98 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.140 2021/11/12 04:34:22 visa Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.141 2021/11/16 13:48:23 visa Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -671,7 +671,7 @@ dopselect(struct proc *p, int nd, fd_set *in, fd_set *ou, fd_set *ex, goto done; nsecs = MAX(1, MIN(TIMESPEC_TO_NSEC(timeout), MAXTSLP)); } - error = tsleep_nsec(&p->p_kq, PSOCK | PCATCH, "kqsel", nsecs); + error = tsleep_nsec(&nowake, PSOCK | PCATCH, "kqsel", nsecs); /* select is not restarted after signals... */ if (error == ERESTART) error = EINTR; @@ -1166,7 +1166,7 @@ doppoll(struct proc *p, struct pollfd *fds, u_int nfds, nsecs = MAX(1, MIN(TIMESPEC_TO_NSEC(timeout), MAXTSLP)); } - error = tsleep_nsec(&p->p_kq, PSOCK | PCATCH, "kqpoll", nsecs); + error = tsleep_nsec(&nowake, PSOCK | PCATCH, "kqpoll", nsecs); if (error == ERESTART) error = EINTR; if (error == EWOULDBLOCK)