Repository navigation
Expand file tree
/
Copy pathgetitimer.2
More file actions
68 lines (67 loc) · 2.57 KB
/
Copy pathgetitimer.2
File metadata and controls
68 lines (67 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
89B6
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.TH GETITIMER 2 "April 14, 2006"
.UC 4
.SH NAME
getitimer, setitimer \- get and set value of interval timer
.SH SYNOPSIS
.nf
.ft B
#include <sys/time.h>
int getitimer(int \fIwhich\fP, struct itimerval *\fIvalue\fP)
.in +5
.ti -5
int setitimer(int \fIwhich\fP, const struct itimerval *\fIvalue\fP, struct itimerval *\fIovalue\fP);
.in -5
.ft R
.fi
.SH DESCRIPTION
.B Getitimer
retrieves the current value of the given interval timer, in \fIvalue\fP.
.PP
.B Setitimer
sets a new value for the given interval timer, as given in \fIvalue\fP, and, if \fIovalue\fP is not set to
.BR NULL ,
stores the old value for the interval timer in \fIovalue\fP.
.PP
For both functions, the \fIwhich\fP parameter indicates which of the interval timers they work on; \fIwhich\fP can have one of the following values:
.PP
.TP 15
.B ITIMER_REAL
A timer that is decremented in realtime. When it expires, a
.BR SIGARLM
signal is delivered to the process.
.TP
.B ITIMER_VIRTUAL
A timer that is decremented in process user time. When it expires, a
.BR SIGVTALRM
signal is delivered to the process.
.TP
.B ITIMER_PROF
A timer that is decremented in process user+system time. When it expires, a
.BR SIGPROF
signal is delivered to the process.
.PP
The specified timer will first expire after the time specified in the 'it_value' field of the itimerval structure. Similarly, upon retrieval the 'it_value' field will contain the time after which the timer will expire.
.PP
If 'it_value' is zero, then the timer is disabled, and the 'it_interval' field is ignored and (upon retrieval) set to zero. Otherwise, 'it_interval' contains the repetition interval after which the timer will repeatedly expire, starting from the moment that the timer expires for the first time according to the 'it_value' value. If 'it_interval' is set to zero, no repetition will occur.
.PP
The maximum supported timeout value that
.B setitimer
accepts, depends on the clock tick rate of the operating system.
.PP
These functions share their real-time timer with
.BR alarm (2).
Therefore, use of both types of functions in one program yields undefined results.
.SH RETURN VALUES
Upon successful completion, these functions return 0. Otherwise, a value of -1 is returned and \fIerrno\fP is set to indicate the error.
.SH ERRORS
The functions will fail if any of the following occur:
.TP 15
.B EINVAL
Either \fIwhich\fP is not one of the ITIMER_* constants above, or one of the timeval structures in \fIvalue\fP contains a bad or too large value.
.TP
.B EFAULT
Bad \fIvalue\fP or \fIovalue\fP address.
.SH SEE ALSO
.BR alarm (2)
.SH AUTHOR
David van Moolenbroek <dcvmoole@cs.vu.nl>