sys_nanosleep  [kernel/hrtimer.c]


Pauses execution for a specified time.

Arguments

eax 162
ebx Pointer to a timespec structure which specifies the delay time:
struc timespec
{
tv_sec  dd ? ; seconds
tv_nsec dd ? ; nanoseconds (it must be in range 0 to 999999999)
}
ecx Pointer to a timespec structure which will be filled with remaining time in case if a signal has been delivered to the process. When this happens the call fails with -EINTR.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EFAULT Problem with copying information from user space.
-EINTR The pause has been interrupted by a non-blocked signal that was delivered to the process. The remaining sleep time has been written into the strcutre pointed by ecx so that the process can easily call sys_nanosleep again and continue with the pause.
-EINVAL The value in the tv_nsec field was not in the range 0 to 999999999 or tv_sec was negative.

Remarks

The current implementation of sys_nanosleep is based on the normal kernel timer mechanism, which has a resolution of 1/HZ s. Therefore, sys_nanosleep pauses always for at least the specified time, however it can take up to 10 ms longer than specified until the process becomes runnable again. For the same reason, the value returned in case of a delivered signal in the structure pointed by ecx is usually rounded to the next larger multiple of 1/HZ s.

Compatibility

n/a