sys_setitimer [kernel/itimer.c]
Sets value of an interval timer. The system provides each process with three interval timers, each decrementing in a distinct time domain. When any timer expires, a signal is sent to the process, and the timer (potentially) restarts. Arguments
eax | 104
ebx | Timer. It may one of the following values:
`ITIMER_REAL` | `decrements in real time, and delivers SIGALRM upon expiration.`
`ITIMER_VIRTUAL` | `decrements only when the process is executing, and delivers SIGVTALRM upon expiration.`
`ITIMER_PROF` | `decrements both when the process executes and when the system is executing on behalf of the process. Coupled with ITIMER_VIRTUAL, this timer is usually used to profile the time spent by the application in user and kernel space. SIGPROF is delivered upon expiration.`
ecx | Pointer to a properly initialized itimerval structure:
`struc itimerval { .it_interval timeval ; next value .it_value timeval ; current value }` `struc timeval { .tv_sec rd 1 ; seconds .tv_usec rd 1 ; microseconds }`
edx | A pointer to an itimerval structure which will be filled with the old timer value. This argument may be 0.
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` | `ecx is not a valid pointer.`
`-EINVAL` | `ebx is not one of ITIMER_REAL, ITIMER_VIRT, or ITIMER_PROF.`
Remarks The generation and delivery of a signal are distinct, and only one instance of each of the signals listed above may be pending for a process. Under very heavy loading, an ITIMER_REAL timer may expire before the signal from a previous expiration has been delivered. The second signal in such an event will be lost. On Linux, timer values are represented in jiffies. If a request is made set a timer with a value whose jiffies representation exceeds MAX_SEC_IN_JIFFIES (defined in include/linux/jiffies.h), then the timer is silently truncated to this ceiling value. On Linux/x86 (where, since kernel 2.6.13, the default jiffy is 0.004 seconds), this means that the ceiling value for a timer is approximately 99.42 days. On certain systems (including x86), Linux kernels before version 2.6.12 have a bug which will produce premature timer expirations of up to one jiffy under some circumstances. This bug is fixed in kernel 2.6.12. POSIX.1-2001 says that sys_setitimer should fail if a tv_usec value is specified that is outside of the range 0 to 999999. However, Linux does not give an error, but instead silently adjusts the corresponding seconds value for the timer. In the future (scheduled for March 2007), this non-conformance will be repaired: existing applications should be fixed now to ensure that they supply a properly formed tv_usec value. Compatibility n/a