Revision | d182ea101a394ef14505edfbeafbc8fd9cf5a131 (tree) |
---|---|
Zeit | 2014-04-28 02:50:28 |
Autor | Akihiro MOTOKI <amotoki@gmai...> |
Commiter | Akihiro MOTOKI |
(split) LDP: Translate inotify.7
@@ -53,8 +53,8 @@ inotify \- ファイルシステムイベントを監視する | ||
53 | 53 | この API では以下のシステムコールが使用される。 |
54 | 54 | .IP * 3 |
55 | 55 | \fBinotify_init\fP(2) は inotify インスタンスを作成し、inotify インスタンスを参照する ファイルディスクリプタを返す。 |
56 | -もっと新しい \fBinotify_init1\fP(2) も \fBinotify_init\fP(2) と同様だが、いくつかの追加の機能を利用するための | |
57 | -\fIflags\fP 引き数を持っている。 | |
56 | +より新しい \fBinotify_init1\fP(2) も \fBinotify_init\fP(2) と同様だが、 | |
57 | +こちらにはいくつかの追加の機能を利用するための \fIflags\fP 引き数がある。 | |
58 | 58 | .IP * |
59 | 59 | \fBinotify_add_watch\fP(2) は inotify インスタンスに関連づけられた「監視対象 (watch) リスト」を操作する。 |
60 | 60 | 監視対象リストの各アイテム ("watch") は、 ファイルまたはディレクトリのパス名と、 そのパス名で参照されるファイルに対して |
@@ -62,21 +62,18 @@ inotify \- ファイルシステムイベントを監視する | ||
62 | 62 | は新しい監視アイテムの作成や既存の監視対象の変更ができる。 各監視対象は一意の「監視対象ディスクリプタ」を持つ。 これは監視対象を作成したときに |
63 | 63 | \fBinotify_add_watch\fP(2) から返される整数である。 |
64 | 64 | .IP * |
65 | -When events occur for monitored files and directories, those events are made | |
66 | -available to the application as structured data that can be read from the | |
67 | -inotify file descriptor using \fBread\fP(2) (see below). | |
65 | +監視しているファイルやディレクトリでイベントが起こると、 それらのイベントはアプリケーションから inotify ファイルディスクリプタから | |
66 | +\fBread\fP(2) を使って構造化データとして読み出すことができる (下記参照)。 | |
68 | 67 | .IP * |
69 | 68 | \fBinotify_rm_watch\fP(2) は inotify の監視対象リストからアイテムを削除する。 |
70 | 69 | .IP * |
71 | 70 | inotify インスタンスを指している 全てのファイルディスクリプタが (\fBclose\fP(2) を使って) クローズされた場合、 |
72 | 71 | その下層にあるオブジェクトとそのリソースは、 カーネルで再利用するために解放される。 関連が切られた監視対象は自動的に解放される。 |
73 | 72 | |
74 | -With careful programming, an application can use inotify to efficiently | |
75 | -monitor and cache the state of a set of filesystem objects. However, robust | |
76 | -applications should allow for the fact that bugs in the monitoring logic or | |
77 | -races of the kind described below may leave the cache inconsistent with the | |
78 | -filesystem state. It is probably wise to to do some consistency checking, | |
79 | -and rebuild the cache when inconsistencies are detected. | |
73 | +注意深くプログラミングすることで、 アプリケーションは inotify | |
74 | +を使ってファイルシステムオブジェクトの集合の状態を効率的に監視しキャッシュしておくことができる。 | |
75 | +しかしながら、ロバストなアプリケーションでは、監視ロジックのバグや以下に説明があるような種類の競合条件によりファイルシステムの状態とキャッシュが一致しない状態になることがあるという事実も考慮に入れておくべきである。 | |
76 | +おそらく何らかの一貫性のチェックを行い、不一致が検出された場合にはキャッシュを再構築するのが懸命だろう。 | |
80 | 77 | .SS "inotify ファイルディスクリプタからのイベントの読み出し" |
81 | 78 | どのようなイベントが起こっていたかを知るには、 アプリケーションで inotify ファイルディスクリプタを \fBread\fP(2) すればよい。 |
82 | 79 | これまでに何もイベントが起こっていない場合、 停止 (blocking) モードのファイルディスクリプタであれば、 少なくとも 1 |
@@ -159,11 +156,9 @@ struct inotify_event { | ||
159 | 156 | 監視対象ディレクトリ内でファイルやディレクトリが削除された。 |
160 | 157 | .TP |
161 | 158 | \fBIN_DELETE_SELF\fP |
162 | -Watched file/directory was itself deleted. (This event also occurs if an | |
163 | -object is moved to another filesystem, since \fBmv\fP(1) in effect copies the | |
164 | -file to the other filesystem and then deletes it from the original | |
165 | -filesystem.) In addition, an \fBIN_IGNORED\fP event will subsequently be | |
166 | -generated for the watch descriptor. | |
159 | +監視対象のファイルやディレクトリ自身が削除あれた。 (このイベントはオブジェクトが別のファイルシステムに移動された場合にも発生する。 \fBmv\fP(1) | |
160 | +は実際には別のファイルシステムにファイルをコピーした後、元のファイルシステムからそのファイルを削除するからである。) また、 | |
161 | +結果的に監視ディスクリプタに対して \fBIN_IGNORED\fP イベントも生成される。 | |
167 | 162 | .TP |
168 | 163 | \fBIN_MODIFY\fP (*) |
169 | 164 | ファイルが変更された (\fBwrite\fP(2), \fBtruncate\fP(2) など)。 |
@@ -239,9 +234,8 @@ generated for the watch descriptor. | ||
239 | 234 | イベントが生成される。 |
240 | 235 | .RE |
241 | 236 | .SS 例 |
242 | -Suppose an application is watching the directory \fIdir\fP and the file | |
243 | -\fIdir/myfile\fP for all events. The examples below show some events that will | |
244 | -be generated for these two objects. | |
237 | +アプリケーションがディレクトリ \fIdir\fP とファイル \fIdir/myfile\fP のすべてのイベントを監視しているとする。 以下に、これらの 2 | |
238 | +つのオブジェクトに対して生成されるイベントの例を示す。 | |
245 | 239 | .RS 4 |
246 | 240 | .TP |
247 | 241 | fd = open("dir/myfile", O_RDWR); |
@@ -260,9 +254,8 @@ close(fd); | ||
260 | 254 | \fIdir\fP と \fIdir/myfile\fP の両方に対して \fBIN_CLOSE_WRITE\fP イベントが生成される |
261 | 255 | .RE |
262 | 256 | .PP |
263 | -Suppose an application is watching the directories \fIdir1\fP and \fIdir2\fP, and | |
264 | -the file \fIdir1/myfile\fP. The following examples show some events that may | |
265 | -be generated. | |
257 | +アプリケーションがディレクトリ \fIdir1\fP と \fIdir2\fP、およびファイル \fIdir1/myfile\fP を監視しているとする。 | |
258 | +以下に生成されるイベントの例を示す。 | |
266 | 259 | .RS 4 |
267 | 260 | .TP |
268 | 261 | link("dir1/myfile", "dir2/new"); |
@@ -274,32 +267,30 @@ rename("dir1/myfile", "dir2/myfile"); | ||
274 | 267 | \fBIN_MOVED_TO\fP は同じ \fIcookie\fP 値を持つ。 |
275 | 268 | .RE |
276 | 269 | .PP |
277 | -Suppose that \fIdir1/xx\fP and \fIdir2/yy\fP are (the only) links to the same | |
278 | -file, and an application is watching \fIdir1\fP, \fIdir2\fP, \fIdir1/xx\fP, and | |
279 | -\fIdir2/yy\fP. Executing the following calls in the order given below will | |
280 | -generate the following events: | |
270 | +\fIdir1/xx\fP と \fIdir2/yy\fP は同じファイルを参照するリンクで (他のリンクはないものとする)、 アプリケーションは \fIdir1\fP, | |
271 | +\fIdir2\fP, \fIdir1/xx\fP, \fIdir2/yy\fP を監視しているものとする。 | |
272 | +以下に示す順序で下記の呼び出しを実行すると、以下のイベントが生成される。 | |
281 | 273 | .RS 4 |
282 | 274 | .TP |
283 | 275 | unlink("dir2/yy"); |
284 | -Generates an \fBIN_ATTRIB\fP event for \fIxx\fP (because its link count changes) | |
285 | -and an \fBIN_DELETE\fP event for \fIdir2\fP. | |
276 | +\fIxx\fP に対して \fBIN_ATTRIB\fP イベントが生成され (リンク数が変化したため)、 \fIdir2\fP に対して \fBIN_DELETE\fP | |
277 | +イベントが生成される。 | |
286 | 278 | .TP |
287 | 279 | unlink("dir1/xx"); |
288 | -Generates \fBIN_ATTRIB\fP, \fBIN_DELETE_SELF\fP, and \fBIN_IGNORED\fP events for | |
289 | -\fIxx\fP, and an \fBIN_DELETE\fP event for \fIdir1\fP. | |
280 | +\fIxx\fP に対してイベント \fBIN_ATTRIB\fP, \fBIN_DELETE_SELF\fP, \fBIN_IGNORED\fP が生成され、 \fIdir1\fP | |
281 | +に対して \fBIN_DELETE\fP イベントが生成される。 | |
290 | 282 | .RE |
291 | 283 | .PP |
292 | -Suppose an application is watching the directory \fIdir\fP and (the empty) | |
293 | -directory \fIdir/subdir\fP. The following examples show some events that may | |
294 | -be generated. | |
284 | +アプリケーションがディレクトリ \fIdir\fP と (空の) ディレクトリ \fIdir/subdir\fP を監視しているものとする。 | |
285 | +以下に生成されるイベントの例を示す。 | |
295 | 286 | .RS 4 |
296 | 287 | .TP |
297 | 288 | mkdir("dir/new", mode); |
298 | -Generates an \fBIN_CREATE | IN_ISDIR\fP event for \fIdir\fP. | |
289 | +\fIdir\fP に対して \fBIN_CREATE | IN_ISDIR\fP イベントが生成される。 | |
299 | 290 | .TP |
300 | 291 | rmdir("dir/subdir"); |
301 | -Generates \fBIN_DELETE_SELF\fP and \fBIN_IGNORED\fP events for \fIsubdir\fP, and an | |
302 | -\fBIN_DELETE | IN_ISDIR\fP event for \fIdir\fP. | |
292 | +\fIsubdir\fP に対してイベント \fBIN_DELETE_SELF\fP と \fBIN_IGNORED\fP が生成され、 \fIdir\fP に対して | |
293 | +\fBIN_DELETE | IN_ISDIR\fP イベントが生成される。 | |
303 | 294 | .RE |
304 | 295 | .SS "/proc インターフェース" |
305 | 296 | 以下のインターフェースは、inotify で消費される カーネルメモリの総量を制限するのに使用できる: |
@@ -344,23 +335,20 @@ inotify ファイルディスクリプタの読み込みで返されるイベン | ||
344 | 335 | inotify API では、inotify イベントが発生するきっかけとなったユーザやプロセスに関する情報は提供されない。とりわけ、inotify |
345 | 336 | 経由でイベントを監視しているプロセスが、自分自身がきっかけとなったイベントと他のプロセスがきっかけとなったイベントを区別する簡単な手段はない。 |
346 | 337 | |
347 | -Inotify reports only events that a user\-space program triggers through the | |
348 | -filesystem API. As a result, it does not catch remote events that occur on | |
349 | -network filesystems. (Applications must fall back to polling the filesystem | |
350 | -to catch such events.) Furthermore, various pseudo\-filesystems such as | |
351 | -\fI/proc\fP, \fI/sys\fP, and \fI/dev/pts\fP are not monitorable with inotify. | |
338 | +inotify は、ファイルシステム API 経由でユーザー空間プログラムがきっかけとなったイベントだけを報告する。 結果として、 inotify | |
339 | +はネットワークファイルシステムで発生したリモートのイベントを捉えることはできない | |
340 | +(このようなイベントを捉えるにはアプリケーションはファイルシステムをポーリングする必要がある)。 さらに、 \fI/proc\fP, \fI/sys\fP, | |
341 | +\fI/dev/pts\fP といったいくつかの疑似ファイルシステムは inotify で監視することができない。 | |
352 | 342 | |
353 | -The inotify API does not report file accesses and modifications that may | |
354 | -occur because of \fBmmap\fP(2) and \fBmsync\fP(2). | |
343 | +inotify API は \fBmmap\fP(2) と \fBmsync\fP(2) により起こったファイルのアクセスと変更を報告しない。 | |
355 | 344 | |
356 | 345 | inotify API では影響が受けるファイルをファイル名で特定する。 |
357 | 346 | しかしながら、アプリケーションが inotify イベントを処理する時点では、 |
358 | 347 | そのファイル名がすでに削除されたり変更されたりしている可能性がある。 |
359 | 348 | |
360 | -The inotify API identifies events via watch descriptors. It is the | |
361 | -application's responsibility to cache a mapping (if one is needed) between | |
362 | -watch descriptors and pathnames. Be aware that directory renamings may | |
363 | -affect multiple cached pathnames. | |
349 | +inotify API では監視対象ディスクリプタを通してイベントが区別される。 (必要であれば) | |
350 | +監視対象ディスクリプタとパス名のマッピングをキャッシュしておくのはアプリケーションの役目である。 | |
351 | +ディレクトリの名前変更の場合、キャッシュしている複数のパス名に影響がある点に注意すること。 | |
364 | 352 | |
365 | 353 | inotify によるディレクトリの監視は再帰的に行われない: あるディレクトリ以下の |
366 | 354 | サブディレクトリを監視する場合、 監視対象を追加で作成しなければならない。 |
@@ -372,50 +360,39 @@ inotify によるディレクトリの監視は再帰的に行われない: あ | ||
372 | 360 | を追加した直後にサブディレクトリの内容をスキャンしたいと思う場合もあるだろう (必要ならそのサブディレクトリ内のサブディレクトリに対する watch |
373 | 361 | も再帰的に追加することもあるだろう)。 |
374 | 362 | |
375 | -Note that the event queue can overflow. In this case, events are lost. | |
376 | -Robust applications should handle the possibility of lost events | |
377 | -gracefully. For example, it may be necessary to rebuild part or all of the | |
378 | -application cache. (One simple, but possibly expensive, approach is to | |
379 | -close the inotify file descriptor, empty the cache, create a new inotify | |
380 | -file descriptor, and then re\-create watches and cache entries for the | |
381 | -objects to be monitored.) | |
363 | +イベントキューはオーバーフローする場合があることに注意すること。 この場合、イベントは失なわれる。 ロバスト性が求められるアプリケーションでは、 | |
364 | +イベントが失なわれる可能性も含めて適切に処理を行うべきである。 | |
365 | +例えば、アプリケーション内のキャッシュの一部分または全てを再構築する必要があるかもしれない。 (単純だが、おそらくコストがかかる方法は、 inotify | |
366 | +ファイルディスクリプタをクローズし、 キャッシュを空にし、 新しい inotify ファイルディスクリプタを作成し、 | |
367 | +監視しているオブジェクトの監視対象ディスクリプタとキャッシュエントリーの再作成を行う方法である。) | |
382 | 368 | .SS "rename() イベントの取り扱い" |
383 | -As noted above, the \fBIN_MOVED_FROM\fP and \fBIN_MOVED_TO\fP event pair that is | |
384 | -generated by \fBrename\fP(2) can be matched up via their shared cookie value. | |
385 | -However, the task of matching has some challenges. | |
369 | +上述の通り、 \fBrename\fP(2) により生成される \fBIN_MOVED_FROM\fP と \fBIN_MOVED_TO\fP イベントの組は、共有される | |
370 | +cookie 値によって対応を取ることができる。 しかし、対応を取る場合にはいくつか難しい点がある。 | |
386 | 371 | |
387 | -These two events are usually consecutive in the event stream available when | |
388 | -reading from the inotify file descriptor. However, this is not guaranteed. | |
389 | -If multiple processes are triggering events for monitored objects, then (on | |
390 | -rare occasions) an arbitrary number of other events may appear between the | |
391 | -\fBIN_MOVED_FROM\fP and \fBIN_MOVED_TO\fP events. | |
372 | +これらの 2 つのイベントは、 inotify ファイルディスクリプタから読み出しを行った場合に、通常はイベントストリーム内で連続している。 | |
373 | +しかしながら、連続していることは保証されていない。 複数のプロセスが監視対象オブジェクトでイベントを発生させた場合、 (めったに起こらないことだが) | |
374 | +イベント \fBIN_MOVED_FROM\fP と \fBIN_MOVED_TO\fP の間に任意の数の他のイベントがはさまる可能性がある。 | |
392 | 375 | |
393 | -Matching up the \fBIN_MOVED_FROM\fP and \fBIN_MOVED_TO\fP event pair generated by | |
394 | -\fBrename\fP(2) is thus inherently racy. (Don't forget that if an object is | |
395 | -renamed outside of a monitored directory, there may not even be an | |
396 | -\fBIN_MOVED_TO\fP event.) Heuristic approaches (e.g., assume the events are | |
397 | -always consecutive) can be used to ensure a match in most cases, but will | |
398 | -inevitably miss some cases, causing the application to perceive the | |
399 | -\fBIN_MOVED_FROM\fP and \fBIN_MOVED_TO\fP events as being unrelated. If watch | |
400 | -descriptors are destroyed and re\-created as a result, then those watch | |
401 | -descriptors will be inconsistent with the watch descriptors in any pending | |
402 | -events. (Re\-creating the inotify file descriptor and rebuilding the cache | |
403 | -may be useful to deal with this scenario.) | |
376 | +したがって、 \fBrename\fP(2) により生成された \fBIN_MOVED_FROM\fP と \fBIN_MOVED_TO\fP | |
377 | +のイベントの組の対応を取るのは本質的に難しいことである (監視対象のディレクトリの外へオブジェクトの rename が行われた場合には | |
378 | +\fBIN_MOVED_TO\fP イベントは存在しさえしないことを忘れてはならない)。 (イベントは常に連続しているとの仮定を置くといった) | |
379 | +発見的な方法を使うと、ほとんどの場合でイベントの組をうまく見つけることができるが、 いくつかの場合に見逃すことが避けられず、 アプリケーションが | |
380 | +\fBIN_MOVED_FROM\fP と \fBIN_MOVED_TO\fP イベントが無関係だとみなしてしまう可能性がある。 | |
381 | +結果的に、監視対象ディスクリプタが破棄され再作成された場合、これらの監視対象ディスクリプタは、処理待ちイベントの監視対象ディスクリプタと一貫性のないものになってしまう | |
382 | +(inotify ファイルディスクリプタの再作成とキャッシュの再構成はこの状況に対処するのに有用な方法なのだが)。 | |
404 | 383 | |
405 | -Applications should also allow for the possibility that the \fBIN_MOVED_FROM\fP | |
406 | -event was the last event that could fit in the buffer returned by the | |
407 | -current call to \fBread\fP(2), and the accompanying \fBIN_MOVED_TO\fP event might | |
408 | -be fetched only on the next \fBread\fP(2). | |
384 | +また、アプリケーションは、 \fBIN_MOVED_FROM\fP イベントが今行った \fBread\fP(2) | |
385 | +の呼び出しで返されたバッファのちょうど一番最後のイベントで、 \fBIN_MOVED_TO\fP イベントは次の \fBread\fP(2) | |
386 | +を行わないと取得できない可能性も考慮に入れる必要がある。 | |
409 | 387 | .SH バグ |
410 | 388 | .\" FIXME kernel commit 611da04f7a31b2208e838be55a42c7a1310ae321 |
411 | 389 | .\" implies that unmount events were buggy 2.6.11 to 2.6.36 |
412 | 390 | .\" |
413 | 391 | 2.6.16 以前のカーネルでは \fBIN_ONESHOT\fP \fImask\fP フラグが働かない。 |
414 | 392 | |
415 | -As originally designed and implemented, the \fBIN_ONESHOT\fP flag did not cause | |
416 | -an \fBIN_IGNORED\fP event to be generated when the watch was dropped after one | |
417 | -event. However, as an unintended effect of other changes, since Linux | |
418 | -2.6.36, an \fBIN_IGNORED\fP event is generated in this case. | |
393 | +元々は設計/実装時の意図通り、 イベントが一つ発生し watch が削除された際に \fBIN_ONESHOT\fP フラグでは \fBIN_IGNORED\fP | |
394 | +イベントが発生しなかった。 しかし、 別の変更での意図していなかった影響により、 Linux 2.6.36 以降では、 この場合に | |
395 | +\fBIN_IGNORED\fP イベントが生成される。 | |
419 | 396 | |
420 | 397 | .\" commit 1c17d18e3775485bf1e0ce79575eb637a94494a2 |
421 | 398 | カーネル 2.6.25 より前では、 連続する同一のイベントを一つにまとめることを意図したコード (古い方のイベントがまだ読み込まれていない場合に、 |
@@ -7,7 +7,7 @@ msgid "" | ||
7 | 7 | msgstr "" |
8 | 8 | "Project-Id-Version: PACKAGE VERSION\n" |
9 | 9 | "POT-Creation-Date: 2014-04-24 00:50+0900\n" |
10 | -"PO-Revision-Date: 2014-04-27 06:31+0900\n" | |
10 | +"PO-Revision-Date: 2014-04-28 02:45+0900\n" | |
11 | 11 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
12 | 12 | "Language-Team: LANGUAGE <LL@li.org>\n" |
13 | 13 | "Language: \n" |
@@ -93,11 +93,7 @@ msgid "" | ||
93 | 93 | "descriptor referring to the inotify instance. The more recent " |
94 | 94 | "B<inotify_init1>(2) is like B<inotify_init>(2), but has a I<flags> argument " |
95 | 95 | "that provides access to some extra functionality." |
96 | -msgstr "" | |
97 | -"B<inotify_init>(2) は inotify インスタンスを作成し、inotify インスタンスを参" | |
98 | -"照する ファイルディスクリプタを返す。 もっと新しい B<inotify_init1>(2) も " | |
99 | -"B<inotify_init>(2) と同様だが、いくつかの追加の機能を利用するための " | |
100 | -"I<flags> 引き数を持っている。" | |
96 | +msgstr "B<inotify_init>(2) は inotify インスタンスを作成し、inotify インスタンスを参照する ファイルディスクリプタを返す。 より新しい B<inotify_init1>(2) も B<inotify_init>(2) と同様だが、 こちらにはいくつかの追加の機能を利用するための I<flags> 引き数がある。" | |
101 | 97 | |
102 | 98 | #. type: Plain text |
103 | 99 | #: build/C/man7/inotify.7:63 |
@@ -124,7 +120,7 @@ msgid "" | ||
124 | 120 | "When events occur for monitored files and directories, those events are made " |
125 | 121 | "available to the application as structured data that can be read from the " |
126 | 122 | "inotify file descriptor using B<read>(2) (see below)." |
127 | -msgstr "" | |
123 | +msgstr "監視しているファイルやディレクトリでイベントが起こると、 それらのイベントはアプリケーションから inotify ファイルディスクリプタから B<read>(2) を使って構造化データとして読み出すことができる (下記参照)。" | |
128 | 124 | |
129 | 125 | #. type: Plain text |
130 | 126 | #: build/C/man7/inotify.7:72 |
@@ -153,7 +149,7 @@ msgid "" | ||
153 | 149 | "races of the kind described below may leave the cache inconsistent with the " |
154 | 150 | "filesystem state. It is probably wise to to do some consistency checking, " |
155 | 151 | "and rebuild the cache when inconsistencies are detected." |
156 | -msgstr "" | |
152 | +msgstr "注意深くプログラミングすることで、 アプリケーションは inotify を使ってファイルシステムオブジェクトの集合の状態を効率的に監視しキャッシュしておくことができる。 しかしながら、ロバストなアプリケーションでは、監視ロジックのバグや以下に説明があるような種類の競合条件によりファイルシステムの状態とキャッシュが一致しない状態になることがあるという事実も考慮に入れておくべきである。 おそらく何らかの一貫性のチェックを行い、不一致が検出された場合にはキャッシュを再構築するのが懸命だろう。" | |
157 | 153 | |
158 | 154 | #. type: SS |
159 | 155 | #: build/C/man7/inotify.7:88 |
@@ -407,7 +403,7 @@ msgid "" | ||
407 | 403 | "file to the other filesystem and then deletes it from the original " |
408 | 404 | "filesystem.) In addition, an B<IN_IGNORED> event will subsequently be " |
409 | 405 | "generated for the watch descriptor." |
410 | -msgstr "" | |
406 | +msgstr "監視対象のファイルやディレクトリ自身が削除あれた。 (このイベントはオブジェクトが別のファイルシステムに移動された場合にも発生する。 B<mv>(1) は実際には別のファイルシステムにファイルをコピーした後、元のファイルシステムからそのファイルを削除するからである。) また、 結果的に監視ディスクリプタに対して B<IN_IGNORED> イベントも生成される。" | |
411 | 407 | |
412 | 408 | #. type: TP |
413 | 409 | #: build/C/man7/inotify.7:247 |
@@ -680,7 +676,7 @@ msgid "" | ||
680 | 676 | "Suppose an application is watching the directory I<dir> and the file I<dir/" |
681 | 677 | "myfile> for all events. The examples below show some events that will be " |
682 | 678 | "generated for these two objects." |
683 | -msgstr "" | |
679 | +msgstr "アプリケーションがディレクトリ I<dir> とファイル I<dir/myfile> のすべてのイベントを監視しているとする。 以下に、これらの 2 つのオブジェクトに対して生成されるイベントの例を示す。" | |
684 | 680 | |
685 | 681 | #. type: TP |
686 | 682 | #: build/C/man7/inotify.7:374 |
@@ -748,7 +744,7 @@ msgid "" | ||
748 | 744 | "Suppose an application is watching the directories I<dir1> and I<dir2>, and " |
749 | 745 | "the file I<dir1/myfile>. The following examples show some events that may " |
750 | 746 | "be generated." |
751 | -msgstr "" | |
747 | +msgstr "アプリケーションがディレクトリ I<dir1> と I<dir2>、およびファイル I<dir1/myfile> を監視しているとする。 以下に生成されるイベントの例を示す。" | |
752 | 748 | |
753 | 749 | #. type: TP |
754 | 750 | #: build/C/man7/inotify.7:424 |
@@ -790,7 +786,7 @@ msgid "" | ||
790 | 786 | "file, and an application is watching I<dir1>, I<dir2>, I<dir1/xx>, and " |
791 | 787 | "I<dir2/yy>. Executing the following calls in the order given below will " |
792 | 788 | "generate the following events:" |
793 | -msgstr "" | |
789 | +msgstr "I<dir1/xx> と I<dir2/yy> は同じファイルを参照するリンクで (他のリンクはないものとする)、 アプリケーションは I<dir1>, I<dir2>, I<dir1/xx>, I<dir2/yy> を監視しているものとする。 以下に示す順序で下記の呼び出しを実行すると、以下のイベントが生成される。" | |
794 | 790 | |
795 | 791 | #. type: TP |
796 | 792 | #: build/C/man7/inotify.7:470 |
@@ -800,16 +796,10 @@ msgstr "unlink(\"dir2/yy\");" | ||
800 | 796 | |
801 | 797 | #. type: Plain text |
802 | 798 | #: build/C/man7/inotify.7:481 |
803 | -#, fuzzy | |
804 | -#| msgid "" | |
805 | -#| "Generates an B<IN_ATTRIB> event for I<myfile> and an B<IN_CREATE> event " | |
806 | -#| "for I<dir2>." | |
807 | 799 | msgid "" |
808 | 800 | "Generates an B<IN_ATTRIB> event for I<xx> (because its link count changes) " |
809 | 801 | "and an B<IN_DELETE> event for I<dir2>." |
810 | -msgstr "" | |
811 | -"I<myfile> に対して B<IN_ATTRIB> イベントが生成され、 I<dir2> に対して " | |
812 | -"B<IN_CREATE> イベントが生成される。" | |
802 | +msgstr "I<xx> に対して B<IN_ATTRIB> イベントが生成され (リンク数が変化したため)、 I<dir2> に対して B<IN_DELETE> イベントが生成される。" | |
813 | 803 | |
814 | 804 | #. type: TP |
815 | 805 | #: build/C/man7/inotify.7:481 |
@@ -819,16 +809,10 @@ msgstr "unlink(\"dir1/xx\");" | ||
819 | 809 | |
820 | 810 | #. type: Plain text |
821 | 811 | #: build/C/man7/inotify.7:494 |
822 | -#, fuzzy | |
823 | -#| msgid "" | |
824 | -#| "Generates an B<IN_ATTRIB> event for I<myfile> and an B<IN_CREATE> event " | |
825 | -#| "for I<dir2>." | |
826 | 812 | msgid "" |
827 | 813 | "Generates B<IN_ATTRIB>, B<IN_DELETE_SELF>, and B<IN_IGNORED> events for " |
828 | 814 | "I<xx>, and an B<IN_DELETE> event for I<dir1>." |
829 | -msgstr "" | |
830 | -"I<myfile> に対して B<IN_ATTRIB> イベントが生成され、 I<dir2> に対して " | |
831 | -"B<IN_CREATE> イベントが生成される。" | |
815 | +msgstr "I<xx> に対してイベント B<IN_ATTRIB>, B<IN_DELETE_SELF>, B<IN_IGNORED> が生成され、 I<dir1> に対して B<IN_DELETE> イベントが生成される。" | |
832 | 816 | |
833 | 817 | #. type: Plain text |
834 | 818 | #: build/C/man7/inotify.7:501 |
@@ -836,7 +820,7 @@ msgid "" | ||
836 | 820 | "Suppose an application is watching the directory I<dir> and (the empty) " |
837 | 821 | "directory I<dir/subdir>. The following examples show some events that may " |
838 | 822 | "be generated." |
839 | -msgstr "" | |
823 | +msgstr "アプリケーションがディレクトリ I<dir> と (空の) ディレクトリ I<dir/subdir> を監視しているものとする。 以下に生成されるイベントの例を示す。" | |
840 | 824 | |
841 | 825 | #. type: TP |
842 | 826 | #: build/C/man7/inotify.7:502 |
@@ -847,7 +831,7 @@ msgstr "mkdir(\"dir/new\", mode);" | ||
847 | 831 | #. type: Plain text |
848 | 832 | #: build/C/man7/inotify.7:508 |
849 | 833 | msgid "Generates an B<IN_CREATE | IN_ISDIR> event for I<dir>." |
850 | -msgstr "" | |
834 | +msgstr "I<dir> に対して B<IN_CREATE | IN_ISDIR> イベントが生成される。" | |
851 | 835 | |
852 | 836 | #. type: TP |
853 | 837 | #: build/C/man7/inotify.7:508 |
@@ -860,7 +844,7 @@ msgstr "rmdir(\"dir/subdir\");" | ||
860 | 844 | msgid "" |
861 | 845 | "Generates B<IN_DELETE_SELF> and B<IN_IGNORED> events for I<subdir>, and an " |
862 | 846 | "B<IN_DELETE | IN_ISDIR> event for I<dir>." |
863 | -msgstr "" | |
847 | +msgstr "I<subdir> に対してイベント B<IN_DELETE_SELF> と B<IN_IGNORED> が生成され、 I<dir> に対して B<IN_DELETE | IN_ISDIR> イベントが生成される。" | |
864 | 848 | |
865 | 849 | #. type: SS |
866 | 850 | #: build/C/man7/inotify.7:521 |
@@ -1057,14 +1041,14 @@ msgid "" | ||
1057 | 1041 | "network filesystems. (Applications must fall back to polling the filesystem " |
1058 | 1042 | "to catch such events.) Furthermore, various pseudo-filesystems such as I</" |
1059 | 1043 | "proc>, I</sys>, and I</dev/pts> are not monitorable with inotify." |
1060 | -msgstr "" | |
1044 | +msgstr "inotify は、ファイルシステム API 経由でユーザー空間プログラムがきっかけとなったイベントだけを報告する。 結果として、 inotify はネットワークファイルシステムで発生したリモートのイベントを捉えることはできない (このようなイベントを捉えるにはアプリケーションはファイルシステムをポーリングする必要がある)。 さらに、 I</proc>, I</sys>, I</dev/pts> といったいくつかの疑似ファイルシステムは inotify で監視することができない。" | |
1061 | 1045 | |
1062 | 1046 | #. type: Plain text |
1063 | 1047 | #: build/C/man7/inotify.7:638 |
1064 | 1048 | msgid "" |
1065 | 1049 | "The inotify API does not report file accesses and modifications that may " |
1066 | 1050 | "occur because of B<mmap>(2) and B<msync>(2)." |
1067 | -msgstr "" | |
1051 | +msgstr "inotify API は B<mmap>(2) と B<msync>(2) により起こったファイルのアクセスと変更を報告しない。" | |
1068 | 1052 | |
1069 | 1053 | #. type: Plain text |
1070 | 1054 | #: build/C/man7/inotify.7:642 |
@@ -1084,7 +1068,7 @@ msgid "" | ||
1084 | 1068 | "application's responsibility to cache a mapping (if one is needed) between " |
1085 | 1069 | "watch descriptors and pathnames. Be aware that directory renamings may " |
1086 | 1070 | "affect multiple cached pathnames." |
1087 | -msgstr "" | |
1071 | +msgstr "inotify API では監視対象ディスクリプタを通してイベントが区別される。 (必要であれば) 監視対象ディスクリプタとパス名のマッピングをキャッシュしておくのはアプリケーションの役目である。 ディレクトリの名前変更の場合、キャッシュしている複数のパス名に影響がある点に注意すること。" | |
1088 | 1072 | |
1089 | 1073 | #. type: Plain text |
1090 | 1074 | #: build/C/man7/inotify.7:652 |
@@ -1127,7 +1111,7 @@ msgid "" | ||
1127 | 1111 | "close the inotify file descriptor, empty the cache, create a new inotify " |
1128 | 1112 | "file descriptor, and then re-create watches and cache entries for the " |
1129 | 1113 | "objects to be monitored.)" |
1130 | -msgstr "" | |
1114 | +msgstr "イベントキューはオーバーフローする場合があることに注意すること。 この場合、イベントは失なわれる。 ロバスト性が求められるアプリケーションでは、 イベントが失なわれる可能性も含めて適切に処理を行うべきである。 例えば、アプリケーション内のキャッシュの一部分または全てを再構築する必要があるかもしれない。 (単純だが、おそらくコストがかかる方法は、 inotify ファイルディスクリプタをクローズし、 キャッシュを空にし、 新しい inotify ファイルディスクリプタを作成し、 監視しているオブジェクトの監視対象ディスクリプタとキャッシュエントリーの再作成を行う方法である。)" | |
1131 | 1115 | |
1132 | 1116 | #. type: SS |
1133 | 1117 | #: build/C/man7/inotify.7:673 |
@@ -1141,7 +1125,7 @@ msgid "" | ||
1141 | 1125 | "As noted above, the B<IN_MOVED_FROM> and B<IN_MOVED_TO> event pair that is " |
1142 | 1126 | "generated by B<rename>(2) can be matched up via their shared cookie value. " |
1143 | 1127 | "However, the task of matching has some challenges." |
1144 | -msgstr "" | |
1128 | +msgstr "上述の通り、 B<rename>(2) により生成される B<IN_MOVED_FROM> と B<IN_MOVED_TO> イベントの組は、共有される cookie 値によって対応を取ることができる。 しかし、対応を取る場合にはいくつか難しい点がある。" | |
1145 | 1129 | |
1146 | 1130 | #. type: Plain text |
1147 | 1131 | #: build/C/man7/inotify.7:693 |
@@ -1151,7 +1135,7 @@ msgid "" | ||
1151 | 1135 | "If multiple processes are triggering events for monitored objects, then (on " |
1152 | 1136 | "rare occasions) an arbitrary number of other events may appear between the " |
1153 | 1137 | "B<IN_MOVED_FROM> and B<IN_MOVED_TO> events." |
1154 | -msgstr "" | |
1138 | +msgstr "これらの 2 つのイベントは、 inotify ファイルディスクリプタから読み出しを行った場合に、通常はイベントストリーム内で連続している。 しかしながら、連続していることは保証されていない。 複数のプロセスが監視対象オブジェクトでイベントを発生させた場合、 (めったに起こらないことだが) イベント B<IN_MOVED_FROM> と B<IN_MOVED_TO> の間に任意の数の他のイベントがはさまる可能性がある。" | |
1155 | 1139 | |
1156 | 1140 | #. type: Plain text |
1157 | 1141 | #: build/C/man7/inotify.7:718 |
@@ -1167,7 +1151,7 @@ msgid "" | ||
1167 | 1151 | "descriptors will be inconsistent with the watch descriptors in any pending " |
1168 | 1152 | "events. (Re-creating the inotify file descriptor and rebuilding the cache " |
1169 | 1153 | "may be useful to deal with this scenario.)" |
1170 | -msgstr "" | |
1154 | +msgstr "したがって、 B<rename>(2) により生成された B<IN_MOVED_FROM> と B<IN_MOVED_TO> のイベントの組の対応を取るのは本質的に難しいことである (監視対象のディレクトリの外へオブジェクトの rename が行われた場合には B<IN_MOVED_TO> イベントは存在しさえしないことを忘れてはならない)。 (イベントは常に連続しているとの仮定を置くといった) 発見的な方法を使うと、ほとんどの場合でイベントの組をうまく見つけることができるが、 いくつかの場合に見逃すことが避けられず、 アプリケーションが B<IN_MOVED_FROM> と B<IN_MOVED_TO> イベントが無関係だとみなしてしまう可能性がある。 結果的に、監視対象ディスクリプタが破棄され再作成された場合、これらの監視対象ディスクリプタは、処理待ちイベントの監視対象ディスクリプタと一貫性のないものになってしまう (inotify ファイルディスクリプタの再作成とキャッシュの再構成はこの状況に対処するのに有用な方法なのだが)。" | |
1171 | 1155 | |
1172 | 1156 | #. type: Plain text |
1173 | 1157 | #: build/C/man7/inotify.7:728 |
@@ -1176,7 +1160,7 @@ msgid "" | ||
1176 | 1160 | "event was the last event that could fit in the buffer returned by the " |
1177 | 1161 | "current call to B<read>(2), and the accompanying B<IN_MOVED_TO> event might " |
1178 | 1162 | "be fetched only on the next B<read>(2)." |
1179 | -msgstr "" | |
1163 | +msgstr "また、アプリケーションは、 B<IN_MOVED_FROM> イベントが今行った B<read>(2) の呼び出しで返されたバッファのちょうど一番最後のイベントで、 B<IN_MOVED_TO> イベントは次の B<read>(2) を行わないと取得できない可能性も考慮に入れる必要がある。" | |
1180 | 1164 | |
1181 | 1165 | #. type: SH |
1182 | 1166 | #: build/C/man7/inotify.7:728 |
@@ -1198,7 +1182,7 @@ msgid "" | ||
1198 | 1182 | "an B<IN_IGNORED> event to be generated when the watch was dropped after one " |
1199 | 1183 | "event. However, as an unintended effect of other changes, since Linux " |
1200 | 1184 | "2.6.36, an B<IN_IGNORED> event is generated in this case." |
1201 | -msgstr "" | |
1185 | +msgstr "元々は設計/実装時の意図通り、 イベントが一つ発生し watch が削除された際に B<IN_ONESHOT> フラグでは B<IN_IGNORED> イベントが発生しなかった。 しかし、 別の変更での意図していなかった影響により、 Linux 2.6.36 以降では、 この場合に B<IN_IGNORED> イベントが生成される。" | |
1202 | 1186 | |
1203 | 1187 | #. commit 1c17d18e3775485bf1e0ce79575eb637a94494a2 |
1204 | 1188 | #. type: Plain text |
@@ -1708,68 +1692,3 @@ msgstr "" | ||
1708 | 1692 | #: build/C/man2/inotify_rm_watch.2:75 |
1709 | 1693 | msgid "B<inotify_add_watch>(2), B<inotify_init>(2), B<inotify>(7)" |
1710 | 1694 | msgstr "B<inotify_add_watch>(2), B<inotify_init>(2), B<inotify>(7)" |
1711 | - | |
1712 | -#~ msgid "2013-09-16" | |
1713 | -#~ msgstr "2013-09-16" | |
1714 | - | |
1715 | -#~ msgid "" | |
1716 | -#~ "The following system calls are used with this API: B<inotify_init>(2) " | |
1717 | -#~ "(or B<inotify_init1>(2)), B<inotify_add_watch>(2), B<inotify_rm_watch>" | |
1718 | -#~ "(2), B<read>(2), and B<close>(2)." | |
1719 | -#~ msgstr "" | |
1720 | -#~ "以下のシステムコールがこの API と共に使用される: B<inotify_init>(2) (や " | |
1721 | -#~ "B<inotify_init1>(2)), B<inotify_add_watch>(2), B<inotify_rm_watch>(2), " | |
1722 | -#~ "B<read>(2), B<close>(2)." | |
1723 | - | |
1724 | -#~ msgid "File/directory created in watched directory (*)." | |
1725 | -#~ msgstr "監視対象ディレクトリ内でファイルやディレクトリが作成された。(*)" | |
1726 | - | |
1727 | -#~ msgid "Watched file/directory was itself deleted." | |
1728 | -#~ msgstr "監視対象のディレクトリまたはファイル自身が削除された。" | |
1729 | - | |
1730 | -#~ msgid "File was modified (*)." | |
1731 | -#~ msgstr "ファイルが修正された。(*)" | |
1732 | - | |
1733 | -#~ msgid "" | |
1734 | -#~ "Two additional convenience macros are B<IN_MOVE>, which equates to " | |
1735 | -#~ "IN_MOVED_FROM|IN_MOVED_TO, and B<IN_CLOSE>, which equates to " | |
1736 | -#~ "IN_CLOSE_WRITE|IN_CLOSE_NOWRITE." | |
1737 | -#~ msgstr "" | |
1738 | -#~ "さらに 2 つの便利なマクロがある。\n" | |
1739 | -#~ "B<IN_MOVE> は IN_MOVED_FROM|IN_MOVED_TO と同じで、\n" | |
1740 | -#~ "B<IN_CLOSE> は IN_CLOSE_WRITE|IN_CLOSE_NOWRITE と同じである。" | |
1741 | - | |
1742 | -#~ msgid "Filesystem containing watched object was unmounted." | |
1743 | -#~ msgstr "監視対象オブジェクトを含むファイルシステムがアンマウントされた。" | |
1744 | - | |
1745 | -#~ msgid "" | |
1746 | -#~ "Note that the event queue can overflow. In this case, events are lost. " | |
1747 | -#~ "Robust applications should handle the possibility of lost events " | |
1748 | -#~ "gracefully." | |
1749 | -#~ msgstr "" | |
1750 | -#~ "イベントキューは溢れる場合があることに注意すること。この場合にはイベント" | |
1751 | -#~ "は\n" | |
1752 | -#~ "失われてしまう。堅牢性が必要なアプリケーションでは、イベントが失われる可能" | |
1753 | -#~ "性\n" | |
1754 | -#~ "を適切に扱う必要がある。" | |
1755 | - | |
1756 | -#~ msgid "" | |
1757 | -#~ "On success, B<inotify_rm_watch>() returns zero, or -1 if an error " | |
1758 | -#~ "occurred (in which case, I<errno> is set appropriately)." | |
1759 | -#~ msgstr "" | |
1760 | -#~ "成功すると、 B<inotify_rm_watch>() は 0 を返す。 エラーの場合、-1 を返" | |
1761 | -#~ "し、 I<errno> を適切に設定する。" | |
1762 | - | |
1763 | -#~ msgid "File moved out of watched directory (*)." | |
1764 | -#~ msgstr "ファイルが監視対象ディレクトリ外へ移動された。(*)" | |
1765 | - | |
1766 | -#~ msgid "File moved into watched directory (*)." | |
1767 | -#~ msgstr "ファイルが監視対象ディレクトリ内へ移動された。(*)" | |
1768 | - | |
1769 | -#~ msgid "" | |
1770 | -#~ "The inotify API provides no information about the user or process that " | |
1771 | -#~ "triggered the inotify event." | |
1772 | -#~ msgstr "" | |
1773 | -#~ "inotify API では inotify イベントのきっかけとなったユーザやプロセスに関す" | |
1774 | -#~ "る\n" | |
1775 | -#~ "情報が提供されない。" |
@@ -7,7 +7,7 @@ msgid "" | ||
7 | 7 | msgstr "" |
8 | 8 | "Project-Id-Version: PACKAGE VERSION\n" |
9 | 9 | "POT-Creation-Date: 2014-04-27 08:03+0900\n" |
10 | -"PO-Revision-Date: 2014-04-27 08:06+0900\n" | |
10 | +"PO-Revision-Date: 2014-04-28 02:47+0900\n" | |
11 | 11 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
12 | 12 | "Language-Team: LANGUAGE <LL@li.org>\n" |
13 | 13 | "Language: \n" |
@@ -53,8 +53,8 @@ inotify \- ファイルシステムイベントを監視する | ||
53 | 53 | この API では以下のシステムコールが使用される。 |
54 | 54 | .IP * 3 |
55 | 55 | \fBinotify_init\fP(2) は inotify インスタンスを作成し、inotify インスタンスを参照する ファイルディスクリプタを返す。 |
56 | -もっと新しい \fBinotify_init1\fP(2) も \fBinotify_init\fP(2) と同様だが、いくつかの追加の機能を利用するための | |
57 | -\fIflags\fP 引き数を持っている。 | |
56 | +より新しい \fBinotify_init1\fP(2) も \fBinotify_init\fP(2) と同様だが、 | |
57 | +こちらにはいくつかの追加の機能を利用するための \fIflags\fP 引き数がある。 | |
58 | 58 | .IP * |
59 | 59 | \fBinotify_add_watch\fP(2) は inotify インスタンスに関連づけられた「監視対象 (watch) リスト」を操作する。 |
60 | 60 | 監視対象リストの各アイテム ("watch") は、 ファイルまたはディレクトリのパス名と、 そのパス名で参照されるファイルに対して |
@@ -62,21 +62,18 @@ inotify \- ファイルシステムイベントを監視する | ||
62 | 62 | は新しい監視アイテムの作成や既存の監視対象の変更ができる。 各監視対象は一意の「監視対象ディスクリプタ」を持つ。 これは監視対象を作成したときに |
63 | 63 | \fBinotify_add_watch\fP(2) から返される整数である。 |
64 | 64 | .IP * |
65 | -When events occur for monitored files and directories, those events are made | |
66 | -available to the application as structured data that can be read from the | |
67 | -inotify file descriptor using \fBread\fP(2) (see below). | |
65 | +監視しているファイルやディレクトリでイベントが起こると、 それらのイベントはアプリケーションから inotify ファイルディスクリプタから | |
66 | +\fBread\fP(2) を使って構造化データとして読み出すことができる (下記参照)。 | |
68 | 67 | .IP * |
69 | 68 | \fBinotify_rm_watch\fP(2) は inotify の監視対象リストからアイテムを削除する。 |
70 | 69 | .IP * |
71 | 70 | inotify インスタンスを指している 全てのファイルディスクリプタが (\fBclose\fP(2) を使って) クローズされた場合、 |
72 | 71 | その下層にあるオブジェクトとそのリソースは、 カーネルで再利用するために解放される。 関連が切られた監視対象は自動的に解放される。 |
73 | 72 | |
74 | -With careful programming, an application can use inotify to efficiently | |
75 | -monitor and cache the state of a set of filesystem objects. However, robust | |
76 | -applications should allow for the fact that bugs in the monitoring logic or | |
77 | -races of the kind described below may leave the cache inconsistent with the | |
78 | -filesystem state. It is probably wise to to do some consistency checking, | |
79 | -and rebuild the cache when inconsistencies are detected. | |
73 | +注意深くプログラミングすることで、 アプリケーションは inotify | |
74 | +を使ってファイルシステムオブジェクトの集合の状態を効率的に監視しキャッシュしておくことができる。 | |
75 | +しかしながら、ロバストなアプリケーションでは、監視ロジックのバグや以下に説明があるような種類の競合条件によりファイルシステムの状態とキャッシュが一致しない状態になることがあるという事実も考慮に入れておくべきである。 | |
76 | +おそらく何らかの一貫性のチェックを行い、不一致が検出された場合にはキャッシュを再構築するのが懸命だろう。 | |
80 | 77 | .SS "inotify ファイルディスクリプタからのイベントの読み出し" |
81 | 78 | どのようなイベントが起こっていたかを知るには、 アプリケーションで inotify ファイルディスクリプタを \fBread\fP(2) すればよい。 |
82 | 79 | これまでに何もイベントが起こっていない場合、 停止 (blocking) モードのファイルディスクリプタであれば、 少なくとも 1 |
@@ -159,11 +156,9 @@ struct inotify_event { | ||
159 | 156 | 監視対象ディレクトリ内でファイルやディレクトリが削除された。 |
160 | 157 | .TP |
161 | 158 | \fBIN_DELETE_SELF\fP |
162 | -Watched file/directory was itself deleted. (This event also occurs if an | |
163 | -object is moved to another filesystem, since \fBmv\fP(1) in effect copies the | |
164 | -file to the other filesystem and then deletes it from the original | |
165 | -filesystem.) In addition, an \fBIN_IGNORED\fP event will subsequently be | |
166 | -generated for the watch descriptor. | |
159 | +監視対象のファイルやディレクトリ自身が削除あれた。 (このイベントはオブジェクトが別のファイルシステムに移動された場合にも発生する。 \fBmv\fP(1) | |
160 | +は実際には別のファイルシステムにファイルをコピーした後、元のファイルシステムからそのファイルを削除するからである。) また、 | |
161 | +結果的に監視ディスクリプタに対して \fBIN_IGNORED\fP イベントも生成される。 | |
167 | 162 | .TP |
168 | 163 | \fBIN_MODIFY\fP (*) |
169 | 164 | ファイルが変更された (\fBwrite\fP(2), \fBtruncate\fP(2) など)。 |
@@ -239,9 +234,8 @@ generated for the watch descriptor. | ||
239 | 234 | イベントが生成される。 |
240 | 235 | .RE |
241 | 236 | .SS 例 |
242 | -Suppose an application is watching the directory \fIdir\fP and the file | |
243 | -\fIdir/myfile\fP for all events. The examples below show some events that will | |
244 | -be generated for these two objects. | |
237 | +アプリケーションがディレクトリ \fIdir\fP とファイル \fIdir/myfile\fP のすべてのイベントを監視しているとする。 以下に、これらの 2 | |
238 | +つのオブジェクトに対して生成されるイベントの例を示す。 | |
245 | 239 | .RS 4 |
246 | 240 | .TP |
247 | 241 | fd = open("dir/myfile", O_RDWR); |
@@ -260,9 +254,8 @@ close(fd); | ||
260 | 254 | \fIdir\fP と \fIdir/myfile\fP の両方に対して \fBIN_CLOSE_WRITE\fP イベントが生成される |
261 | 255 | .RE |
262 | 256 | .PP |
263 | -Suppose an application is watching the directories \fIdir1\fP and \fIdir2\fP, and | |
264 | -the file \fIdir1/myfile\fP. The following examples show some events that may | |
265 | -be generated. | |
257 | +アプリケーションがディレクトリ \fIdir1\fP と \fIdir2\fP、およびファイル \fIdir1/myfile\fP を監視しているとする。 | |
258 | +以下に生成されるイベントの例を示す。 | |
266 | 259 | .RS 4 |
267 | 260 | .TP |
268 | 261 | link("dir1/myfile", "dir2/new"); |
@@ -274,32 +267,30 @@ rename("dir1/myfile", "dir2/myfile"); | ||
274 | 267 | \fBIN_MOVED_TO\fP は同じ \fIcookie\fP 値を持つ。 |
275 | 268 | .RE |
276 | 269 | .PP |
277 | -Suppose that \fIdir1/xx\fP and \fIdir2/yy\fP are (the only) links to the same | |
278 | -file, and an application is watching \fIdir1\fP, \fIdir2\fP, \fIdir1/xx\fP, and | |
279 | -\fIdir2/yy\fP. Executing the following calls in the order given below will | |
280 | -generate the following events: | |
270 | +\fIdir1/xx\fP と \fIdir2/yy\fP は同じファイルを参照するリンクで (他のリンクはないものとする)、 アプリケーションは \fIdir1\fP, | |
271 | +\fIdir2\fP, \fIdir1/xx\fP, \fIdir2/yy\fP を監視しているものとする。 | |
272 | +以下に示す順序で下記の呼び出しを実行すると、以下のイベントが生成される。 | |
281 | 273 | .RS 4 |
282 | 274 | .TP |
283 | 275 | unlink("dir2/yy"); |
284 | -Generates an \fBIN_ATTRIB\fP event for \fIxx\fP (because its link count changes) | |
285 | -and an \fBIN_DELETE\fP event for \fIdir2\fP. | |
276 | +\fIxx\fP に対して \fBIN_ATTRIB\fP イベントが生成され (リンク数が変化したため)、 \fIdir2\fP に対して \fBIN_DELETE\fP | |
277 | +イベントが生成される。 | |
286 | 278 | .TP |
287 | 279 | unlink("dir1/xx"); |
288 | -Generates \fBIN_ATTRIB\fP, \fBIN_DELETE_SELF\fP, and \fBIN_IGNORED\fP events for | |
289 | -\fIxx\fP, and an \fBIN_DELETE\fP event for \fIdir1\fP. | |
280 | +\fIxx\fP に対してイベント \fBIN_ATTRIB\fP, \fBIN_DELETE_SELF\fP, \fBIN_IGNORED\fP が生成され、 \fIdir1\fP | |
281 | +に対して \fBIN_DELETE\fP イベントが生成される。 | |
290 | 282 | .RE |
291 | 283 | .PP |
292 | -Suppose an application is watching the directory \fIdir\fP and (the empty) | |
293 | -directory \fIdir/subdir\fP. The following examples show some events that may | |
294 | -be generated. | |
284 | +アプリケーションがディレクトリ \fIdir\fP と (空の) ディレクトリ \fIdir/subdir\fP を監視しているものとする。 | |
285 | +以下に生成されるイベントの例を示す。 | |
295 | 286 | .RS 4 |
296 | 287 | .TP |
297 | 288 | mkdir("dir/new", mode); |
298 | -Generates an \fBIN_CREATE | IN_ISDIR\fP event for \fIdir\fP. | |
289 | +\fIdir\fP に対して \fBIN_CREATE | IN_ISDIR\fP イベントが生成される。 | |
299 | 290 | .TP |
300 | 291 | rmdir("dir/subdir"); |
301 | -Generates \fBIN_DELETE_SELF\fP and \fBIN_IGNORED\fP events for \fIsubdir\fP, and an | |
302 | -\fBIN_DELETE | IN_ISDIR\fP event for \fIdir\fP. | |
292 | +\fIsubdir\fP に対してイベント \fBIN_DELETE_SELF\fP と \fBIN_IGNORED\fP が生成され、 \fIdir\fP に対して | |
293 | +\fBIN_DELETE | IN_ISDIR\fP イベントが生成される。 | |
303 | 294 | .RE |
304 | 295 | .SS "/proc インターフェース" |
305 | 296 | 以下のインターフェースは、inotify で消費される カーネルメモリの総量を制限するのに使用できる: |
@@ -344,23 +335,20 @@ inotify ファイルディスクリプタの読み込みで返されるイベン | ||
344 | 335 | inotify API では、inotify イベントが発生するきっかけとなったユーザやプロセスに関する情報は提供されない。とりわけ、inotify |
345 | 336 | 経由でイベントを監視しているプロセスが、自分自身がきっかけとなったイベントと他のプロセスがきっかけとなったイベントを区別する簡単な手段はない。 |
346 | 337 | |
347 | -Inotify reports only events that a user\-space program triggers through the | |
348 | -filesystem API. As a result, it does not catch remote events that occur on | |
349 | -network filesystems. (Applications must fall back to polling the filesystem | |
350 | -to catch such events.) Furthermore, various pseudo\-filesystems such as | |
351 | -\fI/proc\fP, \fI/sys\fP, and \fI/dev/pts\fP are not monitorable with inotify. | |
338 | +inotify は、ファイルシステム API 経由でユーザー空間プログラムがきっかけとなったイベントだけを報告する。 結果として、 inotify | |
339 | +はネットワークファイルシステムで発生したリモートのイベントを捉えることはできない | |
340 | +(このようなイベントを捉えるにはアプリケーションはファイルシステムをポーリングする必要がある)。 さらに、 \fI/proc\fP, \fI/sys\fP, | |
341 | +\fI/dev/pts\fP といったいくつかの疑似ファイルシステムは inotify で監視することができない。 | |
352 | 342 | |
353 | -The inotify API does not report file accesses and modifications that may | |
354 | -occur because of \fBmmap\fP(2) and \fBmsync\fP(2). | |
343 | +inotify API は \fBmmap\fP(2) と \fBmsync\fP(2) により起こったファイルのアクセスと変更を報告しない。 | |
355 | 344 | |
356 | 345 | inotify API では影響が受けるファイルをファイル名で特定する。 |
357 | 346 | しかしながら、アプリケーションが inotify イベントを処理する時点では、 |
358 | 347 | そのファイル名がすでに削除されたり変更されたりしている可能性がある。 |
359 | 348 | |
360 | -The inotify API identifies events via watch descriptors. It is the | |
361 | -application's responsibility to cache a mapping (if one is needed) between | |
362 | -watch descriptors and pathnames. Be aware that directory renamings may | |
363 | -affect multiple cached pathnames. | |
349 | +inotify API では監視対象ディスクリプタを通してイベントが区別される。 (必要であれば) | |
350 | +監視対象ディスクリプタとパス名のマッピングをキャッシュしておくのはアプリケーションの役目である。 | |
351 | +ディレクトリの名前変更の場合、キャッシュしている複数のパス名に影響がある点に注意すること。 | |
364 | 352 | |
365 | 353 | inotify によるディレクトリの監視は再帰的に行われない: あるディレクトリ以下の |
366 | 354 | サブディレクトリを監視する場合、 監視対象を追加で作成しなければならない。 |
@@ -372,50 +360,39 @@ inotify によるディレクトリの監視は再帰的に行われない: あ | ||
372 | 360 | を追加した直後にサブディレクトリの内容をスキャンしたいと思う場合もあるだろう (必要ならそのサブディレクトリ内のサブディレクトリに対する watch |
373 | 361 | も再帰的に追加することもあるだろう)。 |
374 | 362 | |
375 | -Note that the event queue can overflow. In this case, events are lost. | |
376 | -Robust applications should handle the possibility of lost events | |
377 | -gracefully. For example, it may be necessary to rebuild part or all of the | |
378 | -application cache. (One simple, but possibly expensive, approach is to | |
379 | -close the inotify file descriptor, empty the cache, create a new inotify | |
380 | -file descriptor, and then re\-create watches and cache entries for the | |
381 | -objects to be monitored.) | |
363 | +イベントキューはオーバーフローする場合があることに注意すること。 この場合、イベントは失なわれる。 ロバスト性が求められるアプリケーションでは、 | |
364 | +イベントが失なわれる可能性も含めて適切に処理を行うべきである。 | |
365 | +例えば、アプリケーション内のキャッシュの一部分または全てを再構築する必要があるかもしれない。 (単純だが、おそらくコストがかかる方法は、 inotify | |
366 | +ファイルディスクリプタをクローズし、 キャッシュを空にし、 新しい inotify ファイルディスクリプタを作成し、 | |
367 | +監視しているオブジェクトの監視対象ディスクリプタとキャッシュエントリーの再作成を行う方法である。) | |
382 | 368 | .SS "rename() イベントの取り扱い" |
383 | -As noted above, the \fBIN_MOVED_FROM\fP and \fBIN_MOVED_TO\fP event pair that is | |
384 | -generated by \fBrename\fP(2) can be matched up via their shared cookie value. | |
385 | -However, the task of matching has some challenges. | |
369 | +上述の通り、 \fBrename\fP(2) により生成される \fBIN_MOVED_FROM\fP と \fBIN_MOVED_TO\fP イベントの組は、共有される | |
370 | +cookie 値によって対応を取ることができる。 しかし、対応を取る場合にはいくつか難しい点がある。 | |
386 | 371 | |
387 | -These two events are usually consecutive in the event stream available when | |
388 | -reading from the inotify file descriptor. However, this is not guaranteed. | |
389 | -If multiple processes are triggering events for monitored objects, then (on | |
390 | -rare occasions) an arbitrary number of other events may appear between the | |
391 | -\fBIN_MOVED_FROM\fP and \fBIN_MOVED_TO\fP events. | |
372 | +これらの 2 つのイベントは、 inotify ファイルディスクリプタから読み出しを行った場合に、通常はイベントストリーム内で連続している。 | |
373 | +しかしながら、連続していることは保証されていない。 複数のプロセスが監視対象オブジェクトでイベントを発生させた場合、 (めったに起こらないことだが) | |
374 | +イベント \fBIN_MOVED_FROM\fP と \fBIN_MOVED_TO\fP の間に任意の数の他のイベントがはさまる可能性がある。 | |
392 | 375 | |
393 | -Matching up the \fBIN_MOVED_FROM\fP and \fBIN_MOVED_TO\fP event pair generated by | |
394 | -\fBrename\fP(2) is thus inherently racy. (Don't forget that if an object is | |
395 | -renamed outside of a monitored directory, there may not even be an | |
396 | -\fBIN_MOVED_TO\fP event.) Heuristic approaches (e.g., assume the events are | |
397 | -always consecutive) can be used to ensure a match in most cases, but will | |
398 | -inevitably miss some cases, causing the application to perceive the | |
399 | -\fBIN_MOVED_FROM\fP and \fBIN_MOVED_TO\fP events as being unrelated. If watch | |
400 | -descriptors are destroyed and re\-created as a result, then those watch | |
401 | -descriptors will be inconsistent with the watch descriptors in any pending | |
402 | -events. (Re\-creating the inotify file descriptor and rebuilding the cache | |
403 | -may be useful to deal with this scenario.) | |
376 | +したがって、 \fBrename\fP(2) により生成された \fBIN_MOVED_FROM\fP と \fBIN_MOVED_TO\fP | |
377 | +のイベントの組の対応を取るのは本質的に難しいことである (監視対象のディレクトリの外へオブジェクトの rename が行われた場合には | |
378 | +\fBIN_MOVED_TO\fP イベントは存在しさえしないことを忘れてはならない)。 (イベントは常に連続しているとの仮定を置くといった) | |
379 | +発見的な方法を使うと、ほとんどの場合でイベントの組をうまく見つけることができるが、 いくつかの場合に見逃すことが避けられず、 アプリケーションが | |
380 | +\fBIN_MOVED_FROM\fP と \fBIN_MOVED_TO\fP イベントが無関係だとみなしてしまう可能性がある。 | |
381 | +結果的に、監視対象ディスクリプタが破棄され再作成された場合、これらの監視対象ディスクリプタは、処理待ちイベントの監視対象ディスクリプタと一貫性のないものになってしまう | |
382 | +(inotify ファイルディスクリプタの再作成とキャッシュの再構成はこの状況に対処するのに有用な方法なのだが)。 | |
404 | 383 | |
405 | -Applications should also allow for the possibility that the \fBIN_MOVED_FROM\fP | |
406 | -event was the last event that could fit in the buffer returned by the | |
407 | -current call to \fBread\fP(2), and the accompanying \fBIN_MOVED_TO\fP event might | |
408 | -be fetched only on the next \fBread\fP(2). | |
384 | +また、アプリケーションは、 \fBIN_MOVED_FROM\fP イベントが今行った \fBread\fP(2) | |
385 | +の呼び出しで返されたバッファのちょうど一番最後のイベントで、 \fBIN_MOVED_TO\fP イベントは次の \fBread\fP(2) | |
386 | +を行わないと取得できない可能性も考慮に入れる必要がある。 | |
409 | 387 | .SH バグ |
410 | 388 | .\" FIXME kernel commit 611da04f7a31b2208e838be55a42c7a1310ae321 |
411 | 389 | .\" implies that unmount events were buggy 2.6.11 to 2.6.36 |
412 | 390 | .\" |
413 | 391 | 2.6.16 以前のカーネルでは \fBIN_ONESHOT\fP \fImask\fP フラグが働かない。 |
414 | 392 | |
415 | -As originally designed and implemented, the \fBIN_ONESHOT\fP flag did not cause | |
416 | -an \fBIN_IGNORED\fP event to be generated when the watch was dropped after one | |
417 | -event. However, as an unintended effect of other changes, since Linux | |
418 | -2.6.36, an \fBIN_IGNORED\fP event is generated in this case. | |
393 | +元々は設計/実装時の意図通り、 イベントが一つ発生し watch が削除された際に \fBIN_ONESHOT\fP フラグでは \fBIN_IGNORED\fP | |
394 | +イベントが発生しなかった。 しかし、 別の変更での意図していなかった影響により、 Linux 2.6.36 以降では、 この場合に | |
395 | +\fBIN_IGNORED\fP イベントが生成される。 | |
419 | 396 | |
420 | 397 | .\" commit 1c17d18e3775485bf1e0ce79575eb637a94494a2 |
421 | 398 | カーネル 2.6.25 より前では、 連続する同一のイベントを一つにまとめることを意図したコード (古い方のイベントがまだ読み込まれていない場合に、 |
@@ -1,2 +0,0 @@ | ||
1 | -# pagename,#complete,#remaining,#all | |
2 | -inotify.7,133,20,153 |
@@ -2074,7 +2074,7 @@ | ||
2074 | 2074 | ○:LDP man-pages:3.65:2012/08/05:hier:7:2014/04/24::nakano@apm.seikei.ac.jp:NAKANO Takeo: |
2075 | 2075 | ○:LDP man-pages:3.65:2010/11/07:hostname:7:2014/04/24::amotoki@gmail.com:Akihiro MOTOKI: |
2076 | 2076 | ○:LDP man-pages:3.65:2012/05/10:icmp:7:2014/04/24::amotoki@gmail.com:Akihiro MOTOKI: |
2077 | -☆:LDP man-pages:3.63=>3.65:2014/04/01:inotify:7:2014/04/14::amotoki@gmail.com:Akihiro MOTOKI: | |
2077 | +○:LDP man-pages:3.65:2014/04/01:inotify:7:2014/04/28::amotoki@gmail.com:Akihiro MOTOKI: | |
2078 | 2078 | ○:LDP man-pages:3.65:2007/10/23:intro:7:2014/04/24::amotoki@dd.iij4u.or.jp:Akihiro MOTOKI: |
2079 | 2079 | ○:LDP man-pages:3.65:2013/09/17:ip:7:2014/04/24::amotoki@gmail.com:Akihiro MOTOKI: |
2080 | 2080 | ○:LDP man-pages:3.65:2012/12/16:ipv6:7:2014/04/24::amotoki@gmail.com:Akihiro MOTOKI: |
@@ -15,8 +15,6 @@ | ||
15 | 15 | <TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>filesystem</B></TD></TR> |
16 | 16 | <TR class="over80"><TD>spu_create.2</TD><TD>13/78</TD><TD>83.33</TD></TR> |
17 | 17 | <TR class="over70"><TD>spufs.7</TD><TD>41/159</TD><TD>74.21</TD></TR> |
18 | -<TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>inotify</B></TD></TR> | |
19 | -<TR class="over80"><TD>inotify.7</TD><TD>20/153</TD><TD>86.93</TD></TR> | |
20 | 18 | <TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>intro</B></TD></TR> |
21 | 19 | <TR class="over80"><TD>proc.5</TD><TD>78/966</TD><TD>91.93</TD></TR> |
22 | 20 | <TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>keyutils</B></TD></TR> |
@@ -81,6 +79,6 @@ | ||
81 | 79 | <TR class="over70"><TD>futimesat.2</TD><TD>10/37</TD><TD>72.97</TD></TR> |
82 | 80 | <TR><TD>utimensat.2</TD><TD>49/107</TD><TD>54.21</TD></TR> |
83 | 81 | <TR class="over80"><TD>zdump.8</TD><TD>1/22</TD><TD>95.45</TD></TR> |
84 | -<TR><TD COLSPAN=3>Total 53 pages</TD></TR> | |
82 | +<TR><TD COLSPAN=3>Total 52 pages</TD></TR> | |
85 | 83 | </TABLE> |
86 | 84 | </BODY></HTML> |