9.65 clock_nanosleep

#define TIMER_ABSTIME 1

int clock_nanosleep(int clock_id, int flags, struct timespec *time,
   struct timespec *remaining);

This syscall sleeps the callee thread for the passed time with the requested clock. If interrupted by a signal or similar, it returns the remaining time that could not be waited.

Unlike what POSIX mandates, this syscall will always need remaining to be a valid structure. clock_id takes the same value as clock.

flags can be one of the following:

TIMER_ABSTIME

Instead of an increment on top of the current time, time is taken as an absolute time (ideally in the future!).

The syscall returns 0 on success or -1 on failure, with the following errno:

EFAULT

time or remaining point to non accessible memory.

EINVAL

One of the passed values is not valid.

EPERM

MAC did not allow this.