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.
30 .Dd September 11, 2000
34 .Nm timer_getoverrun ,
37 .Nd "per-process timers (REALTIME)"
43 .Fn timer_getoverrun "timer_t timerid"
45 .Fn timer_gettime "timer_t timerid" "struct itimerspec *value"
48 .Fa "timer_t timerid" "int flags" "const struct itimerspec *restrict value"
49 .Fa "struct itimerspec *restrict ovalue"
54 system call stores the amount of time until the specified timer,
56 expires and the reload value of the timer into the space pointed to by the
61 member of this structure contains the amount of time
62 before the timer expires, or zero if the timer is disarmed.
64 returned as the interval until timer expiration, even if the timer was armed
76 system call sets the time until the next expiration of the timer specified
83 argument and arms the timer if the
88 If the specified timer was already
91 is called, this call resets the time until next expiration to the value
97 is zero, the timer is disarmed.
98 If the timer is disarmed, then pending signal is removed.
102 is not set in the argument
105 behaves as if the time until next expiration is set to
106 be equal to the interval specified by the
113 nanoseconds from when the call is made.
116 is set in the argument
119 behaves as if the time until next expiration is set to be equal to the
120 difference between the absolute time specified by the it_value member of
121 value and the current value of the clock associated with
123 That is, the timer expires when the clock reaches the value specified by the
127 If the specified time has already passed, the
128 system call succeeds and the expiration notification is made.
130 The reload value of the timer is set to the value specified by the
134 When a timer is armed with a non-zero
137 (or repetitive) timer is specified.
139 Time values that are between two consecutive non-negative integer multiples of
140 the resolution of the specified timer are rounded up to the larger multiple of
142 Quantization error will not cause the timer to expire earlier
143 than the rounded time value.
151 system call stores, in the location referenced by
154 the previous amount of time before the timer would have expired, or zero if the
155 timer was disarmed, together with the previous timer reload value.
157 expire before their scheduled time.
159 Only a single signal is queued to the process for a given timer at any point in
161 When a timer for which a signal is still pending expires, no signal is
162 queued, and a timer overrun will occur.
163 When a timer expiration signal is
164 accepted by a process, the
166 system call returns the timer expiration overrun count for the specified timer.
167 The overrun count returned contains the number of extra timer expirations that
168 occurred between the time the signal was generated (queued) and when it was
169 accepted, up to but not including an maximum of
170 .Brq Dv DELAYTIMER_MAX .
172 such extra expirations is greater than or equal to
173 .Brq Dv DELAYTIMER_MAX ,
174 then the overrun count is set to
175 .Brq Dv DELAYTIMER_MAX .
176 The value returned by
178 applies to the most recent expiration signal acceptance for the timer.
180 expiration signal has been delivered for the timer, the return value of
186 system call succeeds, it returns the timer expiration overrun count as explained
188 Otherwise the value \-1 is returned, and the global variable
190 is set to indicate the error.
192 .Rv -std timer_gettime timer_settime
202 structure specified a nanosecond value less than zero or greater than
203 or equal to 1000 million, and the
205 member of that structure did not
206 specify zero seconds and nanoseconds.
209 These system calls may fail if:
214 argument does not correspond to an ID returned by
216 but not yet deleted by
222 system call may fail if:
229 is not zero and the timer was created with
230 notification by creation of a new thread
231 .Va ( sigev_sigev_notify
234 and a fixed stack address has been set in the thread attribute pointed to by
235 .Va sigev_notify_attributes .
246 Any arguments point outside the allocated address space or there is a
247 memory protection fault.
255 .Fn timer_getoverrun ,
259 system calls conform to
264 per-process timer first appeared in