From 5ae2c6a6fb0014f5c4d0d0131fea6b4c1927e0ff Mon Sep 17 00:00:00 2001 From: Visa Hankala Date: Tue, 16 Nov 2021 13:48:24 +0000 Subject: 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@ --- sys/kern/sys_generic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/kern/sys_generic.c') 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) -- cgit v1.2.3