1 .\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice(s), this list of conditions and the following disclaimer as
9 .\" the first lines of this file unmodified other than the possible
10 .\" addition of one or more copyright notices.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice(s), this list of conditions and the following disclaimer in
13 .\" the documentation and/or other materials provided with the
16 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
17 .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
20 .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 .Dd September 11, 2000
32 .Nm timer_getoverrun ,
35 .Nd "per-process timers (REALTIME)"
41 .Fn timer_getoverrun "timer_t timerid"
43 .Fn timer_gettime "timer_t timerid" "struct itimerspec *value"
46 .Fa "timer_t timerid" "int flags" "const struct itimerspec *restrict value"
47 .Fa "struct itimerspec *restrict ovalue"
52 system call stores the amount of time until the specified timer,
54 expires and the reload value of the timer into the space pointed to by the
59 member of this structure contains the amount of time
60 before the timer expires, or zero if the timer is disarmed.
62 returned as the interval until timer expiration, even if the timer was armed
74 system call sets the time until the next expiration of the timer specified
81 argument and arms the timer if the
86 If the specified timer was already
89 is called, this call resets the time until next expiration to the value
95 is zero, the timer is disarmed.
96 If the timer is disarmed, then pending signal is removed.
100 is not set in the argument
103 behaves as if the time until next expiration is set to
104 be equal to the interval specified by the
111 nanoseconds from when the call is made.
114 is set in the argument
117 behaves as if the time until next expiration is set to be equal to the
118 difference between the absolute time specified by the it_value member of
119 value and the current value of the clock associated with
121 That is, the timer expires when the clock reaches the value specified by the
125 If the specified time has already passed, the
126 system call succeeds and the expiration notification is made.
128 The reload value of the timer is set to the value specified by the
132 When a timer is armed with a non-zero
135 (or repetitive) timer is specified.
137 Time values that are between two consecutive non-negative integer multiples of
138 the resolution of the specified timer are rounded up to the larger multiple of
140 Quantization error will not cause the timer to expire earlier
141 than the rounded time value.
149 system call stores, in the location referenced by
152 the previous amount of time before the timer would have expired, or zero if the
153 timer was disarmed, together with the previous timer reload value.
155 expire before their scheduled time.
157 Only a single signal is queued to the process for a given timer at any point in
159 When a timer for which a signal is still pending expires, no signal is
160 queued, and a timer overrun will occur.
161 When a timer expiration signal is
162 accepted by a process, the
164 system call returns the timer expiration overrun count for the specified timer.
165 The overrun count returned contains the number of extra timer expirations that
166 occurred between the time the signal was generated (queued) and when it was
167 accepted, up to but not including an maximum of
168 .Brq Dv DELAYTIMER_MAX .
170 such extra expirations is greater than or equal to
171 .Brq Dv DELAYTIMER_MAX ,
172 then the overrun count is set to
173 .Brq Dv DELAYTIMER_MAX .
174 The value returned by
176 applies to the most recent expiration signal acceptance for the timer.
178 expiration signal has been delivered for the timer, the return value of
184 system call succeeds, it returns the timer expiration overrun count as explained
186 Otherwise the value \-1 is returned, and the global variable
188 is set to indicate the error.
190 .Rv -std timer_gettime timer_settime
200 structure specified a nanosecond value less than zero or greater than
201 or equal to 1000 million, and the
203 member of that structure did not
204 specify zero seconds and nanoseconds.
207 These system calls may fail if:
212 argument does not correspond to an ID returned by
214 but not yet deleted by
220 system call may fail if:
227 is not zero and the timer was created with
228 notification by creation of a new thread
229 .Va ( sigev_sigev_notify
232 and a fixed stack address has been set in the thread attribute pointed to by
233 .Va sigev_notify_attributes .
244 Any arguments point outside the allocated address space or there is a
245 memory protection fault.
253 .Fn timer_getoverrun ,
257 system calls conform to
262 per-process timer first appeared in