OSDN Git Service

(split) LDP: Force update POT and ja.po
[linuxjm/LDP_man-pages.git] / po4a / semaphore / po / semaphore.pot
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2013-03-26 16:48+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=CHARSET\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: build/C/man3/sem_close.3:26
21 #, no-wrap
22 msgid "SEM_CLOSE"
23 msgstr ""
24
25 #. type: TH
26 #: build/C/man3/sem_close.3:26 build/C/man3/sem_destroy.3:26 build/C/man3/sem_getvalue.3:26 build/C/man3/sem_init.3:26 build/C/man3/sem_open.3:26 build/C/man7/sem_overview.7:26 build/C/man3/sem_post.3:26 build/C/man3/sem_unlink.3:26 build/C/man3/sem_wait.3:26
27 #, no-wrap
28 msgid "2012-05-13"
29 msgstr ""
30
31 #. type: TH
32 #: build/C/man3/sem_close.3:26 build/C/man3/sem_destroy.3:26 build/C/man3/sem_getvalue.3:26 build/C/man3/sem_init.3:26 build/C/man3/sem_open.3:26 build/C/man7/sem_overview.7:26 build/C/man3/sem_post.3:26 build/C/man3/sem_unlink.3:26 build/C/man3/sem_wait.3:26 build/C/man2/semctl.2:41 build/C/man2/semget.2:36 build/C/man2/semop.2:35
33 #, no-wrap
34 msgid "Linux"
35 msgstr ""
36
37 #. type: TH
38 #: build/C/man3/sem_close.3:26 build/C/man3/sem_destroy.3:26 build/C/man3/sem_getvalue.3:26 build/C/man3/sem_init.3:26 build/C/man3/sem_open.3:26 build/C/man7/sem_overview.7:26 build/C/man3/sem_post.3:26 build/C/man3/sem_unlink.3:26 build/C/man3/sem_wait.3:26 build/C/man2/semctl.2:41 build/C/man2/semget.2:36 build/C/man2/semop.2:35
39 #, no-wrap
40 msgid "Linux Programmer's Manual"
41 msgstr ""
42
43 #. type: SH
44 #: build/C/man3/sem_close.3:27 build/C/man3/sem_destroy.3:27 build/C/man3/sem_getvalue.3:27 build/C/man3/sem_init.3:27 build/C/man3/sem_open.3:27 build/C/man7/sem_overview.7:27 build/C/man3/sem_post.3:27 build/C/man3/sem_unlink.3:27 build/C/man3/sem_wait.3:27 build/C/man2/semctl.2:42 build/C/man2/semget.2:37 build/C/man2/semop.2:36
45 #, no-wrap
46 msgid "NAME"
47 msgstr ""
48
49 #. type: Plain text
50 #: build/C/man3/sem_close.3:29
51 msgid "sem_close - close a named semaphore"
52 msgstr ""
53
54 #. type: SH
55 #: build/C/man3/sem_close.3:29 build/C/man3/sem_destroy.3:29 build/C/man3/sem_getvalue.3:29 build/C/man3/sem_init.3:29 build/C/man3/sem_open.3:29 build/C/man3/sem_post.3:29 build/C/man3/sem_unlink.3:29 build/C/man3/sem_wait.3:29 build/C/man2/semctl.2:44 build/C/man2/semget.2:39 build/C/man2/semop.2:38
56 #, no-wrap
57 msgid "SYNOPSIS"
58 msgstr ""
59
60 #. type: Plain text
61 #: build/C/man3/sem_close.3:32 build/C/man3/sem_destroy.3:32 build/C/man3/sem_getvalue.3:32 build/C/man3/sem_init.3:32 build/C/man3/sem_post.3:32 build/C/man3/sem_unlink.3:32 build/C/man3/sem_wait.3:32
62 #, no-wrap
63 msgid "B<#include E<lt>semaphore.hE<gt>>\n"
64 msgstr ""
65
66 #. type: Plain text
67 #: build/C/man3/sem_close.3:34
68 #, no-wrap
69 msgid "B<int sem_close(sem_t *>I<sem>B<);>\n"
70 msgstr ""
71
72 #. type: Plain text
73 #: build/C/man3/sem_close.3:37 build/C/man3/sem_destroy.3:37 build/C/man3/sem_getvalue.3:37 build/C/man3/sem_init.3:37 build/C/man3/sem_open.3:41 build/C/man3/sem_post.3:37 build/C/man3/sem_unlink.3:37 build/C/man3/sem_wait.3:41
74 msgid "Link with I<-pthread>."
75 msgstr ""
76
77 #. type: SH
78 #: build/C/man3/sem_close.3:37 build/C/man3/sem_destroy.3:37 build/C/man3/sem_getvalue.3:37 build/C/man3/sem_init.3:37 build/C/man3/sem_open.3:41 build/C/man7/sem_overview.7:29 build/C/man3/sem_post.3:37 build/C/man3/sem_unlink.3:37 build/C/man3/sem_wait.3:49 build/C/man2/semctl.2:52 build/C/man2/semget.2:49 build/C/man2/semop.2:57
79 #, no-wrap
80 msgid "DESCRIPTION"
81 msgstr ""
82
83 #. type: Plain text
84 #: build/C/man3/sem_close.3:43
85 msgid ""
86 "B<sem_close>()  closes the named semaphore referred to by I<sem>, allowing "
87 "any resources that the system has allocated to the calling process for this "
88 "semaphore to be freed."
89 msgstr ""
90
91 #. type: SH
92 #: build/C/man3/sem_close.3:43 build/C/man3/sem_destroy.3:55 build/C/man3/sem_getvalue.3:54 build/C/man3/sem_init.3:77 build/C/man3/sem_open.3:104 build/C/man3/sem_post.3:45 build/C/man3/sem_unlink.3:44 build/C/man3/sem_wait.3:108 build/C/man2/semctl.2:340 build/C/man2/semget.2:157 build/C/man2/semop.2:314
93 #, no-wrap
94 msgid "RETURN VALUE"
95 msgstr ""
96
97 #. type: Plain text
98 #: build/C/man3/sem_close.3:49
99 msgid ""
100 "On success B<sem_close>()  returns 0; on error, -1 is returned, with "
101 "I<errno> set to indicate the error."
102 msgstr ""
103
104 #. type: SH
105 #: build/C/man3/sem_close.3:49 build/C/man3/sem_destroy.3:61 build/C/man3/sem_getvalue.3:60 build/C/man3/sem_init.3:83 build/C/man3/sem_open.3:116 build/C/man3/sem_post.3:52 build/C/man3/sem_unlink.3:50 build/C/man3/sem_wait.3:114 build/C/man2/semctl.2:387 build/C/man2/semget.2:163 build/C/man2/semop.2:324
106 #, no-wrap
107 msgid "ERRORS"
108 msgstr ""
109
110 #. type: TP
111 #: build/C/man3/sem_close.3:50 build/C/man3/sem_destroy.3:62 build/C/man3/sem_getvalue.3:61 build/C/man3/sem_init.3:84 build/C/man3/sem_open.3:132 build/C/man3/sem_open.3:137 build/C/man3/sem_post.3:53 build/C/man3/sem_wait.3:119 build/C/man3/sem_wait.3:133 build/C/man2/semctl.2:420 build/C/man2/semget.2:188 build/C/man2/semop.2:372
112 #, no-wrap
113 msgid "B<EINVAL>"
114 msgstr ""
115
116 #. type: Plain text
117 #: build/C/man3/sem_close.3:54 build/C/man3/sem_destroy.3:66 build/C/man3/sem_getvalue.3:65 build/C/man3/sem_post.3:57 build/C/man3/sem_wait.3:123
118 msgid "I<sem> is not a valid semaphore."
119 msgstr ""
120
121 #. type: SH
122 #: build/C/man3/sem_close.3:54 build/C/man3/sem_destroy.3:66 build/C/man3/sem_getvalue.3:65 build/C/man3/sem_init.3:95 build/C/man3/sem_open.3:170 build/C/man7/sem_overview.7:138 build/C/man3/sem_post.3:61 build/C/man3/sem_unlink.3:62 build/C/man3/sem_wait.3:143 build/C/man2/semctl.2:462 build/C/man2/semget.2:219 build/C/man2/semop.2:402
123 #, no-wrap
124 msgid "CONFORMING TO"
125 msgstr ""
126
127 #. type: Plain text
128 #: build/C/man3/sem_close.3:56 build/C/man3/sem_destroy.3:68 build/C/man3/sem_getvalue.3:67 build/C/man3/sem_init.3:97 build/C/man3/sem_open.3:172 build/C/man7/sem_overview.7:140 build/C/man3/sem_post.3:63 build/C/man3/sem_unlink.3:64 build/C/man3/sem_wait.3:145
129 msgid "POSIX.1-2001."
130 msgstr ""
131
132 #. type: SH
133 #: build/C/man3/sem_close.3:56 build/C/man3/sem_destroy.3:68 build/C/man3/sem_getvalue.3:67 build/C/man3/sem_init.3:97 build/C/man7/sem_overview.7:140 build/C/man3/sem_post.3:63 build/C/man3/sem_wait.3:145 build/C/man2/semctl.2:465 build/C/man2/semget.2:223 build/C/man2/semop.2:405
134 #, no-wrap
135 msgid "NOTES"
136 msgstr ""
137
138 #. type: Plain text
139 #: build/C/man3/sem_close.3:60
140 msgid ""
141 "All open named semaphores are automatically closed on process termination, "
142 "or upon B<execve>(2)."
143 msgstr ""
144
145 #. type: SH
146 #: build/C/man3/sem_close.3:60 build/C/man3/sem_destroy.3:74 build/C/man3/sem_getvalue.3:71 build/C/man3/sem_init.3:102 build/C/man3/sem_open.3:172 build/C/man7/sem_overview.7:152 build/C/man3/sem_post.3:70 build/C/man3/sem_unlink.3:64 build/C/man3/sem_wait.3:262 build/C/man2/semctl.2:524 build/C/man2/semget.2:294 build/C/man2/semop.2:531
147 #, no-wrap
148 msgid "SEE ALSO"
149 msgstr ""
150
151 #. type: Plain text
152 #: build/C/man3/sem_close.3:67
153 msgid ""
154 "B<sem_getvalue>(3), B<sem_open>(3), B<sem_post>(3), B<sem_unlink>(3), "
155 "B<sem_wait>(3), B<sem_overview>(7)"
156 msgstr ""
157
158 #. type: SH
159 #: build/C/man3/sem_close.3:67 build/C/man3/sem_destroy.3:79 build/C/man3/sem_getvalue.3:75 build/C/man3/sem_init.3:107 build/C/man3/sem_open.3:179 build/C/man7/sem_overview.7:162 build/C/man3/sem_post.3:74 build/C/man3/sem_unlink.3:70 build/C/man3/sem_wait.3:268 build/C/man2/semctl.2:531 build/C/man2/semget.2:301 build/C/man2/semop.2:540
160 #, no-wrap
161 msgid "COLOPHON"
162 msgstr ""
163
164 #. type: Plain text
165 #: build/C/man3/sem_close.3:74 build/C/man3/sem_destroy.3:86 build/C/man3/sem_getvalue.3:82 build/C/man3/sem_init.3:114 build/C/man3/sem_open.3:186 build/C/man7/sem_overview.7:169 build/C/man3/sem_post.3:81 build/C/man3/sem_unlink.3:77 build/C/man3/sem_wait.3:275 build/C/man2/semctl.2:538 build/C/man2/semget.2:308 build/C/man2/semop.2:547
166 msgid ""
167 "This page is part of release 3.50 of the Linux I<man-pages> project.  A "
168 "description of the project, and information about reporting bugs, can be "
169 "found at http://www.kernel.org/doc/man-pages/."
170 msgstr ""
171
172 #. type: TH
173 #: build/C/man3/sem_destroy.3:26
174 #, no-wrap
175 msgid "SEM_DESTROY"
176 msgstr ""
177
178 #. type: Plain text
179 #: build/C/man3/sem_destroy.3:29
180 msgid "sem_destroy - destroy an unnamed semaphore"
181 msgstr ""
182
183 #. type: Plain text
184 #: build/C/man3/sem_destroy.3:34
185 #, no-wrap
186 msgid "B<int sem_destroy(sem_t *>I<sem>B<);>\n"
187 msgstr ""
188
189 #. type: Plain text
190 #: build/C/man3/sem_destroy.3:41
191 msgid ""
192 "B<sem_destroy>()  destroys the unnamed semaphore at the address pointed to "
193 "by I<sem>."
194 msgstr ""
195
196 #. type: Plain text
197 #: build/C/man3/sem_destroy.3:46
198 msgid ""
199 "Only a semaphore that has been initialized by B<sem_init>(3)  should be "
200 "destroyed using B<sem_destroy>()."
201 msgstr ""
202
203 #. type: Plain text
204 #: build/C/man3/sem_destroy.3:51
205 msgid ""
206 "Destroying a semaphore that other processes or threads are currently blocked "
207 "on (in B<sem_wait>(3))  produces undefined behavior."
208 msgstr ""
209
210 #. type: Plain text
211 #: build/C/man3/sem_destroy.3:55
212 msgid ""
213 "Using a semaphore that has been destroyed produces undefined results, until "
214 "the semaphore has been reinitialized using B<sem_init>(3)."
215 msgstr ""
216
217 #. type: Plain text
218 #: build/C/man3/sem_destroy.3:61
219 msgid ""
220 "B<sem_destroy>()  returns 0 on success; on error, -1 is returned, and "
221 "I<errno> is set to indicate the error."
222 msgstr ""
223
224 #.  But not on NPTL, where sem_destroy () is a no-op..
225 #. type: Plain text
226 #: build/C/man3/sem_destroy.3:74
227 msgid ""
228 "An unnamed semaphore should be destroyed with B<sem_destroy>()  before the "
229 "memory in which it is located is deallocated.  Failure to do this can result "
230 "in resource leaks on some implementations."
231 msgstr ""
232
233 #. type: Plain text
234 #: build/C/man3/sem_destroy.3:79
235 msgid "B<sem_init>(3), B<sem_post>(3), B<sem_wait>(3), B<sem_overview>(7)"
236 msgstr ""
237
238 #. type: TH
239 #: build/C/man3/sem_getvalue.3:26
240 #, no-wrap
241 msgid "SEM_GETVALUE"
242 msgstr ""
243
244 #. type: Plain text
245 #: build/C/man3/sem_getvalue.3:29
246 msgid "sem_getvalue - get the value of a semaphore"
247 msgstr ""
248
249 #. type: Plain text
250 #: build/C/man3/sem_getvalue.3:34
251 #, no-wrap
252 msgid "B<int sem_getvalue(sem_t *>I<sem>B<, int *>I<sval>B<);>\n"
253 msgstr ""
254
255 #. type: Plain text
256 #: build/C/man3/sem_getvalue.3:43
257 msgid ""
258 "B<sem_getvalue>()  places the current value of the semaphore pointed to "
259 "I<sem> into the integer pointed to by I<sval>."
260 msgstr ""
261
262 #. type: Plain text
263 #: build/C/man3/sem_getvalue.3:54
264 msgid ""
265 "If one or more processes or threads are blocked waiting to lock the "
266 "semaphore with B<sem_wait>(3), POSIX.1-2001 permits two possibilities for "
267 "the value returned in I<sval>: either 0 is returned; or a negative number "
268 "whose absolute value is the count of the number of processes and threads "
269 "currently blocked in B<sem_wait>(3).  Linux adopts the former behavior."
270 msgstr ""
271
272 #. type: Plain text
273 #: build/C/man3/sem_getvalue.3:60
274 msgid ""
275 "B<sem_getvalue>()  returns 0 on success; on error, -1 is returned and "
276 "I<errno> is set to indicate the error."
277 msgstr ""
278
279 #. type: Plain text
280 #: build/C/man3/sem_getvalue.3:71
281 msgid ""
282 "The value of the semaphore may already have changed by the time "
283 "B<sem_getvalue>()  returns."
284 msgstr ""
285
286 #. type: Plain text
287 #: build/C/man3/sem_getvalue.3:75
288 msgid "B<sem_post>(3), B<sem_wait>(3), B<sem_overview>(7)"
289 msgstr ""
290
291 #. type: TH
292 #: build/C/man3/sem_init.3:26
293 #, no-wrap
294 msgid "SEM_INIT"
295 msgstr ""
296
297 #. type: Plain text
298 #: build/C/man3/sem_init.3:29
299 msgid "sem_init - initialize an unnamed semaphore"
300 msgstr ""
301
302 #. type: Plain text
303 #: build/C/man3/sem_init.3:34
304 #, no-wrap
305 msgid ""
306 "B<int sem_init(sem_t *>I<sem>B<, int >I<pshared>B<, unsigned int "
307 ">I<value>B<);>\n"
308 msgstr ""
309
310 #. type: Plain text
311 #: build/C/man3/sem_init.3:44
312 msgid ""
313 "B<sem_init>()  initializes the unnamed semaphore at the address pointed to "
314 "by I<sem>.  The I<value> argument specifies the initial value for the "
315 "semaphore."
316 msgstr ""
317
318 #. type: Plain text
319 #: build/C/man3/sem_init.3:49
320 msgid ""
321 "The I<pshared> argument indicates whether this semaphore is to be shared "
322 "between the threads of a process, or between processes."
323 msgstr ""
324
325 #. type: Plain text
326 #: build/C/man3/sem_init.3:57
327 msgid ""
328 "If I<pshared> has the value 0, then the semaphore is shared between the "
329 "threads of a process, and should be located at some address that is visible "
330 "to all threads (e.g., a global variable, or a variable allocated dynamically "
331 "on the heap)."
332 msgstr ""
333
334 #. type: Plain text
335 #: build/C/man3/sem_init.3:74
336 msgid ""
337 "If I<pshared> is nonzero, then the semaphore is shared between processes, "
338 "and should be located in a region of shared memory (see B<shm_open>(3), "
339 "B<mmap>(2), and B<shmget>(2)).  (Since a child created by B<fork>(2)  "
340 "inherits its parent's memory mappings, it can also access the semaphore.)  "
341 "Any process that can access the shared memory region can operate on the "
342 "semaphore using B<sem_post>(3), B<sem_wait>(3), etc."
343 msgstr ""
344
345 #. type: Plain text
346 #: build/C/man3/sem_init.3:77
347 msgid ""
348 "Initializing a semaphore that has already been initialized results in "
349 "undefined behavior."
350 msgstr ""
351
352 #. type: Plain text
353 #: build/C/man3/sem_init.3:83
354 msgid ""
355 "B<sem_init>()  returns 0 on success; on error, -1 is returned, and I<errno> "
356 "is set to indicate the error."
357 msgstr ""
358
359 #. type: Plain text
360 #: build/C/man3/sem_init.3:89
361 msgid "I<value> exceeds B<SEM_VALUE_MAX>."
362 msgstr ""
363
364 #. type: TP
365 #: build/C/man3/sem_init.3:89
366 #, no-wrap
367 msgid "B<ENOSYS>"
368 msgstr ""
369
370 #. type: Plain text
371 #: build/C/man3/sem_init.3:95
372 msgid ""
373 "I<pshared> is nonzero, but the system does not support process-shared "
374 "semaphores (see B<sem_overview>(7))."
375 msgstr ""
376
377 #. type: Plain text
378 #: build/C/man3/sem_init.3:102
379 msgid ""
380 "Bizarrely, POSIX.1-2001 does not specify the value that should be returned "
381 "by a successful call to B<sem_init>().  POSIX.1-2008 rectifies this, "
382 "specifying the zero return on success."
383 msgstr ""
384
385 #. type: Plain text
386 #: build/C/man3/sem_init.3:107
387 msgid "B<sem_destroy>(3), B<sem_post>(3), B<sem_wait>(3), B<sem_overview>(7)"
388 msgstr ""
389
390 #. type: TH
391 #: build/C/man3/sem_open.3:26
392 #, no-wrap
393 msgid "SEM_OPEN"
394 msgstr ""
395
396 #. type: Plain text
397 #: build/C/man3/sem_open.3:29
398 msgid "sem_open - initialize and open a named semaphore"
399 msgstr ""
400
401 #. type: Plain text
402 #: build/C/man3/sem_open.3:34
403 #, no-wrap
404 msgid ""
405 "B<#include E<lt>fcntl.hE<gt>>           /* For O_* constants */\n"
406 "B<#include E<lt>sys/stat.hE<gt>>        /* For mode constants */\n"
407 "B<#include E<lt>semaphore.hE<gt>>\n"
408 msgstr ""
409
410 #. type: Plain text
411 #: build/C/man3/sem_open.3:38
412 #, no-wrap
413 msgid ""
414 "B<sem_t *sem_open(const char *>I<name>B<, int >I<oflag>B<);>\n"
415 "B<sem_t *sem_open(const char *>I<name>B<, int >I<oflag>B<, >\n"
416 "B<                mode_t >I<mode>B<, unsigned int >I<value>B<);>\n"
417 msgstr ""
418
419 #. type: Plain text
420 #: build/C/man3/sem_open.3:50
421 msgid ""
422 "B<sem_open>()  creates a new POSIX semaphore or opens an existing "
423 "semaphore.  The semaphore is identified by I<name>.  For details of the "
424 "construction of I<name>, see B<sem_overview>(7)."
425 msgstr ""
426
427 #.  In reality the file system IDs are used on Linux.
428 #. type: Plain text
429 #: build/C/man3/sem_open.3:76
430 msgid ""
431 "The I<oflag> argument specifies flags that control the operation of the "
432 "call.  (Definitions of the flags values can be obtained by including "
433 "I<E<lt>fcntl.hE<gt>>.)  If B<O_CREAT> is specified in I<oflag>, then the "
434 "semaphore is created if it does not already exist.  The owner (user ID) of "
435 "the semaphore is set to the effective user ID of the calling process.  The "
436 "group ownership (group ID) is set to the effective group ID of the calling "
437 "process.  If both B<O_CREAT> and B<O_EXCL> are specified in I<oflag>, then "
438 "an error is returned if a semaphore with the given I<name> already exists."
439 msgstr ""
440
441 #. type: Plain text
442 #: build/C/man3/sem_open.3:104
443 msgid ""
444 "If B<O_CREAT> is specified in I<oflag>, then two additional arguments must "
445 "be supplied.  The I<mode> argument specifies the permissions to be placed on "
446 "the new semaphore, as for B<open>(2).  (Symbolic definitions for the "
447 "permissions bits can be obtained by including I<E<lt>sys/stat.hE<gt>>.)  The "
448 "permissions settings are masked against the process umask.  Both read and "
449 "write permission should be granted to each class of user that will access "
450 "the semaphore.  The I<value> argument specifies the initial value for the "
451 "new semaphore.  If B<O_CREAT> is specified, and a semaphore with the given "
452 "I<name> already exists, then I<mode> and I<value> are ignored."
453 msgstr ""
454
455 #. type: Plain text
456 #: build/C/man3/sem_open.3:116
457 msgid ""
458 "On success, B<sem_open>()  returns the address of the new semaphore; this "
459 "address is used when calling other semaphore-related functions.  On error, "
460 "B<sem_open>()  returns B<SEM_FAILED>, with I<errno> set to indicate the "
461 "error."
462 msgstr ""
463
464 #. type: TP
465 #: build/C/man3/sem_open.3:117 build/C/man3/sem_unlink.3:51 build/C/man2/semctl.2:391 build/C/man2/semget.2:167 build/C/man2/semop.2:336
466 #, no-wrap
467 msgid "B<EACCES>"
468 msgstr ""
469
470 #. type: Plain text
471 #: build/C/man3/sem_open.3:121
472 msgid "The semaphore exists, but the caller does not have permission to open it."
473 msgstr ""
474
475 #. type: TP
476 #: build/C/man3/sem_open.3:121 build/C/man2/semget.2:175
477 #, no-wrap
478 msgid "B<EEXIST>"
479 msgstr ""
480
481 #. type: Plain text
482 #: build/C/man3/sem_open.3:132
483 msgid ""
484 "Both B<O_CREAT> and B<O_EXCL> were specified in I<oflag>, but a semaphore "
485 "with this I<name> already exists."
486 msgstr ""
487
488 #. type: Plain text
489 #: build/C/man3/sem_open.3:137
490 msgid "I<value> was greater than B<SEM_VALUE_MAX>."
491 msgstr ""
492
493 #. type: Plain text
494 #: build/C/man3/sem_open.3:141
495 msgid "I<name> consists of just \"/\", followed by no other characters."
496 msgstr ""
497
498 #. type: TP
499 #: build/C/man3/sem_open.3:141
500 #, no-wrap
501 msgid "B<EMFILE>"
502 msgstr ""
503
504 #. type: Plain text
505 #: build/C/man3/sem_open.3:144
506 msgid "The process already has the maximum number of files and open."
507 msgstr ""
508
509 #. type: TP
510 #: build/C/man3/sem_open.3:144 build/C/man3/sem_unlink.3:54
511 #, no-wrap
512 msgid "B<ENAMETOOLONG>"
513 msgstr ""
514
515 #. type: Plain text
516 #: build/C/man3/sem_open.3:148 build/C/man3/sem_unlink.3:58
517 msgid "I<name> was too long."
518 msgstr ""
519
520 #. type: TP
521 #: build/C/man3/sem_open.3:148
522 #, no-wrap
523 msgid "B<ENFILE>"
524 msgstr ""
525
526 #. type: Plain text
527 #: build/C/man3/sem_open.3:151
528 msgid "The system limit on the total number of open files has been reached."
529 msgstr ""
530
531 #. type: TP
532 #: build/C/man3/sem_open.3:151 build/C/man3/sem_unlink.3:58 build/C/man2/semget.2:199
533 #, no-wrap
534 msgid "B<ENOENT>"
535 msgstr ""
536
537 #.  this error can occur if we have a name of the (nonportable) form
538 #.  /dir/name, and the directory /dev/shm/dir does not exist.
539 #. type: Plain text
540 #: build/C/man3/sem_open.3:167
541 msgid ""
542 "The B<O_CREAT> flag was not specified in I<oflag> and no semaphore with this "
543 "I<name> exists; or, B<O_CREAT> was specified, but I<name> wasn't well "
544 "formed."
545 msgstr ""
546
547 #. type: TP
548 #: build/C/man3/sem_open.3:167 build/C/man2/semget.2:207 build/C/man2/semop.2:379
549 #, no-wrap
550 msgid "B<ENOMEM>"
551 msgstr ""
552
553 #. type: Plain text
554 #: build/C/man3/sem_open.3:170
555 msgid "Insufficient memory."
556 msgstr ""
557
558 #. type: Plain text
559 #: build/C/man3/sem_open.3:179
560 msgid ""
561 "B<sem_close>(3), B<sem_getvalue>(3), B<sem_post>(3), B<sem_unlink>(3), "
562 "B<sem_wait>(3), B<sem_overview>(7)"
563 msgstr ""
564
565 #. type: TH
566 #: build/C/man7/sem_overview.7:26
567 #, no-wrap
568 msgid "SEM_OVERVIEW"
569 msgstr ""
570
571 #. type: Plain text
572 #: build/C/man7/sem_overview.7:29
573 msgid "sem_overview - overview of POSIX semaphores"
574 msgstr ""
575
576 #. type: Plain text
577 #: build/C/man7/sem_overview.7:31
578 msgid "POSIX semaphores allow processes and threads to synchronize their actions."
579 msgstr ""
580
581 #. type: Plain text
582 #: build/C/man7/sem_overview.7:41
583 msgid ""
584 "A semaphore is an integer whose value is never allowed to fall below zero.  "
585 "Two operations can be performed on semaphores: increment the semaphore value "
586 "by one (B<sem_post>(3)); and decrement the semaphore value by one "
587 "(B<sem_wait>(3)).  If the value of a semaphore is currently zero, then a "
588 "B<sem_wait>(3)  operation will block until the value becomes greater than "
589 "zero."
590 msgstr ""
591
592 #. type: Plain text
593 #: build/C/man7/sem_overview.7:44
594 msgid "POSIX semaphores come in two forms: named semaphores and unnamed semaphores."
595 msgstr ""
596
597 #. type: TP
598 #: build/C/man7/sem_overview.7:44
599 #, no-wrap
600 msgid "B<Named semaphores>"
601 msgstr ""
602
603 #.  glibc allows the initial slash to be omitted, and makes
604 #.  multiple initial slashes equivalent to a single slash.
605 #.  This differs from the implementation of POSIX message queues.
606 #.  glibc allows subdirectory components in the name, in which
607 #.  case the subdirectory tree must exist under /dev/shm, and
608 #.  the fist subdirectory component must exist as the name
609 #.  sem.name, and all of the subdirectory components must allow the
610 #.  required permissions if a user wants to create a semaphore
611 #.  object in a subdirectory.
612 #. type: Plain text
613 #: build/C/man7/sem_overview.7:64
614 msgid ""
615 "A named semaphore is identified by a name of the form I</somename>; that is, "
616 "a null-terminated string of up to B<NAME_MAX>I<-4> (i.e., 251) characters "
617 "consisting of an initial slash, followed by one or more characters, none of "
618 "which are slashes.  Two processes can operate on the same named semaphore by "
619 "passing the same name to B<sem_open>(3)."
620 msgstr ""
621
622 #. type: Plain text
623 #: build/C/man7/sem_overview.7:79
624 msgid ""
625 "The B<sem_open>(3)  function creates a new named semaphore or opens an "
626 "existing named semaphore.  After the semaphore has been opened, it can be "
627 "operated on using B<sem_post>(3)  and B<sem_wait>(3).  When a process has "
628 "finished using the semaphore, it can use B<sem_close>(3)  to close the "
629 "semaphore.  When all processes have finished using the semaphore, it can be "
630 "removed from the system using B<sem_unlink>(3)."
631 msgstr ""
632
633 #. type: TP
634 #: build/C/man7/sem_overview.7:79
635 #, no-wrap
636 msgid "B<Unnamed semaphores (memory-based semaphores)>"
637 msgstr ""
638
639 #. type: Plain text
640 #: build/C/man7/sem_overview.7:94
641 msgid ""
642 "An unnamed semaphore does not have a name.  Instead the semaphore is placed "
643 "in a region of memory that is shared between multiple threads (a "
644 "I<thread-shared semaphore>)  or processes (a I<process-shared semaphore>).  "
645 "A thread-shared semaphore is placed in an area of memory shared between the "
646 "threads of a process, for example, a global variable.  A process-shared "
647 "semaphore must be placed in a shared memory region (e.g., a System V shared "
648 "memory segment created using B<shmget>(2), or a POSIX shared memory object "
649 "built created using B<shm_open>(3))."
650 msgstr ""
651
652 #. type: Plain text
653 #: build/C/man7/sem_overview.7:105
654 msgid ""
655 "Before being used, an unnamed semaphore must be initialized using "
656 "B<sem_init>(3).  It can then be operated on using B<sem_post>(3)  and "
657 "B<sem_wait>(3).  When the semaphore is no longer required, and before the "
658 "memory in which it is located is deallocated, the semaphore should be "
659 "destroyed using B<sem_destroy>(3)."
660 msgstr ""
661
662 #. type: Plain text
663 #: build/C/man7/sem_overview.7:108
664 msgid ""
665 "The remainder of this section describes some specific details of the Linux "
666 "implementation of POSIX semaphores."
667 msgstr ""
668
669 #. type: SS
670 #: build/C/man7/sem_overview.7:108
671 #, no-wrap
672 msgid "Versions"
673 msgstr ""
674
675 #. type: Plain text
676 #: build/C/man7/sem_overview.7:114
677 msgid ""
678 "Prior to kernel 2.6, Linux only supported unnamed, thread-shared "
679 "semaphores.  On a system with Linux 2.6 and a glibc that provides the NPTL "
680 "threading implementation, a complete implementation of POSIX semaphores is "
681 "provided."
682 msgstr ""
683
684 #. type: SS
685 #: build/C/man7/sem_overview.7:114
686 #, no-wrap
687 msgid "Persistence"
688 msgstr ""
689
690 #. type: Plain text
691 #: build/C/man7/sem_overview.7:119
692 msgid ""
693 "POSIX named semaphores have kernel persistence: if not removed by "
694 "B<sem_unlink>(3), a semaphore will exist until the system is shut down."
695 msgstr ""
696
697 #. type: SS
698 #: build/C/man7/sem_overview.7:119
699 #, no-wrap
700 msgid "Linking"
701 msgstr ""
702
703 #. type: Plain text
704 #: build/C/man7/sem_overview.7:124
705 msgid ""
706 "Programs using the POSIX semaphores API must be compiled with I<cc -pthread> "
707 "to link against the real-time library, I<librt>."
708 msgstr ""
709
710 #. type: SS
711 #: build/C/man7/sem_overview.7:124
712 #, no-wrap
713 msgid "Accessing named semaphores via the file system"
714 msgstr ""
715
716 #. type: Plain text
717 #: build/C/man7/sem_overview.7:135
718 msgid ""
719 "On Linux, named semaphores are created in a virtual file system, normally "
720 "mounted under I</dev/shm>, with names of the form B<sem.>I<somename>.  (This "
721 "is the reason that semaphore names are limited to B<NAME_MAX>I<-4> rather "
722 "than B<NAME_MAX> characters.)"
723 msgstr ""
724
725 #. type: Plain text
726 #: build/C/man7/sem_overview.7:138
727 msgid ""
728 "Since Linux 2.6.19, ACLs can be placed on files under this directory, to "
729 "control object permissions on a per-user and per-group basis."
730 msgstr ""
731
732 #. type: Plain text
733 #: build/C/man7/sem_overview.7:149
734 msgid ""
735 "System V semaphores (B<semget>(2), B<semop>(2), etc.) are an older semaphore "
736 "API.  POSIX semaphores provide a simpler, and better designed interface than "
737 "System V semaphores; on the other hand POSIX semaphores are less widely "
738 "available (especially on older systems) than System V semaphores."
739 msgstr ""
740
741 #. type: SH
742 #: build/C/man7/sem_overview.7:149 build/C/man3/sem_post.3:67 build/C/man3/sem_wait.3:153 build/C/man2/semop.2:506
743 #, no-wrap
744 msgid "EXAMPLE"
745 msgstr ""
746
747 #. type: Plain text
748 #: build/C/man7/sem_overview.7:152
749 msgid ""
750 "An example of the use of various POSIX semaphore functions is shown in "
751 "B<sem_wait>(3)."
752 msgstr ""
753
754 #. type: Plain text
755 #: build/C/man7/sem_overview.7:162
756 msgid ""
757 "B<sem_close>(3), B<sem_destroy>(3), B<sem_getvalue>(3), B<sem_init>(3), "
758 "B<sem_open>(3), B<sem_post>(3), B<sem_unlink>(3), B<sem_wait>(3), "
759 "B<pthreads>(7)"
760 msgstr ""
761
762 #. type: TH
763 #: build/C/man3/sem_post.3:26
764 #, no-wrap
765 msgid "SEM_POST"
766 msgstr ""
767
768 #. type: Plain text
769 #: build/C/man3/sem_post.3:29
770 msgid "sem_post - unlock a semaphore"
771 msgstr ""
772
773 #. type: Plain text
774 #: build/C/man3/sem_post.3:34
775 #, no-wrap
776 msgid "B<int sem_post(sem_t *>I<sem>B<);>\n"
777 msgstr ""
778
779 #. type: Plain text
780 #: build/C/man3/sem_post.3:45
781 msgid ""
782 "B<sem_post>()  increments (unlocks) the semaphore pointed to by I<sem>.  If "
783 "the semaphore's value consequently becomes greater than zero, then another "
784 "process or thread blocked in a B<sem_wait>(3)  call will be woken up and "
785 "proceed to lock the semaphore."
786 msgstr ""
787
788 #. type: Plain text
789 #: build/C/man3/sem_post.3:52
790 msgid ""
791 "B<sem_post>()  returns 0 on success; on error, the value of the semaphore is "
792 "left unchanged, -1 is returned, and I<errno> is set to indicate the error."
793 msgstr ""
794
795 #. type: TP
796 #: build/C/man3/sem_post.3:57
797 #, no-wrap
798 msgid "B<EOVERFLOW>"
799 msgstr ""
800
801 #.  Added in POSIX.1-2008 TC1 (Austin Interpretation 213)
802 #. type: Plain text
803 #: build/C/man3/sem_post.3:61
804 msgid "The maximum allowable value for a semaphore would be exceeded."
805 msgstr ""
806
807 #. type: Plain text
808 #: build/C/man3/sem_post.3:67
809 msgid ""
810 "B<sem_post>()  is async-signal-safe: it may be safely called within a signal "
811 "handler."
812 msgstr ""
813
814 #. type: Plain text
815 #: build/C/man3/sem_post.3:70
816 msgid "See B<sem_wait>(3)."
817 msgstr ""
818
819 #. type: Plain text
820 #: build/C/man3/sem_post.3:74
821 msgid "B<sem_getvalue>(3), B<sem_wait>(3), B<sem_overview>(7)"
822 msgstr ""
823
824 #. type: TH
825 #: build/C/man3/sem_unlink.3:26
826 #, no-wrap
827 msgid "SEM_UNLINK"
828 msgstr ""
829
830 #. type: Plain text
831 #: build/C/man3/sem_unlink.3:29
832 msgid "sem_unlink - remove a named semaphore"
833 msgstr ""
834
835 #. type: Plain text
836 #: build/C/man3/sem_unlink.3:34
837 #, no-wrap
838 msgid "B<int sem_unlink(const char *>I<name>B<);>\n"
839 msgstr ""
840
841 #. type: Plain text
842 #: build/C/man3/sem_unlink.3:44
843 msgid ""
844 "B<sem_unlink>()  removes the named semaphore referred to by I<name>.  The "
845 "semaphore name is removed immediately.  The semaphore is destroyed once all "
846 "other processes that have the semaphore open close it."
847 msgstr ""
848
849 #. type: Plain text
850 #: build/C/man3/sem_unlink.3:50
851 msgid ""
852 "On success B<sem_unlink>()  returns 0; on error, -1 is returned, with "
853 "I<errno> set to indicate the error."
854 msgstr ""
855
856 #. type: Plain text
857 #: build/C/man3/sem_unlink.3:54
858 msgid "The caller does not have permission to unlink this semaphore."
859 msgstr ""
860
861 #. type: Plain text
862 #: build/C/man3/sem_unlink.3:62
863 msgid "There is no semaphore with the given I<name>."
864 msgstr ""
865
866 #. type: Plain text
867 #: build/C/man3/sem_unlink.3:70
868 msgid ""
869 "B<sem_getvalue>(3), B<sem_open>(3), B<sem_post>(3), B<sem_wait>(3), "
870 "B<sem_overview>(7)"
871 msgstr ""
872
873 #. type: TH
874 #: build/C/man3/sem_wait.3:26
875 #, no-wrap
876 msgid "SEM_WAIT"
877 msgstr ""
878
879 #. type: Plain text
880 #: build/C/man3/sem_wait.3:29
881 msgid "sem_wait, sem_timedwait, sem_trywait - lock a semaphore"
882 msgstr ""
883
884 #. type: Plain text
885 #: build/C/man3/sem_wait.3:34
886 #, no-wrap
887 msgid "B<int sem_wait(sem_t *>I<sem>B<);>\n"
888 msgstr ""
889
890 #. type: Plain text
891 #: build/C/man3/sem_wait.3:36
892 #, no-wrap
893 msgid "B<int sem_trywait(sem_t *>I<sem>B<);>\n"
894 msgstr ""
895
896 #. type: Plain text
897 #: build/C/man3/sem_wait.3:38
898 #, no-wrap
899 msgid ""
900 "B<int sem_timedwait(sem_t *>I<sem>B<, const struct timespec "
901 "*>I<abs_timeout>B<);>\n"
902 msgstr ""
903
904 #. type: Plain text
905 #: build/C/man3/sem_wait.3:45 build/C/man2/semop.2:53
906 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
907 msgstr ""
908
909 #. type: Plain text
910 #: build/C/man3/sem_wait.3:49
911 msgid ""
912 "B<sem_timedwait>(): _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ "
913 "E<gt>=\\ 600"
914 msgstr ""
915
916 #. type: Plain text
917 #: build/C/man3/sem_wait.3:59
918 msgid ""
919 "B<sem_wait>()  decrements (locks) the semaphore pointed to by I<sem>.  If "
920 "the semaphore's value is greater than zero, then the decrement proceeds, and "
921 "the function returns, immediately.  If the semaphore currently has the value "
922 "zero, then the call blocks until either it becomes possible to perform the "
923 "decrement (i.e., the semaphore value rises above zero), or a signal handler "
924 "interrupts the call."
925 msgstr ""
926
927 #. type: Plain text
928 #: build/C/man3/sem_wait.3:69
929 msgid ""
930 "B<sem_trywait>()  is the same as B<sem_wait>(), except that if the decrement "
931 "cannot be immediately performed, then call returns an error (I<errno> set to "
932 "B<EAGAIN>)  instead of blocking."
933 msgstr ""
934
935 #. type: Plain text
936 #: build/C/man3/sem_wait.3:82
937 msgid ""
938 "B<sem_timedwait>()  is the same as B<sem_wait>(), except that I<abs_timeout> "
939 "specifies a limit on the amount of time that the call should block if the "
940 "decrement cannot be immediately performed.  The I<abs_timeout> argument "
941 "points to a structure that specifies an absolute timeout in seconds and "
942 "nanoseconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).  This "
943 "structure is defined as follows:"
944 msgstr ""
945
946 #. type: Plain text
947 #: build/C/man3/sem_wait.3:89
948 #, no-wrap
949 msgid ""
950 "struct timespec {\n"
951 "    time_t tv_sec;      /* Seconds */\n"
952 "    long   tv_nsec;     /* Nanoseconds [0 .. 999999999] */\n"
953 "};\n"
954 msgstr ""
955
956 #. type: Plain text
957 #: build/C/man3/sem_wait.3:100
958 msgid ""
959 "If the timeout has already expired by the time of the call, and the "
960 "semaphore could not be locked immediately, then B<sem_timedwait>()  fails "
961 "with a timeout error (I<errno> set to B<ETIMEDOUT>)."
962 msgstr ""
963
964 #. type: Plain text
965 #: build/C/man3/sem_wait.3:108
966 msgid ""
967 "If the operation can be performed immediately, then B<sem_timedwait>()  "
968 "never fails with a timeout error, regardless of the value of "
969 "I<abs_timeout>.  Furthermore, the validity of I<abs_timeout> is not checked "
970 "in this case."
971 msgstr ""
972
973 #. type: Plain text
974 #: build/C/man3/sem_wait.3:114
975 msgid ""
976 "All of these functions return 0 on success; on error, the value of the "
977 "semaphore is left unchanged, -1 is returned, and I<errno> is set to indicate "
978 "the error."
979 msgstr ""
980
981 #. type: TP
982 #: build/C/man3/sem_wait.3:115 build/C/man2/semop.2:368
983 #, no-wrap
984 msgid "B<EINTR>"
985 msgstr ""
986
987 #. type: Plain text
988 #: build/C/man3/sem_wait.3:119
989 msgid "The call was interrupted by a signal handler; see B<signal>(7)."
990 msgstr ""
991
992 #. type: Plain text
993 #: build/C/man3/sem_wait.3:126
994 msgid "The following additional error can occur for B<sem_trywait>():"
995 msgstr ""
996
997 #. type: TP
998 #: build/C/man3/sem_wait.3:126 build/C/man2/semop.2:343
999 #, no-wrap
1000 msgid "B<EAGAIN>"
1001 msgstr ""
1002
1003 #. type: Plain text
1004 #: build/C/man3/sem_wait.3:130
1005 msgid ""
1006 "The operation could not be performed without blocking (i.e., the semaphore "
1007 "currently has the value zero)."
1008 msgstr ""
1009
1010 #. type: Plain text
1011 #: build/C/man3/sem_wait.3:133
1012 msgid "The following additional errors can occur for B<sem_timedwait>():"
1013 msgstr ""
1014
1015 #. type: Plain text
1016 #: build/C/man3/sem_wait.3:138
1017 msgid ""
1018 "The value of I<abs_timeout.tv_nsecs> is less than 0, or greater than or "
1019 "equal to 1000 million."
1020 msgstr ""
1021
1022 #. type: TP
1023 #: build/C/man3/sem_wait.3:138
1024 #, no-wrap
1025 msgid "B<ETIMEDOUT>"
1026 msgstr ""
1027
1028 #.  POSIX.1-2001 also allows EDEADLK -- "A deadlock condition
1029 #.  was detected", but this does not occur on Linux(?).
1030 #. type: Plain text
1031 #: build/C/man3/sem_wait.3:143
1032 msgid "The call timed out before the semaphore could be locked."
1033 msgstr ""
1034
1035 #.  sem_wait() is always interrupted on most other implementations,
1036 #.  but on FreeBSD 5.4 SA_RESTART does cause restarting.
1037 #. type: Plain text
1038 #: build/C/man3/sem_wait.3:153
1039 msgid ""
1040 "A signal handler always interrupts a blocked call to one of these functions, "
1041 "regardless of the use of the B<sigaction>(2)  B<SA_RESTART> flag."
1042 msgstr ""
1043
1044 #. type: Plain text
1045 #: build/C/man3/sem_wait.3:172
1046 msgid ""
1047 "The (somewhat trivial) program shown below operates on an unnamed "
1048 "semaphore.  The program expects two command-line arguments.  The first "
1049 "argument specifies a seconds value that is used to set an alarm timer to "
1050 "generate a B<SIGALRM> signal.  This handler performs a B<sem_post>(3)  to "
1051 "increment the semaphore that is being waited on in I<main()> using "
1052 "B<sem_timedwait>().  The second command-line argument specifies the length "
1053 "of the timeout, in seconds, for B<sem_timedwait>().  The following shows "
1054 "what happens on two different runs of the program:"
1055 msgstr ""
1056
1057 #. type: Plain text
1058 #: build/C/man3/sem_wait.3:182
1059 #, no-wrap
1060 msgid ""
1061 "$B< ./a.out 2 3>\n"
1062 "About to call sem_timedwait()\n"
1063 "sem_post() from handler\n"
1064 "sem_timedwait() succeeded\n"
1065 "$B< ./a.out 2 1>\n"
1066 "About to call sem_timedwait()\n"
1067 "sem_timedwait() timed out\n"
1068 msgstr ""
1069
1070 #. type: SS
1071 #: build/C/man3/sem_wait.3:184
1072 #, no-wrap
1073 msgid "Program source"
1074 msgstr ""
1075
1076 #. type: Plain text
1077 #: build/C/man3/sem_wait.3:195
1078 #, no-wrap
1079 msgid ""
1080 "#include E<lt>unistd.hE<gt>\n"
1081 "#include E<lt>stdio.hE<gt>\n"
1082 "#include E<lt>stdlib.hE<gt>\n"
1083 "#include E<lt>semaphore.hE<gt>\n"
1084 "#include E<lt>time.hE<gt>\n"
1085 "#include E<lt>assert.hE<gt>\n"
1086 "#include E<lt>errno.hE<gt>\n"
1087 "#include E<lt>signal.hE<gt>\n"
1088 msgstr ""
1089
1090 #. type: Plain text
1091 #: build/C/man3/sem_wait.3:197
1092 #, no-wrap
1093 msgid "sem_t sem;\n"
1094 msgstr ""
1095
1096 #. type: Plain text
1097 #: build/C/man3/sem_wait.3:200
1098 #, no-wrap
1099 msgid ""
1100 "#define handle_error(msg) \\e\n"
1101 "    do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
1102 msgstr ""
1103
1104 #. type: Plain text
1105 #: build/C/man3/sem_wait.3:210
1106 #, no-wrap
1107 msgid ""
1108 "static void\n"
1109 "handler(int sig)\n"
1110 "{\n"
1111 "    write(STDOUT_FILENO, \"sem_post() from handler\\en\", 24);\n"
1112 "    if (sem_post(&sem) == -1) {\n"
1113 "        write(STDERR_FILENO, \"sem_post() failed\\en\", 18);\n"
1114 "        _exit(EXIT_FAILURE);\n"
1115 "    }\n"
1116 "}\n"
1117 msgstr ""
1118
1119 #. type: Plain text
1120 #: build/C/man3/sem_wait.3:217
1121 #, no-wrap
1122 msgid ""
1123 "int\n"
1124 "main(int argc, char *argv[])\n"
1125 "{\n"
1126 "    struct sigaction sa;\n"
1127 "    struct timespec ts;\n"
1128 "    int s;\n"
1129 msgstr ""
1130
1131 #. type: Plain text
1132 #: build/C/man3/sem_wait.3:223
1133 #, no-wrap
1134 msgid ""
1135 "    if (argc != 3) {\n"
1136 "        fprintf(stderr, \"Usage: %s E<lt>alarm-secsE<gt> "
1137 "E<lt>wait-secsE<gt>\\en\",\n"
1138 "                argv[0]);\n"
1139 "        exit(EXIT_FAILURE);\n"
1140 "    }\n"
1141 msgstr ""
1142
1143 #. type: Plain text
1144 #: build/C/man3/sem_wait.3:226
1145 #, no-wrap
1146 msgid ""
1147 "    if (sem_init(&sem, 0, 0) == -1)\n"
1148 "        handle_error(\"sem_init\");\n"
1149 msgstr ""
1150
1151 #. type: Plain text
1152 #: build/C/man3/sem_wait.3:228
1153 #, no-wrap
1154 msgid "    /* Establish SIGALRM handler; set alarm timer using argv[1] */\n"
1155 msgstr ""
1156
1157 #. type: Plain text
1158 #: build/C/man3/sem_wait.3:234
1159 #, no-wrap
1160 msgid ""
1161 "    sa.sa_handler = handler;\n"
1162 "    sigemptyset(&sa.sa_mask);\n"
1163 "    sa.sa_flags = 0;\n"
1164 "    if (sigaction(SIGALRM, &sa, NULL) == -1)\n"
1165 "        handle_error(\"sigaction\");\n"
1166 msgstr ""
1167
1168 #. type: Plain text
1169 #: build/C/man3/sem_wait.3:236
1170 #, no-wrap
1171 msgid "    alarm(atoi(argv[1]));\n"
1172 msgstr ""
1173
1174 #. type: Plain text
1175 #: build/C/man3/sem_wait.3:239
1176 #, no-wrap
1177 msgid ""
1178 "    /* Calculate relative interval as current time plus\n"
1179 "       number of seconds given argv[2] */\n"
1180 msgstr ""
1181
1182 #. type: Plain text
1183 #: build/C/man3/sem_wait.3:242
1184 #, no-wrap
1185 msgid ""
1186 "    if (clock_gettime(CLOCK_REALTIME, &ts) == -1)\n"
1187 "        handle_error(\"clock_gettime\");\n"
1188 msgstr ""
1189
1190 #. type: Plain text
1191 #: build/C/man3/sem_wait.3:244
1192 #, no-wrap
1193 msgid "    ts.tv_sec += atoi(argv[2]);\n"
1194 msgstr ""
1195
1196 #. type: Plain text
1197 #: build/C/man3/sem_wait.3:248
1198 #, no-wrap
1199 msgid ""
1200 "    printf(\"main() about to call sem_timedwait()\\en\");\n"
1201 "    while ((s = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)\n"
1202 "        continue;       /* Restart if interrupted by handler */\n"
1203 msgstr ""
1204
1205 #. type: Plain text
1206 #: build/C/man3/sem_wait.3:250
1207 #, no-wrap
1208 msgid "    /* Check what happened */\n"
1209 msgstr ""
1210
1211 #. type: Plain text
1212 #: build/C/man3/sem_wait.3:258
1213 #, no-wrap
1214 msgid ""
1215 "    if (s == -1) {\n"
1216 "        if (errno == ETIMEDOUT)\n"
1217 "            printf(\"sem_timedwait() timed out\\en\");\n"
1218 "        else\n"
1219 "            perror(\"sem_timedwait\");\n"
1220 "    } else\n"
1221 "        printf(\"sem_timedwait() succeeded\\en\");\n"
1222 msgstr ""
1223
1224 #. type: Plain text
1225 #: build/C/man3/sem_wait.3:261
1226 #, no-wrap
1227 msgid ""
1228 "    exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE);\n"
1229 "}\n"
1230 msgstr ""
1231
1232 #. type: Plain text
1233 #: build/C/man3/sem_wait.3:268
1234 msgid ""
1235 "B<clock_gettime>(2), B<sem_getvalue>(3), B<sem_post>(3), B<sem_overview>(7), "
1236 "B<time>(7)"
1237 msgstr ""
1238
1239 #. type: TH
1240 #: build/C/man2/semctl.2:41
1241 #, no-wrap
1242 msgid "SEMCTL"
1243 msgstr ""
1244
1245 #. type: TH
1246 #: build/C/man2/semctl.2:41 build/C/man2/semget.2:36
1247 #, no-wrap
1248 msgid "2012-05-31"
1249 msgstr ""
1250
1251 #. type: Plain text
1252 #: build/C/man2/semctl.2:44
1253 msgid "semctl - semaphore control operations"
1254 msgstr ""
1255
1256 #. type: Plain text
1257 #: build/C/man2/semctl.2:49 build/C/man2/semget.2:44 build/C/man2/semop.2:43
1258 #, no-wrap
1259 msgid ""
1260 "B<#include E<lt>sys/types.hE<gt>>\n"
1261 "B<#include E<lt>sys/ipc.hE<gt>>\n"
1262 "B<#include E<lt>sys/sem.hE<gt>>\n"
1263 msgstr ""
1264
1265 #. type: Plain text
1266 #: build/C/man2/semctl.2:51
1267 #, no-wrap
1268 msgid "B<int semctl(int >I<semid>B<, int >I<semnum>B<, int >I<cmd>B<, ...);>\n"
1269 msgstr ""
1270
1271 #. type: Plain text
1272 #: build/C/man2/semctl.2:62
1273 msgid ""
1274 "B<semctl>()  performs the control operation specified by I<cmd> on the "
1275 "semaphore set identified by I<semid>, or on the I<semnum>-th semaphore of "
1276 "that set.  (The semaphores in a set are numbered starting at 0.)"
1277 msgstr ""
1278
1279 #. type: Plain text
1280 #: build/C/man2/semctl.2:68
1281 msgid ""
1282 "This function has three or four arguments, depending on I<cmd>.  When there "
1283 "are four, the fourth has the type I<union semun>.  The I<calling program> "
1284 "must define this union as follows:"
1285 msgstr ""
1286
1287 #. type: Plain text
1288 #: build/C/man2/semctl.2:78
1289 #, no-wrap
1290 msgid ""
1291 "union semun {\n"
1292 "    int              val;    /* Value for SETVAL */\n"
1293 "    struct semid_ds *buf;    /* Buffer for IPC_STAT, IPC_SET */\n"
1294 "    unsigned short  *array;  /* Array for GETALL, SETALL */\n"
1295 "    struct seminfo  *__buf;  /* Buffer for IPC_INFO\n"
1296 "                                (Linux-specific) */\n"
1297 "};\n"
1298 msgstr ""
1299
1300 #. type: Plain text
1301 #: build/C/man2/semctl.2:84
1302 msgid ""
1303 "The I<semid_ds> data structure is defined in I<E<lt>sys/sem.hE<gt>> as "
1304 "follows:"
1305 msgstr ""
1306
1307 #. type: Plain text
1308 #: build/C/man2/semctl.2:93
1309 #, no-wrap
1310 msgid ""
1311 "struct semid_ds {\n"
1312 "    struct ipc_perm sem_perm;  /* Ownership and permissions */\n"
1313 "    time_t          sem_otime; /* Last semop time */\n"
1314 "    time_t          sem_ctime; /* Last change time */\n"
1315 "    unsigned short  sem_nsems; /* No. of semaphores in set */\n"
1316 "};\n"
1317 msgstr ""
1318
1319 #. type: Plain text
1320 #: build/C/man2/semctl.2:101
1321 msgid ""
1322 "The I<ipc_perm> structure is defined as follows (the highlighted fields are "
1323 "settable using B<IPC_SET>):"
1324 msgstr ""
1325
1326 #. type: Plain text
1327 #: build/C/man2/semctl.2:113
1328 #, no-wrap
1329 msgid ""
1330 "struct ipc_perm {\n"
1331 "    key_t          __key; /* Key supplied to semget(2) */\n"
1332 "    uid_t          B<uid>;   /* Effective UID of owner */\n"
1333 "    gid_t          B<gid>;   /* Effective GID of owner */\n"
1334 "    uid_t          cuid;  /* Effective UID of creator */\n"
1335 "    gid_t          cgid;  /* Effective GID of creator */\n"
1336 "    unsigned short B<mode>;  /* Permissions */\n"
1337 "    unsigned short __seq; /* Sequence number */\n"
1338 "};\n"
1339 msgstr ""
1340
1341 #. type: Plain text
1342 #: build/C/man2/semctl.2:119
1343 msgid "Valid values for I<cmd> are:"
1344 msgstr ""
1345
1346 #. type: TP
1347 #: build/C/man2/semctl.2:119
1348 #, no-wrap
1349 msgid "B<IPC_STAT>"
1350 msgstr ""
1351
1352 #. type: Plain text
1353 #: build/C/man2/semctl.2:131
1354 msgid ""
1355 "Copy information from the kernel data structure associated with I<semid> "
1356 "into the I<semid_ds> structure pointed to by I<arg.buf>.  The argument "
1357 "I<semnum> is ignored.  The calling process must have read permission on the "
1358 "semaphore set."
1359 msgstr ""
1360
1361 #. type: TP
1362 #: build/C/man2/semctl.2:131
1363 #, no-wrap
1364 msgid "B<IPC_SET>"
1365 msgstr ""
1366
1367 #. type: Plain text
1368 #: build/C/man2/semctl.2:154
1369 msgid ""
1370 "Write the values of some members of the I<semid_ds> structure pointed to by "
1371 "I<arg.buf> to the kernel data structure associated with this semaphore set, "
1372 "updating also its I<sem_ctime> member.  The following members of the "
1373 "structure are updated: I<sem_perm.uid>, I<sem_perm.gid>, and (the least "
1374 "significant 9 bits of)  I<sem_perm.mode>.  The effective UID of the calling "
1375 "process must match the owner (I<sem_perm.uid>)  or creator "
1376 "(I<sem_perm.cuid>)  of the semaphore set, or the caller must be privileged.  "
1377 "The argument I<semnum> is ignored."
1378 msgstr ""
1379
1380 #. type: TP
1381 #: build/C/man2/semctl.2:154
1382 #, no-wrap
1383 msgid "B<IPC_RMID>"
1384 msgstr ""
1385
1386 #. type: Plain text
1387 #: build/C/man2/semctl.2:169
1388 msgid ""
1389 "Immediately remove the semaphore set, awakening all processes blocked in "
1390 "B<semop>(2)  calls on the set (with an error return and I<errno> set to "
1391 "B<EIDRM>).  The effective user ID of the calling process must match the "
1392 "creator or owner of the semaphore set, or the caller must be privileged.  "
1393 "The argument I<semnum> is ignored."
1394 msgstr ""
1395
1396 #. type: TP
1397 #: build/C/man2/semctl.2:169
1398 #, no-wrap
1399 msgid "B<IPC_INFO> (Linux-specific)"
1400 msgstr ""
1401
1402 #. type: Plain text
1403 #: build/C/man2/semctl.2:181
1404 msgid ""
1405 "Returns information about system-wide semaphore limits and parameters in the "
1406 "structure pointed to by I<arg.__buf>.  This structure is of type I<seminfo>, "
1407 "defined in I<E<lt>sys/sem.hE<gt>> if the B<_GNU_SOURCE> feature test macro "
1408 "is defined:"
1409 msgstr ""
1410
1411 #. type: Plain text
1412 #: build/C/man2/semctl.2:203
1413 #, no-wrap
1414 msgid ""
1415 "struct  seminfo {\n"
1416 "    int semmap;  /* Number of entries in semaphore\n"
1417 "                    map; unused within kernel */\n"
1418 "    int semmni;  /* Maximum number of semaphore sets */\n"
1419 "    int semmns;  /* Maximum number of semaphores in all\n"
1420 "                    semaphore sets */\n"
1421 "    int semmnu;  /* System-wide maximum number of undo\n"
1422 "                    structures; unused within kernel */\n"
1423 "    int semmsl;  /* Maximum number of semaphores in a\n"
1424 "                    set */\n"
1425 "    int semopm;  /* Maximum number of operations for\n"
1426 "                    semop(2) */\n"
1427 "    int semume;  /* Maximum number of undo entries per\n"
1428 "                    process; unused within kernel */\n"
1429 "    int semusz;  /* Size of struct sem_undo */\n"
1430 "    int semvmx;  /* Maximum semaphore value */\n"
1431 "    int semaem;  /* Max. value that can be recorded for\n"
1432 "                    semaphore adjustment (SEM_UNDO) */\n"
1433 "};\n"
1434 msgstr ""
1435
1436 #. type: Plain text
1437 #: build/C/man2/semctl.2:217
1438 msgid ""
1439 "The I<semmsl>, I<semmns>, I<semopm>, and I<semmni> settings can be changed "
1440 "via I</proc/sys/kernel/sem>; see B<proc>(5)  for details."
1441 msgstr ""
1442
1443 #. type: TP
1444 #: build/C/man2/semctl.2:217
1445 #, no-wrap
1446 msgid "B<SEM_INFO> (Linux-specific)"
1447 msgstr ""
1448
1449 #. type: Plain text
1450 #: build/C/man2/semctl.2:231
1451 msgid ""
1452 "Returns a I<seminfo> structure containing the same information as for "
1453 "B<IPC_INFO>, except that the following fields are returned with information "
1454 "about system resources consumed by semaphores: the I<semusz> field returns "
1455 "the number of semaphore sets that currently exist on the system; and the "
1456 "I<semaem> field returns the total number of semaphores in all semaphore sets "
1457 "on the system."
1458 msgstr ""
1459
1460 #. type: TP
1461 #: build/C/man2/semctl.2:231
1462 #, no-wrap
1463 msgid "B<SEM_STAT> (Linux-specific)"
1464 msgstr ""
1465
1466 #. type: Plain text
1467 #: build/C/man2/semctl.2:242
1468 msgid ""
1469 "Returns a I<semid_ds> structure as for B<IPC_STAT>.  However, the I<semid> "
1470 "argument is not a semaphore identifier, but instead an index into the "
1471 "kernel's internal array that maintains information about all semaphore sets "
1472 "on the system."
1473 msgstr ""
1474
1475 #. type: TP
1476 #: build/C/man2/semctl.2:242
1477 #, no-wrap
1478 msgid "B<GETALL>"
1479 msgstr ""
1480
1481 #. type: Plain text
1482 #: build/C/man2/semctl.2:253
1483 msgid ""
1484 "Return B<semval> (i.e., the current value)  for all semaphores of the set "
1485 "into I<arg.array>.  The argument I<semnum> is ignored.  The calling process "
1486 "must have read permission on the semaphore set."
1487 msgstr ""
1488
1489 #. type: TP
1490 #: build/C/man2/semctl.2:253 build/C/man2/semctl.2:351
1491 #, no-wrap
1492 msgid "B<GETNCNT>"
1493 msgstr ""
1494
1495 #. type: Plain text
1496 #: build/C/man2/semctl.2:266
1497 msgid ""
1498 "The system call returns the value of B<semncnt> for the I<semnum>-th "
1499 "semaphore of the set (i.e., the number of processes waiting for an increase "
1500 "of B<semval> for the I<semnum>-th semaphore of the set).  The calling "
1501 "process must have read permission on the semaphore set."
1502 msgstr ""
1503
1504 #. type: TP
1505 #: build/C/man2/semctl.2:266 build/C/man2/semctl.2:355
1506 #, no-wrap
1507 msgid "B<GETPID>"
1508 msgstr ""
1509
1510 #. type: Plain text
1511 #: build/C/man2/semctl.2:279
1512 msgid ""
1513 "The system call returns the value of B<sempid> for the I<semnum>-th "
1514 "semaphore of the set (i.e., the PID of the process that executed the last "
1515 "B<semop>(2)  call for the I<semnum>-th semaphore of the set).  The calling "
1516 "process must have read permission on the semaphore set."
1517 msgstr ""
1518
1519 #. type: TP
1520 #: build/C/man2/semctl.2:279 build/C/man2/semctl.2:359
1521 #, no-wrap
1522 msgid "B<GETVAL>"
1523 msgstr ""
1524
1525 #. type: Plain text
1526 #: build/C/man2/semctl.2:287
1527 msgid ""
1528 "The system call returns the value of B<semval> for the I<semnum>-th "
1529 "semaphore of the set.  The calling process must have read permission on the "
1530 "semaphore set."
1531 msgstr ""
1532
1533 #. type: TP
1534 #: build/C/man2/semctl.2:287 build/C/man2/semctl.2:363
1535 #, no-wrap
1536 msgid "B<GETZCNT>"
1537 msgstr ""
1538
1539 #. type: Plain text
1540 #: build/C/man2/semctl.2:300
1541 msgid ""
1542 "The system call returns the value of B<semzcnt> for the I<semnum>-th "
1543 "semaphore of the set (i.e., the number of processes waiting for B<semval> of "
1544 "the I<semnum>-th semaphore of the set to become 0).  The calling process "
1545 "must have read permission on the semaphore set."
1546 msgstr ""
1547
1548 #. type: TP
1549 #: build/C/man2/semctl.2:300
1550 #, no-wrap
1551 msgid "B<SETALL>"
1552 msgstr ""
1553
1554 #. type: Plain text
1555 #: build/C/man2/semctl.2:322
1556 msgid ""
1557 "Set B<semval> for all semaphores of the set using I<arg.array>, updating "
1558 "also the I<sem_ctime> member of the I<semid_ds> structure associated with "
1559 "the set.  Undo entries (see B<semop>(2))  are cleared for altered semaphores "
1560 "in all processes.  If the changes to semaphore values would permit blocked "
1561 "B<semop>(2)  calls in other processes to proceed, then those processes are "
1562 "woken up.  The argument I<semnum> is ignored.  The calling process must have "
1563 "alter (write) permission on the semaphore set."
1564 msgstr ""
1565
1566 #. type: TP
1567 #: build/C/man2/semctl.2:322
1568 #, no-wrap
1569 msgid "B<SETVAL>"
1570 msgstr ""
1571
1572 #. type: Plain text
1573 #: build/C/man2/semctl.2:340
1574 msgid ""
1575 "Set the value of B<semval> to I<arg.val> for the I<semnum>-th semaphore of "
1576 "the set, updating also the I<sem_ctime> member of the I<semid_ds> structure "
1577 "associated with the set.  Undo entries are cleared for altered semaphores in "
1578 "all processes.  If the changes to semaphore values would permit blocked "
1579 "B<semop>(2)  calls in other processes to proceed, then those processes are "
1580 "woken up.  The calling process must have alter permission on the semaphore "
1581 "set."
1582 msgstr ""
1583
1584 #. type: Plain text
1585 #: build/C/man2/semctl.2:347
1586 msgid "On failure B<semctl>()  returns -1 with I<errno> indicating the error."
1587 msgstr ""
1588
1589 #. type: Plain text
1590 #: build/C/man2/semctl.2:351
1591 msgid ""
1592 "Otherwise the system call returns a nonnegative value depending on I<cmd> as "
1593 "follows:"
1594 msgstr ""
1595
1596 #. type: Plain text
1597 #: build/C/man2/semctl.2:355
1598 msgid "the value of B<semncnt>."
1599 msgstr ""
1600
1601 #. type: Plain text
1602 #: build/C/man2/semctl.2:359
1603 msgid "the value of B<sempid>."
1604 msgstr ""
1605
1606 #. type: Plain text
1607 #: build/C/man2/semctl.2:363
1608 msgid "the value of B<semval>."
1609 msgstr ""
1610
1611 #. type: Plain text
1612 #: build/C/man2/semctl.2:367
1613 msgid "the value of B<semzcnt>."
1614 msgstr ""
1615
1616 #. type: TP
1617 #: build/C/man2/semctl.2:367
1618 #, no-wrap
1619 msgid "B<IPC_INFO>"
1620 msgstr ""
1621
1622 #. type: Plain text
1623 #: build/C/man2/semctl.2:375
1624 msgid ""
1625 "the index of the highest used entry in the kernel's internal array recording "
1626 "information about all semaphore sets.  (This information can be used with "
1627 "repeated B<SEM_STAT> operations to obtain information about all semaphore "
1628 "sets on the system.)"
1629 msgstr ""
1630
1631 #. type: TP
1632 #: build/C/man2/semctl.2:375
1633 #, no-wrap
1634 msgid "B<SEM_INFO>"
1635 msgstr ""
1636
1637 #. type: Plain text
1638 #: build/C/man2/semctl.2:379
1639 msgid "As for B<IPC_INFO>."
1640 msgstr ""
1641
1642 #. type: TP
1643 #: build/C/man2/semctl.2:379
1644 #, no-wrap
1645 msgid "B<SEM_STAT>"
1646 msgstr ""
1647
1648 #. type: Plain text
1649 #: build/C/man2/semctl.2:383
1650 msgid "the identifier of the semaphore set whose index was given in I<semid>."
1651 msgstr ""
1652
1653 #. type: Plain text
1654 #: build/C/man2/semctl.2:387
1655 msgid "All other I<cmd> values return 0 on success."
1656 msgstr ""
1657
1658 #. type: Plain text
1659 #: build/C/man2/semctl.2:391
1660 msgid "On failure, I<errno> will be set to one of the following:"
1661 msgstr ""
1662
1663 #. type: Plain text
1664 #: build/C/man2/semctl.2:410
1665 msgid ""
1666 "The argument I<cmd> has one of the values B<GETALL>, B<GETPID>, B<GETVAL>, "
1667 "B<GETNCNT>, B<GETZCNT>, B<IPC_STAT>, B<SEM_STAT>, B<SETALL>, or B<SETVAL> "
1668 "and the calling process does not have the required permissions on the "
1669 "semaphore set and does not have the B<CAP_IPC_OWNER> capability."
1670 msgstr ""
1671
1672 #. type: TP
1673 #: build/C/man2/semctl.2:410 build/C/man2/semop.2:352
1674 #, no-wrap
1675 msgid "B<EFAULT>"
1676 msgstr ""
1677
1678 #. type: Plain text
1679 #: build/C/man2/semctl.2:417
1680 msgid "The address pointed to by I<arg.buf> or I<arg.array> isn't accessible."
1681 msgstr ""
1682
1683 #. type: TP
1684 #: build/C/man2/semctl.2:417 build/C/man2/semop.2:365
1685 #, no-wrap
1686 msgid "B<EIDRM>"
1687 msgstr ""
1688
1689 #. type: Plain text
1690 #: build/C/man2/semctl.2:420 build/C/man2/semop.2:368
1691 msgid "The semaphore set was removed."
1692 msgstr ""
1693
1694 #. type: Plain text
1695 #: build/C/man2/semctl.2:431
1696 msgid ""
1697 "Invalid value for I<cmd> or I<semid>.  Or: for a B<SEM_STAT> operation, the "
1698 "index value specified in I<semid> referred to an array slot that is "
1699 "currently unused."
1700 msgstr ""
1701
1702 #. type: TP
1703 #: build/C/man2/semctl.2:431
1704 #, no-wrap
1705 msgid "B<EPERM>"
1706 msgstr ""
1707
1708 #. type: Plain text
1709 #: build/C/man2/semctl.2:449
1710 msgid ""
1711 "The argument I<cmd> has the value B<IPC_SET> or B<IPC_RMID> but the "
1712 "effective user ID of the calling process is not the creator (as found in "
1713 "I<sem_perm.cuid>)  or the owner (as found in I<sem_perm.uid>)  of the "
1714 "semaphore set, and the process does not have the B<CAP_SYS_ADMIN> "
1715 "capability."
1716 msgstr ""
1717
1718 #. type: TP
1719 #: build/C/man2/semctl.2:449 build/C/man2/semop.2:387
1720 #, no-wrap
1721 msgid "B<ERANGE>"
1722 msgstr ""
1723
1724 #. type: Plain text
1725 #: build/C/man2/semctl.2:462
1726 msgid ""
1727 "The argument I<cmd> has the value B<SETALL> or B<SETVAL> and the value to "
1728 "which B<semval> is to be set (for some semaphore of the set) is less than 0 "
1729 "or greater than the implementation limit B<SEMVMX>."
1730 msgstr ""
1731
1732 #.  SVr4 documents additional error conditions EINVAL, EFBIG, ENOSPC.
1733 #. type: Plain text
1734 #: build/C/man2/semctl.2:465 build/C/man2/semget.2:223 build/C/man2/semop.2:405
1735 msgid "SVr4, POSIX.1-2001."
1736 msgstr ""
1737
1738 #.  Like Linux, the FreeBSD man pages still document
1739 #.  the inclusion of these header files.
1740 #. type: Plain text
1741 #: build/C/man2/semctl.2:478 build/C/man2/semget.2:236 build/C/man2/semop.2:418
1742 msgid ""
1743 "The inclusion of I<E<lt>sys/types.hE<gt>> and I<E<lt>sys/ipc.hE<gt>> isn't "
1744 "required on Linux or by any version of POSIX.  However, some old "
1745 "implementations required the inclusion of these header files, and the SVID "
1746 "also documented their inclusion.  Applications intended to be portable to "
1747 "such old systems may need to include these header files."
1748 msgstr ""
1749
1750 #. type: Plain text
1751 #: build/C/man2/semctl.2:489
1752 msgid ""
1753 "The B<IPC_INFO>, B<SEM_STAT> and B<SEM_INFO> operations are used by the "
1754 "B<ipcs>(1)  program to provide information on allocated resources.  In the "
1755 "future these may modified or moved to a /proc file system interface."
1756 msgstr ""
1757
1758 #. type: Plain text
1759 #: build/C/man2/semctl.2:502
1760 msgid ""
1761 "Various fields in a I<struct semid_ds> were typed as I<short> under Linux "
1762 "2.2 and have become I<long> under Linux 2.4.  To take advantage of this, a "
1763 "recompilation under glibc-2.1.91 or later should suffice.  (The kernel "
1764 "distinguishes old and new calls by an B<IPC_64> flag in I<cmd>.)"
1765 msgstr ""
1766
1767 #. type: Plain text
1768 #: build/C/man2/semctl.2:511
1769 msgid ""
1770 "In some earlier versions of glibc, the I<semun> union was defined in "
1771 "I<E<lt>sys/sem.hE<gt>>, but POSIX.1-2001 requires that the caller define "
1772 "this union.  On versions of glibc where this union is I<not> defined, the "
1773 "macro B<_SEM_SEMUN_UNDEFINED> is defined in I<E<lt>sys/sem.hE<gt>>."
1774 msgstr ""
1775
1776 #. type: Plain text
1777 #: build/C/man2/semctl.2:515
1778 msgid "The following system limit on semaphore sets affects a B<semctl>()  call:"
1779 msgstr ""
1780
1781 #. type: TP
1782 #: build/C/man2/semctl.2:515 build/C/man2/semop.2:464
1783 #, no-wrap
1784 msgid "B<SEMVMX>"
1785 msgstr ""
1786
1787 #. type: Plain text
1788 #: build/C/man2/semctl.2:520
1789 msgid "Maximum value for B<semval>: implementation dependent (32767)."
1790 msgstr ""
1791
1792 #. type: Plain text
1793 #: build/C/man2/semctl.2:524
1794 msgid ""
1795 "For greater portability it is best to always call B<semctl>()  with four "
1796 "arguments."
1797 msgstr ""
1798
1799 #. type: Plain text
1800 #: build/C/man2/semctl.2:531
1801 msgid ""
1802 "B<ipc>(2), B<semget>(2), B<semop>(2), B<capabilities>(7), "
1803 "B<sem_overview>(7), B<svipc>(7)"
1804 msgstr ""
1805
1806 #. type: TH
1807 #: build/C/man2/semget.2:36
1808 #, no-wrap
1809 msgid "SEMGET"
1810 msgstr ""
1811
1812 #. type: Plain text
1813 #: build/C/man2/semget.2:39
1814 msgid "semget - get a semaphore set identifier"
1815 msgstr ""
1816
1817 #. type: Plain text
1818 #: build/C/man2/semget.2:49
1819 msgid "B<int semget(key_t >I<key>B<,> B<int >I<nsems>B<,> B<int >I<semflg>B<);>"
1820 msgstr ""
1821
1822 #. type: Plain text
1823 #: build/C/man2/semget.2:67
1824 msgid ""
1825 "The B<semget>()  system call returns the semaphore set identifier associated "
1826 "with the argument I<key>.  A new set of I<nsems> semaphores is created if "
1827 "I<key> has the value B<IPC_PRIVATE> or if no existing semaphore set is "
1828 "associated with I<key> and B<IPC_CREAT> is specified in I<semflg>."
1829 msgstr ""
1830
1831 #. type: Plain text
1832 #: build/C/man2/semget.2:86
1833 msgid ""
1834 "If I<semflg> specifies both B<IPC_CREAT> and B<IPC_EXCL> and a semaphore set "
1835 "already exists for I<key>, then B<semget>()  fails with I<errno> set to "
1836 "B<EEXIST>.  (This is analogous to the effect of the combination B<O_CREAT | "
1837 "O_EXCL> for B<open>(2).)"
1838 msgstr ""
1839
1840 #. type: Plain text
1841 #: build/C/man2/semget.2:99
1842 msgid ""
1843 "Upon creation, the least significant 9 bits of the argument I<semflg> define "
1844 "the permissions (for owner, group and others)  for the semaphore set.  These "
1845 "bits have the same format, and the same meaning, as the I<mode> argument of "
1846 "B<open>(2)  (though the execute permissions are not meaningful for "
1847 "semaphores, and write permissions mean permission to alter semaphore "
1848 "values)."
1849 msgstr ""
1850
1851 #.  In truth, every one of the many implementations that I've tested sets
1852 #.  the values to zero, but I suppose there is/was some obscure
1853 #.  implementation out there that does not.
1854 #. type: Plain text
1855 #: build/C/man2/semget.2:109
1856 msgid ""
1857 "The values of the semaphores in a newly created set are indeterminate.  "
1858 "(POSIX.1-2001 is explicit on this point.)  Although Linux, like many other "
1859 "implementations, initializes the semaphore values to 0, a portable "
1860 "application cannot rely on this: it should explicitly initialize the "
1861 "semaphores to the desired values."
1862 msgstr ""
1863
1864 #. type: Plain text
1865 #: build/C/man2/semget.2:117
1866 msgid ""
1867 "When creating a new semaphore set, B<semget>()  initializes the set's "
1868 "associated data structure, I<semid_ds> (see B<semctl>(2)), as follows:"
1869 msgstr ""
1870
1871 #. type: Plain text
1872 #: build/C/man2/semget.2:122
1873 msgid ""
1874 "I<sem_perm.cuid> and I<sem_perm.uid> are set to the effective user ID of the "
1875 "calling process."
1876 msgstr ""
1877
1878 #. type: Plain text
1879 #: build/C/man2/semget.2:127
1880 msgid ""
1881 "I<sem_perm.cgid> and I<sem_perm.gid> are set to the effective group ID of "
1882 "the calling process."
1883 msgstr ""
1884
1885 #. type: Plain text
1886 #: build/C/man2/semget.2:132
1887 msgid ""
1888 "The least significant 9 bits of I<sem_perm.mode> are set to the least "
1889 "significant 9 bits of I<semflg>."
1890 msgstr ""
1891
1892 #. type: Plain text
1893 #: build/C/man2/semget.2:136
1894 msgid "I<sem_nsems> is set to the value of I<nsems>."
1895 msgstr ""
1896
1897 #. type: Plain text
1898 #: build/C/man2/semget.2:139
1899 msgid "I<sem_otime> is set to 0."
1900 msgstr ""
1901
1902 #. type: Plain text
1903 #: build/C/man2/semget.2:142
1904 msgid "I<sem_ctime> is set to the current time."
1905 msgstr ""
1906
1907 #. type: Plain text
1908 #: build/C/man2/semget.2:153
1909 msgid ""
1910 "The argument I<nsems> can be 0 (a don't care)  when a semaphore set is not "
1911 "being created.  Otherwise I<nsems> must be greater than 0 and less than or "
1912 "equal to the maximum number of semaphores per semaphore set (B<SEMMSL>)."
1913 msgstr ""
1914
1915 #.  and a check is made to see if it is marked for destruction.
1916 #. type: Plain text
1917 #: build/C/man2/semget.2:157
1918 msgid "If the semaphore set already exists, the permissions are verified."
1919 msgstr ""
1920
1921 #. type: Plain text
1922 #: build/C/man2/semget.2:163
1923 msgid ""
1924 "If successful, the return value will be the semaphore set identifier (a "
1925 "nonnegative integer), otherwise -1 is returned, with I<errno> indicating the "
1926 "error."
1927 msgstr ""
1928
1929 #. type: Plain text
1930 #: build/C/man2/semget.2:167
1931 msgid "On failure I<errno> will be set to one of the following:"
1932 msgstr ""
1933
1934 #. type: Plain text
1935 #: build/C/man2/semget.2:175
1936 msgid ""
1937 "A semaphore set exists for I<key>, but the calling process does not have "
1938 "permission to access the set, and does not have the B<CAP_IPC_OWNER> "
1939 "capability."
1940 msgstr ""
1941
1942 #.  .TP
1943 #.  .B EIDRM
1944 #.  The semaphore set is marked to be deleted.
1945 #. type: Plain text
1946 #: build/C/man2/semget.2:188
1947 msgid ""
1948 "A semaphore set exists for I<key> and I<semflg> specified both B<IPC_CREAT> "
1949 "and B<IPC_EXCL>."
1950 msgstr ""
1951
1952 #. type: Plain text
1953 #: build/C/man2/semget.2:199
1954 msgid ""
1955 "I<nsems> is less than 0 or greater than the limit on the number of "
1956 "semaphores per semaphore set (B<SEMMSL>), or a semaphore set corresponding "
1957 "to I<key> already exists, and I<nsems> is larger than the number of "
1958 "semaphores in that set."
1959 msgstr ""
1960
1961 #. type: Plain text
1962 #: build/C/man2/semget.2:207
1963 msgid ""
1964 "No semaphore set exists for I<key> and I<semflg> did not specify "
1965 "B<IPC_CREAT>."
1966 msgstr ""
1967
1968 #. type: Plain text
1969 #: build/C/man2/semget.2:211
1970 msgid ""
1971 "A semaphore set has to be created but the system does not have enough memory "
1972 "for the new data structure."
1973 msgstr ""
1974
1975 #. type: TP
1976 #: build/C/man2/semget.2:211
1977 #, no-wrap
1978 msgid "B<ENOSPC>"
1979 msgstr ""
1980
1981 #. type: Plain text
1982 #: build/C/man2/semget.2:219
1983 msgid ""
1984 "A semaphore set has to be created but the system limit for the maximum "
1985 "number of semaphore sets (B<SEMMNI>), or the system wide maximum number of "
1986 "semaphores (B<SEMMNS>), would be exceeded."
1987 msgstr ""
1988
1989 #. type: Plain text
1990 #: build/C/man2/semget.2:246
1991 msgid ""
1992 "B<IPC_PRIVATE> isn't a flag field but a I<key_t> type.  If this special "
1993 "value is used for I<key>, the system call ignores everything but the least "
1994 "significant 9 bits of I<semflg> and creates a new semaphore set (on "
1995 "success)."
1996 msgstr ""
1997
1998 #. type: Plain text
1999 #: build/C/man2/semget.2:250
2000 msgid ""
2001 "The following limits on semaphore set resources affect the B<semget>()  "
2002 "call:"
2003 msgstr ""
2004
2005 #. type: TP
2006 #: build/C/man2/semget.2:250
2007 #, no-wrap
2008 msgid "B<SEMMNI>"
2009 msgstr ""
2010
2011 #.  This /proc file is not available in Linux 2.2 and earlier -- MTK
2012 #. type: Plain text
2013 #: build/C/man2/semget.2:256
2014 msgid ""
2015 "System wide maximum number of semaphore sets: policy dependent (on Linux, "
2016 "this limit can be read and modified via the fourth field of "
2017 "I</proc/sys/kernel/sem>)."
2018 msgstr ""
2019
2020 #. type: TP
2021 #: build/C/man2/semget.2:256
2022 #, no-wrap
2023 msgid "B<SEMMSL>"
2024 msgstr ""
2025
2026 #. type: Plain text
2027 #: build/C/man2/semget.2:261
2028 msgid ""
2029 "Maximum number of semaphores per semid: implementation dependent (on Linux, "
2030 "this limit can be read and modified via the first field of "
2031 "I</proc/sys/kernel/sem>)."
2032 msgstr ""
2033
2034 #. type: TP
2035 #: build/C/man2/semget.2:261
2036 #, no-wrap
2037 msgid "B<SEMMNS>"
2038 msgstr ""
2039
2040 #. type: Plain text
2041 #: build/C/man2/semget.2:269
2042 msgid ""
2043 "System wide maximum number of semaphores: policy dependent (on Linux, this "
2044 "limit can be read and modified via the second field of "
2045 "I</proc/sys/kernel/sem>).  Values greater than B<SEMMSL * SEMMNI> makes it "
2046 "irrelevant."
2047 msgstr ""
2048
2049 #. type: SH
2050 #: build/C/man2/semget.2:269 build/C/man2/semop.2:476
2051 #, no-wrap
2052 msgid "BUGS"
2053 msgstr ""
2054
2055 #. type: Plain text
2056 #: build/C/man2/semget.2:275
2057 msgid ""
2058 "The name choice B<IPC_PRIVATE> was perhaps unfortunate, B<IPC_NEW> would "
2059 "more clearly show its function."
2060 msgstr ""
2061
2062 #.  In fact they are initialized to zero on Linux, but POSIX.1-2001
2063 #.  does not specify this, and we can't portably rely on it.
2064 #. type: Plain text
2065 #: build/C/man2/semget.2:294
2066 msgid ""
2067 "The semaphores in a set are not initialized by B<semget>().  In order to "
2068 "initialize the semaphores, B<semctl>(2)  must be used to perform a B<SETVAL> "
2069 "or a B<SETALL> operation on the semaphore set.  (Where multiple peers do not "
2070 "know who will be the first to initialize the set, checking for a nonzero "
2071 "I<sem_otime> in the associated data structure retrieved by a B<semctl>(2)  "
2072 "B<IPC_STAT> operation can be used to avoid races.)"
2073 msgstr ""
2074
2075 #. type: Plain text
2076 #: build/C/man2/semget.2:301
2077 msgid ""
2078 "B<semctl>(2), B<semop>(2), B<ftok>(3), B<capabilities>(7), "
2079 "B<sem_overview>(7), B<svipc>(7)"
2080 msgstr ""
2081
2082 #. type: TH
2083 #: build/C/man2/semop.2:35
2084 #, no-wrap
2085 msgid "SEMOP"
2086 msgstr ""
2087
2088 #. type: TH
2089 #: build/C/man2/semop.2:35
2090 #, no-wrap
2091 msgid "2012-08-27"
2092 msgstr ""
2093
2094 #. type: Plain text
2095 #: build/C/man2/semop.2:38
2096 msgid "semop, semtimedop - semaphore operations"
2097 msgstr ""
2098
2099 #. type: Plain text
2100 #: build/C/man2/semop.2:45
2101 #, no-wrap
2102 msgid ""
2103 "B<int semop(int >I<semid>B<, struct sembuf *>I<sops>B<, unsigned "
2104 ">I<nsops>B<);>\n"
2105 msgstr ""
2106
2107 #. type: Plain text
2108 #: build/C/man2/semop.2:48
2109 #, no-wrap
2110 msgid ""
2111 "B<int semtimedop(int >I<semid>B<, struct sembuf *>I<sops>B<, unsigned "
2112 ">I<nsops>B<,>\n"
2113 "B<               struct timespec *>I<timeout>B<);>\n"
2114 msgstr ""
2115
2116 #. type: Plain text
2117 #: build/C/man2/semop.2:57
2118 msgid "B<semtimedop>(): _GNU_SOURCE"
2119 msgstr ""
2120
2121 #. type: Plain text
2122 #: build/C/man2/semop.2:59
2123 msgid "Each semaphore in a semaphore set has the following associated values:"
2124 msgstr ""
2125
2126 #. type: Plain text
2127 #: build/C/man2/semop.2:66
2128 #, no-wrap
2129 msgid ""
2130 "unsigned short  semval;   /* semaphore value */\n"
2131 "unsigned short  semzcnt;  /* # waiting for zero */\n"
2132 "unsigned short  semncnt;  /* # waiting for increase */\n"
2133 "pid_t           sempid;   /* ID of process that did last op */\n"
2134 msgstr ""
2135
2136 #. type: Plain text
2137 #: build/C/man2/semop.2:80
2138 msgid ""
2139 "B<semop>()  performs operations on selected semaphores in the set indicated "
2140 "by I<semid>.  Each of the I<nsops> elements in the array pointed to by "
2141 "I<sops> specifies an operation to be performed on a single semaphore.  The "
2142 "elements of this structure are of type I<struct sembuf>, containing the "
2143 "following members:"
2144 msgstr ""
2145
2146 #. type: Plain text
2147 #: build/C/man2/semop.2:86
2148 #, no-wrap
2149 msgid ""
2150 "unsigned short sem_num;  /* semaphore number */\n"
2151 "short          sem_op;   /* semaphore operation */\n"
2152 "short          sem_flg;  /* operation flags */\n"
2153 msgstr ""
2154
2155 #. type: Plain text
2156 #: build/C/man2/semop.2:98
2157 msgid ""
2158 "Flags recognized in I<sem_flg> are B<IPC_NOWAIT> and B<SEM_UNDO>.  If an "
2159 "operation specifies B<SEM_UNDO>, it will be automatically undone when the "
2160 "process terminates."
2161 msgstr ""
2162
2163 #. type: Plain text
2164 #: build/C/man2/semop.2:113
2165 msgid ""
2166 "The set of operations contained in I<sops> is performed in I<array order>, "
2167 "and I<atomically>, that is, the operations are performed either as a "
2168 "complete unit, or not at all.  The behavior of the system call if not all "
2169 "operations can be performed immediately depends on the presence of the "
2170 "B<IPC_NOWAIT> flag in the individual I<sem_flg> fields, as noted below."
2171 msgstr ""
2172
2173 #. type: Plain text
2174 #: build/C/man2/semop.2:120
2175 msgid ""
2176 "Each operation is performed on the I<sem_num>-th semaphore of the semaphore "
2177 "set, where the first semaphore of the set is numbered 0.  There are three "
2178 "types of operation, distinguished by the value of I<sem_op>."
2179 msgstr ""
2180
2181 #. type: Plain text
2182 #: build/C/man2/semop.2:133
2183 msgid ""
2184 "If I<sem_op> is a positive integer, the operation adds this value to the "
2185 "semaphore value (I<semval>).  Furthermore, if B<SEM_UNDO> is specified for "
2186 "this operation, the system updates the undo count (I<semadj>)  for this "
2187 "semaphore.  This operation can always proceed\\(emit never forces a thread "
2188 "to wait.  The calling process must have alter permission on the semaphore "
2189 "set."
2190 msgstr ""
2191
2192 #. type: Plain text
2193 #: build/C/man2/semop.2:158
2194 msgid ""
2195 "If I<sem_op> is zero, the process must have read permission on the semaphore "
2196 "set.  This is a \"wait-for-zero\" operation: if I<semval> is zero, the "
2197 "operation can immediately proceed.  Otherwise, if B<IPC_NOWAIT> is specified "
2198 "in I<sem_flg>, B<semop>()  fails with I<errno> set to B<EAGAIN> (and none of "
2199 "the operations in I<sops> is performed).  Otherwise I<semzcnt> (the count of "
2200 "threads waiting until this semaphore's value becomes zero)  is incremented "
2201 "by one and the thread sleeps until one of the following occurs:"
2202 msgstr ""
2203
2204 #. type: IP
2205 #: build/C/man2/semop.2:158 build/C/man2/semop.2:163 build/C/man2/semop.2:171 build/C/man2/semop.2:181 build/C/man2/semop.2:232 build/C/man2/semop.2:247 build/C/man2/semop.2:254 build/C/man2/semop.2:264
2206 #, no-wrap
2207 msgid "\\(bu"
2208 msgstr ""
2209
2210 #. type: Plain text
2211 #: build/C/man2/semop.2:163
2212 msgid "I<semval> becomes 0, at which time the value of I<semzcnt> is decremented."
2213 msgstr ""
2214
2215 #. type: Plain text
2216 #: build/C/man2/semop.2:171
2217 msgid ""
2218 "The semaphore set is removed: B<semop>()  fails, with I<errno> set to "
2219 "B<EIDRM>."
2220 msgstr ""
2221
2222 #. type: Plain text
2223 #: build/C/man2/semop.2:181
2224 msgid ""
2225 "The calling thread catches a signal: the value of I<semzcnt> is decremented "
2226 "and B<semop>()  fails, with I<errno> set to B<EINTR>."
2227 msgstr ""
2228
2229 #. type: Plain text
2230 #: build/C/man2/semop.2:192
2231 msgid ""
2232 "The time limit specified by I<timeout> in a B<semtimedop>()  call expires: "
2233 "B<semop>()  fails, with I<errno> set to B<EAGAIN>."
2234 msgstr ""
2235
2236 #. type: Plain text
2237 #: build/C/man2/semop.2:232
2238 msgid ""
2239 "If I<sem_op> is less than zero, the process must have alter permission on "
2240 "the semaphore set.  If I<semval> is greater than or equal to the absolute "
2241 "value of I<sem_op>, the operation can proceed immediately: the absolute "
2242 "value of I<sem_op> is subtracted from I<semval>, and, if B<SEM_UNDO> is "
2243 "specified for this operation, the system updates the undo count (I<semadj>)  "
2244 "for this semaphore.  If the absolute value of I<sem_op> is greater than "
2245 "I<semval>, and B<IPC_NOWAIT> is specified in I<sem_flg>, B<semop>()  fails, "
2246 "with I<errno> set to B<EAGAIN> (and none of the operations in I<sops> is "
2247 "performed).  Otherwise I<semncnt> (the counter of threads waiting for this "
2248 "semaphore's value to increase)  is incremented by one and the thread sleeps "
2249 "until one of the following occurs:"
2250 msgstr ""
2251
2252 #. type: Plain text
2253 #: build/C/man2/semop.2:247
2254 msgid ""
2255 "I<semval> becomes greater than or equal to the absolute value of I<sem_op>, "
2256 "at which time the value of I<semncnt> is decremented, the absolute value of "
2257 "I<sem_op> is subtracted from I<semval> and, if B<SEM_UNDO> is specified for "
2258 "this operation, the system updates the undo count (I<semadj>)  for this "
2259 "semaphore."
2260 msgstr ""
2261
2262 #. type: Plain text
2263 #: build/C/man2/semop.2:254
2264 msgid ""
2265 "The semaphore set is removed from the system: B<semop>()  fails, with "
2266 "I<errno> set to B<EIDRM>."
2267 msgstr ""
2268
2269 #. type: Plain text
2270 #: build/C/man2/semop.2:264
2271 msgid ""
2272 "The calling thread catches a signal: the value of I<semncnt> is decremented "
2273 "and B<semop>()  fails, with I<errno> set to B<EINTR>."
2274 msgstr ""
2275
2276 #. type: Plain text
2277 #: build/C/man2/semop.2:273
2278 msgid ""
2279 "The time limit specified by I<timeout> in a B<semtimedop>()  call expires: "
2280 "the system call fails, with I<errno> set to B<EAGAIN>."
2281 msgstr ""
2282
2283 #.  and
2284 #.  .I sem_ctime
2285 #. type: Plain text
2286 #: build/C/man2/semop.2:284
2287 msgid ""
2288 "On successful completion, the I<sempid> value for each semaphore specified "
2289 "in the array pointed to by I<sops> is set to the caller's process ID.  In "
2290 "addition, the I<sem_otime> is set to the current time."
2291 msgstr ""
2292
2293 #. type: Plain text
2294 #: build/C/man2/semop.2:314
2295 msgid ""
2296 "B<semtimedop>()  behaves identically to B<semop>()  except that in those "
2297 "cases where the calling thread would sleep, the duration of that sleep is "
2298 "limited by the amount of elapsed time specified by the I<timespec> structure "
2299 "whose address is passed in the I<timeout> argument.  (This sleep interval "
2300 "will be rounded up to the system clock granularity, and kernel scheduling "
2301 "delays mean that the interval may overrun by a small amount.)  If the "
2302 "specified time limit has been reached, B<semtimedop>()  fails with I<errno> "
2303 "set to B<EAGAIN> (and none of the operations in I<sops> is performed).  If "
2304 "the I<timeout> argument is NULL, then B<semtimedop>()  behaves exactly like "
2305 "B<semop>()."
2306 msgstr ""
2307
2308 #. type: Plain text
2309 #: build/C/man2/semop.2:324
2310 msgid ""
2311 "If successful B<semop>()  and B<semtimedop>()  return 0; otherwise they "
2312 "return -1 with I<errno> indicating the error."
2313 msgstr ""
2314
2315 #. type: Plain text
2316 #: build/C/man2/semop.2:328
2317 msgid "On failure, I<errno> is set to one of the following:"
2318 msgstr ""
2319
2320 #. type: TP
2321 #: build/C/man2/semop.2:328
2322 #, no-wrap
2323 msgid "B<E2BIG>"
2324 msgstr ""
2325
2326 #. type: Plain text
2327 #: build/C/man2/semop.2:336
2328 msgid ""
2329 "The argument I<nsops> is greater than B<SEMOPM>, the maximum number of "
2330 "operations allowed per system call."
2331 msgstr ""
2332
2333 #. type: Plain text
2334 #: build/C/man2/semop.2:343
2335 msgid ""
2336 "The calling process does not have the permissions required to perform the "
2337 "specified semaphore operations, and does not have the B<CAP_IPC_OWNER> "
2338 "capability."
2339 msgstr ""
2340
2341 #. type: Plain text
2342 #: build/C/man2/semop.2:352
2343 msgid ""
2344 "An operation could not proceed immediately and either B<IPC_NOWAIT> was "
2345 "specified in I<sem_flg> or the time limit specified in I<timeout> expired."
2346 msgstr ""
2347
2348 #. type: Plain text
2349 #: build/C/man2/semop.2:359
2350 msgid ""
2351 "An address specified in either the I<sops> or the I<timeout> argument isn't "
2352 "accessible."
2353 msgstr ""
2354
2355 #. type: TP
2356 #: build/C/man2/semop.2:359
2357 #, no-wrap
2358 msgid "B<EFBIG>"
2359 msgstr ""
2360
2361 #. type: Plain text
2362 #: build/C/man2/semop.2:365
2363 msgid ""
2364 "For some operation the value of I<sem_num> is less than 0 or greater than or "
2365 "equal to the number of semaphores in the set."
2366 msgstr ""
2367
2368 #. type: Plain text
2369 #: build/C/man2/semop.2:372
2370 msgid ""
2371 "While blocked in this system call, the thread caught a signal; see "
2372 "B<signal>(7)."
2373 msgstr ""
2374
2375 #. type: Plain text
2376 #: build/C/man2/semop.2:379
2377 msgid ""
2378 "The semaphore set doesn't exist, or I<semid> is less than zero, or I<nsops> "
2379 "has a nonpositive value."
2380 msgstr ""
2381
2382 #. type: Plain text
2383 #: build/C/man2/semop.2:387
2384 msgid ""
2385 "The I<sem_flg> of some operation specified B<SEM_UNDO> and the system does "
2386 "not have enough memory to allocate the undo structure."
2387 msgstr ""
2388
2389 #. type: Plain text
2390 #: build/C/man2/semop.2:395
2391 msgid ""
2392 "For some operation I<sem_op+semval> is greater than B<SEMVMX>, the "
2393 "implementation dependent maximum value for I<semval>."
2394 msgstr ""
2395
2396 #. type: SH
2397 #: build/C/man2/semop.2:395
2398 #, no-wrap
2399 msgid "VERSIONS"
2400 msgstr ""
2401
2402 #. type: Plain text
2403 #: build/C/man2/semop.2:402
2404 msgid ""
2405 "B<semtimedop>()  first appeared in Linux 2.5.52, and was subsequently "
2406 "backported into kernel 2.4.22.  Glibc support for B<semtimedop>()  first "
2407 "appeared in version 2.3.3."
2408 msgstr ""
2409
2410 #. type: Plain text
2411 #: build/C/man2/semop.2:426
2412 msgid ""
2413 "The I<sem_undo> structures of a process aren't inherited by the child "
2414 "produced by B<fork>(2), but they are inherited across an B<execve>(2)  "
2415 "system call."
2416 msgstr ""
2417
2418 #. type: Plain text
2419 #: build/C/man2/semop.2:432
2420 msgid ""
2421 "B<semop>()  is never automatically restarted after being interrupted by a "
2422 "signal handler, regardless of the setting of the B<SA_RESTART> flag when "
2423 "establishing a signal handler."
2424 msgstr ""
2425
2426 #. type: Plain text
2427 #: build/C/man2/semop.2:447
2428 msgid ""
2429 "I<semadj> is a per-process integer which is simply the (negative) count of "
2430 "all semaphore operations performed specifying the B<SEM_UNDO> flag.  When a "
2431 "semaphore's value is directly set using the B<SETVAL> or B<SETALL> request "
2432 "to B<semctl>(2), the corresponding I<semadj> values in all processes are "
2433 "cleared."
2434 msgstr ""
2435
2436 #. type: Plain text
2437 #: build/C/man2/semop.2:452
2438 msgid ""
2439 "The I<semval>, I<sempid>, I<semzcnt>, and I<semnct> values for a semaphore "
2440 "can all be retrieved using appropriate B<semctl>(2)  calls."
2441 msgstr ""
2442
2443 #. type: Plain text
2444 #: build/C/man2/semop.2:456
2445 msgid "The following limits on semaphore set resources affect the B<semop>()  call:"
2446 msgstr ""
2447
2448 #. type: TP
2449 #: build/C/man2/semop.2:456
2450 #, no-wrap
2451 msgid "B<SEMOPM>"
2452 msgstr ""
2453
2454 #.  This /proc file is not available in Linux 2.2 and earlier -- MTK
2455 #. type: Plain text
2456 #: build/C/man2/semop.2:464
2457 msgid ""
2458 "Maximum number of operations allowed for one B<semop>()  call (32)  (on "
2459 "Linux, this limit can be read and modified via the third field of "
2460 "I</proc/sys/kernel/sem>)."
2461 msgstr ""
2462
2463 #. type: Plain text
2464 #: build/C/man2/semop.2:469
2465 msgid "Maximum allowable value for I<semval>: implementation dependent (32767)."
2466 msgstr ""
2467
2468 #. type: Plain text
2469 #: build/C/man2/semop.2:476
2470 msgid ""
2471 "The implementation has no intrinsic limits for the adjust on exit maximum "
2472 "value (B<SEMAEM>), the system wide maximum number of undo structures "
2473 "(B<SEMMNU>)  and the per-process maximum number of undo entries system "
2474 "parameters."
2475 msgstr ""
2476
2477 #. type: Plain text
2478 #: build/C/man2/semop.2:497
2479 msgid ""
2480 "When a process terminates, its set of associated I<semadj> structures is "
2481 "used to undo the effect of all of the semaphore operations it performed with "
2482 "the B<SEM_UNDO> flag.  This raises a difficulty: if one (or more) of these "
2483 "semaphore adjustments would result in an attempt to decrease a semaphore's "
2484 "value below zero, what should an implementation do? One possible approach "
2485 "would be to block until all the semaphore adjustments could be performed.  "
2486 "This is however undesirable since it could force process termination to "
2487 "block for arbitrarily long periods.  Another possibility is that such "
2488 "semaphore adjustments could be ignored altogether (somewhat analogously to "
2489 "failing when B<IPC_NOWAIT> is specified for a semaphore operation).  Linux "
2490 "adopts a third approach: decreasing the semaphore value as far as possible "
2491 "(i.e., to zero) and allowing process termination to proceed immediately."
2492 msgstr ""
2493
2494 #.  The bug report:
2495 #.  http://marc.theaimsgroup.com/?l=linux-kernel&m=110260821123863&w=2
2496 #.  the fix:
2497 #.  http://marc.theaimsgroup.com/?l=linux-kernel&m=110261701025794&w=2
2498 #. type: Plain text
2499 #: build/C/man2/semop.2:506
2500 msgid ""
2501 "In kernels 2.6.x, x E<lt>= 10, there is a bug that in some circumstances "
2502 "prevents a thread that is waiting for a semaphore value to become zero from "
2503 "being woken up when the value does actually become zero.  This bug is fixed "
2504 "in kernel 2.6.11."
2505 msgstr ""
2506
2507 #. type: Plain text
2508 #: build/C/man2/semop.2:511
2509 msgid ""
2510 "The following code segment uses B<semop>()  to atomically wait for the value "
2511 "of semaphore 0 to become zero, and then increment the semaphore value by "
2512 "one."
2513 msgstr ""
2514
2515 #. type: Plain text
2516 #: build/C/man2/semop.2:515
2517 #, no-wrap
2518 msgid ""
2519 "    struct sembuf sops[2];\n"
2520 "    int semid;\n"
2521 msgstr ""
2522
2523 #. type: Plain text
2524 #: build/C/man2/semop.2:517
2525 #, no-wrap
2526 msgid "    /* Code to set I<semid> omitted */\n"
2527 msgstr ""
2528
2529 #. type: Plain text
2530 #: build/C/man2/semop.2:521
2531 #, no-wrap
2532 msgid ""
2533 "    sops[0].sem_num = 0;        /* Operate on semaphore 0 */\n"
2534 "    sops[0].sem_op = 0;         /* Wait for value to equal 0 */\n"
2535 "    sops[0].sem_flg = 0;\n"
2536 msgstr ""
2537
2538 #. type: Plain text
2539 #: build/C/man2/semop.2:525
2540 #, no-wrap
2541 msgid ""
2542 "    sops[1].sem_num = 0;        /* Operate on semaphore 0 */\n"
2543 "    sops[1].sem_op = 1;         /* Increment value by one */\n"
2544 "    sops[1].sem_flg = 0;\n"
2545 msgstr ""
2546
2547 #. type: Plain text
2548 #: build/C/man2/semop.2:530
2549 #, no-wrap
2550 msgid ""
2551 "    if (semop(semid, sops, 2) == -1) {\n"
2552 "        perror(\"semop\");\n"
2553 "        exit(EXIT_FAILURE);\n"
2554 "    }\n"
2555 msgstr ""
2556
2557 #. type: Plain text
2558 #: build/C/man2/semop.2:540
2559 msgid ""
2560 "B<clone>(2), B<semctl>(2), B<semget>(2), B<sigaction>(2), "
2561 "B<capabilities>(7), B<sem_overview>(7), B<svipc>(7), B<time>(7)"
2562 msgstr ""