OSDN Git Service

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