Penguin
Blame: getitimer(2)
EditPageHistoryDiffInfoLikePages
Annotated edit history of getitimer(2) version 6, including all changes. View license author blame.
Rev Author # Line
1 perry 1 !!NAME
5 PerryLorier 2 getitimer - get value of an interval timer
1 perry 3 !!SYNOPSIS
5 PerryLorier 4 __#include <sys/time.h>__
5 __int getitimer(int__ ''which''__, struct itimerval *__''value''__);__
1 perry 6
7 !!DESCRIPTION
5 PerryLorier 8 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.
9 ;__ITIMER_REAL__: decrements in real time, and delivers [SIGALRM] upon expiration.
10 ;__ITIMER_VIRTUAL__: decrements only when the process is executing, and delivers [SIGVTALRM] upon expiration.
11 ;__ITIMER_PROF__: decrements both when the process executes and when the system is executing on behalf of the process. Coupled with
12 [ITIMER_VIRTUAL], this timer is usually used to profile the time spent by the application in user and kernel space.
13 [SIGPROF] is delivered upon expiration.
1 perry 14
5 PerryLorier 15 Timer values are defined by the following structures:
1 perry 16
5 PerryLorier 17 struct itimerval {
18 struct timeval it_interval; /* next value */
19 struct timeval it_value; /* current value */
20 };
1 perry 21
5 PerryLorier 22 struct timeval {
23 long tv_sec; /* seconds */
24 long tv_usec; /* microseconds */
25 };
1 perry 26
27
6 PerryLorier 28 getitimer(2) fills the structure indicated by ''value'' with the current setting for the timer indicated by ''which'' (one of __ITIMER_REAL__, __ITIMER_VIRTUAL__, or __ITIMER_PROF__). The element __it_value__ is set to the amount of time remaining on
5 PerryLorier 29 the timer, or zero if the timer is disabled. Similarly, __it_interval__ is set to the reset value. Setitimer(2) sets the indicated timer to the value in ''value''. If ''ovalue'' is nonzero, the old value of the timer is stored there.
1 perry 30
5 PerryLorier 31 Timers decrement from ''it_value'' to zero, generate a signal, and reset to ''it_interval''. A timer which is set to zero (''it_value'' is zero or the timer expires and ''it_interval'' is zero) stops.
1 perry 32
5 PerryLorier 33 Both ''tv_sec'' and ''tv_usec'' are significant in determining the duration of a timer.
1 perry 34
5 PerryLorier 35 Timers will never expire before the requested time, instead expiring some short, constant time afterwards, dependent on the system timer resolution (currently 10ms). Upon expiration, a signal will be generated and the timer reset. If the timer expires while the process is active (always true for __ITIMER_VIRT__) the signal will be delivered immediately when generated. Otherwise the delivery will be
36 offset by a small time dependent on the system loading.
1 perry 37
38 !!RETURN VALUE
5 PerryLorier 39 On success, zero is returned. On error, -1 is returned, and ''errno'' is set appropriately.
1 perry 40 !!ERRORS
5 PerryLorier 41 ;[EFAULT]: ''value'' or ''ovalue'' are not valid pointers.
42 ;[EINVAL]: ''which'' is not one of __ITIMER_REAL__, __ITIMER_VIRT__, or __ITIMER_PROF__.
1 perry 43
44 !!CONFORMING TO
5 PerryLorier 45 SVr4, 4.4BSD (This call first appeared in 4.2BSD).
1 perry 46
5 PerryLorier 47 !!BUGS
48 Under Linux, the generation and delivery of a signal are distinct, and there each signal is permitted only one outstanding event. It's therefore conceivable that under pathologically heavy loading, __ITIMER_REAL__ will expire before the signal from a previous expiration has been delivered. The second signal in such an event will be lost.
1 perry 49
50 !!SEE ALSO
5 PerryLorier 51 gettimeofday(2), sigaction(2), signal(2)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 6 times)