nanosleep() replacement

Darren Tucker dtucker at zip.com.au
Tue Mar 18 08:24:34 EST 2003


Corinna Vinschen wrote:
> On Mon, Mar 17, 2003 at 10:16:50PM +1100, Darren Tucker wrote:
> > I did some fiddling and got pretty close to the real nanosleep with the
> > modified function below.
> 
> wouldn't it make sense to return the correct errno like this:
[snip]
> Even though EINTR is the most common error in the degenerated select,
> it's not necessarily the only error.  E. g. EINVAL, which is returned
> by select if the timer value is invalid.  This is also a common error
> code for nanosleep.

Good point.  I hadn't taken much notice of what different errnos could
return, I just added a case to handle what I saw happening.  Happily,
nanosleep and select return pretty much the same errnos, so what you're
suggesting is probably a good idea.

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.




More information about the openssh-unix-dev mailing list