OSDN Git Service

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