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.
33 .Nd "create a per-process timer (REALTIME)"
41 .Fa "clockid_t clockid" "struct sigevent *restrict evp"
42 .Fa "timer_t *restrict timerid"
47 system call creates a per-process timer using the specified clock,
52 system call returns, in the location referenced by
56 used to identify the timer in timer requests.
57 This timer ID is unique within the calling process until the timer is deleted.
62 The timer whose ID is returned is in a disarmed state upon return from
73 allocated by the application, defines the asynchronous notification to occur
74 when the timer expires.
82 the signal specified in
84 will be sent to the calling process
86 or to the thread whose LWP ID is
87 .Fa evp->sigev_notify_thread_id
88 .Pq Dv SIGEV_THREAD_ID .
89 The information for the queued signal will include:
90 .Bl -column ".Va si_value"
91 .It Sy Member Ta Sy Value
92 .It Va si_code Ta Dv SI_TIMER
96 .It Va si_timerid Ta timer ID
97 .It Va si_overrun Ta timer overrun count
100 .Brq Dv DELAYTIMER_MAX ,
101 an error code defined in
109 the effect is as if the
111 argument pointed to a
115 member having the value
119 having a default signal number
124 the value of the timer ID.
126 This implementation supports a
131 .Dv CLOCK_MONOTONIC .
134 .Fa evp->sigev_notify
138 .Fa sev->sigev_notify_attributes
141 if the attribute pointed to by
142 .Fa sev->sigev_notify_attributes
144 a thread stack address specified by a call to
145 .Fn pthread_attr_setstack
147 .Fn pthread_attr_setstackaddr ,
148 the results are unspecified if the signal is generated more than once.
150 If the call succeeds,
152 returns zero and updates the location referenced by
156 which can be passed to the per-process timer calls.
158 occurs, the system call returns a value of \-1
159 and the global variable
161 is set to indicate the
165 is undefined if an error occurs.
173 The calling process has already created all of the timers it is allowed by
176 The specified clock ID is not supported.
178 The specified asynchronous notification method is not supported.
180 Any arguments point outside the allocated address space or there is a
181 memory protection fault.
186 .Xr timer_getoverrun 2 ,
192 system call conforms to
197 per-process timer first appeared in