Hi Scott, Scott Cheloha wrote on Wed, Jul 21, 2021 at 11:02:00AM -0500:
[ EFAULT ] > Given deraadt@'s response I'm just going to leave the existing > language. Fine with me. > I guess I will need to dig into it a bit. Finding the text of the > really early documents, prior to SUSv2, is tricky. I think you are right. I recently tried to find an online copy of XPG4.2 / SUSv1 (1994) and did not succeed. What you want here is even one step further back: POSIX.1 (1988), POSIX.1b (1993), POSIX.1c (1995), POSIX.2 (1992), XPG4 (1992), see mdoc(7) for an overview. > One additional change: > - Escape the minus sign for "-1". I like that, using \- for mathematical minus is certainly correct in roff(7) in general and perfectly acceptable in manual pages, too. Our mandoc_char(7) page explains that we don't require it, but there is a risk that groff(1) might start requiring it in the next release. I tried to push back, but without success so far. It seems you somewhere lost the s/one billion/1000 million/ tweak that you advertised earlier. Either way, OK schwarze@. Yours, Ingo > Index: nanosleep.2 > =================================================================== > RCS file: /cvs/src/lib/libc/sys/nanosleep.2,v > retrieving revision 1.16 > diff -u -p -r1.16 nanosleep.2 > --- nanosleep.2 31 Dec 2018 18:54:00 -0000 1.16 > +++ nanosleep.2 21 Jul 2021 15:57:55 -0000 > @@ -41,53 +41,71 @@ > .Ft int > .Fn nanosleep "const struct timespec *timeout" "struct timespec *remainder" > .Sh DESCRIPTION > +The > .Fn nanosleep > -suspends execution of the calling process for the duration specified by > +function suspends execution of the calling thread for at least the > +duration specified by > .Fa timeout . > -An unmasked signal will cause it to terminate the sleep early, > -regardless of the > +Delivery of an unmasked signal to the calling thread terminates the > +sleep early, > +even if > .Dv SA_RESTART > -value on the interrupting signal. > +is set with > +.Xr sigaction 2 > +for the interrupting signal. > .Sh RETURN VALUES > -If the > +If > .Fn nanosleep > -function returns because the requested duration has elapsed, the value > -returned will be zero. > +sleeps the full > +.Fa timeout > +without interruption it returns 0. > +Unless > +.Fa remainder > +is > +.Dv NULL , > +it is set to zero. > .Pp > -If the > +If > .Fn nanosleep > -function returns due to the delivery of a signal, the value returned > -will be \-1, and the global variable > +is interrupted by a signal it returns \-1 and the global variable > .Va errno > -will be set to indicate the interruption. > -If > +is set to > +.Dv EINTR . > +Unless > .Fa remainder > -is non-null, the timespec structure it references is updated to contain the > -unslept amount (the requested duration minus the duration actually slept). > -.Sh ERRORS > -If any of the following conditions occur, the > +is > +.Dv NULL , > +it is set to the unslept portion of the > +.Fa timeout . > +.Pp > +Otherwise, > .Fn nanosleep > -function shall return \-1 and set > +returns \-1 and the global variable > .Va errno > -to the corresponding value. > +is set to indicate the error. > +.Sh ERRORS > +.Fn nanosleep > +will fail if: > .Bl -tag -width Er > .It Bq Er EINTR > -.Fn nanosleep > -was interrupted by the delivery of a signal. > +The call is interrupted by the delivery of a signal. > .It Bq Er EINVAL > .Fa timeout > -specified a nanosecond value less than zero or greater than or equal to > -1000 million, > +specifies a nanosecond value less than zero or greater than or equal to > +one billion, > or a second value less than zero. > .It Bq Er EFAULT > -Either > .Fa timeout > -or > -.Fa remainder > points to memory that is not a valid part of the process address space. > +.It Bq Er EFAULT > +.Fa remainder > +is not > +.Dv NULL > +and points to memory that is not a valid part of the process address space. > .El > .Sh SEE ALSO > .Xr sleep 1 , > +.Xr sigaction 2 , > .Xr sleep 3 > .Sh STANDARDS > The > @@ -97,17 +115,23 @@ function conforms to > .Sh HISTORY > The predecessor of this system call, > .Fn sleep , > -appeared in > -.At v3 , > -but was removed when > +first appeared in > +.At v3 . > +It was removed in > +.At v7 > +and replaced with a C library implementation based on > .Xr alarm 3 > -was introduced into > -.At v7 . > +and > +.Xr signal 3 . > +.Pp > The > .Fn nanosleep > -system call has been available since > +function first appeared in > +.St -p1003.1b-93 . > +.Pp > +This implementation of > +.Fn nanosleep > +first appeared in > .Nx 1.3 > and was ported to > -.Ox 2.1 > -and > -.Fx 3.0 . > +.Ox 2.1 .