9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / timer_settime.3c
blobde4c0599a2a18e118de6da91a14bd3385b370433
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
45 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
46 .\"
47 .TH TIMER_SETTIME 3C "Feb 5, 2008"
48 .SH NAME
49 timer_settime, timer_gettime, timer_getoverrun \- per-process timers
50 .SH SYNOPSIS
51 .LP
52 .nf
53 #include <time.h>
55 \fBint\fR \fBtimer_settime\fR(\fBtimer_t\fR \fItimerid\fR, \fBint\fR \fIflags\fR,
56      \fBconst struct itimerspec *restrict\fR \fIvalue\fR,
57      \fBstruct itimerspec *restrict\fR \fIovalue\fR);
58 .fi
60 .LP
61 .nf
62 \fBint\fR \fBtimer_gettime\fR(\fBtimer_t\fR \fItimerid\fR, \fBstruct itimerspec *\fR\fIvalue\fR);
63 .fi
65 .LP
66 .nf
67 \fBint\fR \fBtimer_getoverrun\fR(\fBtimer_t\fR \fItimerid\fR);
68 .fi
70 .SH DESCRIPTION
71 .sp
72 .LP
73 The \fBtimer_settime()\fR function sets the time until the next expiration of
74 the timer specified by \fItimerid\fR from the \fBit_value\fR member of the
75 \fIvalue\fR argument and arm the timer if the \fBit_value\fR member of
76 \fIvalue\fR is non-zero. If the specified timer was already armed when
77 \fBtimer_settime()\fR is called, this call resets the time until next
78 expiration to the \fIvalue\fR specified. If the \fBit_value\fR member of
79 \fIvalue\fR is 0, the timer is disarmed. The effect of disarming or resetting a
80 timer on pending expiration notifications is unspecified.
81 .sp
82 .LP
83 If the flag \fBTIMER_ABSTIME\fR is not set in the argument \fIflags\fR,
84 \fBtimer_settime()\fR behaves as if the time until next expiration is set to be
85 equal to the interval specified by the \fBit_value\fR member of \fIvalue\fR.
86 That is, the timer expires in \fBit_value\fR nanoseconds from when the call is
87 made. If the flag \fBTIMER_ABSTIME\fR is set in the argument \fIflags\fR,
88 \fBtimer_settime()\fR behaves as if the time until next expiration is set to be
89 equal to the difference between the absolute time specified by the
90 \fBit_value\fR member of \fIvalue\fR and the current value of the clock
91 associated with \fItimerid\fR. That is, the timer expires when the clock
92 reaches the value specified by the \fBit_value\fR member of \fIvalue\fR. If the
93 specified time has already passed, the function succeeds and the expiration
94 notification is made.
95 .sp
96 .LP
97 The reload value of the timer is set to the value specified by the
98 \fBit_interval\fR member of \fIvalue\fR. When a timer is armed with a non-zero
99 \fBit_interval\fR, a periodic (or repetitive) timer is specified.
102 Time values that are between two consecutive non-negative integer multiples of
103 the resolution of the specified timer will be rounded up to the larger multiple
104 of the resolution. Quantization error will not cause the timer to expire
105 earlier than the rounded time value.
108 If the argument \fIovalue\fR is not \fINULL\fR, the function
109 \fBtimer_settime()\fR stores, in the location referenced by \fIovalue\fR, a
110 value representing the previous amount of time before the timer would have
111 expired or 0 if the timer was disarmed, together with the previous timer reload
112 value. The members of \fIovalue\fR are subject to the resolution of the timer,
113 and they are the same values that would be returned by a \fBtimer_gettime()\fR
114 call at that point in time.
117 The \fBtimer_gettime()\fR function stores the amount of time until the
118 specified timer, \fItimerid\fR, expires and the reload value of the timer into
119 the space pointed to by the \fIvalue\fR argument. The \fBit_value\fR member of
120 this structure contains the amount of time before the timer expires, or 0 if
121 the timer is disarmed. This value is returned as the interval until timer
122 expiration, even if the timer was armed with absolute time. The
123 \fBit_interval\fR member of \fIvalue\fR contains the reload value last set by
124 \fBtimer_settime()\fR.
127 Only a single signal will be queued to the process for a given timer at any
128 point in time. When a timer for which a signal is still pending expires, no
129 signal will be queued, and a timer overrun occurs. When a timer expiration
130 signal is delivered to or accepted by a process, the \fBtimer_getoverrun()\fR
131 function returns the timer expiration overrun count for the specified timer.
132 The overrun count returned contains the number of extra timer expirations that
133 occurred between the time the signal was generated (queued) and when it was
134 delivered or accepted, up to but not including an implementation-dependent
135 maximum of \fBDELAYTIMER_MAX\fR. If the number of such extra expirations is
136 greater than or equal to \fBDELAYTIMER_MAX\fR, then the overrun count will be
137 set to \fBDELAYTIMER_MAX\fR. The value returned by \fBtimer_getoverrun()\fR
138 applies to the most recent expiration signal delivery or acceptance for the
139 timer. If no expiration signal has been delivered for the timer, the meaning of
140 the overrun count returned is undefined.
141 .SH RETURN VALUES
144 If the \fBtimer_settime()\fR or \fBtimer_gettime()\fR functions succeed,
145 \fB0\fR is returned. If an error occurs for either of these functions,
146 \fB\(mi1\fR is returned, and \fBerrno\fR is set to indicate the error. If the
147 \fBtimer_getoverrun()\fR function succeeds, it returns the timer expiration
148 overrun count as explained above.
149 .SH ERRORS
152 The \fBtimer_settime()\fR, \fBtimer_gettime()\fR and \fBtimer_getoverrun()\fR
153 functions will fail if:
155 .ne 2
157 \fB\fBEINVAL\fR \fR
159 .RS 11n
160 The \fItimerid\fR argument does not correspond to a timer returned by
161 \fBtimer_create\fR(3C) but not yet deleted by \fBtimer_delete\fR(3C).
165 .ne 2
167 \fB\fBENOSYS\fR \fR
169 .RS 11n
170 The \fBtimer_settime()\fR, \fBtimer_gettime()\fR, and \fBtimer_getoverrun()\fR
171 functions are not supported by the system. The \fBtimer_settime()\fR function
172 will fail if:
176 .ne 2
178 \fB\fBEINVAL\fR\fR
180 .RS 11n
181 A \fIvalue\fR structure specified a nanosecond value less than zero or greater
182 than or equal to 1000 million.
185 .SH ATTRIBUTES
188 See \fBattributes\fR(5) for descriptions of the following attributes:
193 box;
194 l | l
195 l | l .
196 ATTRIBUTE TYPE  ATTRIBUTE VALUE
198 Interface Stability     Committed
200 MT-Level        Async-Signal-Safe
202 Standard        See \fBstandards\fR(5).
205 .SH SEE ALSO
208 \fBtime.h\fR(3HEAD), \fBclock_settime\fR(3C), \fBtimer_create\fR(3C),
209 \fBtimer_delete\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)