summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2020-03-20 04:14:51 +0000
committercheloha <cheloha@cvs.openbsd.org>2020-03-20 04:14:51 +0000
commit45c1608a5882f04b4fbfb1f2c3a02e06f8246031 (patch)
tree57ad1414e7f1b4bb227bb7ce031ce02357cd49c7 /sys
parent0f4f8fa9ddaf4a8eb061adac38e0691fff75d1b3 (diff)
kevent(2): tsleep(9) -> tsleep_nsec(9)
With input from visa@. ok visa@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_event.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index bb9d5185a28..ec7492872a3 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.127 2020/02/25 13:21:17 mpi Exp $ */
+/* $OpenBSD: kern_event.c,v 1.128 2020/03/20 04:14:50 cheloha Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -53,6 +53,7 @@
#include <sys/mount.h>
#include <sys/poll.h>
#include <sys/syscallargs.h>
+#include <sys/time.h>
#include <sys/timeout.h>
#include <sys/wait.h>
@@ -843,7 +844,8 @@ kqueue_scan(struct kqueue *kq, int maxevents, struct kevent *ulistp,
struct kevent *kevp;
struct timespec elapsed, start, stop;
struct knote mend, mstart, *kn;
- int s, count, timeout, nkev = 0, error = 0;
+ uint64_t nsecs;
+ int s, count, nkev = 0, error = 0;
struct kevent kev[KQ_NEVENTS];
count = maxevents;
@@ -873,10 +875,12 @@ retry:
goto done;
}
kq->kq_state |= KQ_SLEEP;
- timeout = (tsp == NULL) ? 0 : tstohz(tsp);
- if (tsp != NULL)
+ if (tsp != NULL) {
getnanouptime(&start);
- error = tsleep(kq, PSOCK | PCATCH, "kqread", timeout);
+ nsecs = MIN(TIMESPEC_TO_NSEC(tsp), MAXTSLP);
+ } else
+ nsecs = INFSLP;
+ error = tsleep_nsec(kq, PSOCK | PCATCH, "kqread", nsecs);
if (tsp != NULL) {
getnanouptime(&stop);
timespecsub(&stop, &start, &elapsed);