diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 1997-10-22 12:04:49 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 1997-10-22 12:04:49 +0000 |
| commit | 7a54ede12f864a105a165cdcd4a7264e636c069b (patch) | |
| tree | 4c1baea193f9c71dfc66c96b2520542b349c366d /lib/libc | |
| parent | 45ea5f3053e233c787d34a0441b2560736f53e96 (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -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 0b03a7cff60c..a56c56bdd545 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 03df4953de52..d2d4f1eac46d 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; |
