1 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Modified Tue Oct 22 17:54:56 1996 by Eric S. Raymond <esr@thyrsus.com>
24 .\" Modified 1 Jan 2002, Martin Schulze <joey@infodrom.org>
25 .\" Modified 4 Jan 2002, Michael Kerrisk <mtk.manpages@gmail.com>
26 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
27 .\" Added notes on capability requirements
28 .\" Modified, 11 Nov 2004, Michael Kerrisk <mtk.manpages@gmail.com>
29 .\" Language and formatting clean-ups
30 .\" Added notes on /proc files
31 .\" Rewrote BUGS note about semget()'s failure to initialize
34 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
35 .\" all rights reserved.
36 .\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
37 .\" Updated 2003-04-08, Kentaro Shirakata <argrath@ub32.org>
38 .\" Updated 2005-03-01, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
39 .\" Updated 2006-07-20, Akihiro MOTOKI, LDP v2.36
41 .\"WORD: semaphore ¥»¥Þ¥Õ¥©
42 .\"WORD: identifier ¼±ÊÌ»Ò
44 .\"WORD: group ¥°¥ë¡¼¥×
46 .\"WORD: effective user ID ¼Â¸ú¥æ¡¼¥¶¡¼ ID
47 .\"WORD: effective group ID ¼Â¸ú¥°¥ë¡¼¥× ID
48 .\"WORD: calling process ¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹
49 .\"WORD: process ¥×¥í¥»¥¹
51 .\"WORD: structure ¹½Â¤ÂÎ
52 .\"WORD: initialize ½é´ü²½
53 .\"WORD: system call ¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë
55 .TH SEMGET 2 2004-05-27 "Linux" "Linux Programmer's Manual"
57 semget \- ¥»¥Þ¥Õ¥©½¸¹ç¤Î¼±Ê̻Ҥò¼èÆÀ¤¹¤ë
60 .B #include <sys/types.h>
61 .B #include <sys/ipc.h>
62 .B #include <sys/sem.h>
65 .BI "int semget(key_t " key ,
70 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢°ú¤¿ô
72 ¤ËÂбþ¤¹¤ë¥»¥Þ¥Õ¥©½¸¹ç (semaphore set) ¤Î
73 ¼±ÊÌ»Ò (identifier) ¤òÊÖ¤¹¡£
83 ¤ËÂбþ¤¹¤ë¥»¥Þ¥Õ¥©½¸¹ç¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¡¢
85 ¸Ä¤Î¥»¥Þ¥Õ¥©¤«¤é¤Ê¤ë¿·¤·¤¤½¸¹ç¤¬ºîÀ®¤µ¤ì¤ë¡£
92 ¤ÎξÊý¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
94 ¤ËÂбþ¤¹¤ë¥»¥Þ¥Õ¥©½¸¹ç¤¬´û¤Ë¸ºß¤¹¤ë¤È¡¢
105 ¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤ÎÆ°ºî¤ÈƱ¤¸¤Ç¤¢¤ë)¡£
107 ¥»¥Þ¥Õ¥©½¸¹çºîÀ®»þ¤Ë¡¢°ú¤¿ô
109 ¤Î²¼°Ì 9 ¥Ó¥Ã¥È¤Ï¡¢¤½¤Î¥»¥Þ¥Õ¥©½¸¹ç¤Î (½êÍ¼Ô (owner)¡¢¥°¥ë¡¼¥× (group)¡¢
110 ¾¿Í (others) ¤ËÂФ¹¤ë) ¥¢¥¯¥»¥¹µö²Ä¤ÎÄêµÁ¤È¤·¤Æ»ÈÍѤµ¤ì¤ë¡£
115 ¤ÈƱ¤¸·Á¼°¤ÇƱ¤¸°ÕÌ£¤Ç¤¢¤ë
116 (⤷¡¢¼Â¹Ô (execute) µö²Ä¤Ï¥»¥Þ¥Õ¥©¤Ç¤Ï°ÕÌ£¤ò»ý¤¿¤º¡¢
117 ½ñ¤¹þ¤ß (write) µö²Ä¤Ï¥»¥Þ¥Õ¥©ÃͤÎÊѹ¹ (alter) µö²Ä¤È¤·¤Æµ¡Ç½¤¹¤ë)¡£
119 ¿·¤·¤¯ºîÀ®¤µ¤ì¤¿¥»¥Þ¥Õ¥©½¸¹ç¤Î³Æ¥»¥Þ¥Õ¥©¤ÎÃͤÏÉÔÄê¤Ç¤¢¤ë
120 (¤³¤ÎÅÀ¤Ï POSIX.1-2001 ¤ËÌÀµ¤µ¤ì¤Æ¤¤¤ë)¡£
121 Linux ¤Ï¾¤Î¿¤¯¤Î¼ÂÁõ¤ÈƱÍͤ˥»¥Þ¥Õ¥©Ãͤò 0 ¤Ë½é´ü²½¤¹¤ë¤¬¡¢
122 °Ü¿¢À¤ò¹Íθ¤·¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¤³¤ÎÆ°ºî¤òÁ°Äó¤Ë¤¹¤Ù¤¤Ç¤Ï¤Ê¤¤¡£
123 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÏÌÀ¼¨Åª¤Ë¥»¥Þ¥Õ¥©¤ò´õ˾¤ÎÃͤǽé´ü²½¤¹¤Ù¤¤Ç¤¢¤ë¡£
124 .\" In truth, every one of the many implementations that I've tested sets
125 .\" the values to zero, but I suppose there is/was some obscure
126 .\" implementation out there that does not.
128 ¿·µ¬¤Î¥»¥Þ¥Õ¥©½¸¹ç¤òºîÀ®¤¹¤ëºÝ¡¢
130 ¤Ï¥»¥Þ¥Õ¥©½¸¹ç¤Î¾ðÊó¤òÊÝ»ý¤¹¤ë¥Ç¡¼¥¿¹½Â¤ÂÎ
132 ¤ò¼¡¤Î¤è¤¦¤Ë½é´ü²½¤¹¤ë
141 ¤Ë¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î¼Â¸ú (effective) ¥æ¡¼¥¶ ID ¤òÀßÄꤹ¤ë¡£
146 ¤Ë¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î¼Â¸ú (effective) ¥°¥ë¡¼¥× ID ¤òÀßÄꤹ¤ë¡£
151 ¤Î²¼°Ì 9 ¥Ó¥Ã¥È¤òÀßÄꤹ¤ë¡£
162 ¤Ë¸½ºß¤Î»þ¹ï¤òÀßÄꤹ¤ë¡£
164 ¥»¥Þ¥Õ¥©½¸¹ç¤ÎºîÀ®¤ò¹Ô¤ï¤Ê¤¤¾ì¹ç¤Ï¡¢°ú¤¿ô
166 ¤Ë (don't care ¤ò°ÕÌ£¤¹¤ë) 0 ¤ò»ØÄꤷ¤Æ¤â¤è¤¤¡£
169 ¤Ï 0 ¤è¤êÂ礤¤ÃͤǤʤ±¤ì¤Ð¤Ê¤é¤º¡¢¥»¥Þ¥Õ¥©½¸¹ç¤¢¤¿¤ê¤Î¥»¥Þ¥Õ¥©¤ÎºÇÂç¿ô
171 °Ê²¼¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
173 ¥»¥Þ¥Õ¥©½¸¹ç¤¬´û¤Ë¸ºß¤·¤¿¾ì¹ç¤Ï¡¢¥¢¥¯¥»¥¹µö²Ä¤Î¸¡ºº¤¬¹Ô¤ï¤ì¤ë¡£
174 .\" Ç˲õ (destruction) ¥Þ¡¼¥¯¤¬¤Ê¤¤¤«¥Á¥§¥Ã¥¯¤µ¤ì¤ë¡£
176 À®¸ù¤·¤¿¾ì¹ç¡¢¥»¥Þ¥Õ¥©½¸¹ç¤Î¼±ÊÌ»Ò (ÈóÉé¤ÎÀ°¿ô) ¤¬ÊÖ¤êÃͤȤʤ롣
177 ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
179 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹Ãͤ¬ÀßÄꤵ¤ì¤ë¡£
183 ¤Ë¤Ï°Ê²¼¤ÎÃͤΤ¤¤º¤ì¤«°ì¤Ä¤¬ÀßÄꤵ¤ì¤ë:
187 ¤ËÂбþ¤¹¤ë¥»¥Þ¥Õ¥©½¸¹ç¤Ï¸ºß¤¹¤ë¤¬¡¢
188 ¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Ï¤½¤Î½¸¹ç¤Ø¤Î¥¢¥¯¥»¥¹µö²Ä¤¬¤Ê¤¯¡¢
190 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤â»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
194 ¤ËÂбþ¤¹¤ë¥»¥Þ¥Õ¥©½¸¹ç¤¬Â¸ºß¤·¡¢
203 .\" ¥»¥Þ¥Õ¥©½¸¹ç¤Ëºï½ü (delete) ¥Þ¡¼¥¯¤¬¤Ä¤±¤é¤ì¤Æ¤¤¤ë¡£
207 ¤¬ 0 ¤è¤ê¾®¤µ¤¤¤«¡¢¥»¥Þ¥Õ¥©½¸¹ç¤¢¤¿¤ê¤Î¥»¥Þ¥Õ¥©¤ÎºÇÂç¿ô
212 ¤ËÂбþ¤¹¤ë¥»¥Þ¥Õ¥©½¸¹ç¤¬´û¤Ë¸ºß¤·¡¢
214 ¤¬¤½¤Î½¸¹ç¤Î¥»¥Þ¥Õ¥©¿ô¤è¤ê¤âÂ礤¤¡£
218 ¤ËÂбþ¤¹¤ë¥»¥Þ¥Õ¥©½¸¹ç¤¬Â¸ºß¤»¤º¡¢
222 ¤¬»ØÄꤵ¤ì¤Æ¤â¤¤¤Ê¤¤¡£
225 ¥»¥Þ¥Õ¥©½¸¹ç¤òºîÀ®¤·¤è¤¦¤È¤·¤¿¤¬¡¢¿·¤·¤¤¥Ç¡¼¥¿¹½Â¤ÂΤò
226 ºîÀ®¤¹¤ë¤Î¤Ë½½Ê¬¤Ê¥á¥â¥ê¤¬¥·¥¹¥Æ¥à¤Ë¸ºß¤·¤Ê¤¤¡£
229 ¥»¥Þ¥Õ¥©½¸¹ç¤òºîÀ®¤·¤è¤¦¤È¤¹¤ë¤È¡¢¥·¥¹¥Æ¥à¤Î¥»¥Þ¥Õ¥©½¸¹ç¤Î
232 ¤«¡¢¥·¥¹¥Æ¥àÁ´ÂΤΥ»¥Þ¥Õ¥©¤ÎºÇÂç¿ô
234 ¤Î¤¤¤º¤ì¤«¤òĶ¤¨¤Æ¤·¤Þ¤¦¡£
237 .\" SVr4 ¤Ë¤Ï¡¢ÄÉ²Ã¤Ç EFBIG, E2BIG, EAGAIN, ERANGE, EFAULT
238 .\" ¤Î¥¨¥é¡¼¾õÂ֤ˤĤ¤¤Æ¤Îµ½Ò¤¬¤¢¤ë¡£
241 ¤Ï¥Õ¥é¥°¡¦¥Õ¥£¡¼¥ë¥É¤Ë»ØÄꤹ¤ë¤â¤Î¤Ç¤Ï¤Ê¤¯¡¢
249 ¤Î²¼°Ì 9 ¥Ó¥Ã¥È°Ê³°¤ÏÁ´¤Æ̵»ë¤·¡¢
250 (À®¸ù¤·¤¿¾ì¹ç¤Ï) ¿·¤·¤¤¥»¥Þ¥Õ¥©½¸¹ç¤òºîÀ®¤¹¤ë¡£
252 ¥»¥Þ¥Õ¥©½¸¹ç¤Î¥ê¥½¡¼¥¹¤Ë´Ø¤¹¤ëÀ©¸Â¤Î¤¦¤Á¡¢
254 ¤Ë±Æ¶Á¤òµÚ¤Ü¤¹¤â¤Î¤ò°Ê²¼¤Ëµó¤²¤ë:
257 ¥·¥¹¥Æ¥àÁ´ÂΤΥ»¥Þ¥Õ¥©½¸¹ç¤ÎºÇÂç¿ô: Êý¿Ë°Í¸
258 (Linux ¤Ç¤Ï¡¢¤³¤ÎÀ©¸ÂÃͤÏ
259 .I /proc/sys/kernel/sem
260 ¤ÎÂè4¥Õ¥£¡¼¥ë¥É¤ËÂбþ¤·¡¢Æɤ߽Ф·¤âÊѹ¹¤â¤Ç¤¤ë)¡£
261 .\" ¤³¤Î /proc ¥Õ¥¡¥¤¥ë¤Ï Linux 2.2 °ÊÁ°¤Ç¤ÏÍøÍѤǤ¤Ê¤¤ -- MTK
264 semid ¤¢¤¿¤ê¤Î¥»¥Þ¥Õ¥©¤ÎºÇÂç¿ô: ¼ÂÁõ°Í¸
265 (Linux ¤Ç¤Ï¡¢¤³¤ÎÀ©¸ÂÃͤÏ
266 .I /proc/sys/kernel/sem
267 ¤ÎÂè1¥Õ¥£¡¼¥ë¥É¤ËÂбþ¤·¡¢Æɤ߽Ф·¤âÊѹ¹¤â¤Ç¤¤ë)¡£
270 ¥·¥¹¥Æ¥àÁ´ÂΤΥ»¥Þ¥Õ¥©¤ÎºÇÂç¿ô: Êý¿Ë°Í¸
271 (Linux ¤Ç¤Ï¡¢¤³¤ÎÀ©¸ÂÃͤÏ
272 .I /proc/sys/kernel/sem
273 ¤ÎÂè2¥Õ¥£¡¼¥ë¥É¤ËÂбþ¤·¡¢Æɤ߽Ф·¤âÊѹ¹¤â¤Ç¤¤ë)¡£
275 ¤è¤êÂ礤ÊÃͤϰÕÌ£¤ò»ý¤¿¤Ê¤¤¡£
278 ¤È¤¤¤¦Ì¾Á°¤òÁª¤ó¤À¤Î¤Ï¤ª¤½¤é¤¯¼ºÇԤǤ¢¤í¤¦¡£
280 ¤ÎÊý¤¬¤è¤êÌÀ³Î¤Ë¤½¤Îµ¡Ç½¤òɽ¤·¤Æ¤¤¤ë¤À¤í¤¦¡£
282 ¥»¥Þ¥Õ¥©½¸¹çÆâ¤Î¥»¥Þ¥Õ¥©¤Ï
285 .\" ¼ÂºÝ¤Ï Linux ¤Ç¤Ï¥»¥Þ¥Õ¥©¤Ï 0 ¤Ë½é´ü²½¤µ¤ì¤ë¤¬¡¢
286 .\" POSIX.1-2001 ¤Ç¤Ï¤³¤¦¤Ê¤ë¤³¤È¤òµ¬Äꤷ¤Æ¤¤¤ëÌõ¤Ç¤Ï¤Ê¤¤¤Î¤Ç¡¢
287 .\" °Ü¿¢¤ò¹Íθ¤¹¤ë¤È¤¤Ë¤Ï¤³¤ì¤òÁ°Äó¤Ë¤·¤Æ¤Ï¤¤¤±¤Ê¤¤¡£
288 ¤³¤Î¥»¥Þ¥Õ¥©¤ò½é´ü²½¤¹¤ë¤Ë¤Ï¡¢¥»¥Þ¥Õ¥©½¸¹ç¤ËÂФ·¤Æ
294 Áàºî¤ò¼Â¹Ô¤¹¤ëɬÍפ¬¤¢¤ë¡£
295 (Ê£¿ô²Õ½ê¤«¤é¥»¥Þ¥Õ¥©½¸¹ç¤ÎÁàºî¤¬¹Ô¤ï¤ì¤ë¾ìÌ̤Ǥϡ¢
296 郎ºÇ½é¤Ë½¸¹ç¤ò½é´ü²½¤¹¤ì¤Ð¤è¤¤¤«Ê¬¤«¤é¤Ê¤¤¡£
297 ¤³¤Î¾õ¶·¤òÈò¤±¤ë¤Ë¤Ï¡¢
301 Áàºî¤Ç¼èÆÀ¤Ç¤¤ë¥»¥Þ¥Õ¥©¤Î¥Ç¡¼¥¿¹½Â¤ÂΤÎ
303 ¤¬ 0 °Ê³°¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ì¤Ð¤è¤¤¡£)
308 .BR capabilities (7),
309 .BR sem_overview (7),