In sleep(3), if seconds is zero we don't call nanosleep(2).

I don't like this.  If sleep(3) really is a simplified interface to
nanosleep(2) (as we claim in the manpage) we should let nanosleep(2)
handle the input and make decisions.

Other benefits:

- sleep(3) now *always* shows up in ktrace.

- sleep(3) with a zero input now blocks for up to 1 tick, just like
  nanosleep(2) does with a zero input (more intuitive behavior).

- Neither NetBSD nor FreeBSD bypass nanosleep(2) like this, so now our
  sleep(3) is more like theirs.

ok?

Index: sleep.c
===================================================================
RCS file: /cvs/src/lib/libc/gen/sleep.c,v
retrieving revision 1.12
diff -u -p -r1.12 sleep.c
--- sleep.c     14 Dec 2009 05:10:13 -0000      1.12
+++ sleep.c     6 Jan 2021 16:21:11 -0000
@@ -36,9 +36,6 @@ sleep(unsigned int seconds)
 {
        struct timespec rqt, rmt;
 
-       if (seconds == 0)
-               return(0);
-
        rqt.tv_sec = seconds;
        rqt.tv_nsec = 0;
 

Reply via email to