Debian Codegraph @

templates/man2/semget.2.pot

raw
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: 2026-06-05 06:42+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\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 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "semget"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-08"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid "semget - get a System V semaphore set identifier"
50 msgstr ""
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "LIBRARY"
57 msgstr ""
58
59 #. type: Plain text
60 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
61 #: opensuse-leap-16-1 opensuse-tumbleweed
62 msgid "Standard C library (I<libc>,\\ I<-lc>)"
63 msgstr ""
64
65 #. type: SH
66 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
67 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
68 #, no-wrap
69 msgid "SYNOPSIS"
70 msgstr ""
71
72 #. type: Plain text
73 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
74 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
75 #, no-wrap
76 msgid "B<#include E<lt>sys/sem.hE<gt>>\n"
77 msgstr ""
78
79 #. type: Plain text
80 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
81 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
82 msgid ""
83 "B<int semget(key_t >I<key>B<,> B<int >I<nsems>B<,> B<int >I<semflg>B<);>"
84 msgstr ""
85
86 #. type: SH
87 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
88 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
89 #, no-wrap
90 msgid "DESCRIPTION"
91 msgstr ""
92
93 #. type: Plain text
94 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
95 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
96 msgid ""
97 "The B<semget>() system call returns the System\\ V semaphore set identifier "
98 "associated with the argument I<key>. It may be used either to obtain the "
99 "identifier of a previously created semaphore set (when I<semflg> is zero and "
100 "I<key> does not have the value B<IPC_PRIVATE>), or to create a new set."
101 msgstr ""
102
103 #. type: Plain text
104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
106 msgid ""
107 "A new set of I<nsems> semaphores is created if I<key> has the value "
108 "B<IPC_PRIVATE> or if no existing semaphore set is associated with I<key> and "
109 "B<IPC_CREAT> is specified in I<semflg>."
110 msgstr ""
111
112 #. type: Plain text
113 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
114 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
115 msgid ""
116 "If I<semflg> specifies both B<IPC_CREAT> and B<IPC_EXCL> and a semaphore set "
117 "already exists for I<key>, then B<semget>() fails with I<errno> set to "
118 "B<EEXIST>. (This is analogous to the effect of the combination B<O_CREAT | "
119 "O_EXCL> for B<open>(2).)"
120 msgstr ""
121
122 #. type: Plain text
123 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
124 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
125 msgid ""
126 "Upon creation, the least significant 9 bits of the argument I<semflg> define "
127 "the permissions (for owner, group, and others) for the semaphore set. "
128 "These bits have the same format, and the same meaning, as the I<mode> "
129 "argument of B<open>(2) (though the execute permissions are not meaningful "
130 "for semaphores, and write permissions mean permission to alter semaphore "
131 "values)."
132 msgstr ""
133
134 #. type: Plain text
135 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
136 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
137 msgid ""
138 "When creating a new semaphore set, B<semget>() initializes the set's "
139 "associated data structure, I<semid_ds> (see B<semctl>(2)), as follows:"
140 msgstr ""
141
142 #. type: IP
143 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
144 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
145 #, no-wrap
146 msgid "\\[bu]"
147 msgstr ""
148
149 #. type: Plain text
150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
152 msgid ""
153 "I<sem_perm.cuid> and I<sem_perm.uid> are set to the effective user ID of the "
154 "calling process."
155 msgstr ""
156
157 #. type: Plain text
158 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
159 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
160 msgid ""
161 "I<sem_perm.cgid> and I<sem_perm.gid> are set to the effective group ID of "
162 "the calling process."
163 msgstr ""
164
165 #. type: Plain text
166 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
167 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
168 msgid ""
169 "The least significant 9 bits of I<sem_perm.mode> are set to the least "
170 "significant 9 bits of I<semflg>."
171 msgstr ""
172
173 #. type: Plain text
174 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
175 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
176 msgid "I<sem_nsems> is set to the value of I<nsems>."
177 msgstr ""
178
179 #. type: Plain text
180 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
181 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
182 msgid "I<sem_otime> is set to 0."
183 msgstr ""
184
185 #. type: Plain text
186 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
187 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
188 msgid "I<sem_ctime> is set to the current time."
189 msgstr ""
190
191 #. type: Plain text
192 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
193 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
194 msgid ""
195 "The argument I<nsems> can be 0 (a don't care) when a semaphore set is not "
196 "being created. Otherwise, I<nsems> must be greater than 0 and less than or "
197 "equal to the maximum number of semaphores per semaphore set (B<SEMMSL>)."
198 msgstr ""
199
200 #. and a check is made to see if it is marked for destruction.
201 #. type: Plain text
202 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
203 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
204 msgid "If the semaphore set already exists, the permissions are verified."
205 msgstr ""
206
207 #. type: SH
208 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
209 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
210 #, no-wrap
211 msgid "RETURN VALUE"
212 msgstr ""
213
214 #. type: Plain text
215 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
216 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
217 msgid ""
218 "On success, B<semget>() returns the semaphore set identifier (a nonnegative "
219 "integer). On failure, -1 is returned, and I<errno> is set to indicate the "
220 "error."
221 msgstr ""
222
223 #. type: SH
224 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
225 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
226 #, no-wrap
227 msgid "ERRORS"
228 msgstr ""
229
230 #. type: TP
231 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
232 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
233 #, no-wrap
234 msgid "B<EACCES>"
235 msgstr ""
236
237 #. type: Plain text
238 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
239 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
240 msgid ""
241 "A semaphore set exists for I<key>, but the calling process does not have "
242 "permission to access the set, and does not have the B<CAP_IPC_OWNER> "
243 "capability in the user namespace that governs its IPC namespace."
244 msgstr ""
245
246 #. type: TP
247 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
248 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
249 #, no-wrap
250 msgid "B<EEXIST>"
251 msgstr ""
252
253 #. .TP
254 #. .B EIDRM
255 #. The semaphore set is marked to be deleted.
256 #. type: Plain text
257 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
258 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
259 msgid ""
260 "B<IPC_CREAT> and B<IPC_EXCL> were specified in I<semflg>, but a semaphore "
261 "set already exists for I<key>."
262 msgstr ""
263
264 #. type: TP
265 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
266 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
267 #, no-wrap
268 msgid "B<EINVAL>"
269 msgstr ""
270
271 #. type: Plain text
272 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
273 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
274 msgid ""
275 "I<nsems> is less than 0 or greater than the limit on the number of "
276 "semaphores per semaphore set (B<SEMMSL>)."
277 msgstr ""
278
279 #. type: Plain text
280 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
281 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
282 msgid ""
283 "A semaphore set corresponding to I<key> already exists, but I<nsems> is "
284 "larger than the number of semaphores in that set."
285 msgstr ""
286
287 #. type: TP
288 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
289 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
290 #, no-wrap
291 msgid "B<ENOENT>"
292 msgstr ""
293
294 #. type: Plain text
295 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
296 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
297 msgid ""
298 "No semaphore set exists for I<key> and I<semflg> did not specify "
299 "B<IPC_CREAT>."
300 msgstr ""
301
302 #. type: TP
303 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
304 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
305 #, no-wrap
306 msgid "B<ENOMEM>"
307 msgstr ""
308
309 #. type: Plain text
310 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
311 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
312 msgid ""
313 "A semaphore set has to be created but the system does not have enough memory "
314 "for the new data structure."
315 msgstr ""
316
317 #. type: TP
318 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
319 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
320 #, no-wrap
321 msgid "B<ENOSPC>"
322 msgstr ""
323
324 #. type: Plain text
325 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
326 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
327 msgid ""
328 "A semaphore set has to be created but the system limit for the maximum "
329 "number of semaphore sets (B<SEMMNI>), or the system wide maximum number of "
330 "semaphores (B<SEMMNS>), would be exceeded."
331 msgstr ""
332
333 #. type: SH
334 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
335 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
336 #, no-wrap
337 msgid "STANDARDS"
338 msgstr ""
339
340 #. type: Plain text
341 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
342 #: opensuse-tumbleweed
343 msgid "POSIX.1-2024."
344 msgstr ""
345
346 #. type: SH
347 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
348 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
349 #, no-wrap
350 msgid "HISTORY"
351 msgstr ""
352
353 #. SVr4 documents additional error conditions EFBIG, E2BIG, EAGAIN,
354 #. ERANGE, EFAULT.
355 #. type: Plain text
356 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
357 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
358 msgid "SVr4, POSIX.1-2001."
359 msgstr ""
360
361 #. type: SH
362 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
363 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
364 #, no-wrap
365 msgid "NOTES"
366 msgstr ""
367
368 #. type: Plain text
369 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
370 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
371 msgid ""
372 "B<IPC_PRIVATE> isn't a flag field but a I<key_t> type. If this special "
373 "value is used for I<key>, the system call ignores all but the least "
374 "significant 9 bits of I<semflg> and creates a new semaphore set (on success)."
375 msgstr ""
376
377 #. type: SS
378 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
379 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
380 #, no-wrap
381 msgid "Semaphore initialization"
382 msgstr ""
383
384 #. In truth, every one of the many implementations that I've tested sets
385 #. the values to zero, but I suppose there is/was some obscure
386 #. implementation out there that does not.
387 #. type: Plain text
388 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
389 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
390 msgid ""
391 "The values of the semaphores in a newly created set are indeterminate. "
392 "(POSIX.1-2001 and POSIX.1-2008 are explicit on this point, although "
393 "POSIX.1-2008 notes that a future version of the standard may require an "
394 "implementation to initialize the semaphores to 0.) Although Linux, like "
395 "many other implementations, initializes the semaphore values to 0, a "
396 "portable application cannot rely on this: it should explicitly initialize "
397 "the semaphores to the desired values."
398 msgstr ""
399
400 #. type: Plain text
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 msgid ""
404 "Initialization can be done using B<semctl>(2) B<SETVAL> or B<SETALL> "
405 "operation. Where multiple peers do not know who will be the first to "
406 "initialize the set, checking for a nonzero I<sem_otime> in the associated "
407 "data structure retrieved by a B<semctl>(2) B<IPC_STAT> operation can be "
408 "used to avoid races."
409 msgstr ""
410
411 #. type: SS
412 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
413 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
414 #, no-wrap
415 msgid "Semaphore limits"
416 msgstr ""
417
418 #. type: Plain text
419 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
420 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
421 msgid ""
422 "The following limits on semaphore set resources affect the B<semget>() call:"
423 msgstr ""
424
425 #. type: TP
426 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
427 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
428 #, no-wrap
429 msgid "B<SEMMNI>"
430 msgstr ""
431
432 #. commit e843e7d2c88b7db107a86bd2c7145dc715c058f4
433 #. This /proc file is not available in Linux 2.2 and earlier -- MTK
434 #. type: Plain text
435 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
436 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
437 msgid ""
438 "System-wide limit on the number of semaphore sets. Before Linux 3.19, the "
439 "default value for this limit was 128. Since Linux 3.19, the default value "
440 "is 32,000. On Linux, this limit can be read and modified via the fourth "
441 "field of I</proc/sys/kernel/sem>."
442 msgstr ""
443
444 #. type: TP
445 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
446 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
447 #, no-wrap
448 msgid "B<SEMMSL>"
449 msgstr ""
450
451 #. commit e843e7d2c88b7db107a86bd2c7145dc715c058f4
452 #. type: Plain text
453 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
454 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
455 msgid ""
456 "Maximum number of semaphores per semaphore ID. Before Linux 3.19, the "
457 "default value for this limit was 250. Since Linux 3.19, the default value "
458 "is 32,000. On Linux, this limit can be read and modified via the first "
459 "field of I</proc/sys/kernel/sem>."
460 msgstr ""
461
462 #. type: TP
463 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
464 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
465 #, no-wrap
466 msgid "B<SEMMNS>"
467 msgstr ""
468
469 #. type: Plain text
470 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
471 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
472 msgid ""
473 "System-wide limit on the number of semaphores: policy dependent (on Linux, "
474 "this limit can be read and modified via the second field of I</proc/sys/"
475 "kernel/sem>). Note that the number of semaphores system-wide is also "
476 "limited by the product of B<SEMMSL> and B<SEMMNI>."
477 msgstr ""
478
479 #. type: SH
480 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
481 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
482 #, no-wrap
483 msgid "BUGS"
484 msgstr ""
485
486 #. type: Plain text
487 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
488 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
489 msgid ""
490 "The name choice B<IPC_PRIVATE> was perhaps unfortunate, B<IPC_NEW> would "
491 "more clearly show its function."
492 msgstr ""
493
494 #. type: SH
495 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
496 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
497 #, no-wrap
498 msgid "EXAMPLES"
499 msgstr ""
500
501 #. type: Plain text
502 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
503 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
504 msgid ""
505 "The program shown below uses B<semget>() to create a new semaphore set or "
506 "retrieve the ID of an existing set. It generates the I<key> for "
507 "B<semget>() using B<ftok>(3). The first two command-line arguments are "
508 "used as the I<pathname> and I<proj_id> arguments for B<ftok>(3). The third "
509 "command-line argument is an integer that specifies the I<nsems> argument for "
510 "B<semget>(). Command-line options can be used to specify the B<IPC_CREAT> "
511 "(I<-c>) and B<IPC_EXCL> (I<-x>) flags for the call to B<semget>(). The "
512 "usage of this program is demonstrated below."
513 msgstr ""
514
515 #. type: Plain text
516 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
517 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
518 msgid ""
519 "We first create two files that will be used to generate keys using "
520 "B<ftok>(3), create two semaphore sets using those files, and then list the "
521 "sets using B<ipcs>(1):"
522 msgstr ""
523
524 #. type: Plain text
525 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
526 #: opensuse-tumbleweed
527 #, no-wrap
528 msgid ""
529 "$B< touch mykey mykey2>;\n"
530 "$B< ./t_semget -c mykey p 1>;\n"
531 "ID = 9\n"
532 "$B< ./t_semget -c mykey2 p 2>;\n"
533 "ID = 10\n"
534 "$B< ipcs -s>;\n"
535 "\\&\n"
536 "------ Semaphore Arrays --------\n"
537 "key semid owner perms nsems\n"
538 "0x7004136d 9 mtk 600 1\n"
539 "0x70041368 10 mtk 600 2\n"
540 msgstr ""
541
542 #. type: Plain text
543 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
544 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
545 msgid ""
546 "Next, we demonstrate that when B<semctl>(2) is given the same I<key> (as "
547 "generated by the same arguments to B<ftok>(3)), it returns the ID of the "
548 "already existing semaphore set:"
549 msgstr ""
550
551 #. type: Plain text
552 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
553 #: opensuse-tumbleweed
554 #, no-wrap
555 msgid ""
556 "$B< ./t_semget -c mykey p 1>;\n"
557 "ID = 9\n"
558 msgstr ""
559
560 #. type: Plain text
561 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
562 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
563 msgid ""
564 "Finally, we demonstrate the kind of collision that can occur when "
565 "B<ftok>(3) is given different I<pathname> arguments that have the same "
566 "inode number:"
567 msgstr ""
568
569 #. type: Plain text
570 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
571 #: opensuse-tumbleweed
572 #, no-wrap
573 msgid ""
574 "$B< ln mykey link>;\n"
575 "$B< ls -i1 link mykey>;\n"
576 "2233197 link\n"
577 "2233197 mykey\n"
578 "$B< ./t_semget link p 1>; # Generates same key as \\[aq]mykey\\[aq]\n"
579 "ID = 9\n"
580 msgstr ""
581
582 #. type: SS
583 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
584 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
585 #, no-wrap
586 msgid "Program source"
587 msgstr ""
588
589 #. type: Plain text
590 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
591 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
592 #, no-wrap
593 msgid ""
594 "/* t_semget.c\n"
595 "\\&\n"
596 " Licensed under GNU General Public License v2 or later.\n"
597 "*/\n"
598 "#include E<lt>stdio.hE<gt>\n"
599 "#include E<lt>stdlib.hE<gt>\n"
600 "#include E<lt>sys/ipc.hE<gt>\n"
601 "#include E<lt>sys/sem.hE<gt>\n"
602 "#include E<lt>unistd.hE<gt>\n"
603 "\\&\n"
604 "static void\n"
605 "usage(const char *pname)\n"
606 "{\n"
607 " fprintf(stderr, \"Usage: %s [-cx] pathname proj-id num-sems\\[rs]n\",\n"
608 " pname);\n"
609 " fprintf(stderr, \" -c Use IPC_CREAT flag\\[rs]n\");\n"
610 " fprintf(stderr, \" -x Use IPC_EXCL flag\\[rs]n\");\n"
611 " exit(EXIT_FAILURE);\n"
612 "}\n"
613 "\\&\n"
614 "int\n"
615 "main(int argc, char *argv[])\n"
616 "{\n"
617 " int semid, nsems, flags, opt;\n"
618 " key_t key;\n"
619 "\\&\n"
620 " flags = 0;\n"
621 " while ((opt = getopt(argc, argv, \"cx\")) != -1) {\n"
622 " switch (opt) {\n"
623 " case \\[aq]c\\[aq]: flags |= IPC_CREAT; break;\n"
624 " case \\[aq]x\\[aq]: flags |= IPC_EXCL; break;\n"
625 " default: usage(argv[0]);\n"
626 " }\n"
627 " }\n"
628 "\\&\n"
629 " if (argc != optind + 3)\n"
630 " usage(argv[0]);\n"
631 "\\&\n"
632 " key = ftok(argv[optind], argv[optind + 1][0]);\n"
633 " if (key == -1) {\n"
634 " perror(\"ftok\");\n"
635 " exit(EXIT_FAILURE);\n"
636 " }\n"
637 "\\&\n"
638 " nsems = atoi(argv[optind + 2]);\n"
639 "\\&\n"
640 " semid = semget(key, nsems, flags | 0600);\n"
641 " if (semid == -1) {\n"
642 " perror(\"semget\");\n"
643 " exit(EXIT_FAILURE);\n"
644 " }\n"
645 "\\&\n"
646 " printf(\"ID = %d\\[rs]n\", semid);\n"
647 "\\&\n"
648 " exit(EXIT_SUCCESS);\n"
649 "}\n"
650 msgstr ""
651
652 #. SRC END
653 #. type: SH
654 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
655 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
656 #, no-wrap
657 msgid "SEE ALSO"
658 msgstr ""
659
660 #. type: Plain text
661 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
662 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
663 msgid ""
664 "B<semctl>(2), B<semop>(2), B<ftok>(3), B<capabilities>(7), "
665 "B<sem_overview>(7), B<sysvipc>(7)"
666 msgstr ""
667
668 #. type: TH
669 #: debian-trixie
670 #, no-wrap
671 msgid "2024-06-15"
672 msgstr ""
673
674 #. type: TH
675 #: debian-trixie
676 #, no-wrap
677 msgid "Linux man-pages 6.9.1"
678 msgstr ""
679
680 #. type: Plain text
681 #: debian-trixie
682 msgid "Standard C library (I<libc>, I<-lc>)"
683 msgstr ""
684
685 #. type: Plain text
686 #: debian-trixie fedora-44 fedora-rawhide
687 msgid "POSIX.1-2008."
688 msgstr ""
689
690 #. type: Plain text
691 #: debian-trixie fedora-44 fedora-rawhide
692 #, no-wrap
693 msgid ""
694 "$ B<touch mykey mykey2>\n"
695 "$ B<./t_semget -c mykey p 1>\n"
696 "ID = 9\n"
697 "$ B<./t_semget -c mykey2 p 2>\n"
698 "ID = 10\n"
699 "$ B<ipcs -s>\n"
700 "\\&\n"
701 "------ Semaphore Arrays --------\n"
702 "key semid owner perms nsems\n"
703 "0x7004136d 9 mtk 600 1\n"
704 "0x70041368 10 mtk 600 2\n"
705 msgstr ""
706
707 #. type: Plain text
708 #: debian-trixie fedora-44 fedora-rawhide
709 #, no-wrap
710 msgid ""
711 "$ B<./t_semget -c mykey p 1>\n"
712 "ID = 9\n"
713 msgstr ""
714
715 #. type: Plain text
716 #: debian-trixie fedora-44 fedora-rawhide
717 #, no-wrap
718 msgid ""
719 "$ B<ln mykey link>\n"
720 "$ B<ls -i1 link mykey>\n"
721 "2233197 link\n"
722 "2233197 mykey\n"
723 "$ B<./t_semget link p 1> # Generates same key as \\[aq]mykey\\[aq]\n"
724 "ID = 9\n"
725 msgstr ""
726
727 #. type: TH
728 #: fedora-44 fedora-rawhide
729 #, no-wrap
730 msgid "2024-07-23"
731 msgstr ""
732
733 #. type: TH
734 #: fedora-44 fedora-rawhide
735 #, no-wrap
736 msgid "Linux man-pages 6.13"
737 msgstr ""
738
739 #. type: TH
740 #: mageia-cauldron
741 #, no-wrap
742 msgid "Linux man-pages 6.17"
743 msgstr ""
744
745 #. type: TH
746 #: opensuse-leap-16-1 opensuse-tumbleweed
747 #, no-wrap
748 msgid "Linux man-pages (unreleased)"
749 msgstr ""