From 2e52ab6886d96936860712ad9d351e77059bd495 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 22 Oct 1997 12:04:49 +0000 Subject: Back out part of OpenGroup specs about limiting max arg since it may break compatibility. --- lib/libc/gen/usleep.3 | 10 +--------- lib/libc/gen/usleep.c | 11 +++-------- 2 files changed, 4 insertions(+), 17 deletions(-) (limited to 'lib/libc') 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 #include #include @@ -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; -- cgit v1.1