File: inotify.7

package info (click to toggle)
manpages-ja 0.5.0.0.20080615-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,508 kB
  • ctags: 1
  • sloc: sh: 13,690; perl: 157; makefile: 114
file content (354 lines) | stat: -rw-r--r-- 9,433 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
'\" t
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Japanese Version Copyright (c) 2006 Yuichi SATO
.\"         all rights reserved.
.\" Translated 2006-07-05 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.29
.\" Updated 2006-07-20 by Yuichi SATO, LDP v2.36
.\" Updated 2007-06-13, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.55
.\"
.TH INOTIFY 7 2007-06-03 "Linux" "Linux Programmer's Manual"
.SH ̾
inotify \- ե륷ƥ।٥Ȥƻ뤹
.SH 
.I inotify
API ϥե륷ƥ।٥Ȥƻ뤹뤿ε󶡤롣
inotify ϸġΥեǥ쥯ȥƻ뤹Τ˻Ȥ롣
ǥ쥯ȥƻ뤹硢inotify ϥǥ쥯ȥ꼫Ȥ
ǥ쥯ȥΥեΥ٥Ȥ֤

ʲΥƥॳ뤬 API ȶ˻Ѥ롣
.BR inotify_init (2),
.BR inotify_add_watch (2),
.BR inotify_rm_watch (2),
.BR read (2),
.BR close (2).

.BR inotify_init (2)
 inotify 󥹥󥹤inotify 󥹥󥹤򻲾Ȥ
եǥץ֤

.BR inotify_add_watch (2)
 inotify 󥹥󥹤˴ϢŤ줿ִƻо (watch) ꥹȡפ롣
ƻоݥꥹȤγƥƥ ("watch") ϡ
եޤϥǥ쥯ȥΥѥ̾ȡ
Υѥ̾ǻȤեФ
ͥ뤬ƻ뤹ʣΥ٥Ȥνꤹ롣
.BR inotify_add_watch (2)
Ͽƻ륢ƥκ¸δƻоݤѹǤ롣
ƴƻоݤϰդΡִƻоݥǥץפġ
ϴƻоݤȤ
.BR inotify_add_watch (2)
֤Ǥ롣

.BR inotify_rm_watch (2)
 inotify δƻоݥꥹȤ饢ƥ롣

inotify 󥹥󥹤ؤƤ
ƤΥեǥץ줿硢
βؤˤ륪֥ȤȤΥ꥽ϡ
ͥǺѤ뤿˲롣
Ϣڤ줿ƻоݤϼưŪ˲롣

ɤΤ褦ʥ٥ȤäƤΤˤϡ
ץꥱ inotify եǥץ
.BR read (2)
Ф褤
ޤǤ˲⥤٥ȤäƤʤ硢
 (blocking) ⡼ɤΥեǥץǤС
ʤȤ 1 ĤΥ٥Ȥޤ
.BR read (2)
ߤ롣

.BR read (2)
ȡʲι¤Τ 1 İʾޤХåե֤:
.in +4n
.nf

struct inotify_event {
    int      wd;       /* ƻоݥǥץ */
    uint32_t mask;     /* ٥ȤΥޥ */
    uint32_t cookie;   /* Ϣ륤٥ȷϢŤ
                          դʥå (rename(2) ) */
    uint32_t len;      /* 'name' եɤΥ */
    char     name[];   /* NULL ǽü줿Ǥդ̾ */
};
.fi
.in

.I wd
ϥ٥ȯδƻоݤꤹ롣
ϡäƹԤ줿
.BR inotify_add_watch (2)
ƤӽФ֤줿ƻоݥǥץΤ 1 ĤǤ롣

.I mask
ˤȯ٥ () 򵭽Ҥ뤿ΥӥåȤޤޤ롣

.I cookie
ϴϢ륤٥ȤϢŤ뤿ΰդǤ롣
ߤΤȤͤ rename ٥ȤФƤΤ߻ȤƤꡢ
̤ΥڥǤ
.B IN_MOVE_FROM

.B IN_MOVE_TO
٥Ȥ򥢥ץꥱǴϢŤ뤳ȤǤ롣

.I name
եɤϴƻ뤷Ƥǥ쥯ȥΥեФ
٥Ȥ֤Τˤ¸ߤ롣
ƻ뤹ǥ쥯ȥ꤫ΥեХѥ̾ɽ
Υѥ̾ NULL ǽü졢
θɤ߹ߤŬڤʥɥ쥹Ĵ뤿ˡ
 NULL ХȤޤޤ⤢롣

.I len
եɤ NULL ХȤޤ
.I name
ƤΥХȿɽ
äơ
.I inotify_event
¤ΤΥ
.I "sizeof(inotify_event)+len"
Ǥ롣

.BR read (2)
Ϥ줿ХåեƼΥ٥Ȥ˴ؤ֤ʤ
ưϥͥΥСˤۤʤ롣
2.6.21 ΥͥǤϡ
.BR read (2)
 0 ֤
2.6.21 ʹߤΥͥǤϡ
.BR read (2)
ϥ顼
.B EINVAL
ǼԤ롣
.SS inotify ٥
.BR inotify_add_watch (2)

.I mask
ȡinotify ե빽¤Τ
.BR read (2)
Ȥ֤
.I inotify_event
¤Τ
.I mask
եɤϡȤ inotify ٥Ȥ̤뤿
ӥåȥޥǤ롣
ʲΥӥåȤ
.BR inotify_add_watch (2)
Ƥ֤Ȥ
.I mask
˻ǽǤꡢ
.BR read (2)
֤
.I mask
եɤ֤:
.RS 4
.sp
.PD 0
.TP 18
.B IN_ACCESS
ե뤬 (read) 줿(*)
.TP
.B IN_ATTRIB
᥿ǡѹ줿 (ġॹסĥ°ʤ)(*)
.TP
.B IN_CLOSE_WRITE
񤭹ߤΤ˥ץ󤵤줿ե뤬줿(*)
.TP
.B IN_CLOSE_NOWRITE
񤭹߰ʳΤ˥ץ󤵤줿ե뤬줿(*)
.TP
.B IN_CREATE
ƻоݥǥ쥯ȥǥեǥ쥯ȥ꤬줿(*)
.TP
.B IN_DELETE
ƻоݥǥ쥯ȥǥեǥ쥯ȥ꤬줿(*)
.TP
.B IN_DELETE_SELF
ƻоݤΥǥ쥯ȥޤϥե뼫Ȥ줿
.TP
.B IN_MODIFY
ե뤬줿(*)
.TP
.B IN_MOVE_SELF
ƻоݤΥǥ쥯ȥޤϥե뼫Ȥư줿
.TP
.B IN_MOVED_FROM
ե뤬ƻоݥǥ쥯ȥ곰ذư줿(*)
.TP
.B IN_MOVED_TO
ե뤬ƻоݥǥ쥯ȥذư줿(*)
.TP
.B IN_OPEN
ե뤬ץ󤵤줿(*)
.PD
.RE
.PP
ǥ쥯ȥƻ뤹硢
嵭ǥꥹ (*) դ٥Ȥϡ
Υǥ쥯ȥΥեФȯ롣
ΤȤ
.I inotify_event
¤Τ֤
.I name
եɤϡǥ쥯ȥΥե̾ɽ
.PP
.B IN_ALL_EVENTS
ޥϾ嵭Υ٥ƤΥޥȤ롣
Υޥ
.BR inotify_add_watch (2)
ƤӽФȤ
.I mask
ȤƻȤ롣

 2 Ĥʥޥ롣
.B IN_MOVE

IN_MOVED_FROM|IN_MOVED_TO

.B IN_CLOSE

IN_CLOSE_WRITE|IN_CLOSE_NOWRITE

.PP
¾ˤʲΥӥåȤ
.BR inotify_add_watch (2)
Ƥ֤Ȥ
.I mask
˻Ǥ:
.RS 4
.sp
.PD 0
.TP 18
.B IN_DONT_FOLLOW
\fIpathname\fP ܥå󥯤Ǥéʤ
(Linux 2.6.15 ʹ)
.TP
.B IN_MASK_ADD
\fIpathname\fP Фƻޥ¸ߤ硢
(ޥ֤ǤϤʤ) ٥Ȥɲ (OR) 롣
.TP
.B IN_ONESHOT
1 ĤΥ٥ȤˤĤ \fIpathname\fP ƻ뤷
٥ȤȯƻоݥꥹȤ롣
.TP
.B IN_ONLYDIR
\fIpathname\fP ǥ쥯ȥξˤΤߴƻ뤹롣
(Linux 2.6.15 ʹ)
.PD
.RE
.PP
ʲΥӥåȤ
.BR read (2)
֤
.I mask
եɤꤵ:
.RS 4
.sp
.PD 0
.TP 18
.B IN_IGNORED
ƻоݤ (\fBinotify_rm_watch\fP(2) ˤ) Ū
줿⤷ (եκޤϥե
ƥΥޥȤˤ) ưŪ˺줿
.TP
.B IN_ISDIR
Υ٥Ȥоݤǥ쥯ȥǤ롣
.TP
.B IN_Q_OVERFLOW
٥ȥ塼줿 (Υ٥Ȥξ硢\fIwd\fP  \-1 Ǥ)
.TP
.B IN_UNMOUNT
ƻоݥ֥Ȥޤե륷ƥबޥȤ줿
.PD
.RE
.SS /proc 󥿡ե
ʲΥ󥿡եϡinotify Ǿ񤵤
̤ͥ¤Τ˻ѤǤ:
.TP
.I /proc/sys/fs/inotify/max_queued_events
Υեͤϡץꥱ
.BR inotify_init (2)
ƤӽФȤ˻Ѥ졢б inotify 󥹥󥹤ˤĤ
塼륤٥Ȥοξ¤ꤹ롣
¤Ķ٥Ȥ˴뤬
.B IN_Q_OVERFLOW
٥Ȥ롣
.TP
.I /proc/sys/fs/inotify/max_user_instances
1 Ĥμ¥桼 ID ФǤ
inotify 󥹥󥹤οξ¤ꤹ롣
.TP
.I /proc/sys/fs/inotify/max_user_watches
 inotify 󥹥󥹤˴ϢŤƻоݤο¤ꤹ롣
.SH С
inotify  2.6.13  Linux ͥȹޤ줿
ɬפʥ饤֥Υ󥿡եϡ
glibc ΥС 2.4 ɲä줿
.RB ( IN_DONT_FOLLOW ,
.BR IN_MASK_ADD ,
.B IN_ONLYDIR
ϥС 2.5 ɲä줿)
.SH 
inotify API  Linux ȼΤΤǤ롣
.SH 
inotify եǥץ
.BR select (2),
.BR poll (2),
.BR epoll (7)
ȤäƴƻǤ롣

inotify եǥץФ
Ϣ³ inotify ٥ȤƱξ
.RI ( wd ,
.IR mask ,
.IR cookie ,
.I name
)Ϣ³륤٥Ȥ 1 ĤΥ٥ȤˤޤȤ롣

inotify եǥץɤ߹ߤ֤륤٥Ȥϡ
դ줿塼ˤʤ롣
äơȤСǥ쥯ȥ̤̾̾ѹ硢
inotify եǥץˤĤƤ֤
٥Ȥ뤳Ȥݾڤ롣

.B FIONREAD
.BR ioctl (2)
 inotify եǥץ鲿Хɤ߹뤫֤

inotify ˤǥ쥯ȥδƻϺƵŪ˹Ԥʤ:
ǥ쥯ȥʲΥ֥ǥ쥯ȥƻ뤹硢
ƻоݤɲäǺʤФʤʤ
.SH Х
2.6.16 ΥͥǤ
.B IN_ONESHOT
.I mask
ե饰Ưʤ
.SH Ϣ
.BR inotify_add_watch (2),
.BR inotify_init (2),
.BR inotify_rm_watch (2),
.BR read (2),
.BR stat (2),
.IR Documentation/filesystems/inotify.txt .