diff options
author | ache <ache@FreeBSD.org> | 1997-10-22 12:04:49 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-10-22 12:04:49 +0000 |
commit | 2e52ab6886d96936860712ad9d351e77059bd495 (patch) | |
tree | 7d54b1724979c5cf997974d4f552c02c1d6765cc /lib | |
parent | 3cb44cbe93023ab3aaa8f60947d59c2bf33865c5 (diff) | |
download | FreeBSD-src-2e52ab6886d96936860712ad9d351e77059bd495.zip FreeBSD-src-2e52ab6886d96936860712ad9d351e77059bd495.tar.gz |
Back out part of OpenGroup specs about limiting max arg since it may break
compatibility.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/usleep.3 | 10 | ||||
-rw-r--r-- | lib/libc/gen/usleep.c | 11 |
2 files changed, 4 insertions, 17 deletions
diff --git a/lib/libc/gen/usleep.3 b/lib/libc/gen/usleep.3 index 0b03a7c..a56c56b 100644 --- a/lib/libc/gen/usleep.3 +++ b/lib/libc/gen/usleep.3 @@ -52,10 +52,6 @@ of time. System activity or time spent in processing the call may lengthen the sleep slightly. .Pp -The -.Fa microseconds -argument must be less than 1000000. -.Pp If a timer is already running on the process its state is unaltered by this .Fn usleep @@ -83,13 +79,9 @@ The .Fn usleep function will fail if: -.Bl -tag -width [EINVAL] +.Bl -tag -width [EINTR] .It Bq Er EINTR Some signal occurse. -.It Bq Er EINVAL -The -.Fa microseconds -argument specified 1000000 or more microseconds. .Sh NOTES .Pp A microsecond is 0.000001 seconds. diff --git a/lib/libc/gen/usleep.c b/lib/libc/gen/usleep.c index 03df495..d2d4f1e 100644 --- a/lib/libc/gen/usleep.c +++ b/lib/libc/gen/usleep.c @@ -36,10 +36,9 @@ static char sccsid[] = "@(#)usleep.c 8.1 (Berkeley) 6/4/93"; #endif static char rcsid[] = - "$Id: usleep.c,v 1.19 1997/10/17 09:40:08 ache Exp $"; + "$Id: usleep.c,v 1.20 1997/10/22 10:55:49 ache Exp $"; #endif /* LIBC_SCCS and not lint */ -#include <errno.h> #include <time.h> #include <unistd.h> @@ -49,13 +48,9 @@ usleep(useconds) { struct timespec time_to_sleep; - if (useconds >= 1000000) { - errno = EINVAL; - return -1; - } if (useconds) { - time_to_sleep.tv_nsec = useconds * 1000; - time_to_sleep.tv_sec = 0; + time_to_sleep.tv_nsec = (useconds % 1000000) * 1000; + time_to_sleep.tv_sec = useconds / 1000000; return nanosleep(&time_to_sleep, NULL); } return 0; |