Print this page
9842 man page typos and spelling
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3c/sem_timedwait.3c
+++ new/usr/src/man/man3c/sem_timedwait.3c
1 1 .\"
2 2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 3 .\" permission to reproduce portions of its copyrighted documentation.
4 4 .\" Original documentation from The Open Group can be obtained online at
5 5 .\" http://www.opengroup.org/bookstore/.
6 6 .\"
7 7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 8 .\" Group, have given us permission to reprint portions of their
9 9 .\" documentation.
10 10 .\"
11 11 .\" In the following statement, the phrase ``this text'' refers to portions
12 12 .\" of the system documentation.
13 13 .\"
14 14 .\" Portions of this text are reprinted and reproduced in electronic form
15 15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 16 .\" Standard for Information Technology -- Portable Operating System
17 17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 20 .\" between these versions and the original IEEE and The Open Group
21 21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 22 .\" document. The original Standard can be obtained online at
23 23 .\" http://www.opengroup.org/unix/online.html.
24 24 .\"
25 25 .\" This notice shall appear on any product containing this material.
26 26 .\"
27 27 .\" The contents of this file are subject to the terms of the
28 28 .\" Common Development and Distribution License (the "License").
29 29 .\" You may not use this file except in compliance with the License.
30 30 .\"
31 31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 32 .\" or http://www.opensolaris.org/os/licensing.
33 33 .\" See the License for the specific language governing permissions
34 34 .\" and limitations under the License.
35 35 .\"
36 36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 38 .\" If applicable, add the following below this CDDL HEADER, with the
39 39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 41 .\"
42 42 .\"
43 43 .\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved.
44 44 .\" Portions Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
45 45 .\"
46 46 .TH SEM_TIMEDWAIT 3C "Feb 5, 2008"
47 47 .SH NAME
48 48 sem_timedwait, sem_reltimedwait_np \- lock a semaphore
49 49 .SH SYNOPSIS
50 50 .LP
51 51 .nf
52 52 #include <semaphore.h>
53 53 #include <time.h>
54 54
55 55 \fBint\fR \fBsem_timedwait\fR(\fBsem_t *restrict\fR \fIsem\fR,
↓ open down ↓ |
55 lines elided |
↑ open up ↑ |
56 56 \fBconst struct timespec *restrict\fR \fIabs_timeout\fR);
57 57 .fi
58 58
59 59 .LP
60 60 .nf
61 61 \fBint\fR \fBsem_reltimedwait_np\fR(\fBsem_t *restrict\fR \fIsem\fR,
62 62 \fBconst struct timespec *restrict\fR \fIrel_timeout\fR);
63 63 .fi
64 64
65 65 .SH DESCRIPTION
66 -.sp
67 66 .LP
68 67 The \fBsem_timedwait()\fR function locks the semaphore referenced by \fIsem\fR
69 68 as in the \fBsem_wait\fR(3C) function. However, if the semaphore cannot be
70 69 locked without waiting for another process or thread to unlock the semaphore by
71 70 performing a \fBsem_post\fR(3C) function, this wait is terminated when the
72 71 specified timeout expires.
73 72 .sp
74 73 .LP
75 74 The \fBsem_reltimedwait_np()\fR function is identical to the
76 75 \fBsem_timedwait()\fR function, except that the timeout is specified as a
77 76 relative time interval.
78 77 .sp
79 78 .LP
80 79 For \fBsem_timedwait()\fR, the timeout expires when the absolute time specified
81 80 by \fIabs_timeout\fR passes, as measured by the \fBCLOCK_REALTIME\fR clock
82 81 (that is, when the value of that clock equals or exceeds \fIabs_timeout\fR), or
83 82 if the absolute time specified by \fIabs_timeout\fR has already been passed at
84 83 the time of the call.
85 84 .sp
86 85 .LP
87 86 For \fBsem_reltimedwait_np()\fR, the timeout expires when the time interval
88 87 specified by \fIrel_timeout\fR passes, as measured by the \fBCLOCK_REALTIME\fR
89 88 clock, or if the time interval specified by \fIrel_timeout\fR is negative at
90 89 the time of the call.
91 90 .sp
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
92 91 .LP
93 92 The resolution of the timeout is the resolution of the \fBCLOCK_REALTIME\fR
94 93 clock. The \fBtimespec\fR data type is defined as a structure in the
95 94 <\fBtime.h\fR> header.
96 95 .sp
97 96 .LP
98 97 Under no circumstance does the function fail with a timeout if the semaphore
99 98 can be locked immediately. The validity of the \fIabs_timeout\fR need not be
100 99 checked if the semaphore can be locked immediately.
101 100 .SH RETURN VALUES
102 -.sp
103 101 .LP
104 102 The \fBsem_timedwait()\fR and \fBsem_reltimedwait_np()\fR functions return 0 if
105 103 the calling process successfully performed the semaphore lock operation on the
106 104 semaphore designated by \fIsem\fR. If the call was unsuccessful, the state of
107 105 the semaphore is be unchanged and the function returns -1 and sets \fBerrno\fR
108 106 to indicate the error.
109 107 .SH ERRORS
110 -.sp
111 108 .LP
112 109 The \fBsem_timedwait()\fR and \fBsem_reltimedwait_np()\fR functions will fail
113 110 if:
114 111 .sp
115 112 .ne 2
116 113 .na
117 114 \fB\fBEINVAL\fR\fR
118 115 .ad
119 116 .RS 13n
120 117 The \fIsem\fR argument does not refer to a valid semaphore.
121 118 .RE
122 119
123 120 .sp
124 121 .ne 2
125 122 .na
126 123 \fB\fBEINVAL\fR\fR
127 124 .ad
128 125 .RS 13n
129 126 The process or thread would have blocked, and the timeout parameter specified a
130 127 nanoseconds field value less than zero or greater than or equal to 1,000
131 128 million.
132 129 .RE
133 130
134 131 .sp
135 132 .ne 2
136 133 .na
137 134 \fB\fBETIMEDOUT\fR\fR
138 135 .ad
139 136 .RS 13n
140 137 The semaphore could not be locked before the specified timeout expired.
141 138 .RE
142 139
143 140 .sp
144 141 .LP
145 142 The \fBsem_timedwait()\fR and \fBsem_reltimedwait_np()\fR functions may fail
146 143 if:
147 144 .sp
148 145 .ne 2
149 146 .na
150 147 \fB\fBEDEADLK\fR\fR
151 148 .ad
152 149 .RS 11n
153 150 A deadlock condition was detected.
154 151 .RE
155 152
↓ open down ↓ |
35 lines elided |
↑ open up ↑ |
156 153 .sp
157 154 .ne 2
158 155 .na
159 156 \fB\fBEINTR\fR\fR
160 157 .ad
161 158 .RS 11n
162 159 A signal interrupted this function.
163 160 .RE
164 161
165 162 .SH ATTRIBUTES
166 -.sp
167 163 .LP
168 164 See \fBattributes\fR(5) for descriptions of the following attributes:
169 165 .sp
170 166
171 167 .sp
172 168 .TS
173 169 box;
174 170 c | c
175 171 l | l .
176 172 ATTRIBUTE TYPE ATTRIBUTE VALUE
177 173 _
178 -Interface Stability Commmitted
174 +Interface Stability Committed
179 175 _
180 176 MT-Level MT-Safe
181 177 _
182 178 Standard See below.
183 179 .TE
184 180
185 181 .sp
186 182 .LP
187 183 For \fBsem_timedwait()\fR, see \fBstandards\fR(5).
188 184 .SH SEE ALSO
189 -.sp
190 185 .LP
191 186 \fBsemctl\fR(2), \fBsemget\fR(2), \fBsemop\fR(2), \fBtime\fR(2),
192 187 \fBsem_post\fR(3C), \fBsem_trywait\fR(3C), \fBsem_wait\fR(3C),
193 188 \fBattributes\fR(5), \fBstandards\fR(5)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX