From: claudio Date: Wed, 15 Feb 2023 10:07:50 +0000 (+0000) Subject: Use the nowake channel for sys_nanosleep() instead of handrolling the same. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=48607af64ea40d2f89c80aab14b33cded718ab73;p=openbsd Use the nowake channel for sys_nanosleep() instead of handrolling the same. OK cheloha@ jca@ mvs@ --- diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 9072595194f..9caf7c1f327 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_time.c,v 1.162 2023/02/04 19:33:03 cheloha Exp $ */ +/* $OpenBSD: kern_time.c,v 1.163 2023/02/15 10:07:50 claudio Exp $ */ /* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */ /* @@ -269,7 +269,6 @@ sys_clock_getres(struct proc *p, void *v, register_t *retval) int sys_nanosleep(struct proc *p, void *v, register_t *retval) { - static int chan; struct sys_nanosleep_args/* { syscallarg(const struct timespec *) rqtp; syscallarg(struct timespec *) rmtp; @@ -294,7 +293,7 @@ sys_nanosleep(struct proc *p, void *v, register_t *retval) do { getnanouptime(&start); nsecs = MAX(1, MIN(TIMESPEC_TO_NSEC(&request), MAXTSLP)); - error = tsleep_nsec(&chan, PWAIT | PCATCH, "nanoslp", nsecs); + error = tsleep_nsec(&nowake, PWAIT | PCATCH, "nanoslp", nsecs); getnanouptime(&stop); timespecsub(&stop, &start, &elapsed); timespecsub(&request, &elapsed, &request);