From 8599f9e108b853b72544216cf749e7fd896e9fa5 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 6 Nov 1997 01:25:50 +0000 Subject: XPG4.2 compat: 1) usleep() and ualarm() use useconds_t not u_int 2) usleep() returns an int --- lib/libc/gen/usleep.3 | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'lib/libc/gen/usleep.3') diff --git a/lib/libc/gen/usleep.3 b/lib/libc/gen/usleep.3 index b8ff9be759f..6326eefc5ad 100644 --- a/lib/libc/gen/usleep.3 +++ b/lib/libc/gen/usleep.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: usleep.3,v 1.3 1997/04/25 14:47:59 kstailey Exp $ +.\" $OpenBSD: usleep.3,v 1.4 1997/11/06 01:25:48 millert Exp $ .\" .\" Copyright (c) 1986, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 4, 1993 +.Dd November 4, 1997 .Dt USLEEP 3 .Os BSD 4.3 .Sh NAME @@ -39,8 +39,8 @@ .Nd suspend execution for interval of microseconds .Sh SYNOPSIS .Fd #include -.Ft void -.Fn usleep "u_int microseconds" +.Ft int +.Fn usleep "useconds_t microseconds" .Sh DESCRIPTION The .Fn usleep @@ -63,6 +63,32 @@ with other uses of (not that .Fn usleep interferes with interval timers anymore.) +.Sh RETURN VALUE +If the +.Fn usleep +function returns because the requested time has elapsed, the value +returned will be zero. +.Pp +If the +.Fn usleep +function returns due to the delivery of a signal, the value returned +will be the -1, and the global variable +.Va errno +will be set to indicate the interruption. +.Sh ERRORS +If any of the following conditions occur, the +.Nm +function shall return -1 and set +.Va errno +to the corresponding value. +.Bl -tag -width Er +.It Bq Er EINTR +.Nm +was interrupted by the delivery of a signal. +.It Bq Er EINVAL +.Fa useconds +specified a value of 1,000,000 or more microseconds. +.El .Sh SEE ALSO .Xr getitimer 2 , .Xr nanosleep 2 , @@ -71,6 +97,11 @@ interferes with interval timers anymore.) .Xr alarm 3 .Xr sleep 3 , .Xr ualarm 3 , +.Sh STANDARDS +The +.Fn +function conforms to +.St -xpg4.2 . .Sh HISTORY The .Fn usleep -- cgit v1.2.3