On Thursday, 08.10.2015 at 08:28, Antti Kantee wrote:
> On 08/10/15 08:20, Hajime Tazaki wrote:
> >btw, clock_nanosleep(2) seems to be a bit trickier.
> >
> >NetBSD returns -1 while Linux returns errno (positive).
> >
> >http://man.netbsd.org/HEAD/usr/share/man/html2/nanosleep.html
> >http://man7.org/linux/man-pages/man2/clock_nanosleep.2.html
> >
> >need an #ifdef around the code ? shiver...
>
> I think the NetBSD manpage is wrong.
FWIW, here's what clock_nanosleep(3posix) has to say:
RETURN VALUE
If the clock_nanosleep() function returns because the requested time
has elapsed, its return value shall be zero.
If the clock_nanosleep() function returns because it has been inter‐
rupted by a signal, it shall return the corresponding error value. For
the relative clock_nanosleep() function, if the rmtp argument is non-
NULL, the timespec structure referenced by it shall be updated to con‐
tain the amount of time remaining in the interval (the requested time
minus the time actually slept). If the rmtp argument is NULL, the
remaining time is not returned. The absolute clock_nanosleep() function
has no effect on the structure referenced by rmtp.
If clock_nanosleep() fails, it shall return the corresponding error
value.