2 .\" Hey Emacs! This file is -*- nroff -*- source.
4 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
5 .\" and Copyright (C) 1993 Michael Haardt, Ian Jackson;
6 .\" and Copyright (C) 1998 Jamie Lokier;
7 .\" and Copyright (C) 2002 Michael Kerrisk.
9 .\" Permission is granted to make and distribute verbatim copies of this
10 .\" manual provided the copyright notice and this permission notice are
11 .\" preserved on all copies.
13 .\" Permission is granted to copy and distribute modified versions of this
14 .\" manual under the conditions for verbatim copying, provided that the
15 .\" entire resulting derived work is distributed under the terms of a
16 .\" permission notice identical to this one.
18 .\" Since the Linux kernel and libraries are constantly changing, this
19 .\" manual page may be incorrect or out-of-date. The author(s) assume no
20 .\" responsibility for errors or omissions, or for damages resulting from
21 .\" the use of the information contained herein. The author(s) may not
22 .\" have taken the same level of care in the production of this manual,
23 .\" which is licensed free of charge, as they might when working
26 .\" Formatted or processed versions of this manual, if unaccompanied by
27 .\" the source, must acknowledge the copyright and authors of this work.
29 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
30 .\" Modified 1995-09-26 by Andries Brouwer <aeb@cwi.nl>
31 .\" and again on 960413 and 980804 and 981223.
32 .\" Modified 1998-12-11 by Jamie Lokier <jamie@imbolc.ucc.ie>
33 .\" Applied correction by Christian Ehrhardt - aeb, 990712
34 .\" Modified 2002-04-23 by Michael Kerrisk <mtk.manpages@gmail.com>
35 .\" Added note on F_SETFL and O_DIRECT
36 .\" Complete rewrite + expansion of material on file locking
37 .\" Incorporated description of F_NOTIFY, drawing on
38 .\" Stephen Rothwell's notes in Documentation/dnotify.txt.
39 .\" Added description of F_SETLEASE and F_GETLEASE
40 .\" Corrected and polished, aeb, 020527.
41 .\" Modified 2004-03-03 by Michael Kerrisk <mtk.manpages@gmail.com>
42 .\" Modified description of file leases: fixed some errors of detail
43 .\" Replaced the term "lease contestant" by "lease breaker"
44 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
45 .\" Added notes on capability requirements
46 .\" Modified 2004-12-08, added O_NOATIME after note from Martin Pool
47 .\" 2004-12-10, mtk, noted F_GETOWN bug after suggestion from aeb.
48 .\" 2005-04-08 Jamie Lokier <jamie@shareable.org>, mtk
49 .\" Described behavior of F_SETOWN/F_SETSIG in
50 .\" multithreaded processes, and generally cleaned
51 .\" up the discussion of F_SETOWN.
52 .\" 2005-05-20, Johannes Nicolai <johannes.nicolai@hpi.uni-potsdam.de>,
53 .\" mtk: Noted F_SETOWN bug for socket file descriptor in Linux 2.4
54 .\" and earlier. Added text on permissions required to send signal.
55 .\" 2009-09-30, Michael Kerrisk
56 .\" Note obsolete F_SETOWN behavior with threads.
57 .\" Document F_SETOWN_EX and F_GETOWN_EX
59 .\" Japanese Version Copyright (c) 1996 Takeshi Ueno
60 .\" and Copyright (c) 2005, 2006, 2008 Akihiro MOTOKI
62 .\" Translated 1996-07-03, Takeshi Ueno <tueno@vio.co.jp>
63 .\" Modified 1998-09-10, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
64 .\" Modified 1999-08-14, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
65 .\" Updated & Modified 2001-04-03, Yuichi SATO <ysato@h4.dion.ne.jp>
66 .\" Updated & Modified 2005-03-15, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
67 .\" Updated & Modified 2005-04-22, Akihiro MOTOKI
68 .\" Updated & Modified 2005-10-14, Akihiro MOTOKI
69 .\" Updated & Modified 2005-11-19, Akihiro MOTOKI, LDP v2.14
70 .\" Updated 2006-04-16, Akihiro MOTOKI, LDP v2.29
71 .\" Updated 2008-02-11, Akihiro MOTOKI, LDP v2.77
72 .\" Updated 2008-09-19, Akihiro MOTOKI, LDP v3.09
73 .\" Updated 2010-04-23, Akihiro MOTOKI, LDP v3.24
75 .\"WORD: asynchronous I/O ÈóƱ´ü I/O
76 .\"WORD: descriptor ¥Ç¥£¥¹¥¯¥ê¥×¥¿
77 .\"WORD: open file description ¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ëµ½Ò
78 .\"WORD: feature test macro µ¡Ç½¸¡ºº¥Þ¥¯¥í
79 .\"WORD: I/O availability signal I/O ¤¬ÍøÍѲÄǽ¤Ë¤Ê¤Ã¤¿¤³¤È¤ò¼¨¤¹¥·¥°¥Ê¥ë
81 .TH FCNTL 2 2009-10-17 "Linux" "Linux Programmer's Manual"
84 .\"O fcntl \- manipulate file descriptor
85 fcntl \- ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ÎÁàºî¤ò¹Ô¤¦
89 .B #include <unistd.h>
92 .BI "int fcntl(int " fd ", int " cmd ", ... /* " arg " */ );"
97 .\"O performs one of the operations described below on the open file descriptor
99 .\"O The operation is determined by
102 ¤Ï¡¢¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
104 ¤Ë´Ø¤·¤Æ²¼µ¤ÎÁàºî¤ò¹Ô¤¦¡£Áàºî¤Ï
109 .\"O can take an optional third argument.
110 .\"O Whether or not this argument is required is determined by
112 .\"O The required argument type is indicated in parentheses after each
114 .\"O name (in most cases, the required type is
116 .\"O and we identify the argument using the name
120 .\"O is specified if the argument is not required.
122 ¤Ï¥ª¥×¥·¥ç¥ó¤È¤·¤ÆÂè»°°ú¤¿ô¤ò¤È¤ë¤³¤È¤¬¤Ç¤¤ë¡£
123 Âè»°°ú¤¿ô¤¬É¬Íפ«¤É¤¦¤«¤Ï
128 ̾¤Î¸å¤í¤Î³ç¸ÌÆâ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë
129 (¤Û¤È¤ó¤É¤Î¾ì¹ç¡¢É¬Íפʷ¿¤Ï
131 ¤Ç¤¢¤ê¡¢¤³¤Î°ú¤¿ô¤òɽ¤¹¤Î¤Ë
133 ¤È¤¤¤¦Ì¾Á°¤ò»È¤Ã¤Æ¤¤¤ë)¡£
134 °ú¤¿ô¤¬É¬Íפʤ¤¾ì¹ç¤Ë¤Ï
137 .\"O .SS "Duplicating a file descriptor"
138 .SS "¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ÎÊ£À½"
140 .BR F_DUPFD " (\fIlong\fP)"
141 .\"O Find the lowest numbered available file descriptor
142 .\"O greater than or equal to
144 .\"O and make it be a copy of
146 .\"O This is different from
148 .\"O which uses exactly the descriptor specified.
149 ÍøÍѲÄǽ¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¤¦¤Á¡¢
151 °Ê¾å¤ÇºÇ¾®¤Î¤â¤Î¤òõ¤·¡¢
153 ¤Î¥³¥Ô¡¼¤È¤¹¤ë¡£¤³¤ì¤ÏÊ̤ηÁ¤Î
157 ¤Ç¤Ï»ØÄꤵ¤ì¤¿¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬»È¤ï¤ì¤ëÅÀ¤¬°ã¤¦¡£
159 .\"O On success, the new descriptor is returned.
160 À®¸ù¤¹¤ë¤È¡¢¿·¤·¤¤¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬ÊÖ¤µ¤ì¤ë¡£
164 .\"O for further details.
169 .\"O .BR F_DUPFD_CLOEXEC " (\fIlong\fP; since Linux 2.6.24)"
170 .BR F_DUPFD_CLOEXEC " (\fIlong\fP; Linux 2.6.24 °Ê¹ß)"
173 .\"O but additionally set the
174 .\"O close-on-exec flag for the duplicate descriptor.
176 ¤ÈƱÍͤÀ¤¬¡¢¤½¤ì¤Ë²Ã¤¨¤ÆÊ£À½¤µ¤ì¤¿¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂФ·¤Æ
177 close-on-exec ¥Õ¥é¥°¤ò¥»¥Ã¥È¤¹¤ë¡£
178 .\"O Specifying this flag permits a program to avoid an additional
181 .\"O operation to set the
184 ¤³¤Î¥Õ¥é¥°¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¢¥×¥í¥°¥é¥à¤Ï
186 ¥Õ¥é¥°¤ò¥»¥Ã¥È¤¹¤ë¤¿¤á¤Ë
190 Áàºî¤òÄɲäǹԤ¦É¬Íפ¬¤Ê¤¯¤Ê¤ë¡£
191 .\"O For an explanation of why this flag is useful,
192 .\"O see the description of
196 ¤³¤Î¥Õ¥é¥°¤¬¤Ê¤¼ÍÍѤ«¤Ë¤Ä¤¤¤Æ¤Ï¡¢
201 .\"O .SS "File descriptor flags"
202 .SS "¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¦¥Õ¥é¥°"
203 .\"O The following commands manipulate the flags associated with
204 .\"O a file descriptor.
205 .\"O Currently, only one such flag is defined:
206 .\"O .BR FD_CLOEXEC ,
207 .\"O the close-on-exec flag.
210 .\"O bit is 0, the file descriptor will remain open across an
212 .\"O otherwise it will be closed.
213 °Ê²¼¤Î¥³¥Þ¥ó¥É¤ò»È¤Ã¤Æ¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ë´ØÏ¢¤¹¤ë¥Õ¥é¥°
214 ¤òÁàºî¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
215 ¸½ºß¤Î¤È¤³¤í¡¢ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥Õ¥é¥°¤Ï°ì¤Ä¤À¤±¤Ç¤¢¤ë:
217 (close-on-exec ¥Õ¥é¥°)¡£
219 ¥Ó¥Ã¥È¤¬ 0 ¤Ê¤é¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï
221 ¤ò¹Ô¤Ã¤Æ¤â¥ª¡¼¥×¥ó¤µ¤ì¤¿¤Þ¤Þ¤À¤¬¡¢¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ï¥¯¥í¡¼¥º¤µ¤ì¤ë¡£
223 .BR F_GETFD " (\fIvoid\fP)"
224 .\"O Read the file descriptor flags;
227 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¦¥Õ¥é¥°¤òÆɤ߽Ф¹¡£
231 .BR F_SETFD " (\fIlong\fP)"
232 .\"O Set the file descriptor flags to the value specified by
234 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¦¥Õ¥é¥°¤Ë
236 ¤Ç»ØÄꤷ¤¿ÃͤòÀßÄꤹ¤ë¡£
237 .\"O .SS "File status flags"
238 .SS "¥Õ¥¡¥¤¥ë¾õÂ֥ե饰"
239 .\"O Each open file description has certain associated status flags,
243 .\"O .\" .BR creat (2),
244 .\"O and possibly modified by
246 .\"O Duplicated file descriptors
249 .\"O .BR fcntl (F_DUPFD),
251 .\"O etc.) refer to the same open file description, and thus
252 .\"O share the same file status flags.
253 ¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ëµ½Ò (open file description) ¤Ë¤Ï¡¢
254 ¥Õ¥¡¥¤¥ëµ½ÒËè¤ËÀßÄꤵ¤ì¤ë¾õÂ֥ե饰¤¬¤¤¤¯¤Ä¤«¤¢¤ë¡£¤³¤ì¤é¤Î¥Õ¥é¥°¤Ï
260 ¤Ë¤è¤êÊѹ¹¤¹¤ë¤³¤È¤â¤Ç¤¤ë¡£¤³¤ì¤é¤Ï¡¢
264 ¤Ê¤É¤Ç) Ê£À½¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿Æ±»Î¤Ï
265 Ʊ¤¸¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ëµ½Ò¤ò»²¾È¤¹¤ë¡£
267 Ʊ¤¸¥Õ¥¡¥¤¥ë¾õÂ֥ե饰¤¬¶¦Í¤µ¤ì¤ë¡£
269 .\"O The file status flags and their semantics are described in
271 ¥Õ¥¡¥¤¥ë¾õÂ֥ե饰¤È¤½¤Î°ÕÌ£¤Ï
275 .BR F_GETFL " (\fIvoid\fP)"
276 .\"O Read the file status flags;
279 ¥Õ¥¡¥¤¥ë¾õÂ֥ե饰¤òÆɤ߽Ф¹¡£
283 .BR F_SETFL " (\fIlong\fP)"
284 .\"O Set the file status flags to the value specified by
286 .\"O File access mode
287 .\"O .RB ( O_RDONLY ", " O_WRONLY ", " O_RDWR )
288 .\"O and file creation flags
290 .\"O .BR O_CREAT ", " O_EXCL ", " O_NOCTTY ", " O_TRUNC )
296 ¤Ç»ØÄꤵ¤ì¤¿ÃͤòÀßÄꤹ¤ë¡£
298 ¤Î¤¦¤Á¡¢¥Õ¥¡¥¤¥ë¤Î¥¢¥¯¥»¥¹¥â¡¼¥É
299 .RB ( O_RDONLY ", " O_WRONLY ", " O_RDWR )
300 ¤È¥Õ¥¡¥¤¥ëºîÀ®¥Õ¥é¥° (¤¹¤Ê¤ï¤Á
301 .BR O_CREAT ", " O_EXCL ", " O_NOCTTY ", " O_TRUNC )
302 ¤Ë´Ø¤¹¤ë¥Ó¥Ã¥È¤Ï̵»ë¤µ¤ì¤ë¡£
303 .\"O On Linux this command can only change the
311 Linux ¤Ç¤Ï¡¢¤³¤Î¥³¥Þ¥ó¥É¤ÇÊѹ¹¤Ç¤¤ë¤Î¤Ï
318 .\"O .\" FIXME . According to POSIX.1-2001, O_SYNC should also be modifiable
319 .\"O .\" via fcntl(2), but currently Linux does not permit this
320 .\"O .\" See http://bugzilla.kernel.org/show_bug.cgi?id=5994
321 .\" FIXME . POSIX.1-2001 ¤Ë¤è¤ë¤È¡¢ O_SYNC ¤â fcntl(2) ¤ÇÊѹ¹¤Ç¤¤ë¤Ù¤¤À¤¬¡¢
322 .\" ¸½ºß¤Î¤È¤³¤í Linux ¤Ç¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
323 .\" http://bugzilla.kernel.org/show_bug.cgi?id=5994 »²¾È
324 .\"O .SS "Advisory locking"
325 .SS "¥¢¥É¥Ð¥¤¥¶¥ê¡¦¥í¥Ã¥¯"
326 .\"O .BR F_GETLK ", " F_SETLK " and " F_SETLKW
327 .\"O are used to acquire, release, and test for the existence of record
328 .\"O locks (also known as file-segment or file-region locks).
329 .\"O The third argument,
331 .\"O is a pointer to a structure that has at least the following fields
332 .\"O (in unspecified order).
333 .BR F_GETLK ", " F_SETLK ", " F_SETLKW
334 ¤Ï¡¢¥ì¥³¡¼¥É¡¦¥í¥Ã¥¯¤Î³ÍÆÀ¡¿²òÊü¡¿¥Æ¥¹¥È¤Î¤¿¤á¤Ë»ÈÍѤ¹¤ë
335 (¥ì¥³¡¼¥É¡¦¥í¥Ã¥¯¤Ï¥Õ¥¡¥¤¥ë¥»¥°¥á¥ó¥È¡¦¥í¥Ã¥¯¤ä
336 ¥Õ¥¡¥¤¥ëÎΰè¥í¥Ã¥¯¤È¤â¸Æ¤Ð¤ì¤ë)¡£
339 ¤Ï¡¢°Ê²¼¤Ë¼¨¤¹¥Õ¥£¡¼¥ë¥É¤ò´Þ¤à¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤¢¤ë
340 (¥Õ¥£¡¼¥ë¥É¤Î½ç½ø¤Ï´Ø·¸¤Ê¤¯¡¢¹½Â¤ÂΤ˾¤Î¥Õ¥£¡¼¥ë¥É¤¬¤¢¤Ã¤Æ¤â¤è¤¤)¡£
346 short l_type; /* Type of lock: F_RDLCK,
348 short l_whence; /* How to interpret l_start:
349 SEEK_SET, SEEK_CUR, SEEK_END */
350 off_t l_start; /* Starting offset for lock */
351 off_t l_len; /* Number of bytes to lock */
352 pid_t l_pid; /* PID of process blocking our lock
360 .\"O .IR l_whence ", " l_start ", and " l_len
361 .\"O fields of this structure specify the range of bytes we wish to lock.
362 .\"O Bytes past the end of the file may be locked,
363 .\"O but not bytes before the start of the file.
365 .IR l_whence ", " l_start ", " l_len
366 ¥Õ¥£¡¼¥ë¥É¤Ç¡¢¥í¥Ã¥¯¤ò¹Ô¤¤¤¿¤¤¥Ð¥¤¥ÈÈϰϤò»ØÄꤹ¤ë¡£
367 ¥Õ¥¡¥¤¥ë¤ÎËöÈø¤è¤ê¸å¤í¤Î¥Ð¥¤¥È¤ò¥í¥Ã¥¯¤¹¤ë¤³¤È¤Ï¤Ç¤¤ë¤¬¡¢
368 ¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤è¤êÁ°¤Î¥Ð¥¤¥È¤ò¥í¥Ã¥¯¤¹¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£
371 .\"O is the starting offset for the lock, and is interpreted
372 .\"O relative to either:
373 .\"O the start of the file (if
377 .\"O the current file offset (if
381 .\"O or the end of the file (if
385 .\"O In the final two cases,
387 .\"O can be a negative number provided the
388 .\"O offset does not lie before the start of the file.
390 ¤Ï¥í¥Ã¥¯¤ò¹Ô¤¦Îΰè¤Î³«»Ï¥ª¥Õ¥»¥Ã¥È¤Ç¤¢¤ë¡£
397 ¤Î¾ì¹ç¤Ï¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È¡¢
401 ¤Î¾ì¹ç¤Ï¸½ºß¤Î¥Õ¥¡¥¤¥ë¥ª¥Õ¥»¥Ã¥È¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È¡¢
405 ¤Î¾ì¹ç¤Ï¥Õ¥¡¥¤¥ë¤ÎËöÈø¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È¤È²ò¼á¤µ¤ì¤ë¡£
406 ¸å¤í¤Î£²¤Ä¤Î¾ì¹ç¤Ë¤Ï¡¢
407 ¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤è¤êÁ°¤Ë¤Ê¤é¤Ê¤¤ÈϰϤǡ¢
409 ¤ËÉé¤ÎÃͤò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
412 .\"O specifies the number of bytes to be locked.
415 .\"O is positive, then the range to be locked covers bytes
417 .\"O up to and including
418 .\"O .IR l_start + l_len \- 1 .
419 .\"O Specifying 0 for
421 .\"O has the special meaning: lock all bytes starting at the
422 .\"O location specified by
423 .\"O .IR l_whence " and " l_start
424 .\"O through to the end of file, no matter how large the file grows.
426 ¤Ï¥í¥Ã¥¯¤·¤¿¤¤¥Ð¥¤¥È¿ô¤ò¼¨¤¹¡£
428 ¤¬Àµ¤Î¾ì¹ç¡¢¥í¥Ã¥¯¤µ¤ì¤ë¥Ð¥¤¥ÈÈϰϤÏ
431 .IR l_start + l_len \- 1
434 ¤Ë 0 ¤ò»ØÄꤷ¤¿¾ì¹ç¤ÏÆÃÊ̤ʰÕÌ£¤ò»ý¤Ä:
435 .IR l_whence " and " l_start
436 ¤Ç»ØÄꤵ¤ì¤ë°ÌÃÖ¤«¤é¥Õ¥¡¥¤¥ë¤ÎËöÈø¤Þ¤Ç¤ÎÁ´¤Æ¤Î¥Ð¥¤¥È¤ò¥í¥Ã¥¯¤¹¤ë
437 (¥Õ¥¡¥¤¥ë¤¬¤É¤ó¤Ê¤ËÂ礤¯¤Ê¤Ã¤¿¤È¤·¤Æ¤â¥Õ¥¡¥¤¥ë¤ÎËöÈø¤Þ¤Ç¥í¥Ã¥¯¤¹¤ë)¡£
439 .\"O POSIX.1-2001 allows (but does not require)
440 .\"O an implementation to support a negative
444 .\"O is negative, the interval described by
447 .\"O .IR l_start + l_len
448 .\"O up to and including
449 .\"O .IR l_start \-1.
450 .\"O This is supported by Linux since kernel versions 2.4.21 and 2.5.49.
451 POSIX.1-2001 ¤Ç¤Ï¡¢Éé¤ÎÃͤÎ
453 ¤ò¥µ¥Ý¡¼¥È¤¹¤ë¼ÂÁõ¤òǧ¤á¤Æ¤¤¤ë (ɬ¿Ü¤Ç¤Ï¤Ê¤¤)¡£
455 ¤¬Éé¤Î¾ì¹ç¡¢¥í¥Ã¥¯¤µ¤ì¤ë¥Ð¥¤¥ÈÈϰϤÏ
460 ¤³¤ÎÆ°ºî¤Ï¥«¡¼¥Í¥ë 2.4.21 °Ê¹ß¤ª¤è¤Ó 2.5.49 °Ê¹ß¤Î Linux ¤Ç
465 .\"O field can be used to place a read
470 .\"O Any number of processes may hold a read lock (shared lock)
471 .\"O on a file region, but only one process may hold a write lock
472 .\"O (exclusive lock).
473 .\"O An exclusive lock excludes all other locks,
474 .\"O both shared and exclusive.
476 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¥Õ¥¡¥¤¥ë¤ËÂФ·¤ÆÆɤ߽Ф·¥í¥Ã¥¯
481 ÀßÄꤹ¤ë¤«¤ò»ØÄꤹ¤ë¡£
482 ¥Õ¥¡¥¤¥ë¤Î¤¢¤ëÎΰè¤ËÂФ·¤Æ¡¢Æɤ߽Ф·¥í¥Ã¥¯ (¶¦Í¥í¥Ã¥¯) ¤òÊÝ»ý¤Ç¤¤ë
483 ¥×¥í¥»¥¹¿ô¤ËÀ©¸Â¤Ï¤Ê¤¤¤¬¡¢½ñ¤¹þ¤ß¥í¥Ã¥¯ (ÇÓ¾¥í¥Ã¥¯) ¤òÊÝ»ý¤Ç¤¤ë
484 ¤Î¤Ï°ì¤Ä¤Î¥×¥í¥»¥¹¤À¤±¤Ç¤¢¤ë¡£ÇÓ¾¥í¥Ã¥¯¤òÀßÄꤹ¤ë¤È¡¢(¶¦Í¥í¥Ã¥¯¤«
485 ÇÓ¾¥í¥Ã¥¯¤Ë¤«¤«¤ï¤é¤º) ¾¤Î¥í¥Ã¥¯¤Ï²¿¤âÀßÄê¤Ç¤¤Ê¤¤¡£
486 .\"O A single process can hold only one type of lock on a file region;
487 .\"O if a new lock is applied to an already-locked region,
488 .\"O then the existing lock is converted to the new lock type.
489 .\"O (Such conversions may involve splitting, shrinking, or coalescing with
490 .\"O an existing lock if the byte range specified by the new lock does not
491 .\"O precisely coincide with the range of the existing lock.)
492 °ì¤Ä¤Î¥×¥í¥»¥¹¤Ï¡¢¥Õ¥¡¥¤¥ë¤Î¤¢¤ëÎΰè¤ËÂФ·¤Æ°ì¼ïÎà¤Î¥í¥Ã¥¯¤·¤«ÊÝ»ý¤Ç¤¤Ê¤¤¡£
493 ¿·µ¬¤Î¥í¥Ã¥¯¤¬¥í¥Ã¥¯¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ëÎΰè¤ËÂФ·¤ÆŬÍѤµ¤ì¤ë¤È¡¢´û¸¤Î¥í¥Ã¥¯
494 ¤Ï¿·µ¬¤Î¥í¥Ã¥¯¤Î¼ïÊ̤ËÊÑ´¹¤µ¤ì¤ë
495 (¿·µ¬¤Î¥í¥Ã¥¯¤Ç»ØÄꤵ¤ì¤¿¥Ð¥¤¥ÈÈϰϤ¬´û¸¥í¥Ã¥¯¤ÎÈϰϤȰìÃפ¹¤ë¾ì¹ç°Ê³°¤Ç¤Ï¡¢
496 ÊÑ´¹¤Î²áÄø¤Ç´û¸¤Î¥í¥Ã¥¯¤Îʬ³ä¡¢½Ì¾®¡¢·ë¹ç¤¬¹Ô¤ï¤ì¤ë¤³¤È¤¬¤¢¤ë)¡£
498 .BR F_SETLK " (\fIstruct flock *\fP)"
499 .\"O Acquire a lock (when
505 .\"O or release a lock (when
509 .\"O on the bytes specified by the
510 .\"O .IR l_whence ", " l_start ", and " l_len
518 ¤Î¾ì¹ç¤Ï) ¥í¥Ã¥¯¤Î³ÍÆÀ¤ò¡¢
520 ¤Î¾ì¹ç¤Ï) ¥í¥Ã¥¯¤Î²òÊü¤ò¡¢
523 .IR l_whence ", " l_start ", " l_len
524 ¤Ç»ØÄꤵ¤ì¤¿ÈϰϤΥХ¤¥È¤ËÂФ·¤Æ¹Ô¤¦¡£
525 .\"O If a conflicting lock is held by another process,
526 .\"O this call returns \-1 and sets
532 »ØÄꤵ¤ì¤¿¥í¥Ã¥¯¤¬Â¾¤Î¥×¥í¥»¥¹¤¬ÀßÄꤷ¤Æ¤¤¤ë¥í¥Ã¥¯¤È¾×Æͤ¹¤ë¾ì¹ç¤Ï¡¢
541 .BR F_SETLKW " (\fIstruct flock *\fP)"
544 .\"O but if a conflicting lock is held on the file, then wait for that
545 .\"O lock to be released.
547 ¤ÈƱÍͤÀ¤¬¡¢¤³¤Á¤é¤Ç¤Ï¤½¤Î¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¾×Æͤ¹¤ë¥í¥Ã¥¯¤¬
548 ŬÍѤµ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ë¡¢¤½¤Î¥í¥Ã¥¯¤¬²òÊü¤µ¤ì¤ë¤Î¤òÂÔ¤ÄÅÀ¤¬°Û¤Ê¤ë¡£
549 .\"O If a signal is caught while waiting, then the call is interrupted
550 .\"O and (after the signal handler has returned)
551 .\"O returns immediately (with return value \-1 and
556 .\"O .BR signal (7)).
557 ÂԤäƤ¤¤ë´Ö¤Ë¥·¥°¥Ê¥ë¤ò¼õ¤±¤¿¾ì¹ç¤Ï¡¢¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÏÃæÃǤµ¤ì¡¢
558 (¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤¬Ìá¤Ã¤¿Ä¾¸å¤Ë) ÊÖ¤êÃÍ \-1 ¤òÊÖ¤¹ (¤Þ¤¿
566 .BR F_GETLK " (\fIstruct flock *\fP)"
567 .\"O On input to this call,
569 .\"O describes a lock we would like to place on the file.
570 ¤³¤Î¥³¡¼¥ë¤Î¸Æ¤Ó½Ð¤·»þ¤Ë¤Ï¡¢
572 ¤Ë¤Ï¤½¤Î¥Õ¥¡¥¤¥ë¤ËŬÍѤ·¤è¤¦¤È¤¹¤ë¥í¥Ã¥¯¤Ë´Ø¤¹¤ë¾ðÊó¤¬Æþ¤Ã¤Æ¤¤¤ë¡£
573 .\"O If the lock could be placed,
575 .\"O does not actually place it, but returns
581 .\"O and leaves the other fields of the structure unchanged.
582 ¥í¥Ã¥¯¤òŬÍѤǤ¤ë¾ì¹ç¤Ë¤Ï¡¢
584 ¤Ï¼ÂºÝ¤Ë¤Ï¥í¥Ã¥¯¤ò¹Ô¤ï¤º¡¢¹½Â¤ÂÎ
590 ¤òÀßÄꤷ¡¢Â¾¤Î¥Õ¥£¡¼¥ë¥É¤ÏÊѹ¹¤»¤º¤Ë¡¢Éüµ¢¤¹¤ë¡£
591 .\"O If one or more incompatible locks would prevent
592 .\"O this lock being placed, then
594 .\"O returns details about one of these locks in the
595 .\"O .IR l_type ", " l_whence ", " l_start ", and " l_len
600 .\"O to be the PID of the process holding that lock.
601 °ã¤¦¼ïÊ̤Υí¥Ã¥¯¤¬ (°ì¤Ä¤â¤·¤¯¤ÏÊ£¿ô) ŬÍѤµ¤ì¤Æ¤¤¤Æ
602 ¥í¥Ã¥¯¤òŬÍѤǤ¤Ê¤¤¤è¤¦¤Ê¾ì¹ç¤Ë¤Ï¡¢
604 ¤Ï¡¢¸¶°ø¤È¤Ê¤Ã¤¿¥í¥Ã¥¯¤Î°ì¤Ä¤Ë¤Ä¤¤¤Æ¤Î¾ÜºÙ¾ðÊó¤ò¹½Â¤ÂÎ
607 .IR l_type ", " l_whence ", " l_start ", " l_len
610 ¤Ë¥í¥Ã¥¯¤òÊÝ»ý¤·¤Æ¤¤¤ë¥×¥í¥»¥¹¤Î PID ¤òÀßÄꤷ¤Æ¡¢Éüµ¢¤¹¤ë¡£
612 .\"O In order to place a read lock,
614 .\"O must be open for reading.
615 .\"O In order to place a write lock,
617 .\"O must be open for writing.
618 .\"O To place both types of lock, open a file read-write.
619 Æɤ߽Ф·¥í¥Ã¥¯¤òŬÍѤ¹¤ë¤Ë¤Ï¡¢
621 ¤ÏÆɤ߽Ф·ÍѤ˥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
622 ½ñ¤¹þ¤ß¥í¥Ã¥¯¤òŬÍѤ¹¤ë¤Ë¤Ï¡¢
624 ¤Ï½ñ¤¹þ¤ßÍѤ˥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
625 Æɤ߽ñ¤Î¾Êý¤Î¥í¥Ã¥¯¤òŬÍѤ¹¤ë¤Ë¤Ï¡¢Æɤ߽ñ¤Î¾ÍѤÇ
626 ¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
628 .\"O As well as being removed by an explicit
630 .\"O record locks are automatically released when the process
631 .\"O terminates or if it closes
633 .\"O file descriptor referring to a file on which locks are held.
636 ¤Ë¤è¤êÌÀ¼¨Åª¤Ëºï½ü¤µ¤ì¤ë¤À¤±¤Ç¤Ê¤¯¡¢
637 ¥×¥í¥»¥¹¤¬½ªÎ»¤·¤¿¤È¤¤ä¡¢¥í¥Ã¥¯¤¬Å¬ÍѤµ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤ë
638 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¤¤¤º¤ì¤«¤¬¥¯¥í¡¼¥º¤µ¤ì¤¿¾ì¹ç¤Ë¤â²òÊü¤µ¤ì¤ë¡£
639 ¤³¤Î¥í¥Ã¥¯¤Î²òÊü¤Ï¼«Æ°Åª¤Ë¹Ô¤ï¤ì¤ë¡£
640 .\"O .\" (Additional file descriptors referring to the same file
641 .\"O .\" may have been obtained by calls to
642 .\"O .\" .BR open "(2), " dup "(2), " dup2 "(2), or " fcntl ().)
643 .\" .RB ( open "(2), " dup "(2), " dup2 "(2), " fcntl ()
644 .\" ¤Î¸Æ¤Ó½Ð¤·¤Ë¤è¤Ã¤ÆƱ¤¸¥Õ¥¡¥¤¥ë¤ò»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬
645 .\" ¾¤Ë¤â¤Ç¤¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤)
646 .\"O This is bad: it means that a process can lose the locks on
651 .\"O when for some reason a library function decides to open, read
653 ¤³¤ÎÆ°ºî¤Ï¤Þ¤º¤¤: ¤¢¤ë¥×¥í¥»¥¹¤¬
657 ¤È¤¤¤Ã¤¿¥Õ¥¡¥¤¥ë¤Ë¥í¥Ã¥¯¤òŬÍѤ·¤Æ¤¤¤ë¤È¤¤Ë¡¢
658 ¤¢¤ë¥é¥¤¥Ö¥é¥ê´Ø¿ô¤¬²¿¤«¤ÎÍýͳ¤ÇƱ¤¸¥Õ¥¡¥¤¥ë¤ò open, read, close
659 ¤¹¤ë¤È¡¢¤½¤Î¥Õ¥¡¥¤¥ë¤Ø¤Î¥í¥Ã¥¯¤¬¼º¤ï¤ì¤ë¤³¤È¤Ë¤Ê¤ë¡£
661 .\"O Record locks are not inherited by a child created via
663 .\"O but are preserved across an
667 ¤ÇºîÀ®¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Ë¤Ï·Ñ¾µ¤µ¤ì¤Ê¤¤¤¬¡¢
669 ¤ÎÁ°¸å¤Ç¤ÏÊݸ¤µ¤ì¤ë¡£
671 .\"O Because of the buffering performed by the
673 .\"O library, the use of record locking with routines in that package
674 .\"O should be avoided; use
680 ¤Ç¤Ï¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¤¬¹Ô¤ï¤ì¤ë¤Î¤Ç¡¢
681 stdio ´ØÏ¢¤Î´Ø¿ô¤Ç¤Ï¥ì¥³¡¼¥É¤Î¥í¥Ã¥¯¤Î»ÈÍѤϲóÈò¤µ¤ì¤ë;
687 .\"O .SS "Mandatory locking"
688 .SS "¶¯À©¥í¥Ã¥¯ (mandatory locking)"
690 .\"O The above record locks may be either advisory or mandatory,
691 .\"O and are advisory by default.
692 ¾å½Ò¤Î¥í¥Ã¥¯¤Ë¤Ï¥¢¥É¥Ð¥¤¥¶¥ê¡¦¥í¥Ã¥¯ (advisory lock) ¤È¶¯À©¥í¥Ã¥¯ (mandatory
693 lock) ¤ÎÆó¼ïÎब¤¢¤ë¤¬¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥¢¥É¥Ð¥¤¥¶¥ê¡¦¥í¥Ã¥¯¤È¤Ê¤ë¡£
695 .\"O Advisory locks are not enforced and are useful only between
696 .\"O cooperating processes.
697 ¥¢¥É¥Ð¥¤¥¶¥ê¡¦¥í¥Ã¥¯¤Ë¶¯À©ÎϤϤʤ¯¡¢¶¨Ä´¤·¤ÆÆ°ºî¤¹¤ë¥×¥í¥»¥¹´Ö¤Ç¤Î¤ß
700 .\"O Mandatory locks are enforced for all processes.
701 ¶¯À©¥í¥Ã¥¯¤ÏÁ´¤Æ¤Î¥×¥í¥»¥¹¤ËÂФ·¤Æ¸ú²Ì¤¬¤¢¤ë¡£
702 .\"O If a process tries to perform an incompatible access (e.g.,
706 .\"O on a file region that has an incompatible mandatory lock,
707 .\"O then the result depends upon whether the
709 .\"O flag is enabled for its open file description.
712 .\"O flag is not enabled, then
713 .\"O system call is blocked until the lock is removed
714 .\"O or converted to a mode that is compatible with the access.
717 .\"O flag is enabled, then the system call fails with the error
719 ¤¢¤ë¥×¥í¥»¥¹¤¬¸ß´¹À¤Î¤Ê¤¤¶¯À©¥í¥Ã¥¯¤¬Å¬ÍѤµ¤ì¤¿¥Õ¥¡¥¤¥ëÎΰè¤ËÂФ·¤Æ
723 ¤Ë¤è¤ê) ¸ß´¹À¤Î¤Ê¤¤¥¢¥¯¥»¥¹¤ò¼Â¹Ô¤·¤è¤¦¤È¤·¤¿¾ì¹ç¡¢
725 ¤½¤Î¥Õ¥¡¥¤¥ë¤Î¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ëµ½Ò¤Ç
727 ¥Õ¥é¥°¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤«¤Ë¤è¤ê·è¤Þ¤ë¡£
729 ¥Õ¥é¥°¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Ê¤¤¤È¤¤Ï¡¢¥í¥Ã¥¯¤¬ºï½ü¤µ¤ì¤ë¤«¡¢
730 ¥í¥Ã¥¯¤¬¥¢¥¯¥»¥¹¤È¸ß´¹À¤Î¤¢¤ë¥â¡¼¥É¤ËÊÑ´¹¤µ¤ì¤ë¤Þ¤Ç¡¢
731 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÏÄä»ß (block) ¤µ¤ì¤ë¡£
733 ¥Õ¥é¥°¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤È¤¤Ï¡¢¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¥¨¥é¡¼
737 .\"O To make use of mandatory locks, mandatory locking must be enabled
738 .\"O both on the file system that contains the file to be locked,
739 .\"O and on the file itself.
740 .\"O Mandatory locking is enabled on a file system
741 .\"O using the "\-o mand" option to
747 .\"O Mandatory locking is enabled on a file by disabling
748 .\"O group execute permission on the file and enabling the set-group-ID
749 .\"O permission bit (see
753 ¶¯À©¥í¥Ã¥¯¤ò»ÈÍѤ¹¤ë¤¿¤á¤Ë¤Ï¡¢¥í¥Ã¥¯ÂоݤΥե¡¥¤¥ë¤¬´Þ¤Þ¤ì¤ë¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à
754 ¤È¡¢¥í¥Ã¥¯ÂоݤΥե¡¥¤¥ë¼«¿È¤ÎξÊý¤Ë¤Ä¤¤¤Æ¡¢¶¯À©¥í¥Ã¥¯¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Ê¤±¤ì
755 ¤Ð¤Ê¤é¤Ê¤¤¡£¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ë¤Ä¤¤¤Æ¶¯À©¥í¥Ã¥¯¤ò͸ú¤Ë¤¹¤ë¤Ë¤Ï¡¢
757 ¤Ë "\-o mand" ¥ª¥×¥·¥ç¥ó¤òÅϤ¹¤«¡¢
761 ¥Õ¥é¥°¤ò»ØÄꤹ¤ë¡£¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ¶¯À©¥í¥Ã¥¯¤ò͸ú¤Ë¤¹¤ë¤Ë¤Ï¡¢
762 ¤½¤Î¥Õ¥¡¥¤¥ë¤Î¥°¥ë¡¼¥×¼Â¹Ôµö²Ä (group execute permission) ¤ò̵¸ú¤È¤·¡¢
763 ¤«¤Ä set-group-ID µö²Ä¥Ó¥Ã¥È¤ò͸ú¤Ë¤¹¤ë
769 .\"O The Linux implementation of mandatory locking is unreliable.
771 Linux ¤Î¶¯À©¥í¥Ã¥¯¤Î¼ÂÁõ¤Ï¿®ÍêÀ¤Ë·ç¤±¤ë¤â¤Î¤Ç¤¢¤ë¡£
772 ²¼µ¤Î¡Ö¥Ð¥°¡×¤ÎÀá¤ò»²¾È¤Î¤³¤È¡£
773 .\"O .SS "Managing signals"
777 .\"O .BR F_GETOWN_EX ,
778 .\"O .BR F_SETOWN_EX ,
782 .\"O are used to manage I/O availability signals:
789 ¤Ï¡¢I/O ¤¬ÍøÍѲÄǽ¤Ë¤Ê¤Ã¤¿¤³¤È¤ò¼¨¤¹¥·¥°¥Ê¥ë¤ò´ÉÍý¤¹¤ë¤¿¤á¤Ë»ÈÍѤµ¤ì¤ë¡£
791 .BR F_GETOWN " (\fIvoid\fP)"
792 .\"O Return (as the function result)
793 .\"O the process ID or process group currently receiving
797 .\"O signals for events on file descriptor
799 .\"O Process IDs are returned as positive values;
800 .\"O process group IDs are returned as negative values (but see BUGS below).
803 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
805 ¤Î¥¤¥Ù¥ó¥È¤ËÂФ¹¤ë¥·¥°¥Ê¥ë
809 ¤ò¼õ¤±¤Æ¤¤¤ë¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ID ¤«¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ò
810 (´Ø¿ô¤Î·ë²Ì¤È¤·¤Æ) ÊÖ¤¹¡£
811 ¥×¥í¥»¥¹ID ¤ÏÀµ¤ÎÃͤȤ·¤ÆÊÖ¤µ¤ì¤ë¡£
812 ¥×¥í¥»¥¹¥°¥ë¡¼¥×ID ¤ÏÉé¤ÎÃͤȤ·¤ÆÊÖ¤µ¤ì¤ë (²¼µ¤Î¥Ð¥°¤Î¾Ï¤ò»²¾È)¡£
816 .BR F_SETOWN " (\fIlong\fP)"
817 .\"O Set the process ID or process group ID that will receive
821 .\"O signals for events on file descriptor
823 .\"O to the ID given in
825 .\"O A process ID is specified as a positive value;
826 .\"O a process group ID is specified as a negative value.
827 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
829 ¤Î¥¤¥Ù¥ó¥ÈȯÀ¸¤òÃΤ餻¤ë¥·¥°¥Ê¥ë
834 ¥×¥í¥»¥¹ ID ¤Þ¤¿¤Ï¥×¥í¥»¥¹¥°¥ë¡¼¥×ID ¤ò
836 ¤Ç»ØÄꤵ¤ì¤¿ ID ¤ËÀßÄꤹ¤ë¡£
837 ¥×¥í¥»¥¹ID ¤ÏÀµ¤ÎÃͤȤ·¤Æ»ØÄꤷ¡¢
838 ¥×¥í¥»¥¹¥°¥ë¡¼¥×ID ¤ÏÉé¤ÎÃͤȤ·¤Æ»ØÄꤹ¤ë¡£
839 .\"O Most commonly, the calling process specifies itself as the owner
843 .\"O .BR getpid (2)).
844 ¤Û¤È¤ó¤É¤Î¾ì¹ç¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Ï½êͼԤȤ·¤Æ¼«Ê¬¼«¿È¤ò»ØÄꤹ¤ë
851 .\"O .\" From glibc.info:
855 .\"O status flag on a file descriptor by using the
861 .\"O signal is sent whenever input or output becomes possible
862 .\"O on that file descriptor.
864 .\"O can be used to obtain delivery of a signal other than
869 ¥³¥Þ¥ó¥É¤ò»ÈÍѤ·¤Æ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ë
871 ¾õÂ֥ե饰¤òÀßÄꤷ¤¿¾ì¹ç¤Ë¤Ï¡¢¤½¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ø¤Î
872 Æþ½ÐÎϤ¬²Äǽ¤Ë¤Ê¤ëÅÙ¤Ë
878 °Ê³°¤ÎÊ̤Υ·¥°¥Ê¥ë¤ÎÇÛÁ÷¤ò¼õ¤±¤é¤ì¤ë¤è¤¦¤Ë
879 ¤¹¤ë¤Î¤Ë¤â»È¤¦¤³¤È¤¬¤Ç¤¤ë¡£
880 .\"O If this permission check fails, then the signal is
881 .\"O silently discarded.
882 µö²Ä (permission) ¤Î¥Á¥§¥Ã¥¯¤Ç¼ºÇÔ¤·¤¿¾ì¹ç¤Ë¤Ï¡¢
883 ¥·¥°¥Ê¥ë¤ÏÌۤäƼΤƤé¤ì¤ë¡£
885 .\"O Sending a signal to the owner process (group) specified by
887 .\"O is subject to the same permissions checks as are described for
889 .\"O where the sending process is the one that employs
891 .\"O (but see BUGS below).
893 ¤Ë¤è¤ê»ØÄꤵ¤ì¤¿½êÍ¼Ô¤Î¥×¥í¥»¥¹ (¤Þ¤¿¤Ï¥×¥í¥»¥¹¥°¥ë¡¼¥×) ¤Ë
894 ¥·¥°¥Ê¥ë¤òÁ÷¤ëºÝ¤Ë¤Ï¡¢
896 ¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¤Î¤ÈƱ¤¸µö²Ä¤Î¥Á¥§¥Ã¥¯¤¬¹Ô¤ï¤ì¤ë¡£
897 ¤³¤Î¤È¤¡¢¥·¥°¥Ê¥ë¤òÁ÷¿®¤¹¤ë¥×¥í¥»¥¹¤Ï
899 ¤ò»È¤Ã¤¿¥×¥í¥»¥¹¤Ç¤¢¤ë
900 (⤷¡¢²¼µ¤Î¡Ö¥Ð¥°¡×¤Î¾Ï¤ò»²¾È¤Î¤³¤È)¡£
902 .\"O If the file descriptor
904 .\"O refers to a socket,
907 .\"O the recipient of
909 .\"O signals that are delivered when out-of-band
910 .\"O data arrives on that socket.
912 .\"O is sent in any situation where
914 .\"O would report the socket as having an "exceptional condition".)
915 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬¥½¥±¥Ã¥È¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢
917 ¤ò»ÈÍѤ·¤Æ¡¢¥½¥±¥Ã¥È¤ËÂÓ°è³° (out-of-band) ¥Ç¡¼¥¿¤¬ÆϤ¤¤¿»þ¤Ë
919 ¥·¥°¥Ê¥ë¤òÇÛÁ÷¤¹¤ëÁê¼ê¤òÁªÂò¤¹¤ë¤³¤È¤â¤Ç¤¤ë
923 ¤¬¥½¥±¥Ã¥È¤¬¡ÖÆÃÊ̤ʾõÂ֡פˤ¢¤ë¤ÈÊó¹ð¤¹¤ë¤³¤È¤À¤í¤¦)¡£
924 .\"O .\" The following appears to be rubbish. It doesn't seem to
925 .\"O .\" be true according to the kernel source, and I can write
926 .\"O .\" a program that gets a terminal-generated SIGIO even though
927 .\"O .\" it is not the foreground process group of the terminal.
928 .\"O .\" -- MTK, 8 Apr 05
930 .\"O .\" If the file descriptor
932 .\"O .\" refers to a terminal device, then SIGIO
933 .\"O .\" signals are sent to the foreground process group of the terminal.
934 .\" °Ê²¼¤Îµ½Ò¤Ï¥´¥ß¤À¤í¤¦¡£
935 .\" ¥«¡¼¥Í¥ë¥½¡¼¥¹¤ò¸«¤ë¤È¤³¤Îµ½Ò¤Ï´Ö°ã¤Ã¤Æ¤¤¤ë¤è¤¦¤À¤·¡¢
936 .\" ¥×¥í¥°¥é¥à¤ò½ñ¤¤¤Æ¤ß¤¿¤È¤³¤í¡¢Ã¼Ëö¤Î¥Õ¥©¥¢¥°¥é¥ó¥É¡¦¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ç
937 .\" ¤Ê¤¯¤Æ¤â¡¢Ã¼Ëö¤¬À¸À®¤·¤¿ SIGIO ¥·¥°¥Ê¥ë¤ò¼õ¤±¤È¤ë¡£
940 .\" ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬Ã¼Ëö¥Ç¥Ð¥¤¥¹¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢
941 .\" SIGIO ¥·¥°¥Ê¥ë¤Ï¤½¤ÎüËö¤Î¥Õ¥©¥¢¥°¥é¥ó¥É¡¦¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ø¤ÈÁ÷¤é¤ì¤ë¡£
943 .\"O The following was true in 2.6.x kernels up to and including
945 ¥Ð¡¼¥¸¥ç¥ó 2.6.11 °ÊÁ°¤Î 2.6.x ¥«¡¼¥Í¥ë¤Ç¤Ï¡¢°Ê²¼¤Ë¼¨¤¹Æ°ºî¤Ç¤¢¤Ã¤¿¡£
948 .\"O If a nonzero value is given to
950 .\"O in a multithreaded process running with a threading library
951 .\"O that supports thread groups (e.g., NPTL),
952 .\"O then a positive value given to
954 .\"O has a different meaning:
955 .\"O .\" The relevant place in the (2.6) kernel source is the
956 .\"O .\" 'switch' in fs/fcntl.c::send_sigio_to_task() -- MTK, Apr 2005
957 .\"O instead of being a process ID identifying a whole process,
958 .\"O it is a thread ID identifying a specific thread within a process.
959 ¥¹¥ì¥Ã¥É¥°¥ë¡¼¥×¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¥¹¥ì¥Ã¥É¥é¥¤¥Ö¥é¥ê (Î㤨¤Ð NPTL) ¤ò
960 »È¤Ã¤ÆÆ°ºî¤·¤Æ¤¤¤ë¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¡¦¥×¥í¥»¥¹¤Ç
962 ¤Ë 0 °Ê³°¤ÎÃͤò»ØÄꤷ¤¿¾ì¹ç¡¢
964 ¤ËÀµ¤ÎÃͤòÅϤ¹¤È¡¢¤½¤Î°ÕÌ£¤¬°ã¤Ã¤Æ¤¯¤ë:
965 .\" The relevant place in the (2.6) kernel source is the
966 .\" 'switch' in fs/fcntl.c::send_sigio_to_task() -- MTK, Apr 2005
967 ¥×¥í¥»¥¹Á´ÂΤò¼¨¤¹¥×¥í¥»¥¹ID ¤Ç¤Ï¤Ê¤¯¡¢¥×¥í¥»¥¹Æâ¤ÎÆÃÄê¤Î
968 ¥¹¥ì¥Ã¥É¤ò¼¨¤¹¥¹¥ì¥Ã¥ÉID ¤È²ò¼á¤µ¤ì¤ë¡£
969 .\"O Consequently, it may be necessary to pass
975 .\"O to get sensible results when
980 ¤ò»È¤¦¾ì¹ç¤Ë¤Ï¡¢¤¤Á¤ó¤È·ë²Ì¤ò¼õ¤±¼è¤ë¤Ë¤Ï¡¢
986 ¤ÎÊÖ¤êÃͤˤ¹¤ëɬÍפ¬¤¢¤ë¤À¤í¤¦¡£
987 .\"O (In current Linux threading implementations,
988 .\"O a main thread's thread ID is the same as its process ID.
989 .\"O This means that a single-threaded program can equally use
993 .\"O in this scenario.)
994 (¸½¾õ¤Î Linux ¥¹¥ì¥Ã¥É¼ÂÁõ¤Ç¤Ï¡¢¥á¥¤¥ó¡¦¥¹¥ì¥Ã¥É¤Î¥¹¥ì¥Ã¥ÉID ¤Ï
995 ¤½¤Î¥¹¥ì¥Ã¥É¤Î¥×¥í¥»¥¹ID ¤ÈƱ¤¸¤Ç¤¢¤ë¡£¤Ä¤Þ¤ê¡¢
996 ¥·¥°¥Ê¥ë¡¦¥¹¥ì¥Ã¥É¤Î¥×¥í¥°¥é¥à¤Ç¤Ï¤³¤Î¾ì¹ç
1000 ¤ÏÁ´¤¯Æ±¤¸¤è¤¦¤Ë»È¤¦¤³¤È¤¬¤Ç¤¤ë¡£)
1001 .\"O Note, however, that the statements in this paragraph do not apply
1004 .\"O signal generated for out-of-band data on a socket:
1005 .\"O this signal is always sent to either a process or a process group,
1006 .\"O depending on the value given to
1008 .\"O .\" send_sigurg()/send_sigurg_to_task() bypasses
1009 .\"O .\" kill_fasync()/send_sigio()/send_sigio_to_task()
1010 .\"O .\" to directly call send_group_sig_info()
1011 .\"O .\" -- MTK, Apr 2005 (kernel 2.6.11)
1012 ¤¿¤À¤·¡¢Ãí°Õ¤¹¤Ù¤ÅÀ¤È¤·¤Æ¡¢¤³¤ÎÃÊÍî¤Ç½Ò¤Ù¤¿¤³¤È¤Ï¡¢
1013 ¥½¥±¥Ã¥È¤ÎÂÓ°è³°¥Ç¡¼¥¿¤¬ÆϤ¤¤¿¤È¤¤ËÀ¸À®¤µ¤ì¤ë
1015 ¥·¥°¥Ê¥ë¤Ë¤Ï¤¢¤Æ¤Ï¤Þ¤é¤Ê¤¤¡£
1016 ¤³¤Î¥·¥°¥Ê¥ë¤Ï¾ï¤Ë¥×¥í¥»¥¹¤«¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ËÁ÷¤é¤ì¡¢
1019 ¤ËÅϤµ¤ì¤¿Ãͤˤ·¤¿¤¬¤Ã¤Æ·è¤á¤é¤ì¤ë¡£
1020 .\" send_sigurg()/send_sigurg_to_task() bypasses
1021 .\" kill_fasync()/send_sigio()/send_sigio_to_task()
1022 .\" to directly call send_group_sig_info()
1023 .\" -- MTK, Apr 2005 (kernel 2.6.11)
1026 .\"O The above behavior was accidentally dropped in Linux 2.6.12,
1027 .\"O and won't be restored.
1028 .\"O From Linux 2.6.32 onwards, use
1029 .\"O .BR F_SETOWN_EX
1034 .\"O signals at a particular thread.
1035 ¾åµ¤ÎÆ°ºî¤Ï¡¢Linux 2.6.12 ¤Ç¿Þ¤é¤º¤âºï½ü¤µ¤ì¡¢
1036 ¸µ¤ËÌᤵ¤ì¤Ê¤¤Í½Äê¤Ç¤¢¤ë¡£
1037 Linux 2.6.32 °Ê¹ß¤Ç¡¢ÆÃÄê¤Î¥¹¥ì¥Ã¥É°¸¤Ë¥·¥°¥Ê¥ë
1045 .\"O .BR F_GETOWN_EX " (struct f_owner_ex *) (since Linux 2.6.32)"
1046 .BR F_GETOWN_EX " (struct f_owner_ex *) (Linux 2.6.32 °Ê¹ß)"
1047 .\"O Return the current file descriptor owner settings
1048 .\"O as defined by a previous
1049 .\"O .BR F_SETOWN_EX
1051 .\"O The information is returned in the structure pointed to by
1053 .\"O which has the following form:
1056 Áàºî¤ÇÄêµÁ¤µ¤ì¤¿¸½ºß¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î½êͼÔÀßÄê
1059 ¤¬»Ø¤¹¹½Â¤ÂΤ˳ÊǼ¤µ¤ì¤ÆÊÖ¤µ¤ì¤ë¡£¹½Â¤ÂΤϰʲ¼¤ÎÄ̤ê¤Ç¤¢¤ë¡£
1072 .\"O field will have one of the values
1073 .\"O .BR F_OWNER_TID ,
1074 .\"O .BR F_OWNER_PID ,
1076 .\"O .BR F_OWNER_PGRP .
1082 ¤Î¤¤¤º¤ì¤«°ì¤Ä¤ÎÃͤȤʤ롣
1085 .\"O field is a positive integer representing a thread ID, process ID,
1086 .\"O or process group ID.
1089 .\"O for more details.
1091 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¥¹¥ì¥Ã¥É ID¡¢¥×¥í¥»¥¹ ID¡¢¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤ò
1092 ɽ¤¹Àµ¤ÎÀ°¿ô¤Ç¤¢¤ë¡£¾ÜºÙ¤Ï
1096 .\"O .BR F_SETOWN_EX " (struct f_owner_ex *) (since Linux 2.6.32)"
1097 .BR F_SETOWN_EX " (struct f_owner_ex *) (Linux 2.6.32 °Ê¹ß)"
1098 .\"O This operation performs a similar task to
1100 .\"O It allows the caller to direct I/O availability signals
1101 .\"O to a specific thread, process, or process group.
1104 ¤ÈƱÍͤνèÍý¤ò¹Ô¤¦¡£
1105 ¤³¤ÎÁàºî¤ò»È¤¦¤È¡¢I/O ¤¬ÍøÍѲÄǽ¤Ë¤Ê¤Ã¤¿¤³¤È¤ò¼¨¤¹¥·¥°¥Ê¥ë¤ò¡¢
1106 ÆÃÄê¤Î¥¹¥ì¥Ã¥É¡¢¥×¥í¥»¥¹¡¢¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ËÁ÷¤ë¤³¤È¤¬¤Ç¤¤ë
1108 .\"O The caller specifies the target of signals via
1110 .\"O which is a pointer to a
1115 .\"O field has one of the following values, which define how
1117 .\"O is interpreted:
1120 ·Ðͳ¤Ç¥·¥°¥Ê¥ë¤ÎÇÛÁ÷Àè¤ò»ØÄꤹ¤ë¡£
1124 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤¢¤ë¡£
1126 ¥Õ¥£¡¼¥ë¥É¤Ï°Ê²¼¤Î¤¤¤º¤ì¤«¤ÎÃͤò¼è¤ê¡¢
1129 ¤¬¤É¤Î¤è¤¦¤Ë²ò¼á¤µ¤ì¤ë¤«¤¬µ¬Äꤵ¤ì¤ë¡£
1133 .\"O Send the signal to the thread whose thread ID
1134 .\"O (the value returned by a call to
1137 .\"O .BR gettid (2))
1138 .\"O is specified in
1142 ¤Ç»ØÄꤵ¤ì¤¿ÃͤΥ¹¥ì¥Ã¥É¤Ë¤½¤Î¥·¥°¥Ê¥ë¤òÁ÷¤ë
1147 ¤Î¸Æ¤Ó½Ð¤·¤ÇÊÖ¤µ¤ì¤ëÃͤǤ¢¤ë)¡£
1150 .\"O Send the signal to the process whose ID
1151 .\"O is specified in
1155 ¤Ç»ØÄꤵ¤ì¤¿ÃÍ¤Î¥×¥í¥»¥¹¤Ë¤½¤Î¥·¥°¥Ê¥ë¤òÁ÷¤ë¡£
1158 .\"O Send the signal to the process group whose ID
1159 .\"O is specified in
1161 .\"O (Note that, unlike with
1163 .\"O a process group ID is specified as a positive value here.)
1166 ¤Ç»ØÄꤵ¤ì¤¿ÃÍ¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë¤½¤Î¥·¥°¥Ê¥ë¤òÁ÷¤ë¡£
1168 ¤È°Û¤Ê¤ê¡¢¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤Ë¤ÏÀµ¤ÎÃͤò»ØÄꤹ¤ëÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£)
1171 .BR F_GETSIG " (\fIvoid\fP)"
1172 .\"O Return (as the function result)
1173 .\"O the signal sent when input or output becomes possible.
1174 .\"O A value of zero means
1177 .\"O Any other value (including
1180 .\"O signal sent instead, and in this case additional info is available to
1181 .\"O the signal handler if installed with
1182 .\"O .BR SA_SIGINFO .
1185 ÆþÎϤä½ÐÎϤ¬²Äǽ¤Ë¤Ê¤Ã¤¿¾ì¹ç¤ËÁ÷¤ë¥·¥°¥Ê¥ë¤ò
1186 (´Ø¿ô¤Î·ë²Ì¤È¤·¤Æ) ÊÖ¤¹¡£
1189 ¤òÁ÷¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
1191 ¤ò´Þ¤à) ¾¤ÎÃͤϤ¤¤º¤ì¤â¡¢
1193 ¤ÎÂå¤ï¤ê¤ËÁ÷¤ë¥·¥°¥Ê¥ëÈÖ¹æ¤òɽ¤¹¡£
1194 ¸å¼Ô¤Î¾ì¹ç¡¢¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ò
1196 ¥Õ¥é¥°ÉÕ¤¤ÇÀßÄꤹ¤ì¤Ð¡¢¥Ï¥ó¥É¥é¤ÇÄɲäξðÊó¤òÆÀ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
1200 .BR F_SETSIG " (\fIlong\fP)"
1201 .\"O Set the signal sent when input or output becomes possible
1202 .\"O to the value given in
1204 .\"O A value of zero means to send the default
1207 .\"O Any other value (including
1209 .\"O is the signal to send instead, and in this case additional info
1210 .\"O is available to the signal handler if installed with
1211 .\"O .BR SA_SIGINFO .
1212 ÆþÎϤä½ÐÎϤ¬²Äǽ¤Ë¤Ê¤Ã¤¿¾ì¹ç¤ËÁ÷¤ë¥·¥°¥Ê¥ë¤ò
1214 ¤Ë»ØÄꤵ¤ì¤¿ÃͤËÀßÄꤹ¤ë¡£
1217 ¤òÁ÷¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
1219 ¤ò´Þ¤à) ¾¤ÎÃͤϤ¤¤º¤ì¤â¡¢
1221 ¤ÎÂå¤ï¤ê¤ËÁ÷¤ë¥·¥°¥Ê¥ëÈÖ¹æ¤òɽ¤¹¡£
1222 ¸å¼Ô¤Î¾ì¹ç¡¢¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ò
1224 ¥Õ¥é¥°ÉÕ¤¤ÇÀßÄꤹ¤ì¤Ð¡¢
1225 ¥Ï¥ó¥É¥é¤ÇÄɲäξðÊó¤òÆÀ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
1227 .\" The following was true only up until 2.6.11:
1229 .\"O .\" Additionally, passing a nonzero value to
1230 .\"O .\" .B F_SETSIG
1231 .\"O .\" changes the signal recipient from a whole process to a specific thread
1232 .\"O .\" within a process.
1233 .\"O .\" See the description of
1234 .\"O .\" .B F_SETOWN
1235 .\"O .\" for more details.
1238 .\" ¤Ë 0 °Ê³°¤ÎÃͤòÅϤ¹¤È¡¢¥·¥°¥Ê¥ë¤Î¼õ¿®¼Ô¤ò¥×¥í¥»¥¹Á´ÂΤ«¤é
1239 .\" ¥×¥í¥»¥¹Æâ¤ÎÆÃÄê¤Î¥¹¥ì¥Ã¥É¤ËÊѹ¹¤µ¤ì¤ë¡£¾ÜºÙ¤Ï
1241 .\" ¤ÎÀâÌÀ¤ò»²¾È¤Î¤³¤È¡£
1245 .\"O with a nonzero value, and setting
1248 .\"O signal handler (see
1249 .\"O .BR sigaction (2)),
1250 .\"O extra information about I/O events is passed to
1251 .\"O the handler in a
1255 ¤Ë¥¼¥í°Ê³°¤ÎÃͤòÀßÄꤷ¡¢¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë
1257 ¥Õ¥é¥°¤òÀßÄꤹ¤ë¤È¡¢
1259 ¤ò»²¾È) I/O ¥¤¥Ù¥ó¥È¤Ë´Ø¤¹¤ëÄɲäξðÊó¤¬
1261 ¹½Â¤ÂΤǥ·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤ØÅϤµ¤ì¤ë¡£
1264 .\"O field indicates the source is
1268 .\"O field gives the file descriptor associated with the event.
1270 .\"O there is no indication which file descriptors are pending, and you
1271 .\"O should use the usual mechanisms
1272 .\"O .RB ( select (2),
1277 .\"O set etc.) to determine which file descriptors are available for I/O.
1279 ¥Õ¥£¡¼¥ë¥É¤¬¼¨¤¹¥·¥°¥Ê¥ë¤Î¸¶°ø¤¬
1283 ¥Õ¥£¡¼¥ë¥É¤Ë¤Ï¥¤¥Ù¥ó¥È¤ËÂбþ¤¹¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬Æþ¤Ã¤Æ¤¤¤ë¡£
1284 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢¤É¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬ÍøÍѲÄǽ¤«¤ò¼¨¤¹¾ðÊó¤Ï
1285 ¤Ê¤¤¤Î¤Ç¡¢¤É¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç I/O ¤¬²Äǽ¤«¤òȽÃǤ¹¤ë¤¿¤á¤Ë¤Ï
1292 ¤Ê¤É) ¤ò»ÈÍѤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
1294 .\"O By selecting a real time signal (value >=
1295 .\"O .BR SIGRTMIN ),
1296 .\"O multiple I/O events may be queued using the same signal numbers.
1297 .\"O (Queuing is dependent on available memory).
1298 .\"O Extra information is available
1301 .\"O is set for the signal handler, as above.
1302 ¥ê¥¢¥ë¥¿¥¤¥à¥·¥°¥Ê¥ë (Ãͤ¬
1304 °Ê¾å) ¤òÁªÂò¤·¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢
1305 Ʊ¤¸¥·¥°¥Ê¥ëÈÖ¹æ¤ò»ý¤ÄÊ£¿ô¤Î I/O ¥¤¥Ù¥ó¥È¤¬¥¥å¡¼¤ËÆþ¤ë¤³¤È¤¬¤¢¤ë
1306 (¥¥å¡¼¤ËÆþ¤ì¤ë¤«¤É¤¦¤«¤ÏÍøÍѲÄǽ¤Ê¥á¥â¥ê¤Ë°Í¸¤·¤Æ¤¤¤ë)¡£
1309 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Î¤¿¤á¤ÎÄɲäξðÊó¤¬ÆÀ¤é¤ì¤ë¡£
1311 .\"O Note that Linux imposes a limit on the
1312 .\"O number of real-time signals that may be queued to a
1314 .\"O .BR getrlimit (2)
1316 .\"O .BR signal (7))
1317 .\"O and if this limit is reached, then the kernel reverts to
1320 .\"O and this signal is delivered to the entire
1321 .\"O process rather than to a specific thread.
1322 .\" See fs/fcntl.c::send_sigio_to_task() (2.4/2.6) sources -- MTK, Apr 05
1323 °Ê²¼¤ÎÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
1324 Linux ¤Ç¤Ï°ì¤Ä¤Î¥×¥í¥»¥¹¤ËÂФ·¤Æ¥¥å¡¼¤ËÆþ¤ì¤é¤ì¤ë¥ê¥¢¥ë¥¿¥¤¥à
1325 ¥·¥°¥Ê¥ë¤Î¿ô¤Ë¾å¸Â¤¬Àߤ±¤é¤ì¤Æ¤ª¤ê
1329 ¤ò»²¾È)¡¢¤³¤Î¾å¸Â¤Ë㤹¤ë¤È¥«¡¼¥Í¥ë¤Ï
1331 ¥·¥°¥Ê¥ë¤òÇÛÁ÷¤¹¤ë¡£¤³¤Î
1333 ¥·¥°¥Ê¥ë¤Ï¡¢»ØÄꤵ¤ì¤¿¥¹¥ì¥Ã¥É¤Ç¤Ï¤Ê¤¯¥×¥í¥»¥¹Á´ÂΤËÁ÷¤é¤ì¤ë¡£
1335 .\"O Using these mechanisms, a program can implement fully asynchronous I/O
1340 .\"O most of the time.
1341 ¤³¤ì¤é¤Îµ¡¹½¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç¡¢¤Û¤È¤ó¤É¤Î¾ì¹ç¤Ç
1345 ¤ò»ÈÍѤ»¤º¤Ë´°Á´¤ÊÈóƱ´ü I/O ¤ò¼ÂÁõ¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
1351 .\"O is specific to BSD and Linux.
1355 ¤Î»ÈÍÑ¤Ï BSD ¤È Linux ¤ËÆÃͤǤ¢¤ë¡£
1356 .\"O .BR F_GETOWN_EX ,
1357 .\"O .BR F_SETOWN_EX ,
1361 .\"O are Linux-specific.
1362 .\"O POSIX has asynchronous I/O and the
1363 .\"O .I aio_sigevent
1364 .\"O structure to achieve similar things; these are also available
1365 .\"O in Linux as part of the GNU C Library (Glibc).
1370 ¤Ï Linux ¸ÇͤǤ¢¤ë¡£POSIX ¤Ë¤Ï¡¢Æ±ÍͤΤ³¤È¤ò¹Ô¤¦¤¿¤á¤Ë¡¢ÈóƱ´ü I/O ¤È
1372 ¹½Â¤ÂΤ¬¤¢¤ë¡£Linux ¤Ç¤Ï¡¢GNU C ¥é¥¤¥Ö¥é¥ê (Glibc) ¤Î°ìÉô¤È¤·¤Æ
1373 ¤³¤ì¤é¤âÍøÍѲÄǽ¤Ç¤¢¤ë¡£
1375 .SS "¥ê¡¼¥¹ (leases)"
1379 .\"O (Linux 2.4 onwards) are used (respectively) to establish a new lease,
1380 .\"O and retrieve the current lease, on the open file description
1381 .\"O referred to by the file descriptor
1383 (Linix 2.4 °Ê¹ß¤ÇÍøÍѲÄǽ)
1387 ¤¬»²¾È¤¹¤ë¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ëµ½Ò¤ËÂФ·¤Æ¿·¤·¤¤¥ê¡¼¥¹¤òÀßÄꤹ¤ë¤Î¤Ë»ÈÍѤµ¤ì¤ë¡£
1391 ¤¬»²¾È¤¹¤ë¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ëµ½Ò¤ËÂФ·¤ÆÀßÄꤵ¤ì¤Æ¤¤¤ë
1392 ¸½ºß¤Î¥ê¡¼¥¹¤ò¼èÆÀ¤¹¤ë¤Î¤Ë»ÈÍѤµ¤ì¤ë¡£
1393 .\"O A file lease provides a mechanism whereby the process holding
1394 .\"O the lease (the "lease holder") is notified (via delivery of a signal)
1395 .\"O when a process (the "lease breaker") tries to
1398 .\"O .BR truncate (2)
1399 .\"O the file referred to by that file descriptor.
1400 ¥Õ¥¡¥¤¥ë¤Î¥ê¡¼¥¹¤Ë¤è¤ê¡¢
1401 ¤¢¤ë¥×¥í¥»¥¹ ("lease breaker") ¤¬¤½¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬»²¾È
1402 ¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ
1406 ¤ò¹Ô¤ª¤¦¤È¤·¤¿ºÝ¤Ë¡¢¥ê¡¼¥¹¤òÊÝ»ý¤·¤Æ¤¤¤ë¥×¥í¥»¥¹ ("lease holder") ¤Ø
1407 (¥·¥°¥Ê¥ë¤ÎÇÛÁ÷¤Ë¤è¤ë) ÄÌÃΤ¬¹Ô¤ï¤ì¤ë¤È¤¤¤¦µ¡¹½¤¬Ä󶡤µ¤ì¤ë¡£
1409 .BR F_SETLEASE " (\fIlong\fP)"
1410 .\"O Set or remove a file lease according to which of the following
1411 .\"O values is specified in the integer
1414 ¤ÎÆâÍƤ˴𤤤ƥե¡¥¤¥ë¤Î¥ê¡¼¥¹¤ÎÀßÄê¡¢ºï½ü¤ò¹Ô¤¦¡£À°¿ô
1416 ¤Ë¤Ï°Ê²¼¤ÎÃͤ¬»ØÄê¤Ç¤¤ë:
1421 .\"O Take out a read lease.
1422 .\"O This will cause the calling process to be notified when
1423 .\"O the file is opened for writing or is truncated.
1424 .\"O .\" The following became true in kernel 2.6.10:
1425 .\"O .\" See the man-pages-2.09 Changelog for further info.
1426 .\"O A read lease can only be placed on a file descriptor that
1427 .\"O is opened read-only.
1428 Æɤ߽Ф·¥ê¡¼¥¹¤ò¼èÆÀ¤¹¤ë¡£¤³¤ì¤Ë¤è¤ê¡¢
1429 ¤½¤Î¥Õ¥¡¥¤¥ë¤¬½ñ¤¹þ¤ßÍѤ˥ª¡¼¥×¥ó¤µ¤ì¤¿¤ê¡¢¥Õ¥¡¥¤¥ë¤¬ÀÚ¤êµÍ¤á¤é¤ì¤¿¾ì¹ç¤Ë¡¢
1430 ¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤ËÄÌÃΤ¬¹Ô¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
1431 .\" °Ê²¼¤ÎÆâÍƤϥ«¡¼¥Í¥ë 2.6.10 ¤Ç¼ÂÁõ¤µ¤ì¤¿¡£
1432 .\" ¤è¤ê¾Ü¤·¤¤¾ðÊó¤Ï man-pages-2.09 ¤Î Changelog ¤ò»²¾È¡£
1433 Æɤ߽Ф·¥ê¡¼¥¹¤òÀßÄê¤Ç¤¤ë¤Î¤Ï¡¢Æɤ߽Ф·ÀìÍѤǥª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë
1434 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂФ·¤Æ¤Î¤ß¤Ç¤¢¤ë¡£
1437 .\"O Take out a write lease.
1438 .\"O This will cause the caller to be notified when
1439 .\"O the file is opened for reading or writing or is truncated.
1440 .\"O A write lease may be placed on a file only if there are no
1441 .\"O other open file descriptors for the file.
1442 ½ñ¤¹þ¤ß¥ê¡¼¥¹¤ò¼èÆÀ¤¹¤ë¡£¤³¤ì¤Ë¤è¤ê¡¢
1443 (Æɤ߽Ф·ÍѤ«½ñ¤¹þ¤ßÍѤˤ«¤«¤ï¤é¤º) ¤½¤Î¥Õ¥¡¥¤¥ë¤¬¥ª¡¼¥×¥ó¤µ¤ì¤¿¤ê¡¢
1444 ¥Õ¥¡¥¤¥ë¤¬ÀÚ¤êµÍ¤á¤é¤ì¤¿¾ì¹ç¤Ë¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤ËÄÌÃΤ¬¹Ô¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
1445 ½ñ¤¹þ¤ß¥ê¡¼¥¹¤Ï¡¢¤½¤Î¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬
1446 ¾¤Ë¤Ê¤¤¾ì¹ç¤Ë¤Î¤ßÀßÄê¤Ç¤¤ë¡£
1449 .\"O Remove our lease from the file.
1450 ¤½¤Î¥Õ¥¡¥¤¥ë¤«¤é¥ê¡¼¥¹¤òºï½ü¤¹¤ë¡£
1453 .\"O Leases are associated with an open file description (see
1455 .\"O This means that duplicate file descriptors (created by, for example,
1459 .\"O refer to the same lease, and this lease may be modified
1460 .\"O or released using any of these descriptors.
1461 .\"O Furthermore, the lease is released by either an explicit
1463 .\"O operation on any of these duplicate descriptors, or when all
1464 .\"O such descriptors have been closed.
1465 ¥ê¡¼¥¹¤Ï¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ëµ½Ò¤ËÂФ·¤Æ´ØÏ¢ÉÕ¤±¤é¤ì¤ë
1472 ¤Ê¤É¤Ë¤è¤êºîÀ®¤µ¤ì¤¿) ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ÎÊ£À½¤ÏƱ¤¸¥ê¡¼¥¹¤ò»²¾È¤·¡¢
1473 Ê£À½¤â´Þ¤á¤¿¤É¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò»È¤Ã¤Æ¤â¤³¤Î¥ê¡¼¥¹¤òÊѹ¹¤·¤¿¤ê
1475 ¤Þ¤¿¡¢¤³¤ì¤é¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¤¤¤º¤ì¤«¤ËÂФ·¤Æ
1477 Áàºî¤¬ÌÀ¼¨Åª¤Ë¼Â¹Ô¤µ¤ì¤¿¾ì¹ç¤ä¡¢¤¹¤Ù¤Æ¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬
1478 ÊĤ¸¤é¤ì¤¿¾ì¹ç¤Ë¤â¡¢¥ê¡¼¥¹¤Ï²òÊü¤µ¤ì¤ë¡£
1480 .\"O Leases may only be taken out on regular files.
1481 .\"O An unprivileged process may only take out a lease on a file whose
1482 .\"O UID (owner) matches the file system UID of the process.
1483 .\"O A process with the
1485 .\"O capability may take out leases on arbitrary files.
1486 ¥ê¡¼¥¹¤Î¼èÆÀ¤ÏÄ̾ï¤Î¥Õ¥¡¥¤¥ë (regular file) ¤ËÂФ·¤Æ¤Î¤ß²Äǽ¤Ç¤¢¤ë¡£
1487 ÈóÆø¢¥×¥í¥»¥¹¤¬¥ê¡¼¥¹¤ò¼èÆÀ¤Ç¤¤ë¤Î¤Ï¡¢UID (½êͼÔ) ¤¬¥×¥í¥»¥¹¤Î
1488 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à UID ¤È°ìÃפ¹¤ë¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¤À¤±¤Ç¤¢¤ë¡£
1490 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹¤ÏǤ°Õ¤Î¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¥ê¡¼¥¹¤ò¼èÆÀ¤Ç¤¤ë¡£
1492 .BR F_GETLEASE " (\fIvoid\fP)"
1493 .\"O Indicates what type of lease is associated with the file descriptor
1495 .\"O by returning either
1496 .\"O .BR F_RDLCK ", " F_WRLCK ", or " F_UNLCK ,
1497 .\"O indicating, respectively, a read lease , a write lease, or no lease.
1500 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
1502 ¤ËÂФ·¤ÆÀßÄꤵ¤ì¤Æ¤¤¤ë¥ê¡¼¥¹¤Î¼ïÊ̤ò¼èÆÀ¤¹¤ë¡£
1503 .BR F_RDLCK ", " F_WRLCK ", " F_UNLCK
1504 ¤Î¤¤¤º¤ì¤«¤¬ÊÖ¤µ¤ì¤ë¡£
1505 .BR F_RDLCK ", " F_WRLCK
1506 ¤Ï¤½¤ì¤¾¤ì¡¢Æɤ߽Ф·¥ê¡¼¥¹¡¢½ñ¤¹þ¤ß¥ê¡¼¥¹¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤³¤È¤ò¼¨¤·¡¢
1508 ¤Ï¥ê¡¼¥¹¤¬²¿¤âÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò¼¨¤¹¡£
1512 .\"O When a process (the "lease breaker") performs an
1515 .\"O .BR truncate (2)
1516 .\"O that conflicts with a lease established via
1517 .\"O .BR F_SETLEASE ,
1518 .\"O the system call is blocked by the kernel and
1519 .\"O the kernel notifies the lease holder by sending it a signal
1522 ¤¢¤ë¥×¥í¥»¥¹ ("lease folder") ¤¬
1524 ¤ÇÀßÄꤵ¤ì¤¿¥ê¡¼¥¹¤ÈÌ·½â¤¹¤ë¤è¤¦¤Ê
1529 ¤½¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¥«¡¼¥Í¥ë¤Ë¤è¤Ã¤ÆÄä»ß¤µ¤ì¡¢
1530 ¥«¡¼¥Í¥ë¤Ï lease holder ¤Ë¥·¥°¥Ê¥ë (¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï
1532 ¤òÁ÷¤Ã¤ÆÄÌÃΤò¹Ô¤¦¡£
1533 .\"O The lease holder should respond to receipt of this signal by doing
1534 .\"O whatever cleanup is required in preparation for the file to be
1535 .\"O accessed by another process (e.g., flushing cached buffers) and
1536 .\"O then either remove or downgrade its lease.
1537 lease holder ¤Ï¤³¤Î¥·¥°¥Ê¥ë¤ò¼õ¿®¤·¤¿¤È¤¤Ë¤Ï¤¤Á¤ó¤ÈÂбþ¤¹¤Ù¤¤Ç¤¢¤ë¡£
1538 ¶ñÂÎŪ¤Ë¤Ï¡¢ÊÌ¤Î¥×¥í¥»¥¹¤¬¤½¤Î¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¤Î½àÈ÷¤È¤·¤Æ
1539 ɬÍפʸåÊÒÉÕ¤± (Î㤨¤Ð¡¢¥¥ã¥Ã¥·¥å¤µ¤ì¤¿¥Ð¥Ã¥Õ¥¡¤Î¥Õ¥é¥Ã¥·¥å) ¤ò
1540 ¤¹¤Ù¤Æ¹Ô¤Ã¤Æ¤«¤é¡¢¤½¤Î¥Õ¥¡¥¤¥ë¤Î¥ê¡¼¥¹¤Îºï½ü¤Þ¤¿¤Ï³Ê²¼¤²¤ò¹Ô¤¦¡£
1541 .\"O A lease is removed by performing an
1543 .\"O command specifying
1547 ¥ê¡¼¥¹¤òºï½ü¤ò¤¹¤ë¤Ë¤Ï¡¢
1554 .\"O If the lease holder currently holds a write lease on the file,
1555 .\"O and the lease breaker is opening the file for reading,
1556 .\"O then it is sufficient for the lease holder to downgrade
1557 .\"O the lease to a read lease.
1558 .\"O This is done by performing an
1560 .\"O command specifying
1564 lease holder ¤¬¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤ß¥ê¡¼¥¹¤òÊÝ»ý¤·¤Æ¤¤¤Æ¡¢
1565 lease breaker ¤¬Æɤ߽Ф·ÍѤˤ½¤Î¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤·¤Æ¤¤¤ë¾ì¹ç¡¢
1566 lease holder ¤¬ÊÝ»ý¤·¤Æ¤¤¤ë¥ê¡¼¥¹¤òÆɤ߽Ф·¥ê¡¼¥¹¤Ë³Ê²¼¤²¤¹¤ì¤Ð
1567 ½½Ê¬¤Ç¤¢¤ë¡£¤³¤ì¤ò¤¹¤ë¤Ë¤Ï¡¢
1575 .\"O If the lease holder fails to downgrade or remove the lease within
1576 .\"O the number of seconds specified in
1577 .\"O .I /proc/sys/fs/lease-break-time
1578 .\"O then the kernel forcibly removes or downgrades the lease holder's lease.
1580 .I /proc/sys/fs/lease-break-time
1581 ¤Ç»ØÄꤵ¤ì¤¿Éÿô°ÊÆâ¤Ë¥ê¡¼¥¹¤Î³Ê²¼¤²¤«ºï½ü¤ò¹Ô¤¨¤Ê¤«¤Ã¤¿¾ì¹ç¡¢
1582 ¥«¡¼¥Í¥ë¤Ï¶¯À©Åª¤Ë¤½¤Î lease holder ¤Î¥ê¡¼¥¹¤òºï½ü¤â¤·¤¯¤Ï³Ê²¼¤²¤ò¹Ô¤¦¡£
1584 .\"O Once the lease has been voluntarily or forcibly removed or downgraded,
1585 .\"O and assuming the lease breaker has not unblocked its system call,
1586 .\"O the kernel permits the lease breaker's system call to proceed.
1587 °ìÅ٥꡼¥¹¤Îºï½ü¤«³Ê²¼¤²¤¬¼«È¯Åª¤â¤·¤¯¤Ï¶¯À©Åª¤Ë¹Ô¤ï¤ì¤ë¤È¡¢
1588 lease breaker ¤¬¤Þ¤À¥·¥¹¥Æ¥à¥³¡¼¥ë¤òºÆ³«¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢
1589 ¥«¡¼¥Í¥ë¤¬ lease breaker ¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î³¹Ô¤òµö²Ä¤¹¤ë¡£
1591 .\"O If the lease breaker's blocked
1594 .\"O .BR truncate (2)
1595 .\"O is interrupted by a signal handler,
1596 .\"O then the system call fails with the error
1598 .\"O but the other steps still occur as described above.
1599 lease breaker ¤¬¼Â¹Ô¤·¤¿
1603 ¤¬Ää»ßÃæ¤Ë¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤êÃæÃǤµ¤ì¤¿¾ì¹ç¡¢
1604 ¤½¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
1606 ¥¨¥é¡¼¤Ç¼ºÇÔ¤¹¤ë¤¬¡¢¾å¤Ç½Ò¤Ù¤¿Â¾¤Î½èÍý¤Ï
1608 .\"O If the lease breaker is killed by a signal while blocked in
1611 .\"O .BR truncate (2),
1612 .\"O then the other steps still occur as described above.
1616 ¤¬Ää»ßÃæ¤Ë lease breaker ¤¬¥·¥°¥Ê¥ë¤Ë¤è¤ê kill ¤µ¤ì¤¿¾ì¹ç¡¢
1617 ¾å¤Ç½Ò¤Ù¤¿Â¾¤Î½èÍý¤Ï¤½¤Î¤Þ¤Þ¹Ô¤ï¤ì¤ë¡£
1618 .\"O If the lease breaker specifies the
1620 .\"O flag when calling
1622 .\"O then the call immediately fails with the error
1623 .\"O .BR EWOULDBLOCK ,
1624 .\"O but the other steps still occur as described above.
1629 ¥Õ¥é¥°¤ò»ØÄꤷ¤¿¾ì¹ç¡¢¤½¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
1631 ¥¨¥é¡¼¤Çľ¤Á¤Ë¼ºÇÔ¤¹¤ë¤¬¡¢¾å¤Ç½Ò¤Ù¤¿Â¾¤Î½èÍý¤Ï¤½¤Î¤Þ¤Þ¹Ô¤ï¤ì¤ë¡£
1633 .\"O The default signal used to notify the lease holder is
1635 .\"O but this can be changed using the
1641 .\"O command is performed (even one specifying
1644 .\"O handler is established using
1645 .\"O .BR SA_SIGINFO ,
1646 .\"O then the handler will receive a
1648 .\"O structure as its second argument, and the
1650 .\"O field of this argument will hold the descriptor of the leased file
1651 .\"O that has been accessed by another process.
1652 .\"O (This is useful if the caller holds leases against multiple files).
1653 lease holder ¤Ø¤ÎÄÌÃΤ˻Ȥï¤ì¤ë¥Ç¥Õ¥©¥ë¥È¤Î¥·¥°¥Ê¥ë¤Ï
1659 ¥³¥Þ¥ó¥É¤ÇÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
1663 ¤ò»ØÄꤵ¤ì¤¿¾ì¹ç¤â´Þ¤à)¡¢
1665 ¥Õ¥é¥°ÉÕ¤¤Ç¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢
1666 ¥Ï¥ó¥É¥é¤ÎÂèÆó°ú¤¿ô¤È¤·¤Æ
1668 ¹½Â¤ÂΤ¬ÅϤµ¤ì¡¢¤³¤Î°ú¤¿ô¤Î
1670 ¥Õ¥£¡¼¥ë¥É¤Ë¤ÏÊÌ¤Î¥×¥í¥»¥¹¤¬¥¢¥¯¥»¥¹¤·¤¿¥ê¡¼¥¹ÀßÄêºÑ¤ß¥Õ¥¡¥¤¥ë¤Î
1671 ¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬Æþ¤Ã¤Æ¤¤¤ë
1672 (¤³¤Îµ¡Ç½¤ÏÊ£¿ô¤Î¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¥ê¡¼¥¹¤òÀßÄꤹ¤ë¾ì¹ç¤ËÍÍѤǤ¢¤ë)¡£
1673 .\"O .SS "File and directory change notification (dnotify)"
1674 .SS "¥Õ¥¡¥¤¥ë¤ä¥Ç¥£¥ì¥¯¥È¥ê¤ÎÊѹ¹¤ÎÄÌÃÎ (dnotify)"
1676 .BR F_NOTIFY " (\fIlong\fP)"
1677 .\"O (Linux 2.4 onwards)
1679 .\"O Provide notification when the directory referred to by
1681 .\"O or any of the files that it contains is changed.
1682 .\"O The events to be notified are specified in
1684 .\"O which is a bit mask specified by ORing together zero or more of
1685 .\"O the following bits:
1687 ¤Ç»²¾È¤µ¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê¤«¡¢¤½¤ÎÃæ¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤ËÊѹ¹¤¬¤¢¤Ã¤¿¾ì¹ç¤Ë
1688 ÄÌÃΤò¹Ô¤¦¡£¤É¤Î¥¤¥Ù¥ó¥È¤òÄÌÃΤ¹¤ë¤«¤Ï
1692 ¤Ï¥Ó¥Ã¥È¥Þ¥¹¥¯¤Ç¡¢°Ê²¼¤Î¥Ó¥Ã¥È¤Î 0¸Ä°Ê¾å¤ÎÏÀÍýϤò¤È¤Ã¤¿¤â¤Î¤ò»ØÄꤹ¤ë¡£
1698 .\"O A file was accessed (read, pread, readv)
1699 ¥Õ¥¡¥¤¥ë¤Ø¤Î¥¢¥¯¥»¥¹¤¬¤¢¤Ã¤¿ (read, pread, readv)
1702 .\"O A file was modified (write, pwrite, writev, truncate, ftruncate).
1703 ¥Õ¥¡¥¤¥ë¤ÎÆâÍƤ¬Êѹ¹¤µ¤ì¤¿ (write, pwrite, writev, truncate, ftruncate).
1706 .\"O A file was created (open, creat, mknod, mkdir, link, symlink, rename).
1707 ¥Õ¥¡¥¤¥ë¤¬ºîÀ®¤µ¤ì¤¿ (open, creat, mknod, mkdir, link, symlink, rename).
1710 .\"O A file was unlinked (unlink, rename to another directory, rmdir).
1711 ¥Õ¥¡¥¤¥ë¤¬ºï½ü (unlink) ¤µ¤ì¤¿ (unlink, Ê̤Υǥ£¥ì¥¯¥È¥ê¤Ø¤Î rename, rmdir)
1714 .\"O A file was renamed within this directory (rename).
1715 ¥Ç¥£¥ì¥¯¥È¥êÆâ¤Ç¤Î¥Õ¥¡¥¤¥ë̾¤ÎÊѹ¹¤¬¤¢¤Ã¤¿ (rename)
1718 .\"O The attributes of a file were changed (chown, chmod, utime[s]).
1719 ¥Õ¥¡¥¤¥ë°À¤¬Êѹ¹¤µ¤ì¤¿ (chown, chmod, utime[s])
1723 .\"O (In order to obtain these definitions, the
1725 .\"O feature test macro must be defined.)
1726 (¾åµ¤ÎÄêµÁ¤òÍøÍѤ¹¤ë¤Ë¤Ï
1728 µ¡Ç½¸¡ºº¥Þ¥¯¥í¤òÄêµÁ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£)
1730 .\"O Directory notifications are normally "one-shot", and the application
1731 .\"O must reregister to receive further notifications.
1732 ¥Ç¥£¥ì¥¯¥È¥ê¤ÎÊѹ¹ÄÌÃΤÏÄ̾ï¡Ö°ì²ó¸Â¤ê (one-shot)¡×¤Ç¤¢¤ê¡¢
1733 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¦¤Ç¤½¤Î¸å¤µ¤é¤ËÄÌÃΤò¼õ¿®¤·¤¿¤¤¾ì¹ç¤Ï
1734 ºÆÅÐÏ¿¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
1735 .\"O Alternatively, if
1736 .\"O .B DN_MULTISHOT
1739 .\"O then notification will remain in effect until explicitly removed.
1743 ¤¬´Þ¤Þ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ë¤Ï¡¢
1744 Êѹ¹ÄÌÃΤÏÌÀ¼¨Åª¤Ë²ò½ü¤µ¤ì¤ë¤Þ¤Ç͸ú¾õÂÖ¤¬·Ñ³¤¹¤ë¡£
1746 .\"O .\" The following does seem a poor API-design choice...
1747 .\" °Ê²¼¤Ï API ¤ÎÀ߷פ¬¤Þ¤º¤¤¤È»×¤¦¤Î¤À¤¬...
1750 .\"O requests is cumulative, with the events in
1752 .\"O being added to the set already monitored.
1754 Í×µá¤ÏÀÑ»»¤µ¤ì¤Æ¤¤¤¯¡£¤Ä¤Þ¤ê¡¢
1756 ¤Ç»ØÄꤵ¤ì¤¿¥¤¥Ù¥ó¥È¤¬¤¹¤Ç¤Ë¥â¥Ë¥¿¤µ¤ì¤Æ¤¤¤ë
1757 ¥¤¥Ù¥ó¥È½¸¹ç¤Ë²Ã»»¤µ¤ì¤ë·Á¤Ë¤Ê¤ë¡£
1758 .\"O To disable notification of all events, make an
1760 .\"O call specifying
1763 ¤¹¤Ù¤Æ¤Î¥¤¥Ù¥ó¥È¤ÎÄÌÃΤò̵¸ú¤Ë¤¹¤ë¤Ë¤Ï¡¢
1767 ¤ò¸Æ¤Ó½Ð¤¹É¬Íפ¬¤¢¤ë¡£
1769 .\"O Notification occurs via delivery of a signal.
1770 ÄÌÃΤϥ·¥°¥Ê¥ë¤ÎÇÛÁ÷¤Ç¹Ô¤ï¤ì¤ë¡£
1771 .\"O The default signal is
1773 .\"O but this can be changed using the
1777 ¥Ç¥Õ¥©¥ë¥È¤Î¥·¥°¥Ê¥ë¤Ï
1783 ¥³¥Þ¥ó¥É¤ÇÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
1784 .\"O In the latter case, the signal handler receives a
1786 .\"O structure as its second argument (if the handler was
1787 .\"O established using
1788 .\"O .BR SA_SIGINFO )
1791 .\"O field of this structure contains the file descriptor which
1792 .\"O generated the notification (useful when establishing notification
1793 .\"O on multiple directories).
1796 ¥Õ¥é¥°ÉÕ¤¤Ç¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï)
1797 ¥Ï¥ó¥É¥é¤ÎÂèÆó°ú¤¿ô¤È¤·¤Æ
1799 ¹½Â¤ÂΤ¬ÅϤµ¤ì¡¢¤³¤Î¹½Â¤ÂΤÎ
1801 ¥Õ¥£¡¼¥ë¥É¤Ë¤ÏÄÌÃΤιԤï¤ì¤¿¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬Æþ¤Ã¤Æ¤¤¤ë
1802 (¤³¤Îµ¡Ç½¤ÏÊ£¿ô¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ËÂФ·¤ÆÄÌÃΤòÀßÄꤹ¤ë¾ì¹ç¤ËÍÍѤǤ¢¤ë)¡£
1804 .\"O Especially when using
1805 .\"O .BR DN_MULTISHOT ,
1806 .\"O a real time signal should be used for notification,
1807 .\"O so that multiple notifications can be queued.
1810 ¤ò»È¤¦¾ì¹ç¤Ï¡¢ÄÌÃΤˤϥꥢ¥ë¥¿¥¤¥à¥·¥°¥Ê¥ë¤ò»È¤¦¤Ù¤¤Ç¤¢¤ë¡£
1811 ¤½¤ì¤Ï¡¢¥ê¥¢¥ë¥¿¥¤¥à¥·¥°¥Ê¥ë¤ò»È¤¦¤³¤È¤Ç¡¢Ê£¿ô¤ÎÄÌÃΤò¥¥å¡¼¤ËÆþ¤ì¤ë
1812 ¤³¤È¤¬¤Ç¤¤ë¤«¤é¤Ç¤¢¤ë¡£
1815 .\"O New applications should use the
1817 .\"O interface (available since kernel 2.6.13),
1818 .\"O which provides a much superior interface for obtaining notifications of
1819 .\"O file system events.
1821 .\"O .BR inotify (7).
1823 ¿·¤·¤¯¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò½ñ¤¯ºÝ¤Ë¤Ï¡¢(¥«¡¼¥Í¥ë 2.6.13 °Ê¹ß¤ÇÍøÍѲÄǽ¤È¤Ê¤Ã¤¿)
1825 ¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò»ÈÍѤ¹¤Ù¤¤Ç¤¢¤ë¡£
1827 ¤Ï¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¥¤¥Ù¥ó¥È¤ÎÄÌÃΤò¼èÆÀ¤¹¤ë¤¿¤á¤Î
1828 ¤º¤Ã¤ÈÍ¥¤ì¤¿¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¤¢¤ë¡£
1831 .\"O .SH "RETURN VALUE"
1833 .\"O For a successful call, the return value depends on the operation:
1834 À®¸ù¤·¤¿¾ì¹ç¤ÎÊÖ¤êÃͤÏÁàºî¤Î¼ïÎà¤Ë¤è¤ê°ã¤¦:
1837 .\"O The new descriptor.
1838 ¿·¤·¤¤¥Ç¥£¥¹¥¯¥ê¥×¥¿¤òÊÖ¤¹¡£
1841 .\"O Value of flags.
1845 .\"O Value of flags.
1849 .\"O Type of lease held on file descriptor.
1850 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂФ·¤ÆÊÝ»ý¤µ¤ì¤Æ¤¤¤ë¥ê¡¼¥¹¤Î¼ïÊ̤òÊÖ¤¹¡£
1853 .\"O Value of descriptor owner.
1854 ¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î½êͼԤòÊÖ¤¹¡£
1857 .\"O Value of signal sent when read or write becomes possible, or zero
1858 .\"O for traditional
1861 Æɤ߹þ¤ß¤ä½ñ¤½Ð¤·¤¬²Äǽ¤Ë¤Ê¤Ã¤¿»þ¤ËÁ÷¤é¤ì¤ë¥·¥°¥Ê¥ë¤ÎÃÍ¡¢¤â¤·¤¯¤Ï
1864 Æ°ºî¤Î¾ì¹ç¤Ë¤Ï¥¼¥í¤òÊÖ¤¹¡£
1866 .\"O All other commands
1868 ¾¤ÎÁ´¤Æ¤Î¥³¥Þ¥ó¥É¤Ï 0 ¤òÊÖ¤¹¡£
1870 .\"O On error, \-1 is returned, and
1872 .\"O is set appropriately.
1873 ¥¨¥é¡¼¤Î»þ¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
1875 ¤ËŬÀÚ¤ÊÃͤ¬ÀßÄꤵ¤ì¤ë¡£
1879 .\"O .BR EACCES " or " EAGAIN
1880 .BR EACCES " ¤« " EAGAIN
1881 .\"O Operation is prohibited by locks held by other processes.
1882 ¾¤Î¥×¥í¥»¥¹¤¬ÊÝ»ý¤·¤Æ¤¤¤ë¥í¥Ã¥¯¤Ë¤è¤Ã¤ÆÁàºî¤¬¶Ø»ß¤µ¤ì¤Æ¤¤¤ë¡£
1885 .\"O The operation is prohibited because the file has been memory-mapped by
1886 .\"O another process.
1887 ¤½¤Î¥Õ¥¡¥¤¥ë¤Ï¾¤Î¥×¥í¥»¥¹¤Ë¤è¤Ã¤Æ¥á¥â¥ê¡¦¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤ë¤¿¤á¡¢
1888 Áàºî¤¬¶Ø»ß¤µ¤ì¤Æ¤¤¤ë¡£
1892 .\"O is not an open file descriptor, or the command was
1896 .\"O and the file descriptor open mode doesn't match with the
1897 .\"O type of lock requested.
1899 ¤¬¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¡£
1904 ¤À¤Ã¤¿¤¬¡¢ÂоݤΥե¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¥ª¡¼¥×¥ó¥â¡¼¥É¤¬
1905 ɬÍפȤʤë¥í¥Ã¥¯¤Î·¿¤Ë¥Þ¥Ã¥Á¤·¤Æ¤¤¤Ê¤¤¡£
1908 .\"O It was detected that the specified
1910 .\"O command would cause a deadlock.
1914 ¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¤¿¾ì¹ç¤Ë¤Ï¥Ç¥Ã¥É¥í¥Ã¥¯¤Ë¤Ê¤ë¤³¤È¤¬¸¡½Ð¤µ¤ì¤¿¡£
1918 .\"O is outside your accessible address space.
1920 ¤¬ÍøÍѲÄǽ¤Ê¥¢¥É¥ì¥¹¶õ´Ö¤Î³°Éô¤Ë¤¢¤ë¡£
1925 .\"O the command was interrupted by a signal; see
1926 .\"O .BR signal (7).
1928 .\"O .BR F_GETLK " and " F_SETLK ,
1929 .\"O the command was interrupted by a signal before the lock was checked or
1931 .\"O Most likely when locking a remote file (e.g., locking over
1932 .\"O NFS), but can sometimes happen locally.
1934 ¥³¥Þ¥ó¥É¤¬¥·¥°¥Ê¥ë¤Ë¤è¤ê³ä¤ê¹þ¤Þ¤ì¤¿
1937 .BR F_GETLK " ¤È " F_SETLK
1938 ¤Î¾ì¹ç¡¢¥í¥Ã¥¯¤ò³Îǧ¤·¤¿¤ê¼èÆÀ¤·¤¿¤ê¤¹¤ëÁ°¤Ë¥·¥°¥Ê¥ë¤Ë¤è¤Ã¤Æ³ä¤ê¹þ¤Þ¤ì¤¿¡£
1939 ¤³¤ì¤Ï¤¿¤¤¤Æ¤¤¥ê¥â¡¼¥È¤Î¥Õ¥¡¥¤¥ë¤ò¥í¥Ã¥¯¤¹¤ë¾ì¹ç
1940 (Î㤨¤Ð NFS ¾å¤Ç¥í¥Ã¥¯¤¹¤ë¾ì¹ç) ¤Ëµ¯¤³¤ë¡£
1941 ¤·¤«¤·¥í¡¼¥«¥ë¤Ç¤âµ¯¤³¤ë¾ì¹ç¤¬¤¢¤ë¡£
1947 .\"O is negative or is greater than the maximum allowable value.
1951 .\"O is not an allowable signal number.
1954 ¤¬É餫¡¢¤â¤·¤¯¤Ïµö¤µ¤ì¤ëºÇÂçÃͤè¤ê¤âÂ礤¤¡£
1958 ¤¬ÍøÍѲÄǽ¤Ê¥·¥°¥Ê¥ëÈÖ¹æ¤Ç¤Ï¤Ê¤¤¡£
1963 .\"O the process already has the maximum number of file descriptors open.
1965 ¥×¥í¥»¥¹¤¬¤¹¤Ç¤ËºÇÂç¿ô¤Þ¤Ç¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò¥ª¡¼¥×¥ó¤·¤Æ¤¤¤ë¡£
1968 .\"O Too many segment locks open, lock table is full, or a remote locking
1969 .\"O protocol failed (e.g., locking over NFS).
1970 ¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¥í¥Ã¥¯¤Î¿ô¤¬Â¿²á¤®¤Æ¡¢¥í¥Ã¥¯¡¦¥Æ¡¼¥Ö¥ë¤¬¤¤¤Ã¤Ñ¤¤¤Ç¤¢¤ë¡£
1971 ¤Þ¤¿¤Ï remote locking protocol (Î㤨¤Ð NFS ¾å¤Î¥í¥Ã¥¯) ¤¬¼ºÇÔ¤·¤¿¡£
1974 .\"O Attempted to clear the
1976 .\"O flag on a file that has the append-only attribute set.
1977 ÄɲÃÀìÍÑ°À¤¬ÀßÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤Î
1979 ¥Õ¥é¥°¤ò¥¯¥ê¥¢¤·¤è¤¦¤È»î¤ß¤¿¡£
1980 .\"O .SH "CONFORMING TO"
1982 .\"O SVr4, 4.3BSD, POSIX.1-2001.
1983 SVr4, 4.3BSD, POSIX.1-2001.
1984 .\"O Only the operations
1996 .\"O are specified in POSIX.1-2001.
1997 POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ëÁàºî¤Ï¡¢
2010 .\"O .B F_DUPFD_CLOEXEC
2011 .\"O is specified in POSIX.1-2008.
2013 ¤Ï POSIX.1-2008 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
2015 .\"O .BR F_GETOWN_EX ,
2016 .\"O .BR F_SETOWN_EX ,
2020 .\"O .BR F_GETLEASE ,
2023 .\"O are Linux-specific.
2026 .\"O macro to obtain these definitions.)
2034 ¤Ï Linux ¸ÇͤǤ¢¤ë (¤³¤ì¤é¤ÎÄêµÁ¤ò͸ú¤Ë¤¹¤ë¤Ë¤Ï
2036 ¥Þ¥¯¥í¤òÄêµÁ¤¹¤ë¤³¤È)¡£
2038 .\"O .\" SVr4 documents additional EIO, ENOLINK and EOVERFLOW error conditions.
2039 .\" SVr4 ¤Ë¤Ï¾¤Ë EFAULT, EINTR, EIO, ENOLINK, EOVERFLOW ¥¨¥é¡¼¾õÂ֤ˤĤ¤¤Æ¤Î
2043 .\"O The errors returned by
2045 .\"O are different from those returned by
2047 ¥¨¥é¡¼¤ÎºÝ¤ÎÊÖ¤êÃͤ¬
2053 .\"O Since kernel 2.0, there is no interaction between the types of lock
2058 ¥«¡¼¥Í¥ë 2.0 °Ê¹ß¤Ç¤Ï¡¢
2062 ¤¬ÀßÄꤹ¤ë¥í¥Ã¥¯¼ïÊ̤δ֤ËÁê¸ßºîÍѤϤʤ¤¡£
2064 .\"O Several systems have more fields in
2065 .\"O .I "struct flock"
2066 .\"O such as, for example,
2068 .\"O .\" e.g., Solaris 8 documents this field in fcntl(2), and Irix 6.5
2069 .\"O .\" documents it in fcntl(5). mtk, May 2007
2072 .\"O alone is not going to be very useful if the process holding the lock
2073 .\"O may live on a different machine.
2074 ¥·¥¹¥Æ¥à¤Ë¤è¤Ã¤Æ¤Ï¡¢
2076 ¤Ë¾åµ°Ê³°¤Î¥Õ¥£¡¼¥ë¥É¤¬¤¢¤ë¤â¤Î¤â¤¢¤ë (Î㤨¤Ð
2078 .\" e.g., Solaris 8 documents this field in fcntl(2), and Irix 6.5
2079 .\" documents it in fcntl(5). mtk, May 2007
2080 ¤Ï¤Ã¤¤ê¤È¸À¤¨¤ë¤³¤È¤Ï¡¢¥í¥Ã¥¯¤òÊÝ»ý¤·¤Æ¤¤¤ë¥×¥í¥»¥¹¤¬Ê̤Υޥ·¥ó¤Ë¸ºß
2083 ¤À¤±¤Ï¤¢¤Þ¤êÌò¤Ë¤¿¤¿¤Ê¤¤¤À¤í¤¦¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£
2086 .\"O A limitation of the Linux system call conventions on some
2087 .\"O architectures (notably i386) means that if a (negative)
2088 .\"O process group ID to be returned by
2090 .\"O falls in the range \-1 to \-4095, then the return value is wrongly
2091 .\"O interpreted by glibc as an error in the system call;
2092 .\"O .\" glibc source: sysdeps/unix/sysv/linux/i386/sysdep.h
2093 .\"O that is, the return value of
2095 .\"O will be \-1, and
2097 .\"O will contain the (positive) process group ID.
2098 ¤¤¤¯¤Ä¤«¤Î¥¢¡¼¥¥Æ¥¯¥Á¥ã (ÆÃ¤Ë i386) ¤Ë¤ª¤±¤ë Linux ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î´·½¬
2099 ¤Î¤¿¤á°Ê²¼¤ÎÀ©¸Â¤¬Â¸ºß¤¹¤ë¡£
2101 ¤¬ÊÖ¤¹ (Éé¤Î) ¥×¥í¥»¥¹¥°¥ë¡¼¥×ID ¤¬ \-1 ¤«¤é \-4095 ¤ÎÈϰϤËÆþ¤Ã¤¿¾ì¹ç¡¢
2102 glibc ¤Ï¤³¤ÎÊÖ¤êÃͤò¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¤È
2103 ´Ö°ã¤Ã¤Æ²ò¼á¤·¤Æ¤·¤Þ¤¦¡£¤Ä¤Þ¤ê¡¢
2105 ¤ÎÊÖ¤êÃÍ¤Ï \-1 ¤È¤Ê¤ê¡¢
2107 ¤Ë¤Ï (Àµ¤Î) ¥×¥í¥»¥¹¥°¥ë¡¼¥×ID ¤¬ÀßÄꤵ¤ì¤ë¤³¤È¤Ë¤Ê¤ë¡£
2108 .\"O The Linux-specific
2109 .\"O .BR F_SETOWN_EX
2111 .\"O .BR F_GETOWN_EX
2112 .\"O operations avoid this problem.
2117 ¤Ç¤Ï¤³¤ÎÌäÂê¤ò²óÈò¤Ç¤¤ë¡£
2118 .\"O .\" mtk, Dec 04: some limited testing on alpha and ia64 seems to
2119 .\"O .\" indicate that ANY negative PGID value will cause F_GETOWN
2120 .\"O .\" to misinterpret the return as an error. Some other architectures
2121 .\"O .\" seem to have the same range check as i386.
2122 .\" mtk, Dec 04: alpha ¤È ia64 ¤Ç¤Ï¡¢¾¯¤·¥Æ¥¹¥È¤·¤Æ¤ß¤¿¸Â¤ê¡¢
2123 .\" ¡Ö¤É¤ó¤Ê¡×Éé¤Î PGID ¤Ç¤â F_GETOWN ¤Ç¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¤È´Ö°ã¤Ã¤Æ
2124 .\" ²ò¼á¤µ¤ì¤Æ¤·¤Þ¤¦¤è¤¦¤À¡£Â¾¤Î¤¤¤¯¤Ä¤«¤Î¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Ç¤Ï¡¢
2125 .\" i386 ¤ÈƱÍͤÎÈϰϤΥÁ¥§¥Ã¥¯¤¬¹Ô¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£
2127 .\"O In Linux 2.4 and earlier, there is bug that can occur
2128 .\"O when an unprivileged process uses
2130 .\"O to specify the owner
2131 .\"O of a socket file descriptor
2132 .\"O as a process (group) other than the caller.
2135 .\"O can return \-1 with
2139 .\"O even when the owner process (group) is one that the caller
2140 .\"O has permission to send signals to.
2141 .\"O Despite this error return, the file descriptor owner is set,
2142 .\"O and signals will be sent to the owner.
2143 Linux 2.4 °ÊÁ°¤Ç¤Ï¡¢ÈóÆø¢¥×¥í¥»¥¹¤¬
2145 ¤ò»È¤Ã¤Æ¡¢¥½¥±¥Ã¥È¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î½êͼԤË
2146 ¸Æ¤Ó½Ð¤·¸µ°Ê³°¤Î¥×¥í¥»¥¹ (¤ä¥×¥í¥»¥¹¥°¥ë¡¼¥×) ¤ò»ØÄꤹ¤ë¤È
2147 ȯÀ¸¤¹¤ë¥Ð¥°¤¬¤¢¤ë¡£¤³¤Î¾ì¹ç¡¢
2148 ¸Æ¤Ó½Ð¤·¸µ¤¬½êͼԤȤ·¤Æ»ØÄꤷ¤¿¥×¥í¥»¥¹ (¤ä¥×¥í¥»¥¹¥°¥ë¡¼¥×) ¤Ë
2149 ¥·¥°¥Ê¥ë¤òÁ÷¤ëµö²Ä¤ò»ý¤Ã¤Æ¤¤¤¿¤È¤·¤Æ¤â¡¢
2155 ¤òÀßÄꤹ¤ë¤³¤È¤¬¤¢¤ë¡£
2156 ¤³¤Î¥¨¥é¡¼¤¬Ê֤俤ˤ⤫¤«¤ï¤é¤º¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î½êͼÔ
2157 ¤ÏÀßÄꤵ¤ì¡¢¥·¥°¥Ê¥ë¤Ï¤½¤Î½êͼԤËÁ÷¤é¤ì¤ë¡£
2159 .\"O The implementation of mandatory locking in all known versions of Linux
2160 .\"O is subject to race conditions which render it unreliable:
2161 .\"O .\" http://marc.info/?l=linux-kernel&m=119013491707153&w=2
2164 .\"O call that overlaps with a lock may modify data after the mandatory lock is
2168 .\"O call that overlaps with a lock may detect changes to data that were made
2169 .\"O only after a write lock was acquired.
2170 .\"O Similar races exist between mandatory locks and
2172 .\"O It is therefore inadvisable to rely on mandatory locking.
2173 ¤³¤ì¤Þ¤Ç¤Î Linux ¤ÎÁ´¤Æ¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤ª¤±¤ë¶¯À©¥í¥Ã¥¯¤Î¼ÂÁõ¤Ï¡¢
2174 ¶¥¹ç¾ò·ï²¼¤Ç¶¯À©¥í¥Ã¥¯¤¬ÉÔ´°Á´¤Ë¤Ê¤ë¤è¤¦¤Ê¾ì¹ç¤¬¤¢¤ë¡£
2175 .\" http://marc.info/?l=linux-kernel&m=119013491707153&w=2
2176 ¥í¥Ã¥¯¤È½Å¤Ê¤Ã¤Æ¼Â¹Ô¤µ¤ì¤¿
2178 ¤Î¸Æ¤Ó½Ð¤·¤Ï¶¯À©¥í¥Ã¥¯¤¬³ÍÆÀ¤µ¤ì¤¿¸å¤Ë¤â¥Ç¡¼¥¿¤òÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
2179 ¥í¥Ã¥¯¤È½Å¤Ê¤Ã¤Æ¼Â¹Ô¤µ¤ì¤¿
2181 ¤Î¸Æ¤Ó½Ð¤·¤Ï¶¯À©¥í¥Ã¥¯¤¬³ÍÆÀ¤µ¤ì¤¿¸å¤Ë¤Ê¤Ã¤Æ¹Ô¤ï¤ì¤¿¥Ç¡¼¥¿¤ÎÊѹ¹¤ò
2182 ¸¡½Ð¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
2183 ƱÍͤζ¥¹ç¾ò·ï¤¬¶¯À©¥í¥Ã¥¯¤È
2185 ¤Î´Ö¤Ë¤â¸ºß¤¹¤ë¡£¤½¤ì¤æ¤¨¡¢¶¯À©¥í¥Ã¥¯¤ËÍê¤ë¤Î¤Ï¤ªÁ¦¤á¤Ç¤¤Ê¤¤¡£
2193 .BR capabilities (7),
2194 .BR feature_test_macros (7)
2197 .\"O .IR locks.txt ,
2198 .\"O .IR mandatory-locking.txt ,
2201 .\"O in the kernel source directory
2202 .\"O .IR Documentation/filesystems/ .
2203 .\"O (On older kernels, these files are directly under the
2204 .\"O .I Documentation/
2206 .\"O .I mandatory-locking.txt
2208 .\"O .IR mandatory.txt .)
2210 .IR Documentation/filesystems/
2213 .IR mandatory-locking.txt ,
2216 (°ÊÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï¡¢¤³¤ì¤é¤Î¥Õ¥¡¥¤¥ë¤Ï
2218 ¥Ç¥£¥ì¥¯¥È¥êľ²¼¤Ë¤¢¤ê¡¢
2219 .I mandatory-locking.txt
2222 ¤È¤¤¤¦Ì¾Á°¤Ç¤¢¤Ã¤¿¡£)