OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man2 / futex.2
1 .\" Page by b.hubert - may be freely modified and distributed
2 .\"
3 .\" Niki A. Rahimi (LTC Security Development, narahimi@us.ibm.com)
4 .\" added ERRORS section.
5 .\"
6 .\" Modified 2004-06-17 mtk
7 .\" Modified 2004-10-07 aeb, added FUTEX_REQUEUE, FUTEX_CMP_REQUEUE
8 .\"
9 .\" FIXME
10 .\" 2.6.14 adds FUTEX_WAKE_OP
11 .\" 2.6.18 adds (Ingo Molnar) priority inheritance support:
12 .\" FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI.  These need
13 .\" to be documented in the manual page.  Probably there is sufficient
14 .\" material in the kernel source file Documentation/pi-futex.txt.
15 .\" 2.6.25 adds FUTEX_WAKE_BITSET, FUTEX_WAIT_BITSET
16 .\"
17 .\" Japanese Version Copyright(C) 2003 Suzuki Takashi
18 .\"         all rights reserved.
19 .\" Translated Fri Oct 24 10:37:10 JST 2003
20 .\"         by Suzuki Takashi.
21 .\" Updated & Modified Sat Feb  5 14:28:53 JST 2005
22 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.01
23 .\" Updated & Modified Wed Jan  3 04:51:22 JST 2007 by Yuichi SATO, LDP v2.43
24 .\"
25 .\"WORD: integer                int ·¿ÊÑ¿ô
26 .\"WORD: sleep                  µ¯¾²ÂÔ¤Á¤¹¤ë
27 .\"WORD: wake                   µ¯¾²¤¹¤ë
28 .\"WORD: wake up                µ¯¾²¤¹¤ë
29 .\"
30 .TH FUTEX 2 2008-11-27 "Linux" "Linux Programmer's Manual"
31 .\"O .SH NAME
32 .SH Ì¾Á°
33 .\"O futex \- Fast Userspace Locking system call
34 futex \- ¹â®¥æ¡¼¥¶¶õ´Ö¥í¥Ã¥¯µ¡¹½¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë
35 .\"O .SH SYNOPSIS
36 .SH ½ñ¼°
37 .nf
38 .sp
39 .B "#include <linux/futex.h>"
40 .B "#include <sys/time.h>"
41 .sp
42 .BI "int futex(int *" uaddr ", int " op ", int " val \
43 ", const struct timespec *" timeout ,
44 .br
45 .BI "          int *" uaddr2 ", int " val3 );
46 .\" int *? void *? u32 *?
47 .fi
48 .\"O .SH "DESCRIPTION"
49 .SH ÀâÌÀ
50 .PP
51 .\"O The
52 .\"O .BR futex ()
53 .\"O system call provides a method for
54 .\"O a program to wait for a value at a given address to change, and a
55 .\"O method to wake up anyone waiting on a particular address (while the
56 .\"O addresses for the same memory in separate processes may not be
57 .\"O equal, the kernel maps them internally so the same memory mapped in
58 .\"O different locations will correspond for
59 .\"O .BR futex ()
60 .\"O calls).
61 .\"O It is typically used to
62 .\"O implement the contended case of a lock in shared memory, as
63 .\"O described in
64 .\"O .BR futex (7).
65 .BR futex ()
66 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢
67 »ØÄꤷ¤¿¥¢¥É¥ì¥¹¤ÎÃͤ¬Êѹ¹¤µ¤ì¤ë¤Î¤ò¥×¥í¥°¥é¥à¤¬ÂԤļêÃʤä
68 ÆÃÄê¤Î¥¢¥É¥ì¥¹¤ËÂФ·¤ÆÂÔµ¡Ãæ¤Î¥×¥í¥»¥¹¤ò wake (µ¯¾²) ¤µ¤»¤ë¼êÃʤòÄ󶡤¹¤ë
69 (¥×¥í¥»¥¹¤¬°Û¤Ê¤ì¤ÐƱ¤¸¥á¥â¥ê¤ËÂФ¹¤ë¥¢¥É¥ì¥¹¤âƱ¤¸¤Ç¤Ï¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤¤¬¡¢
70 ¥«¡¼¥Í¥ë¤Ï°Û¤Ê¤ë°ÌÃ֤˥ޥåפµ¤ì¤¿Æ±¤¸¥á¥â¥ê¤ò
71 .BR futex ()
72 ¤Ç»È¤¨¤ë¤è¤¦ÆâÉô¤Ç¥Þ¥Ã¥×¤¹¤ë)¡£
73 ŵ·¿Åª¤Ë¤Ï¡¢futex ¤Ï
74 .BR futex (7)
75 ¤Ëµ­¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ë¡¢
76 ¶¦Í­¥á¥â¥êÃæ¤Î¥í¥Ã¥¯¤¬¶¥¹ç¤¹¤ë¾ì¹ç¤Î½èÍý¤ò¼ÂÁõ¤¹¤ë¤Î¤ËÍѤ¤¤é¤ì¤ë¡£
77 .PP
78 .\"O When a
79 .\"O .BR futex (7)
80 .\"O operation did not finish uncontended in userspace, a call needs to be made
81 .\"O to the kernel to arbitrate.
82 .\"O Arbitration can either mean putting the calling
83 .\"O process to sleep or, conversely, waking a waiting process.
84 .BR futex (7)
85 ¤ÎÁàºî¤¬¥æ¡¼¥¶¶õ´Ö¤Ç¶¥¹ç¤Ê¤¯´°Î»¤·¤Ê¤«¤Ã¤¿¾ì¹ç¡¢
86 ¥«¡¼¥Í¥ë¤ËÃçºÛ¤µ¤»¤ë¤¿¤á¤Ë¥·¥¹¥Æ¥à¥³¡¼¥ë¤ò¸Æ¤ÖɬÍפ¬¤¢¤ë¡£
87 ÃçºÛ¤È¤¤¤¦¤Î¤Ï¡¢¸Æ¤Ó½Ð¤·¥×¥í¥»¥¹¤ò sleep (µ¯¾²ÂÔ¤Á) ¤µ¤»¤¿¤ê¡¢È¿ÂФË
88 ÂÔ¤Á¥×¥í¥»¥¹¤ò wake ¤µ¤»¤¿¤ê¤¹¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
89 .PP
90 .\"O Callers of this function are expected to adhere to the semantics as set out in
91 .\"O .BR futex (7).
92 .\"O As these
93 .\"O semantics involve writing nonportable assembly instructions, this in turn
94 .\"O probably means that most users will in fact be library authors and not
95 .\"O general application developers.
96 ¤³¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹¥×¥í¥»¥¹¤Ï
97 .BR futex (7)
98 ¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ë¥»¥Þ¥ó¥Æ¥£¥¯¥¹¤ËÃé¼Â¤Ç¤¢¤ë¤³¤È¤¬Í׵ᤵ¤ì¤ë¡£
99 ¤³¤Î¥»¥Þ¥ó¥Æ¥£¥¯¥¹¤Ë¤Ï°Ü¿¢ÉÔ²Äǽ¤Ê¥¢¥»¥ó¥Ö¥êÌ¿Îá¤ò½ñ¤¯¤³¤È¤¬´Þ¤Þ¤ì¤ë¡£
100 ¤³¤Î¤³¤È¤Ï¸À¤¤´¹¤¨¤ë¤È futex ¤Î¥æ¡¼¥¶¤Î¤Û¤È¤ó¤É¤Ï¼ÂºÝ¤Ï¥é¥¤¥Ö¥é¥ê¤Îºî¼Ô¤Ç¤¢¤ê¡¢
101 °ìÈÌ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î³«È¯¼Ô¤Ç¤Ï¤Ê¤¤¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£
102 .PP
103 .\"O The
104 .\"O .I uaddr
105 .\"O argument needs to point to an aligned integer which stores the counter.
106 .\"O The operation to execute is passed via the
107 .\"O .I op
108 .\"O argument, along with a value
109 .\"O .IR val .
110 .I uaddr
111 °ú¤­¿ô¤Ï¡¢¥«¥¦¥ó¥¿¤ò³ÊǼ¤¹¤ë¡¢
112 ¥¢¥é¥¤¥ó¥á¥ó¥È¤Î·¤Ã¤¿ int ·¿ÊÑ¿ô¤ò»Ø¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
113 ¼Â¹Ô¤¹¤ëÁàºî¤Ï
114 .I op
115 °ú¤­¿ô¤ò²ð¤·¤Æ¡¢ÃÍ
116 .I val
117 ¤È¤È¤â¤ËÅϤµ¤ì¤ë¡£
118 .PP
119 .\"O Five operations are currently defined:
120 ¸½ºß¤Î¤È¤³¤í 5 ¤Ä¤ÎÁàºî¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë:
121 .TP
122 .B FUTEX_WAIT
123 .\"O This operation atomically verifies that the futex address
124 .\"O .I uaddr
125 .\"O still contains the value
126 .\"O .IR val ,
127 .\"O and sleeps awaiting
128 .\"O .B FUTEX_WAKE
129 .\"O on this futex address.
130 .\"O If the
131 .\"O .I timeout
132 .\"O argument is non-NULL, its contents describe the maximum
133 .\"O duration of the wait, which is infinite otherwise.
134 .\"O The arguments
135 .\"O .I uaddr2
136 .\"O and
137 .\"O .I val3
138 .\"O are ignored.
139 ¤³¤ÎÁàºî¤Ï futex ¥¢¥É¥ì¥¹
140 .I uaddr
141 ¤Ë»ØÄꤵ¤ì¤¿ÃÍ
142 .I val
143 ¤¬¤Þ¤À³ÊǼ¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤òÉÔ²ÄʬÁàºî¤Ç¸¡¾Ú¤·¡¢
144 sleep ¾õÂÖ¤Ç
145 ¤³¤Î futex ¥¢¥É¥ì¥¹¤ËÂФ·¤Æ
146 .B FUTEX_WAKE
147 ¤¬¼Â¹Ô¤µ¤ì¤ë¤Î¤òÂԤġ£
148 .I timeout
149 °ú¤­¿ô¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢¤½¤ÎÆâÍƤÏ
150 ÂÔ¤Á»þ´Ö¤ÎºÇÂçÃͤòɽ¤¹¡£NULL ¤Î¾ì¹ç¤Ï̵¸ÂÂç¤òɽ¤¹¡£
151 °ú¤­¿ô
152 .I uaddr2
153 ¤È
154 .I val3
155 ¤Ï̵»ë¤µ¤ì¤ë¡£
156
157 .\"O For
158 .\"O .BR futex (7),
159 .\"O this call is executed if decrementing the count gave a negative value
160 .\"O (indicating contention), and will sleep until another process releases
161 .\"O the futex and executes the
162 .\"O .B FUTEX_WAKE
163 .\"O operation.
164 .BR futex (7)
165 ¤Ë¾È¤é¤·¹ç¤ï¤»¤ë¤È¡¢¤³¤Î¸Æ¤Ó½Ð¤·¤Ï
166 ¥«¥¦¥ó¥È¤Î¥Ç¥¯¥ê¥á¥ó¥È¤ÇÉé¤ÎÃÍ (¶¥¹ç¤òɽ¤¹) ¤Ë¤Ê¤Ã¤¿¾ì¹ç¤Ë¼Â¹Ô¤µ¤ì¡¢
167 ÊÌ¤Î¥×¥í¥»¥¹¤¬¤½¤Î futex ¤ò²òÊü¤·
168 .B FUTEX_WAKE
169 ¤ÎÁàºî¤ò¼Â¹Ô¤¹¤ë¤Þ¤Ç sleep ¤¹¤ë¡£
170 .TP
171 .B FUTEX_WAKE
172 .\"O This operation wakes at most \fIval\fP
173 .\"O processes waiting on this futex address (i.e., inside
174 .\"O .BR FUTEX_WAIT ).
175 ¤³¤ÎÁàºî¤Ç¤Ï»ØÄꤷ¤¿ futex ¥¢¥É¥ì¥¹¤ËÂФ·¤ÆÂÔ¤Á¾õÂÖ¤Î
176 (¤¹¤Ê¤ï¤Á
177 .B FUTEX_WAIT
178 Ãæ¤Î) ºÇÂç \fIval\fP ¸Ä¤Î¥×¥í¥»¥¹¤ò wake ¤µ¤»¤ë¡£
179 .\"O The arguments
180 .\"O .IR timeout ,
181 .\"O .I uaddr2
182 .\"O and
183 .\"O .I val3
184 .\"O are ignored.
185 °ú¤­¿ô
186 .IR timeout ,
187 .IR uaddr2 ,
188 .I val3
189 ¤Ï̵»ë¤µ¤ì¤ë¡£
190
191 .\"O For
192 .\"O .BR futex (7),
193 .\"O this is executed if incrementing
194 .\"O the count showed that there were waiters, once the futex value has been set
195 .\"O to 1 (indicating that it is available).
196 \fBfutex\fR(4) ¤Ë¾È¤é¤·¹ç¤ï¤»¤ë¤È¡¢
197 ¤³¤ÎÁàºî¤Ï
198 ¥«¥¦¥ó¥È¤Î¥¤¥ó¥¯¥ê¥á¥ó¥È¤ÇÂÔ¤Á¥×¥í¥»¥¹¤¬¤¢¤ë¤ÈȽÌÀ¤·¡¢
199 futex Ãͤ¬ 1 ¤ËÀßÄꤵ¤ì¤¿ (ÍøÍѲÄǽ¤Ç¤¢¤ë¤³¤È¤òɽ¤¹) ¾ì¹ç¤Ë¼Â¹Ô¤µ¤ì¤ë¡£
200 .TP
201 .\"O .BR FUTEX_FD " (present up to and including Linux 2.6.25)"
202 .BR FUTEX_FD " (Linux 2.6.25 °ÊÁ°)"
203 .\"O To support asynchronous wakeups, this operation associates a file descriptor
204 .\"O with a futex.
205 .\"O .\" , suitable for .BR poll (2).
206 .\"O If another process executes a
207 .\"O .BR FUTEX_WAKE ,
208 .\"O the process will receive the signal number that was passed in
209 .\"O number that was passed in
210 .\"O .IR val .
211 .\"O The calling process must close the returned file descriptor after use.
212 ÈóƱ´ü¤Î wake ¤ËÂбþ¤¹¤ë¤¿¤á¡¢¤³¤ÎÁàºî¤Ï¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò futex ¤Ë
213 ´ØÏ¢¤Å¤±¤ë¡£
214 .\" .BR poll (2)
215 .\" ¤ËŬ¤·¤Æ¤¤¤ë¡£
216 ÊÌ¤Î¥×¥í¥»¥¹¤¬
217 .B FUTEX_WAKE
218 ¤ò¼Â¹Ô¤¹¤ë¤È¡¢¥×¥í¥»¥¹¤Ï
219 .I val
220 ¤ÇÅϤµ¤ì¤¿¥·¥°¥Ê¥ëÈÖ¹æ¤Î¥·¥°¥Ê¥ë¤ò¼õ¿®¤¹¤ë¡£
221 ¸Æ¤Ó½Ð¤·¥×¥í¥»¥¹¤Ï»ÈÍѸ塢ÊÖ¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò
222 ¥¯¥í¡¼¥º¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
223 .\"O The arguments
224 .\"O .IR timeout ,
225 .\"O .I uaddr2
226 .\"O and
227 .\"O .I val3
228 .\"O are ignored.
229 °ú¤­¿ô
230 .IR timeout ,
231 .IR uaddr2 ,
232 .I val3
233 ¤Ï̵»ë¤µ¤ì¤ë¡£
234
235 .\"O To prevent race conditions, the caller should test if the futex has
236 .\"O been upped after
237 .\"O .B FUTEX_FD
238 .\"O returns.
239 ¶¥¹ç¾õÂÖ¤òËɻߤ¹¤ë¤¿¤á¡¢¸Æ¤Ó½Ð¤·¥×¥í¥»¥¹¤Ï
240 .B FUTEX_FD
241 ¤¬Ê֤俤¢¤È
242 futex ¤¬ up ¤µ¤ì¤¿¤«¤É¤¦¤«¤ò³Îǧ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
243
244 .\" FIXME . Check that this flag does eventually get removed.
245 .\"O Because it was inherently racy,
246 .\"O .B FUTEX_FD
247 .\"O has been removed from Linux 2.6.26 onwards.
248 .B FUTEX_FD
249 ¤Ï¤â¤È¤â¤È¶¥¹ç¤¬µ¯¤­¤ä¤¹¤«¤Ã¤¿¤¿¤á¡¢
250 Linux 2.6.26 °Ê¹ß¤Çºï½ü¤µ¤ì¤Æ¤¤¤ë¡£
251 .TP
252 .\"O .BR FUTEX_REQUEUE " (since Linux 2.5.70)"
253 .BR FUTEX_REQUEUE " (Linux 2.5.70 °Ê¹ß)"
254 .\"O This operation was introduced in order to avoid a "thundering herd" effect
255 .\"O when
256 .\"O .B FUTEX_WAKE
257 .\"O is used and all processes woken up need to acquire another
258 .\"O futex.
259 .\"O This call wakes up
260 .\"O .I val
261 .\"O processes, and requeues all other waiters on the futex at address
262 .\"O .IR uaddr2 .
263 ¤³¤ÎÁàºî¤Ï¡¢
264 .B FUTEX_WAKE
265 ¤¬»È¤ï¤ì¤Æ¤¤¤Æ¡¢¤«¤Ä wake ¤µ¤ì¤Æ¤¤¤ëÁ´¤Æ¤Î¥×¥í¥»¥¹¤¬
266 ¾¤Î futex ¤ò¼èÆÀ¤¹¤ëɬÍפ¬¤¢¤ë¾ì¹ç¤Ë¡¢
267 ¡Ö½Ã¤Î·²¤ì¤Î˽Áö (thundering herd)¡×¸ú²Ì¤òÈò¤±¤ë¤¿¤á¤ËƳÆþ¤µ¤ì¤¿¡£
268 ¤³¤Î¸Æ¤Ó½Ð¤·¤Ï
269 .I val
270 ¸Ä¤Î¥×¥í¥»¥¹¤ò wake ¤·¡¢¥¢¥É¥ì¥¹
271 .I uaddr2
272 ¤Ç futex ¤òÂԤäƤ¤¤ë¾¤ÎÁ´¤Æ¤Î¥×¥í¥»¥¹¤òºÆÅÙ¥­¥å¡¼¤Ë¤¤¤ì¤ë¡£
273 .\"O The arguments
274 .\"O .I timeout
275 .\"O and
276 .\"O .I val3
277 .\"O are ignored.
278 °ú¤­¿ô
279 .I timeout
280 ¤È
281 .I val3
282 ¤Ï̵»ë¤µ¤ì¤ë¡£
283 .TP
284 .\"O .BR FUTEX_CMP_REQUEUE " (since Linux 2.6.7)"
285 .BR FUTEX_CMP_REQUEUE " (Linux 2.6.7 °Ê¹ß)"
286 .\"O There was a race in the intended use of
287 .\"O .BR FUTEX_REQUEUE ,
288 .\"O so
289 .\"O .B FUTEX_CMP_REQUEUE
290 .\"O was introduced.
291 .\"O This is similar to
292 .\"O .BR FUTEX_REQUEUE ,
293 .\"O but first checks whether the location
294 .\"O .I uaddr
295 .\"O still contains the value
296 .\"O .IR val3 .
297 .\"Osato:
298 .\"Osato: intended ¤¬¤è¤¯Ê¬¤«¤é¤Ê¤¤¡£
299 .\"Osato:
300 ¸Î°Õ¤Ë
301 .B FUTEX_REQUEUE
302 ¤ò»È¤¦¾ì¹ç¤Ë¶¥¹ç¤¬µ¯¤³¤ë¤¿¤á¡¢
303 .B FUTEX_CMP_REQUEUE
304 ¤¬Æ³Æþ¤µ¤ì¤¿¡£¤³¤ì¤Ï
305 .B FUTEX_REQUEUE
306 ¤È»÷¤Æ¤¤¤ë¤¬¡¢¾ì½ê
307 .I uaddr
308 ¤ËÃÍ
309 .I val3
310 ¤¬¤Þ¤ÀÊÝ»ý¤µ¤ì¤Æ¤¤¤ë¤«¤òºÇ½é¤Ë¥Á¥§¥Ã¥¯¤¹¤ë¡£
311 .\"O If not, the operation fails with the error
312 .\"O .BR EAGAIN .
313 .\"O The argument
314 .\"O .I timeout
315 .\"O is ignored.
316 ÊÝ»ý¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢Áàºî¤Ï¥¨¥é¡¼
317 .B EAGAIN
318 ¤Ç¼ºÇÔ¤¹¤ë¡£°ú¤­¿ô
319 .I timeout
320 ¤Ï̵»ë¤µ¤ì¤ë¡£
321 .\"O .SH "RETURN VALUE"
322 .SH ÊÖ¤êÃÍ
323 .PP
324 .\"O Depending on which operation was executed,
325 .\"O the returned value for a successful call can have differing meanings.
326 ¤É¤ÎÁàºî¤¬¼Â¹Ô¤µ¤ì¤¿¤«¤Ë¤è¤Ã¤Æ¡¢
327 À®¸ù»þ¤ÎÊÖ¤êÃͤΰÕÌ£¤¬ÊѤï¤ë¡£
328 .TP
329 .B FUTEX_WAIT
330 .\"O Returns 0 if the process was woken by a
331 .\"O .B FUTEX_WAKE
332 .\"O call.
333 .\"O In case of timeout,
334 .\"O the operation fails with the error
335 .\"O .BR ETIMEDOUT .
336 .\"O If the futex was not equal to the expected value,
337 .\"O the operation fails with the error
338 .\"O .BR EWOULDBLOCK .
339 .\"O Signals (see
340 .\"O .BR signal (7))
341 .\"O or other spurious wakeups cause
342 .\"O .B FUTEX_WAIT
343 .\"O to fail with the error
344 .\"O .BR EINTR .
345 ¥×¥í¥»¥¹¤¬
346 .B FUTEX_WAKE
347 ¤Î¸Æ¤Ó½Ð¤·¤Ç wake ¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£
348 ¥¿¥¤¥à¥¢¥¦¥È¤Î¾ì¹ç¡¢Áàºî¤Ï¥¨¥é¡¼
349 .B ETIMEOUT
350 ¤Ç¼ºÇÔ¤¹¤ë¡£
351 futex ¤¬»ØÄꤵ¤ì¤¿ÃͤÈÅù¤·¤¯¤Ê¤¤¾ì¹ç¡¢
352 ¥¨¥é¡¼
353 .B EWOULDBLOCK
354 ¤Ç¼ºÇÔ¤¹¤ë¡£
355 ¥·¥°¥Ê¥ë¤ò¼õ¿®¤¹¤ë¤«
356 .RB ( signal (7)
357 »²¾È) Â¾¤Îµ¶¤Î wake ¤¬¤¢¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢¥¨¥é¡¼
358 .B EINTR
359 ¤Ç¼ºÇÔ¤¹¤ë¡£
360 .TP
361 .B FUTEX_WAKE
362 .\"O Returns the number of processes woken up.
363 wake ¤·¤¿¥×¥í¥»¥¹¤Î¿ô¤òÊÖ¤¹¡£
364 .TP
365 .B FUTEX_FD
366 .\"O Returns the new file descriptor associated with the futex.
367 futex ¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿¿·¤¿¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤òÊÖ¤¹¡£
368 .TP
369 .B FUTEX_REQUEUE
370 .\"O Returns the number of processes woken up.
371 wake ¤·¤¿¥×¥í¥»¥¹¤Î¿ô¤òÊÖ¤¹¡£
372 .TP
373 .B FUTEX_CMP_REQUEUE
374 .\"O Returns the number of processes woken up.
375 wake ¤·¤¿¥×¥í¥»¥¹¤Î¿ô¤òÊÖ¤¹¡£
376 .PP
377 .\"O In the event of an error, all operations return \-1, and set
378 .\"O .I errno
379 .\"O to indicate the error.
380 ¥¨¥é¡¼¤Î¾ì¹ç¡¢Á´¤Æ¤ÎÁàºî¤Ç \-1 ¤¬Ê֤ꡢ
381 .I errno
382 ¤¬¥¨¥é¡¼¤ÎÆâÍƤò¼¨¤¹ÃͤËÀßÄꤵ¤ì¤ë¡£
383 .\"O .SH ERRORS
384 .SH ¥¨¥é¡¼
385 .TP
386 .B EACCES
387 .\"O No read access to futex memory.
388 futex ¥á¥â¥ê¤ËÆɤ߹þ¤ß¥¢¥¯¥»¥¹¸¢¤¬¤Ê¤«¤Ã¤¿¡£
389 .TP
390 .B EAGAIN
391 .\"O .B FUTEX_CMP_REQUEUE
392 .\"O found an unexpected futex value.
393 .\"O (This probably indicates a race;
394 .\"O use the safe
395 .\"O .B FUTEX_WAKE
396 .\"O now.)
397 .B FUTEX_CMP_REQUEUE
398 ¤Çͽ´ü¤·¤Ê¤¤ futex Ãͤ¬¸«¤Ä¤«¤Ã¤¿
399 (¤³¤ì¤Ï¶¥¹ç¤ò¼¨¤·¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
400 ¤³¤Î¾ì¹ç¤Ï°ÂÁ´¤Ê
401 .B FUTEX_WAKE
402 ¤ò»È¤¦¤³¤È)¡£
403 .TP
404 .B EFAULT
405 .\"O Error in getting
406 .\"O .I timeout
407 .\"O information from userspace.
408 ¥æ¡¼¥¶¶õ´Ö¤«¤é
409 .I timeout
410 ¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ëºÝ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
411 .TP
412 .B EINVAL
413 .\"O An operation was not defined or error in page alignment.
414 Áàºî¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£¤Þ¤¿¤Ï¥Ú¡¼¥¸¡¦¥¢¥é¥¤¥ó¥á¥ó¥È¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
415 .TP
416 .B ENFILE
417 .\"O The system limit on the total number of open files has been reached.
418 ¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤ÎÁí¿ô¤¬¥·¥¹¥Æ¥à¤ÎÀ©¸Â¤Ë㤷¤¿¡£
419 .TP
420 .B ENOSYS
421 .\"O Invalid operation specified in
422 .\"O .IR op .
423 .I op
424 ¤Ë̵¸ú¤ÊÁàºî¤¬»ØÄꤵ¤ì¤¿¡£
425 .\"O .SH "VERSIONS"
426 .SH ¥Ð¡¼¥¸¥ç¥ó
427 .PP
428 .\"O Initial futex support was merged in Linux 2.5.7 but with different semantics
429 .\"O from what was described above.
430 .\"O A 4-argument system call with the semantics
431 .\"O given here was introduced in Linux 2.5.40.
432 .\"O In Linux 2.5.70 one argument
433 .\"O was added.
434 .\"O In Linux 2.6.7 a sixth argument was added \(em messy, especially
435 .\"O on the s390 architecture.
436 ºÇ½é¤Î futex Âбþ¤Ï Linux 2.5.7 ¤ÇÁȤ߹þ¤Þ¤ì¤¿¤¬¡¢
437 ¾åµ­¤Î¥»¥Þ¥ó¥Æ¥£¥¯¥¹¤È¤Ï°Û¤Ê¤ë¡£
438 ¤³¤³¤Ç¼¨¤µ¤ì¤Æ¤¤¤ë¥»¥Þ¥ó¥Æ¥£¥¯¥¹¤ò»ý¤Ä
439 4 ¤Ä¤Î°ú¤­¿ô¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢Linux 2.5.40 ¤ÇƳÆþ¤µ¤ì¤¿¡£
440 Linux 2.5.70 ¤Ç¤Ï 1 ¤Ä¤Î°ú¤­¿ô¤¬Äɲ䵤줿¡£
441 Linux 2.6.7 ¤Ç¤Ï 6 ÈÖÌܤΰú¤­¿ô¤¬Äɲ䵤줿¡£
442 ¤³¤ì¤Ï±ø¤¯¡¢s390 ¥¢¡¼¥­¥Æ¥¯¥Á¥ã¾å¤ÎÆÃÊ̤Τâ¤Î¤Ç¤¢¤ë¡£
443 .\"O .SH "CONFORMING TO"
444 .SH ½àµò
445 .\"O This system call is Linux-specific.
446 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux Æȼ«¤Ç¤¢¤ë¡£
447 .\"O .SH "NOTES"
448 .SH Ãí°Õ
449 .PP
450 .\"O To reiterate, bare futexes are not intended as an easy-to-use abstraction
451 .\"O for end-users.
452 .\"O (There is no wrapper function for this system call in glibc.)
453 .\"O Implementors are expected to be assembly literate and to have
454 .\"O read the sources of the futex userspace library referenced below.
455 ·«¤êÊÖ¤¹¤¬¡¢Íç¤Î futex ¤Ï¥¨¥ó¥É¥æ¡¼¥¶¤¬Íưפ˻Ȥ¦¤³¤È¤Î¤Ç¤­¤ë³µÇ°¤È¤·¤Æ
456 °Õ¿Þ¤µ¤ì¤¿¤â¤Î¤Ç¤Ï¤Ê¤¤
457 (glibc ¤Ë¤Ï¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ËÂФ¹¤ë¥é¥Ã¥Ñ¡¼´Ø¿ô¤Ï¤Ê¤¤)¡£
458 ¼ÂÁõ¼Ô¤Ï¡¢¥¢¥»¥ó¥Ö¥ê¸À¸ì¤Ë´·¤ì¤Æ¤ª¤ê¡¢°Ê²¼¤Ëµó¤²¤ë futex ¥æ¡¼¥¶¶õ´Ö¥é¥¤¥Ö¥é¥ê¤Î
459 ¥½¡¼¥¹¤òÆɤ߽ª¤¨¤Æ¤¤¤ë¤³¤È¤¬Í׵ᤵ¤ì¤ë¡£
460 .\"O .\" .SH "AUTHORS"
461 .\" .SH Ãø¼Ô
462 .\" .PP
463 .\"O .\" Futexes were designed and worked on by
464 .\"O .\" Hubertus Franke (IBM Thomas J. Watson Research Center),
465 .\"O .\" Matthew Kirkwood, Ingo Molnar (Red Hat)
466 .\"O .\" and Rusty Russell (IBM Linux Technology Center).
467 .\"O .\" This page written by bert hubert.
468 .\" futex ¤Ï Hubertus Franke (IBM Thomas J. Watson Research Center),
469 .\" Matthew Kirkwood, Ingo Molnar (Red Hat),
470 .\" Rusty Russell (IBM Linux Technology Center) ¤¬À߷פ·¡¢ºîÀ®¤·¤¿¡£
471 .\" ¤³¤Î¥Ú¡¼¥¸¤Ï bert hubert ¤¬µ­¤·¤¿¡£
472 .\"O .SH SEE ALSO
473 .SH ´ØÏ¢¹àÌÜ
474 .BR futex (7)
475 .PP
476 \fIFuss, Futexes and Furwocks: Fast Userlevel Locking in Linux\fP
477 (proceedings of the Ottawa Linux Symposium 2002),
478 .\"O futex example library, futex-*.tar.bz2
479 futex ¤Î»ÈÍÑÎã¥é¥¤¥Ö¥é¥ê, futex-*.tar.bz2
480 <URL:ftp://ftp.nl.kernel.org/pub/linux/kernel/people/rusty/>.