Go to the previous, next section.

getitimer and setitimer

SYNOPSIS

int getitimer(int which, struct itimerval *value);

int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue);

PARAMETERS

which: [in] the timer to access.

value: (For getitimer) [out] the value of the timer. (For setitimer) [in] the new value of the timer.

ovalue: [out] the old value of the timer.

DESCRIPTION

Each task posess 3 interval timers:

ITIMER_REAL
Real time timer. It delivers SIGALRM upon expiration.

ITIMER_VIRTUAL
Runs only during the time the task is actually running on the processor. It delivers SIGVTALRM upon expiration.

ITIMER_PROF
Runs only during the time the taks is actually running on the processor or during the operating system is running on behalf of the task. It delivers SIGPROF upon expiration.

The structure itimerval has the following structure:

struct  itimerval {
        struct  timeval it_interval;    /* timer interval */
        struct  timeval it_value;       /* current value */
};

struct timeval {
        long    tv_sec;         /* seconds */
        long    tv_usec;        /* microseconds */
};

getitimer gets those values for a specific timer and setitimer sets those values for a specific timer (and also retrieve the old values). If it_value or it_interval is set to 0 the timer is deactivated. The timers always expire at or after the requested time. If the requesting process is active at the moment of expiration a signal is immediately delivered otherwise the delivery may be delayed.

RETURN VALUE

On success zero is returned. On error -1 is returned and errno is set to one of the following values:

Go to the previous, next section.