1 .\" $NetBSD: timer_settime.2,v 1.4 2003/09/14 09:02:50 wiz Exp $
3 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Christos Zoulas.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
30 .Dd September 13, 2003
37 .Nd process timer manipulation
43 .Fn timer_settime "timer_t timerid" "int flags" "const struct itimerspec * restrict tim" "struct itimerspec * restrict otim"
45 .Fn timer_gettime "timer_t timerid" "struct itimerspec *tim"
47 .Fn timer_getoverrun "timer_t timerid"
51 sets the next expiration time of the timer with id
58 If the value is 0, the timer is disarmed.
63 the old timer settingas are returned.
68 then the expiration time is set to the value in nanoseconds specified
71 argument from the time the call to
78 then the expiration time is set to be equal to the difference between the
79 clock associated with this timer, and the value specified in the
82 If that time has already passed, then the call succeeds, and the
83 expiration notification occurs.
89 argument is non-zero, then the timer reloads upon expiration.
93 function returns the current settings of the timer
100 Only one notification event (signal) can be pending for a given timer
102 If a timer expires while the signal is still queued for delivery, then
103 the overrun counter for that timer is increased.
104 The counter can store values up to
106 When the signal is finally delivered to the process, then the
108 function can be used to retrieve the overrun counter for the timer
113 Expiration time values are always rounded up to the resolution of the timer,
114 so a notification will never be sent before the requested time.
115 Values returned in the
123 are subject to the above rounding effect and might not exactly match the
124 requested values by the user.
130 functions return 0, and the
132 function returns the expiration overrun count for the specified timer.
133 Otherwise, the functions return \-1, and set
135 to indicate the error.
139 .Fn timer_getoverrun ,
142 functions will fail if:
147 does not correspond to a valid timer id as returned by
149 or that timer id has been deleted by
155 function will fail if:
158 A nanosecond field in the
160 structure specified a value less than zero or greater than or equal to 10e9.
163 .Xr clock_gettime 2 ,