Back out part of OpenGroup specs about limiting max arg since it may break
compatibility.
This commit is contained in:
parent
45ea5f3053
commit
7a54ede12f
@ -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.
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user