OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / release / man7 / sem_overview.7
1 '\" t
2 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\"
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
27 .\" Translated 2006-04-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
28 .\" Updated 2008-08-07, Akihiro MOTOKI, LDP v3.05
29 .\" Updated 2009-02-23, Akihiro MOTOKI, LDP v3.19
30 .\"
31 .TH SEM_OVERVIEW 7 2010-05-22 "Linux" "Linux Programmer's Manual"
32 .SH Ì¾Á°
33 sem_overview \- POSIX ¥»¥Þ¥Õ¥©¤Î³µÍ×
34 .SH ÀâÌÀ
35 POSIX ¥»¥Þ¥Õ¥©¤ò»ÈÍѤ¹¤ë¤È¡¢¥×¥í¥»¥¹¤ä¥¹¥ì¥Ã¥É´Ö¤Ç¤½¤ÎÆ°ºî¤ò
36 Ʊ´ü¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
37
38 ¥»¥Þ¥Õ¥©¤ÏÀ°¿ô¤Ç¤¢¤ê¡¢¤½¤ÎÃͤϷ褷¤Æ 0 Ì¤Ëþ¤Ë¤Ê¤ë¤³¤È¤Ïµö¤µ¤ì¤Ê¤¤¡£
39 ¥»¥Þ¥Õ¥©¤ËÂФ·¤Æ¤Ç¤­¤ëÁàºî¤Ï 2 ¤Ä¤Ç¤¢¤ë:
40 ¥»¥Þ¥Õ¥©Ãͤò 1 Áý¤ä¤¹
41 .RB ( sem_post (3));
42 ¥»¥Þ¥Õ¥©Ãͤò 1 ¸º¤é¤¹
43 .RB ( sem_wait (3))¡£
44 ¥»¥Þ¥Õ¥©¤ÎÃͤ¬¤¹¤Ç¤Ë 0 ¤Î¾ì¹ç¡¢¥»¥Þ¥Õ¥©Ãͤ¬ 0 ¤è¤êÂ礭¤¯¤Ê¤ë¤Þ¤Ç
45 .BR sem_wait (3)
46 Áàºî¤ÏÄä»ß (block) ¤¹¤ë¡£
47
48 POSIX ¥»¥Þ¥Õ¥©¤Ë¤Ï¡¢Ì¾Á°ÉÕ¤­¥»¥Þ¥Õ¥© (named semaphore) ¤È
49 ̾Á°¤Ê¤·¥»¥Þ¥Õ¥© (unnamed semaphore) ¤Î 2¤Ä¤Î·Á¤¬¤¢¤ë¡£
50 .TP
51 .B Ì¾Á°ÉÕ¤­¥»¥Þ¥Õ¥©
52 ̾Á°ÉÕ¤­¥»¥Þ¥Õ¥©¤Ï
53 .I /somename
54 ¤È¤¤¤¦·Á¼°¤Î̾Á°¤Ç¼±Ê̤µ¤ì¤ë¡£
55 ¤½¤Î̾Á°¤Ï¡¢ºÇÂç¤Ç
56 .BI NAME_MAX \-4
57 (¤¹¤Ê¤ï¤Á 251) Ê¸»ú¤Î NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤Ç¡¢
58 .\" glibc allows the initial slash to be omitted, and makes
59 .\" multiple initial slashes equivalent to a single slash.
60 .\" This differs from the implementation of POSIX message queues.
61 ¥¹¥é¥Ã¥·¥å¤Ç»Ï¤Þ¤ê¡¢¥¹¥é¥Ã¥·¥å°Ê³°¤Îʸ»ú¤¬ 1 Ê¸»ú°Ê¾å³¤¯·Á¼°¤Ç¤¢¤ë¡£
62 .\" glibc allows subdirectory components in the name, in which
63 .\" case the subdirectory tree must exist under /dev/shm, and
64 .\" the fist subdirectory component must exist as the name
65 .\" sem.name, and all of the subdirectory components must allow the
66 .\" required permissions if a user wants to create a semaphore
67 .\" object in a subdirectory.
68 .BR sem_open (3)
69 ¤ËƱ¤¸Ì¾Á°¤òÅϤ¹¤³¤È¤Ë¤è¤ê¡¢2 ¤Ä¤Î¥×¥í¥»¥¹´Ö¤ÇƱ¤¸Ì¾Á°¤Î¥»¥Þ¥Õ¥©
70 ¤ËÂФ·Áàºî¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤ë¡£
71
72 .BR sem_open (3)
73 ´Ø¿ô¤Ï¡¢¿·¤·¤¤Ì¾Á°ÉÕ¤­¥»¥Þ¥Õ¥©¤òºîÀ®¤¹¤ë¤«¡¢´û¤Ë¸ºß¤¹¤ë̾Á°ÉÕ¤­
74 ¥»¥Þ¥Õ¥©¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£
75 ¥»¥Þ¥Õ¥©¤ò¥ª¡¼¥×¥ó¤·¤¿¸å¤Ï¡¢
76 .BR sem_post (3)
77 ¤È
78 .BR sem_wait (3)
79 ¤ò»È¤Ã¤Æ¥»¥Þ¥Õ¥©¤òÁàºî¤Ç¤­¤ë¡£
80 ¥×¥í¥»¥¹¤¬¥»¥Þ¥Õ¥©¤Î»ÈÍѤò½ª¤¨¤¿ºÝ¤Ï¡¢
81 .BR sem_close (3)
82 ¤ò»È¤Ã¤Æ¥»¥Þ¥Õ¥©¤ò¥¯¥í¡¼¥º¤Ç¤­¤ë¡£
83 ¤¢¤ë¥»¥Þ¥Õ¥©¤ò¤É¤Î¥×¥í¥»¥¹¤â»ÈÍѤ·¤Ê¤¯¤Ê¤ë¤È¡¢
84 .BR sem_unlink (3)
85 ¤ò»È¤Ã¤Æ¤½¤Î¥»¥Þ¥Õ¥©¤ò¥·¥¹¥Æ¥à¤«¤éºï½ü¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
86 .TP
87 .B Ì¾Á°¤Ê¤·¥»¥Þ¥Õ¥© (¥á¥â¥ê¥Ù¡¼¥¹¡¦¥»¥Þ¥Õ¥©)
88 ̾Á°¤Ê¤·¥»¥Þ¥Õ¥©¤Ï̾Á°¤ò»ý¤¿¤Ê¤¤¡£¤½¤ÎÂå¤ï¤ê¡¢¥»¥Þ¥Õ¥©¤Ï¡¢
89 Ê£¿ô¥¹¥ì¥Ã¥É´Ö¤Ç¶¦Í­¤µ¤ì¤¿¥á¥â¥êÎΰ衢¤â¤·¤¯¤ÏÊ£¿ô¥×¥í¥»¥¹´Ö¤Ç
90 ¶¦Í­¤µ¤ì¤¿¥á¥â¥êÎΰè¤ËÃÖ¤«¤ì¤ë (Á°¼Ô¤ò
91 .IR "¥¹¥ì¥Ã¥É¶¦Í­¥»¥Þ¥Õ¥© (thread-shared semaphore)" ¡¢
92 ¸å¼Ô¤ò
93 .IR "¥×¥í¥»¥¹¶¦Í­¥»¥Þ¥Õ¥© (process-shared semaphore)"
94 ¤È¸Æ¤Ö)¡£¥¹¥ì¥Ã¥É¶¦Í­¥»¥Þ¥Õ¥©¤Ï¡¢Æ±¤¸¥×¥í¥»¥¹Æâ¤Î¥¹¥ì¥Ã¥É´Ö¤Ç¶¦Í­¤µ¤ì¤¿
95 ¥á¥â¥êÎΰ衢Î㤨¤ÐÂç°èÊÑ¿ô (global variable) ¤ËÇÛÃÖ¤µ¤ì¤ë¡£
96 ¥×¥í¥»¥¹¶¦Í­¥»¥Þ¥Õ¥©¤Ï¡¢¶¦Í­¥á¥â¥êÎΰè (Î㤨¤Ð¡¢
97 .BR shmget (2)
98 ¤ò»È¤Ã¤ÆºîÀ®¤Ç¤­¤ë System V ¶¦Í­¥á¥â¥ê¡¦¥»¥°¥á¥ó¥È¤ä
99 .BR shm_open (3)
100 ¤ò»È¤Ã¤ÆºîÀ®¤Ç¤­¤ë POSIX ¶¦Í­¥á¥â¥ê¡¦¥ª¥Ö¥¸¥§¥¯¥È)
101 Æâ¤ËÇÛÃÖ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
102
103 ̾Á°¤Ê¤·¥»¥Þ¥Õ¥©¤Ï¡¢»ÈÍѤ¹¤ëÁ°¤Ë
104 .BR sem_init (3)
105 ¤ò»È¤Ã¤Æ½é´ü²½¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
106 ¥»¥Þ¥Õ¥©¤Ï
107 .BR sem_post (3)
108 ¤È
109 .BR sem_wait (3)
110 ¤ò»È¤Ã¤ÆÁàºî¤Ç¤­¤ë¡£
111 ¥»¥Þ¥Õ¥©¤¬¤â¤Ï¤äɬÍפʤ¯¤Ê¤Ã¤¿¤È¤­¤ä¡¢
112 ¥»¥Þ¥Õ¥©¤¬ÃÖ¤«¤ì¤Æ¤¤¤ë¥á¥â¥ê¤ò²òÊü¤¹¤ëÁ°¤Ë¤Ï¡¢
113 .BR sem_destroy (3)
114 ¤ò»È¤Ã¤Æ¥»¥Þ¥Õ¥©¤òÇË´þ¤¹¤Ù¤­¤Ç¤¢¤ë¡£
115 .PP
116 ¤³¤ÎÀá¤Î»Ä¤ê¤Ç¤Ï¡¢POSIX ¥»¥Þ¥Õ¥©¤Î Linux ¤Î¼ÂÁõ¤Î¾ÜºÙ
117 ¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£
118 .SS ¥Ð¡¼¥¸¥ç¥ó
119 ¥Ð¡¼¥¸¥ç¥ó 2.6 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï¡¢Linux ¤Ï
120 ̾Á°¤Ê¤·¤Î¥¹¥ì¥Ã¥É¶¦Í­¥»¥Þ¥Õ¥©¤Î¤ß¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤¿¡£
121 Linux 2.6 ¤È NPTL ¥¹¥ì¥Ã¥É¼ÂÁõ¤òÄ󶡤·¤Æ¤¤¤ë glibc ¤¬Æþ¤Ã¤¿
122 ¥·¥¹¥Æ¥à¤Ç¤Ï¡¢POSIX ¥»¥Þ¥Õ¥©¤Î´°Á´¤Ê¼ÂÁõ¤¬Ä󶡤µ¤ì¤ë¡£
123 .SS »ý³À­
124 POSIX Ì¾Á°ÉÕ¤­¥»¥Þ¥Õ¥©¤Ï¥«¡¼¥Í¥ëÆâ¤ÇÊÝ»ý¤µ¤ì¤ë¡£
125 .BR sem_unlink (3)
126 ¤Çºï½ü¤µ¤ì¤Ê¤±¤ì¤Ð¡¢¥»¥Þ¥Õ¥©¤Ï
127 ¥·¥¹¥Æ¥à¤¬¥·¥ã¥Ã¥È¥À¥¦¥ó¤µ¤ì¤ë¤Þ¤Ç¸ºß¤·Â³¤±¤ë¡£
128 .SS ¥ê¥ó¥¯
129 POSIX ¥»¥Þ¥Õ¥© API ¤ò»ÈÍѤ·¤¿¥×¥í¥°¥é¥à¤Ï
130 .I cc \-lrt
131 ¤Ç¥³¥ó¥Ñ¥¤¥ë¤·¡¢¥ê¥¢¥ë¥¿¥¤¥à¥é¥¤¥Ö¥é¥ê
132 .I librt
133 ¤È¥ê¥ó¥¯¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
134 .SS ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à·Ðͳ¤Ç¤Î̾Á°ÉÕ¤­¥»¥Þ¥Õ¥©¤Ø¤Î¥¢¥¯¥»¥¹
135 Linux ¤Ç¤Ï¡¢Ì¾Á°ÉÕ¤­¥»¥Þ¥Õ¥©¤Ï²¾ÁÛ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à
136 (virtual file system) Æâ¤Ë
137 .I \fBsem.\fPsomename
138 ¤È¤¤¤¦·Á¤Î̾Á°¤ÇºîÀ®¤µ¤ì¤ë¡£²¾ÁÛ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ÏÄ̾ï
139 .I /dev/shm
140 °Ê²¼¤Ë¥Þ¥¦¥ó¥È¤µ¤ì¤ë¡£
141 (¤³¤ì¤¬¡¢¥»¥Þ¥Õ¥©¤Î̾Á°¤Îʸ»ú¿ô¤Î¾å¸Â¤¬
142 .B NAME_MAX
143 ¤Ç¤Ï¤Ê¤¯
144 .BI NAME_MAX \-4
145 ¤È¤Ê¤Ã¤Æ¤¤¤ëÍýͳ¤Ç¤¢¤ë¡£)
146
147 Linux 2.6.19 °Ê¹ß¤Ç¤Ï¡¢¤³¤Î¥Ç¥£¥ì¥¯¥È¥êÇÛ²¼¤Î¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ ACL ¤ò
148 ÀßÄê¤Ç¤­¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Îµö²Ä¤ò¥æ¡¼¥¶Ã±°Ì¡¢¥°¥ë¡¼¥×ñ°Ì¤ÇÀ©¸æ¤¹¤ë¤³¤È¤¬
149 ¤Ç¤­¤ë¡£
150 .SH ½àµò
151 POSIX.1-2001.
152 .SH Ãí°Õ
153 System V ¥»¥Þ¥Õ¥©
154 .RB ( semget (2),
155 .BR semop (2)
156 ¤Ê¤É) ¤Ï¸Å¤¤¥»¥Þ¥Õ¥© API ¤Ç¤¢¤ë¡£ POSIX ¥»¥Þ¥Õ¥©¤Ï System V ¤è¤ê¤â
157 ´Êñ¤Ç¡¢¤¦¤Þ¤¯À߷פµ¤ì¤¿¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤òÄ󶡤·¤Æ¤¤¤ë¡£
158 °ìÊý¤Ç¡¢POSIX ¥»¥Þ¥Õ¥©¤Ï System V ¥»¥Þ¥Õ¥©¤ÈÈæ¤Ù¤ë¤È
159 ÍøÍѤǤ­¤ë¥·¥¹¥Æ¥à¤¬¾¯¤Ê¤¤ (Æäˡ¢¸Å¤¤¥·¥¹¥Æ¥à¤Ç¤Ï¾¯¤Ê¤¤)¡£
160 .SH Îã
161 ³Æ¼ï¤Î POSIX ¥»¥Þ¥Õ¥©´Ø¿ô¤ò»ÈÍѤ·¤¿Î㤬
162 .BR sem_wait (3)
163 ¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ë¡£
164 .SH ´ØÏ¢¹àÌÜ
165 .BR sem_close (3),
166 .BR sem_destroy (3),
167 .BR sem_getvalue (3),
168 .BR sem_init (3),
169 .BR sem_open (3),
170 .BR sem_post (3),
171 .BR sem_unlink (3),
172 .BR sem_wait (3),
173 .BR pthreads (7)