OSDN Git Service

LDP: Address fuzzy changes (notify)
authorAkihiro Motoki <amotoki@gmail.com>
Tue, 6 Apr 2021 08:53:40 +0000 (17:53 +0900)
committerAkihiro Motoki <amotoki@gmail.com>
Tue, 6 Apr 2021 08:53:40 +0000 (17:53 +0900)
manual/LDP_man-pages/draft/man2/fanotify_init.2 [new file with mode: 0644]
manual/LDP_man-pages/draft/man2/fanotify_mark.2 [new file with mode: 0644]
manual/LDP_man-pages/draft/man2/inotify_add_watch.2
manual/LDP_man-pages/draft/man2/inotify_init.2
manual/LDP_man-pages/draft/man7/fanotify.7 [new file with mode: 0644]
manual/LDP_man-pages/draft/man7/inotify.7
manual/LDP_man-pages/po4a/notify/po/ja.po
manual/LDP_man-pages/stats/notify
manual/LDP_man-pages/untrans.html

diff --git a/manual/LDP_man-pages/draft/man2/fanotify_init.2 b/manual/LDP_man-pages/draft/man2/fanotify_init.2
new file mode 100644 (file)
index 0000000..3582069
--- /dev/null
@@ -0,0 +1,256 @@
+
+.\" Copyright (C) 2013, Heinrich Schuchardt <xypron.glpk@gmx.de>
+.\"
+.\" %%%LICENSE_START(VERBATIM)
+.\" 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.  The author(s) may.
+.\" not have taken the same level of care in the production of this.
+.\" manual, which is licensed free of charge, as they might when working.
+.\" professionally.
+.\"
+.\" Formatted or processed versions of this manual, if unaccompanied by
+.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH FANOTIFY_INIT 2 2020\-11\-01 Linux "Linux Programmer's Manual"
+.SH 名前
+fanotify_init \- fanotify グループを作成し、初期化する
+.SH 書式
+\fB#include <fcntl.h>\fP
+.br
+\fB#include <sys/fanotify.h>\fP
+.PP
+\fBint fanotify_init(unsigned int \fP\fIflags\fP\fB, unsigned int
+\fP\fIevent_f_flags\fP\fB);\fP
+.SH 説明
+fanotify API の概要については \fBfanotify\fP(7) を参照。
+.PP
+\fBfanotify_init\fP() は新しい fanotify グループを初期化し、
+このグループに関連付けられたイベントキューに対するファイルディスクリプターを返す。
+.PP
+このファイルディスクリプターは、 \fBfanotify_mark\fP(2) の呼び出しで fanotify イベントが作成されるファイル、 ディレクトリ、
+マウント、ファイルシステムを指定するのに使用できる。 \fBfanotify_mark\fP(2) で指定したファイル、 これらのイベントは、
+このファイルディスクリプターからの読み出しで受信する。 いくつかのイベントは、 ファイルがアクセスされたことを示す単なる情報である。
+他のいくつかのイベントは、 別のアプリケーションがファイルやディレクトリにアクセスする許可を与えるかを判定するのに使用される。
+ファイルシステムオブジェクトへのアクセス許可イベントについては、 承認結果をこのファイルディスクリプターに書き込む。
+.PP
+複数のプログラムが同時に fanotify インターフェースを使って同じファイルを同時に監視することができる。
+.PP
+現在の実装では、 ユーザーあたりの fanotify グループ数は 128 に制限されている。 この制限は上書きすることができない。
+.PP
+\fBfanotify_init\fP() を呼び出すには \fBCAP_SYS_ADMIN\fP ケーパビリティーが必要である。 この制約は将来のバージョンの
+API で緩和される可能性がある。 そのため、 以下に示すケーパビリティーチェックのいくつかが実装されている。
+.PP
+\fIflags\fP 引き数は、 イベントを待つアプリケーションの通知クラスを定義する複数ビットのフィールドである。 これに加えて、
+このファイルディスクリプターの動作を示す 1 ビットのフィールドがある。
+.PP
+アクセス許可イベントを監視しているプログラムが複数いる場合、 通知クラスを使って監視するプログラムのイベント受信順序が管理される。
+.PP
+以下の通知クラスのいずれか一つだけを \fIflags\fP に指定できる。
+.TP 
+\fBFAN_CLASS_PRE_CONTENT\fP
+この値は、 ファイルがアクセスされたことを通知するイベントと、 ファイルへのアクセスするかの許可の判断を求めるイベントを受信することを示す。
+これはイベント受信者がファイルが最終的なデータを格納する前にそのファイルにアクセスする必要がある場合に使用される。
+この通知クラスは例えば階層型ストレージ管理などで使用される。
+.TP 
+\fBFAN_CLASS_CONTENT\fP
+この値は、 ファイルがアクセスされたことを通知するイベントと、 ファイルへのアクセスするかの許可の判断を求めるイベントを受信することを示す。
+これはイベント受信者がファイルに最終的なデータが格納された際にそのファイルにアクセスする必要がある場合に使用される。
+この通知クラスは例えばウイルス検知プログラムなどで使用される。
+.TP 
+\fBFAN_CLASS_NOTIF\fP
+これはデフォルト値である。 この値を指定する必要はない。 この値は、 ファイルがアクセスされたことを通知するイベントの受信だけを行うことを意味する。
+ファイルがアクセスする前にアクセス許可の判定を行うことはできない。
+.PP
+異なる通知クラスの受信者は \fBFAN_CLASS_PRE_CONTENT\fP, \fBFAN_CLASS_CONTENT\fP,
+\fBFAN_CLASS_NOTIF\fP の順序でイベントを受信する。 同じ通知クラスの受信者での通知順序は不定である。
+.PP
+\fIflags\fP には以下のビットを追加でセットすることができる。
+.TP 
+\fBFAN_CLOEXEC\fP
+close\-on\-exec フラグ (\fBFD_CLOEXEC\fP) を新しいファイルディスクリプターにセットする。 \fBopen\fP(2) の
+\fBO_CLOEXEC\fP フラグの説明を参照。
+.TP 
+\fBFAN_NONBLOCK\fP
+ノンブロッキングフラグ (\fBO_NONBLOCK\fP) をそのファイルディスクリプターで有効にする。
+このファイルディスクリプターからの読み出しは停止しない。 その代わり、 読みだし可能なデータが何もない場合、 \fBread\fP(2) はエラー
+\fBEAGAIN\fP で失敗する。
+.TP 
+\fBFAN_UNLIMITED_QUEUE\fP
+そのイベントキューの 16384 イベントの上限を削除する。 このフラグを使用するには \fBCAP_SYS_ADMIN\fP ケーパビリティーが必要である。
+.TP 
+\fBFAN_UNLIMITED_MARKS\fP
+8192 マークの上限を削除する。 このフラグを使用するには \fBCAP_SYS_ADMIN\fP ケーパビリティーが必要である。
+.TP 
+\fBFAN_REPORT_TID\fP (Linux 4.20 以降)
+.\" commit d0a6a87e40da49cfc7954c491d3065a25a641b29
+Report thread ID (TID) instead of process ID (PID)  in the \fIpid\fP field of
+the \fIstruct fanotify_event_metadata\fP supplied to \fBread\fP(2)  (see
+\fBfanotify\fP(7)).
+.TP 
+\fBFAN_REPORT_FID\fP (Linux 5.1 以降)
+.\" commit a8b13aa20afb69161b5123b4f1acc7ea0a03d360
+This value allows the receipt of events which contain additional information
+about the underlying filesystem object correlated to an event.  An
+additional record of type \fBFAN_EVENT_INFO_TYPE_FID\fP encapsulates the
+information about the object and is included alongside the generic event
+metadata structure.  The file descriptor that is used to represent the
+object correlated to an event is instead substituted with a file handle.  It
+is intended for applications that may find the use of a file handle to
+identify an object more suitable than a file descriptor.  Additionally, it
+may be used for applications monitoring a directory or a filesystem that are
+interested in the directory entry modification events \fBFAN_CREATE\fP,
+\fBFAN_DELETE\fP, and \fBFAN_MOVE\fP, or in events such as \fBFAN_ATTRIB\fP,
+\fBFAN_DELETE_SELF\fP, and \fBFAN_MOVE_SELF\fP.  All the events above require an
+fanotify group that identifies filesystem objects by file handles.  Note
+that for the directory entry modification events the reported file handle
+identifies the modified directory and not the created/deleted/moved child
+object.  The use of \fBFAN_CLASS_CONTENT\fP or \fBFAN_CLASS_PRE_CONTENT\fP is not
+permitted with this flag and will result in the error \fBEINVAL\fP.  See
+\fBfanotify\fP(7)  for additional details.
+.TP 
+\fBFAN_REPORT_DIR_FID\fP (Linux 5.9 以降)
+Events for fanotify groups initialized with this flag will contain (see
+exceptions below) additional information about a directory object correlated
+to an event.  An additional record of type \fBFAN_EVENT_INFO_TYPE_DFID\fP
+encapsulates the information about the directory object and is included
+alongside the generic event metadata structure.  For events that occur on a
+non\-directory object, the additional structure includes a file handle that
+identifies the parent directory filesystem object.  Note that there is no
+guarantee that the directory filesystem object will be found at the location
+described by the file handle information at the time the event is received.
+When combined with the flag \fBFAN_REPORT_FID\fP, two records may be reported
+with events that occur on a non\-directory object, one to identify the
+non\-directory object itself and one to identify the parent directory
+object.  Note that in some cases, a filesystem object does not have a
+parent, for example, when an event occurs on an unlinked but open file.  In
+that case, with the \fBFAN_REPORT_FID\fP flag, the event will be reported with
+only one record to identify the non\-directory object itself, because there
+is no directory associated with the event.  Without the \fBFAN_REPORT_FID\fP
+flag, no event will be reported.  See \fBfanotify\fP(7)  for additional
+details.
+.TP 
+\fBFAN_REPORT_NAME\fP (Linux 5.9 以降)
+Events for fanotify groups initialized with this flag will contain
+additional information about the name of the directory entry correlated to
+an event.  This flag must be provided in conjunction with the flag
+\fBFAN_REPORT_DIR_FID\fP.  Providing this flag value without
+\fBFAN_REPORT_DIR_FID\fP will result in the error \fBEINVAL\fP.  This flag may be
+combined with the flag \fBFAN_REPORT_FID\fP.  An additional record of type
+\fBFAN_EVENT_INFO_TYPE_DFID_NAME\fP, which encapsulates the information about
+the directory entry, is included alongside the generic event metadata
+structure and substitutes the additional information record of type
+\fBFAN_EVENT_INFO_TYPE_DFID\fP.  The additional record includes a file handle
+that identifies a directory filesystem object followed by a name that
+identifies an entry in that directory.  For the directory entry modification
+events \fBFAN_CREATE\fP, \fBFAN_DELETE\fP, and \fBFAN_MOVE\fP, the reported name is
+that of the created/deleted/moved directory entry.  For other events that
+occur on a directory object, the reported file handle is that of the
+directory object itself and the reported name is '.'.  For other events that
+occur on a non\-directory object, the reported file handle is that of the
+parent directory object and the reported name is the name of a directory
+entry where the object was located at the time of the event.  The rationale
+behind this logic is that the reported directory file handle can be passed
+to \fBopen_by_handle_at\fP(2)  to get an open directory file descriptor and
+that file descriptor along with the reported name can be used to call
+\fBfstatat\fP(2).  The same rule that applies to record type
+\fBFAN_EVENT_INFO_TYPE_DFID\fP also applies to record type
+\fBFAN_EVENT_INFO_TYPE_DFID_NAME\fP: if a non\-directory object has no parent,
+either the event will not be reported or it will be reported without the
+directory entry information.  Note that there is no guarantee that the
+filesystem object will be found at the location described by the directory
+entry information at the time the event is received.  See \fBfanotify\fP(7)
+for additional details.
+.TP 
+\fBFAN_REPORT_DFID_NAME\fP
+This is a synonym for (\fBFAN_REPORT_DIR_FID\fP|\fBFAN_REPORT_NAME\fP).
+.PP
+\fIevent_f_flags\fP 引き数は fanotify イベントが作成されるオープンファイル記述にセットされるファイル状態フラグを定義する。
+これらのフラグの詳細については \fBopen\fP(2) の \fIflags\fP 値の説明を参照のこと。 \fIevent_f_flags\fP
+にはアクセスモードのビットを複数入れることができる。 このフィールドには以下の値も指定することができる。
+.TP 
+\fBO_RDONLY\fP
+読み出しアクセスのみを許可する。
+.TP 
+\fBO_WRONLY\fP
+書き込みアクセスのみを許可する。
+.TP 
+\fBO_RDWR\fP
+読み出しと書き込みの両方を許可する。
+.PP
+他のビットも \fIevent_f_flags\fP もセットすることができる。 役立つであろう値は以下である。
+.TP 
+\fBO_LARGEFILE\fP
+2\ GB を超えるファイルのサポートを有効にする。 このフラグのセットに失敗すると、 32 ビットシステムで fanotify
+グループが監視するラージファイルをオープンしようとした際に \fBEOVERFLOW\fP エラーとなる。
+.TP 
+\fBO_CLOEXEC\fP (Linux 3.18 以降)
+.\" commit 0b37e097a648aa71d4db1ad108001e95b69a2da4
+このファイルディスクリプターで close\-on\-exec フラグを有効にする。 このフラグが役立つ理由については \fBopen\fP(2) の
+\fBO_CLOEXEC\fP フラグの説明を参照。
+.PP
+\fBO_APPEND\fP, \fBO_DSYNC\fP, \fBO_NOATIME\fP, \fBO_NONBLOCK\fP, \fBO_SYNC\fP も指定することができる。
+\fIevent_f_flags\fP にこれ以外のフラグを指定すると、 エラー \fBEINVAL\fP が起こる (ただし、バグを参照)。
+.SH 返り値
+成功すると \fBfanotify_init\fP() は新しいファイルディスクリプターを返す。 エラーの場合、 \-1 を返し、 \fIerrno\fP
+にエラーを示す値を設定する。
+.SH エラー
+.TP 
+\fBEINVAL\fP
+.\" commit 23c9deeb3285d34fd243abb3d6b9f07db60c3cf4
+An invalid value was passed in \fIflags\fP or \fIevent_f_flags\fP.
+\fBFAN_ALL_INIT_FLAGS\fP (deprecated since Linux kernel version 4.20)  defines
+all allowable bits for \fIflags\fP.
+.TP 
+\fBEMFILE\fP
+このユーザーの fanotify グループ数が 128 を超過した。
+.TP 
+\fBEMFILE\fP
+The per\-process limit on the number of open file descriptors has been
+reached.
+.TP 
+\fBENOMEM\fP
+通知グループへのメモリー割り当てが失敗した。
+.TP 
+\fBENOSYS\fP
+このカーネルは \fBfanotify_init\fP() を実装していない。 fanotify API が利用できるのは、 カーネルが
+\fBCONFIG_FANOTIFY\fP を有効にして作成されている場合だけである。
+.TP 
+\fBEPERM\fP
+呼び出し元が \fBCAP_SYS_ADMIN\fP ケーパビリティーを持っていないので、操作が許可されない。
+.SH バージョン
+\fBfanotify_init\fP() は Linux カーネルのバージョン 2.6.36 で導入され、 バージョン 2.6.37 で有効になった。
+.SH 準拠
+このシステムコールは Linux 独自である。
+.SH バグ
+The following bug was present in Linux kernels before version 3.18:
+.IP * 3
+.\" Fixed by commit 0b37e097a648aa71d4db1ad108001e95b69a2da4
+\fBO_CLOEXEC\fP が \fIevent_f_flags\fP に指定された場合、 無視される。
+.PP
+バージョン 3.14 より前の Linux カーネルには以下のバグが存在する。
+.IP * 3
+.\" Fixed by commit 48149e9d3a7e924010a0daab30a6197b7d7b6580
+\fIevent_f_flags\fP 引き数に無効なフラグがないかのチェックが行われない。 \fBFMODE_EXEC\fP
+などの内部での使用のみが意図されたフラグを指定することができ、 その場合 fanotify
+ファイルディスクリプターからの読み出し時に返されるファイルディスクリプターにそのフラグがセットされる。
+.SH 関連項目
+\fBfanotify_mark\fP(2), \fBfanotify\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
+\%https://www.kernel.org/doc/man\-pages/ に書かれている。
diff --git a/manual/LDP_man-pages/draft/man2/fanotify_mark.2 b/manual/LDP_man-pages/draft/man2/fanotify_mark.2
new file mode 100644 (file)
index 0000000..184e857
--- /dev/null
@@ -0,0 +1,330 @@
+.\" Copyright (C) 2013,  Heinrich Schuchardt <xypron.glpk@gmx.de>
+.\"
+.\" %%%LICENSE_START(VERBATIM)
+.\" 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.  The author(s) may.
+.\" not have taken the same level of care in the production of this.
+.\" manual, which is licensed free of charge, as they might when working.
+.\" professionally.
+.\"
+.\" Formatted or processed versions of this manual, if unaccompanied by
+.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH FANOTIFY_MARK 2 2020\-11\-01 Linux "Linux Programmer's Manual"
+.SH 名前
+fanotify_mark \- ファイルシステムオブジェクトへの fanotify マークの追加、削除、変更
+.SH 書式
+.nf
+\fB#include <sys/fanotify.h>\fP
+.PP
+\fBint fanotify_mark(int \fP\fIfanotify_fd\fP\fB, unsigned int \fP\fIflags\fP\fB,\fP
+\fB                  uint64_t \fP\fImask\fP\fB, int \fP\fIdirfd\fP\fB, const char *\fP\fIpathname\fP\fB);\fP
+.fi
+.SH 説明
+fanotify API の概要については \fBfanotify\fP(7) を参照。
+.PP
+\fBfanotify_mark\fP() はファイルシステムオブジェクトに対する fanotify マークの追加、削除、変更を行う。
+呼び出し元はマークを付けるファイルシステムオブジェクトに対する読み出し許可を持っていなければならない。
+.PP
+\fIfanotify_fd\fP 引き数は \fBfanotify_init\fP(2) で返されたファイルディスクリプターである。
+.PP
+\fIflags\fP は実行する操作内容を示すビットマスクである。 以下の値のいずれか一つだけを指定しなければならない。
+.TP 
+\fBFAN_MARK_ADD\fP
+\fImask\fP のイベントを mark マスク (もしくは ignore マスク) に追加する。 \fImask\fP は空であってはいけない。
+空の場合はエラー \fBEINVAL\fP が発生する。
+.TP 
+\fBFAN_MARK_REMOVE\fP
+引き数 \fImask\fP のイベントを mark マスク (もしくは ignore マスク) から削除する。 \fImask\fP は空であってはいけない。
+空の場合はエラー \fBEINVAL\fPが発生する。
+.TP 
+\fBFAN_MARK_FLUSH\fP
+Remove either all marks for filesystems, all marks for mounts, or all marks
+for directories and files from the fanotify group.  If \fIflags\fP contains
+\fBFAN_MARK_MOUNT\fP, all marks for mounts are removed from the group.  If
+\fIflags\fP contains \fBFAN_MARK_FILESYSTEM\fP, all marks for filesystems are
+removed from the group.  Otherwise, all marks for directories and files are
+removed.  No flag other than and at most one of the flags \fBFAN_MARK_MOUNT\fP
+or \fBFAN_MARK_FILESYSTEM\fP can be used in conjunction with
+\fBFAN_MARK_FLUSH\fP.  \fImask\fP is ignored.
+.PP
+上記のどの値も指定されなかった場合、 または 2 つ以上の値が指定された場合、 呼び出しはエラー \fBEINVAL\fP で失敗する。
+.PP
+これに加えて、 \fIflags\fP に以下の値を 0 個以上ビット単位の論理和 (OR) で指定できる。
+.TP 
+\fBFAN_MARK_DONT_FOLLOW\fP
+\fIpathname\fP がシンボリックリンクの場合、 リンクが参照するファイルではなく、 リンク自身にマークを付ける (デフォルトでは
+\fBfanotify_mark\fP() は \fIpathname\fP がシンボリックリンクの場合シンボリックリンクの展開を行う)。
+.TP 
+\fBFAN_MARK_ONLYDIR\fP
+マークが付けられたファイルシステムオブジェクトがディレクトリでない場合、 エラー \fBENOTDIR\fP が発生する。
+.TP 
+\fBFAN_MARK_MOUNT\fP
+Mark the mount point specified by \fIpathname\fP.  If \fIpathname\fP is not itself
+a mount point, the mount point containing \fIpathname\fP will be marked.  All
+directories, subdirectories, and the contained files of the mount point will
+be monitored.  The events which require that filesystem objects are
+identified by file handles, such as \fBFAN_CREATE\fP, \fBFAN_ATTRIB\fP,
+\fBFAN_MOVE\fP, and \fBFAN_DELETE_SELF\fP, cannot be provided as a \fImask\fP when
+\fIflags\fP contains \fBFAN_MARK_MOUNT\fP.  Attempting to do so will result in the
+error \fBEINVAL\fP being returned.
+.TP 
+\fBFAN_MARK_FILESYSTEM\fP (Linux 4.20 以降)
+.\" commit d54f4fba889b205e9cd8239182ca5d27d0ac3bc2
+Mark the filesystem specified by \fIpathname\fP.  The filesystem containing
+\fIpathname\fP will be marked.  All the contained files and directories of the
+filesystem from any mount point will be monitored.
+.TP 
+\fBFAN_MARK_IGNORED_MASK\fP
+\fImask\fP のイベントの ignore マスクへの追加、もしくは削除を行う。
+.TP 
+\fBFAN_MARK_IGNORED_SURV_MODIFY\fP
+ignore マスクは変更イベントが発生しても残り続ける。 このフラグがセットされていない場合、
+無視するファイルやディレクトリに対して変更イベントが発生した際に ignore マスクはクリアされる。
+.PP
+\fImask\fP はどのイベントに対して通知を受けるか (もしくはどのイベントを無視するか) を定義する。  以下の値から構成されるビットマスクである。
+.TP 
+\fBFAN_ACCESS\fP
+ファイルやディレクトリへのアクセス (読み出し) があった際にイベントを作成する (「バグ」も参照)。
+.TP 
+\fBFAN_MODIFY\fP
+ファイルが変更された (書き込み) 際にイベントを作成する。
+.TP 
+\fBFAN_CLOSE_WRITE\fP
+書き込み可能ファイルがクローズされた際にイベントを作成する。
+.TP 
+\fBFAN_CLOSE_NOWRITE\fP
+読み出し専用のファイルやディレクトリがクローズされた際にイベントを作成する。
+.TP 
+\fBFAN_OPEN\fP
+ファイルやディレクトリがオープンされた際にイベントを作成する。
+.TP 
+\fBFAN_OPEN_EXEC\fP (Linux 5.0 以降)
+.\" commit 9b076f1c0f4869b838a1b7aa0edb5664d47ec8aa
+Create an event when a file is opened with the intent to be executed.  See
+NOTES for additional details.
+.TP 
+\fBFAN_ATTRIB\fP (Linux 5.1 以降)
+.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
+Create an event when the metadata for a file or directory has changed.  An
+fanotify group that identifies filesystem objects by file handles is
+required.
+.TP 
+\fBFAN_CREATE\fP (Linux 5.1 以降)
+.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
+Create an event when a file or directory has been created in a marked parent
+directory.  An fanotify group that identifies filesystem objects by file
+handles is required.
+.TP 
+\fBFAN_DELETE\fP (Linux 5.1 以降)
+.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
+Create an event when a file or directory has been deleted in a marked parent
+directory.  An fanotify group that identifies filesystem objects by file
+handles is required.
+.TP 
+\fBFAN_DELETE_SELF\fP (Linux 5.1 以降)
+.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
+Create an event when a marked file or directory itself is deleted.  An
+fanotify group that identifies filesystem objects by file handles is
+required.
+.TP 
+\fBFAN_MOVED_FROM\fP (Linux 5.1 以降)
+.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
+Create an event when a file or directory has been moved from a marked parent
+directory.  An fanotify group that identifies filesystem objects by file
+handles is required.
+.TP 
+\fBFAN_MOVED_TO\fP (Linux 5.1 以降)
+.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
+Create an event when a file or directory has been moved to a marked parent
+directory.  An fanotify group that identifies filesystem objects by file
+handles is required.
+.TP 
+\fBFAN_MOVE_SELF\fP (Linux 5.1 以降)
+.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
+Create an event when a marked file or directory itself has been moved.  An
+fanotify group that identifies filesystem objects by file handles is
+required.
+.TP 
+\fBFAN_OPEN_PERM\fP
+ファイルやディレクトリをオープンするアクセス許可が要求された際にイベントを作成する。 fanotify ファイルディスクリプターが
+\fBFAN_CLASS_PRE_CONTENT\fP か \fBFAN_CLASS_CONTENT\fP を指定されて作成されている必要がある。
+.TP 
+\fBFAN_OPEN_EXEC_PERM\fP (since Linux 5.0)
+.\" commit 66917a3130f218dcef9eeab4fd11a71cd00cd7c9
+Create an event when a permission to open a file for execution is
+requested.  An fanotify file descriptor created with
+\fBFAN_CLASS_PRE_CONTENT\fP or \fBFAN_CLASS_CONTENT\fP is required.  See NOTES for
+additional details.
+.TP 
+\fBFAN_ACCESS_PERM\fP
+ファイルやディレクトリを読み出すアクセス許可が要求された際にイベントを作成する。 fanotify ファイルディスクリプターが
+\fBFAN_CLASS_PRE_CONTENT\fP か \fBFAN_CLASS_CONTENT\fP を指定されて作成されている必要がある。
+.TP 
+\fBFAN_ONDIR\fP
+Create events for directories\(emfor example, when \fBopendir\fP(3),
+\fBreaddir\fP(3)  (but see BUGS), and \fBclosedir\fP(3)  are called.  Without this
+flag, events are created only for files.  In the context of directory entry
+events, such as \fBFAN_CREATE\fP, \fBFAN_DELETE\fP, \fBFAN_MOVED_FROM\fP, and
+\fBFAN_MOVED_TO\fP, specifying the flag \fBFAN_ONDIR\fP is required in order to
+create events when subdirectory entries are modified (i.e., \fBmkdir\fP(2)/
+\fBrmdir\fP(2)).
+.TP 
+\fBFAN_EVENT_ON_CHILD\fP
+Events for the immediate children of marked directories shall be created.
+The flag has no effect when marking mounts and filesystems.  Note that
+events are not generated for children of the subdirectories of marked
+directories.  More specifically, the directory entry modification events
+\fBFAN_CREATE\fP, \fBFAN_DELETE\fP, \fBFAN_MOVED_FROM\fP, and \fBFAN_MOVED_TO\fP are not
+generated for any entry modifications performed inside subdirectories of
+marked directories.  Note that the events \fBFAN_DELETE_SELF\fP and
+\fBFAN_MOVE_SELF\fP are not generated for children of marked directories.  To
+monitor complete directory trees it is necessary to mark the relevant mount
+or filesystem.
+.PP
+The following composed values are defined:
+.TP 
+\fBFAN_CLOSE\fP
+ファイルがクローズされた (\fBFAN_CLOSE_WRITE\fP|\fBFAN_CLOSE_NOWRITE\fP)。
+.TP 
+\fBFAN_MOVE\fP
+A file or directory has been moved (\fBFAN_MOVED_FROM\fP|\fBFAN_MOVED_TO\fP).
+.PP
+マークを付けるファイルシステムオブジェクトは、 ファイルディスクリプター \fIdirfd\fP と \fIpathname\fP
+で指定されたパス名から決定される。
+.IP * 3
+\fIpathname\fP が NULL の場合、 \fIdirfd\fP でマークを付けるファイルシステムオブジェクトが定義される。
+.IP *
+\fIpathname\fP が NULL で、 \fIdirfd\fP が特別な値 \fBAT_FDCWD\fP の場合、
+カレントワーキングディレクトリがマークされる。
+.IP *
+\fIpathname\fP が絶対パスの場合、 そのパス名によりマークを付けるファイルシステムオブジェクトが定義され、 \fIdirfd\fP は無視される。
+.IP *
+\fIpathname\fP が相対パスで、 \fIdirfd\fP が \fBAT_FDCWD\fP でない場合、 マークを付けるファイルシステムオブジェクトは
+\fIdirfd\fP が参照するディレクトリに対する相対パス \fIpathname\fP を解釈して決定される。
+.IP *
+\fIpathname\fP が相対パスで、 \fIdirfd\fP が \fBAT_FDCWD\fP の場合、
+マークを付けるファイルシステムオブジェクトはカレントワーキングディレクトリに対する相対パス \fIpathname\fP を解釈して決定される。
+.SH 返り値
+成功すると \fBfanotify_mark\fP() は 0 を返す。 エラーの場合、 \-1 を返し、 \fIerrno\fP にエラーの原因を示す値を設定する。
+.SH エラー
+.TP 
+\fBEBADF\fP
+無効なファイルディスクリプターが \fIfanotify_fd\fP で渡された。
+.TP 
+\fBEINVAL\fP
+無効な値が \fIflags\fP か \fImask\fP に指定されたか、 \fIfanotify_fd\fP が fanotify
+ファイルディスクリプターでなかった。
+.TP 
+\fBEINVAL\fP
+The fanotify file descriptor was opened with \fBFAN_CLASS_NOTIF\fP or the
+fanotify group identifies filesystem objects by file handles and mask
+contains a flag for permission events (\fBFAN_OPEN_PERM\fP or
+\fBFAN_ACCESS_PERM\fP).
+.TP 
+\fBENODEV\fP
+The filesystem object indicated by \fIpathname\fP is not associated with a
+filesystem that supports \fIfsid\fP (e.g., \fBtmpfs\fP(5)).  This error can be
+returned only with an fanotify group that identifies filesystem objects by
+file handles.
+.TP 
+\fBENOENT\fP
+\fIdirfd\fP と \fIpathname\fP で指定されたファイルシステムオブジェクトが存在しない。
+このエラーはマークされていないオブジェクトからマークを削除しようとした場合にも発生する。
+.TP 
+\fBENOMEM\fP
+必要なメモリーを割り当てできなかった。
+.TP 
+\fBENOSPC\fP
+マークの数が 8192 の上限を超過し、 \fBfanotify_init\fP(2) で fanotify ファイルディスクリプターが作成された際に
+\fBFAN_UNLIMITED_MARKS\fP フラグが指定されていなかった。
+.TP 
+\fBENOSYS\fP
+このカーネルでは \fBfanotify_mark\fP() が実装されていない。 fanotify API が利用できるのは、 カーネルで
+\fBCONFIG_FANOTIFY\fP が有効になっている場合だけである。
+.TP 
+\fBENOTDIR\fP
+\fIflags\fP に \fBFAN_MARK_ONLYDIR\fP が含まれているが、 \fIdirfd\fP と \fIpathname\fP
+がディレクトリを指定していない。
+.TP 
+\fBEOPNOTSUPP\fP
+The object indicated by \fIpathname\fP is associated with a filesystem that
+does not support the encoding of file handles.  This error can be returned
+only with an fanotify group that identifies filesystem objects by file
+handles.
+.TP 
+\fBEXDEV\fP
+The filesystem object indicated by \fIpathname\fP resides within a filesystem
+subvolume (e.g., \fBbtrfs\fP(5))  which uses a different \fIfsid\fP than its root
+superblock.  This error can be returned only with an fanotify group that
+identifies filesystem objects by file handles.
+.SH バージョン
+\fBfanotify_mark\fP() は Linux カーネルのバージョン 2.6.36 で導入され、 バージョン 2.6.37 で有効になった。
+.SH 準拠
+このシステムコールは Linux 独自である。
+.SH 注意
+.SS "FAN_OPEN_EXEC と FAN_OPEN_EXEC_PERM"
+When using either \fBFAN_OPEN_EXEC\fP or \fBFAN_OPEN_EXEC_PERM\fP within the
+\fImask\fP, events of these types will be returned only when the direct
+execution of a program occurs.  More specifically, this means that events of
+these types will be generated for files that are opened using \fBexecve\fP(2),
+\fBexecveat\fP(2), or \fBuselib\fP(2).  Events of these types will not be raised
+in the situation where an interpreter is passed (or reads) a file for
+interpretation.
+.PP
+Additionally, if a mark has also been placed on the Linux dynamic linker, a
+user should also expect to receive an event for it when an ELF object has
+been successfully opened using \fBexecve\fP(2)  or \fBexecveat\fP(2).
+.PP
+For example, if the following ELF binary were to be invoked and a
+\fBFAN_OPEN_EXEC\fP mark has been placed on /:
+.PP
+.in +4n
+.EX
+$ /bin/echo foo
+.EE
+.in
+.PP
+The listening application in this case would receive \fBFAN_OPEN_EXEC\fP events
+for both the ELF binary and interpreter, respectively:
+.PP
+.in +4n
+.EX
+/bin/echo
+/lib64/ld\-linux\-x86\-64.so.2
+.EE
+.in
+.SH バグ
+バージョン 3.16 より前の Linux カーネルでは以下のバグが存在した。
+.IP * 3
+.\" Fixed by commit 0a8dd2db579f7a0ac7033d6b857c3d5dbaa77563
+\fIflags\fP に \fBFAN_MARK_FLUSH\fP が指定されている場合、 たとえそのオブジェクトが使用されない場合であっても、
+\fIdirfd\fP と \fIpathname\fP には有効なファイルシステムオブジェクトを指定しなければならない。
+.IP *
+.\" Fixed by commit d4c7cf6cffb1bc711a833b5e304ba5bcfe76398b
+\fBreaddir\fP(2) は \fBFAN_ACCESS\fP イベントを生成しない。
+.IP *
+.\" Fixed by commit cc299a98eb13a9853675a9cbb90b30b4011e1406
+\fBfanotify_mark\fP() が \fBFAN_MARK_FLUSH\fP 付きで呼び出された場合、 \fIflags\fP
+の値が無効かはチェックされない。
+.SH 関連項目
+\fBfanotify_init\fP(2), \fBfanotify\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
+\%https://www.kernel.org/doc/man\-pages/ に書かれている。
index ed133e2..720b9ac 100644 (file)
@@ -50,21 +50,18 @@ inotify_add_watch \- 初期化済み inotify インスタンスに監視対象
 \fIpathname\fP のどのイベントを監視するかは、引き数のビットマスク \fImask\fP で指定する。 \fImask\fP
 に設定できるビットの説明については \fBinotify\fP(7)  を参照のこと。
 .PP
-A successful call to \fBinotify_add_watch\fP()  returns a unique watch
-descriptor for this inotify instance, for the filesystem object (inode) that
-corresponds to \fIpathname\fP.  If the filesystem object was not previously
-being watched by this inotify instance, then the watch descriptor is newly
-allocated.  If the filesystem object was already being watched (perhaps via
-a different link to the same object), then the descriptor for the existing
-watch is returned.
+\fBinotify_add_watch\fP() の呼び出しが成功すると、 \fIpathname\fP に対応するファイルシステムオブジェクト (inode)
+に対する、 一意な監視対象ディスクリプター (watch descriptor) を、 対象の inotify インスタンスに対して返す。
+そのファイルシステムオブジェクトが対象の inotify インスタンスによって以前に監視されていない場合には、
+監視対象ディスクリプターは新規に割り当てられる。 ファイルシステムオブジェクトが (おそらく同じオブジェクトに対する異なるリンク経由で)
+すでに監視されている場合には、 既存の監視に対するディスクリプターが返される。
 .PP
 これ以降に inotify ファイルディスクリプターから \fBread\fP(2)  を行うと、監視対象ディスクリプターが返される。 これらの
 \fBread\fP()  を行うと、ファイルシステムイベントを示す \fIinotify_event\fP 構造体が読み出される (\fBinotify\fP(7)
 参照)。この構造体内の監視対象ディスクリプターにより、 どのオブジェクトでそのイベントが発生したかを特定できる。
 .SH 返り値
-On success, \fBinotify_add_watch\fP()  returns a watch descriptor (a
-nonnegative integer).  On error, \-1 is returned and \fIerrno\fP is set
-appropriately.
+成功すると、 \fBinotify_add_watch\fP()  は非負の監視対象ディスクリプター (非負の整数) を返す。 エラーの場合、\-1 を返し、
+\fIerrno\fP を適切に設定する。
 .SH エラー
 .TP 
 \fBEACCES\fP
@@ -104,8 +101,8 @@ inotify 監視対象の総数がユーザーが追加できる上限に達して
 inotify は Linux カーネル 2.6.13 に組み込まれた。
 .SH 準拠
 このシステムコールは Linux 独自である。
-.SH EXAMPLES
-See \fBinotify\fP(7).
+.SH 
+\fBinotify\fP(7) 参照。
 .SH 関連項目
 \fBinotify_init\fP(2), \fBinotify_rm_watch\fP(2), \fBinotify\fP(7)
 .SH この文書について
index a13b2df..fb5b698 100644 (file)
@@ -80,7 +80,7 @@ The per\-process limit on the number of open file descriptors has been
 reached.
 .TP 
 \fBENFILE\fP
-The system\-wide limit on the total number of open files has been reached.
+オープンされたファイルの総数がシステム全体の上限に達していた。
 .TP 
 \fBENOMEM\fP
 カーネルメモリーが十分になかった。
diff --git a/manual/LDP_man-pages/draft/man7/fanotify.7 b/manual/LDP_man-pages/draft/man7/fanotify.7
new file mode 100644 (file)
index 0000000..f8a48e1
--- /dev/null
@@ -0,0 +1,897 @@
+.\" Copyright (C) 2013, Heinrich Schuchardt <xypron.glpk@gmx.de>
+.\" and Copyright (C) 2014, Michael Kerrisk <mtk.manpages@gmail.com>
+.\"
+.\" %%%LICENSE_START(VERBATIM)
+.\" 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.  The author(s) may.
+.\" not have taken the same level of care in the production of this.
+.\" manual, which is licensed free of charge, as they might when working.
+.\" professionally.
+.\"
+.\" Formatted or processed versions of this manual, if unaccompanied by
+.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH FANOTIFY 7 2020\-11\-01 Linux "Linux Programmer's Manual"
+.SH 名前
+fanotify \- ファイルシステムイベントを監視する
+.SH 説明
+The fanotify API provides notification and interception of filesystem
+events.  Use cases include virus scanning and hierarchical storage
+management.  In the original fanotify API, only a limited set of events was
+supported.  In particular, there was no support for create, delete, and move
+events.  The support for those events was added in Linux 5.1.  (See
+\fBinotify\fP(7)  for details of an API that did notify those events pre Linux
+5.1.)
+.PP
+\fBinotify\fP(7) API と比較して追加されている機能としては、 マウントされたファイルシステムの全オブジェクトを監視する機能、
+アクセス許可の判定を行う機能、 他のアプリケーションによるアクセスの前にファイルを読み出したり変更したりする機能がある。
+.PP
+この API では以下のシステムコールを使用する: \fBfanotify_init\fP(2), \fBfanotify_mark\fP(2),
+\fBread\fP(2), \fBwrite\fP(2), \fBclose\fP(2)。
+.SS "fanotify_init(), fanotify_mark() と通知グループ"
+\fBfanotify_init\fP(2) システムコールは fanotify 通知グループを作成、初期化し、
+この通知グループを参照するファイルディスクリプターを返す。
+.PP
+fanotify 通知グループはカーネル内部のオブジェクトで、
+イベントが作成されるファイル、ディレクトリ、ファイルシステム、マウントポイントのリストを保持する。
+.PP
+fanotify 通知グループの各エントリーには 2 つのビットマスクがある。 \fImark\fP マスクと \fIignore\fP マスクである。 mark
+マスクはどのファイル操作についてイベントを作成するかを定義する。 ignore マスクはどの操作についてイベントを作成しないかを定義する。 これらの 2
+種類のマスクがあることで、 ファイルシステム、マウントポイント、ディレクトリに対してイベントの受信を mark しておきつつ、
+同時にそのマウントポイントやディレクトリ配下の特定のオブジェクトに対するイベントを無視する、 といったことができる。
+.PP
+\fBfanotify_mark\fP(2) システムコールは、ファイル、ディレクトリ、ファイルシステム、マウントポイントを通知グループに追加し、
+どのイベントを報告 (もしくは無視) するかを指定する。 また、このようなエントリーの削除、変更も行う。
+.PP
+ignore マスクの考えられる使用方法はファイルキャッシュに対してである。
+ファイルキャッシュに関して興味のあるイベントは、ファイルの変更とファイルのクローズである。 それゆえ、
+キャッシュされたディレクトリやマウントポイントは、 これらのイベントを受信するようにマークされる。
+ファイルが変更されたという最初のイベントを受信した後は、 対応するキャッシュエントリーは無効化される。 そのファイルがクローズされるまでは、
+このファイルに対する変更イベントは興味のない情報となる。 したがって、 変更イベントを ignore マスクに追加することができる。
+クローズイベントを受信すると、 変更イベントを ignore イベントから削除し、 ファイルキャッシュエントリーを更新することができる。
+.PP
+The entries in the fanotify notification groups refer to files and
+directories via their inode number and to mounts via their mount ID.  If
+files or directories are renamed or moved within the same mount, the
+respective entries survive.  If files or directories are deleted or moved to
+another mount or if filesystems or mounts are unmounted, the corresponding
+entries are deleted.
+.SS イベントキュー
+通知グループにより監視されているファイルシステムオブジェクトでイベントが発生すると、 fanotify システムはイベントを生成し、
+そのイベントはキューにまとめられる。 これらのイベントは、 \fBfanotify_init\fP(2) が返した fanotify
+ファイルディスクリプターから (\fBread\fP(2) などを使って) 読み出すことができる。
+.PP
+Two types of events are generated: \fInotification\fP events and \fIpermission\fP
+events.  Notification events are merely informative and require no action to
+be taken by the receiving application with one exception: if a valid file
+descriptor is provided within a generic event, the file descriptor must be
+closed.  Permission events are requests to the receiving application to
+decide whether permission for a file access shall be granted.  For these
+events, the recipient must write a response which decides whether access is
+granted or not.
+.PP
+イベントは、 読み出されると、 fanotify グループのイベントキューから削除される。 読み出されたアクセス許可イベントは、 fanotify
+ファイルディスクリプターにアクセス許可の判定が書き込まれるか、 fanotify ファイルディスクリプターがクローズされるまで、 fanotify
+グループの内部のリストに保持される。
+.SS "fanotify イベントの読み出し"
+\fBfanotify_init\fP(2) が返したファイルディスクリプターに対する \fBread\fP(2) を呼び出しは、
+(\fBfanotify_init\fP(2) の呼び出しでフラグ \fBFAN_NONBLOCK\fP を指定しなかった場合)
+ファイルイベントが起こるか、呼び出しがシグナルによって割り込まれる (\fBsignal\fP(7) 参照) まで停止する。
+.PP
+The use of one of the flags \fBFAN_REPORT_FID\fP, \fBFAN_REPORT_DIR_FID\fP in
+\fBfanotify_init\fP(2)  influences what data structures are returned to the
+event listener for each event.  Events reported to a group initialized with
+one of these flags will use file handles to identify filesystem objects
+instead of file descriptors.
+.TP 
+\fBread\fP(2) が成功すると、
+読み出しバッファーには以下の構造体が 1 つ以上格納される。
+.PP
+.in +4n
+.EX
+struct fanotify_event_metadata {
+    __u32 event_len;
+    __u8 vers;
+    __u8 reserved;
+    __u16 metadata_len;
+    __aligned_u64 mask;
+    __s32 fd;
+    __s32 pid;
+};
+.EE
+.in
+.PP
+In case of an fanotify group that identifies filesystem objects by file
+handles, you should also expect to receive one or more additional
+information records of the structure detailed below following the generic
+\fIfanotify_event_metadata\fP structure within the read buffer:
+.PP
+.in +4n
+.EX
+struct fanotify_event_info_header {
+    __u8 info_type;
+    __u8 pad;
+    __u16 len;
+};
+
+struct fanotify_event_info_fid {
+    struct fanotify_event_info_header hdr;
+    __kernel_fsid_t fsid;
+    unsigned char file_handle[0];
+};
+.EE
+.in
+.PP
+性能上の理由から、複数のイベントを一度の \fBread\fP(2) で取得できるように大きめのバッファーサイズ (例えば 4096 バイト)
+を使用することを推奨する。
+.PP
+\fBread\fP(2) の返り値はバッファーに格納されたバイト数である。 エラーの場合は \-1 が返される (ただし、バグも参照)。
+.PP
+\fIfanotify_event_metadata\fP 構造体のフィールドは以下のとおりである。
+.TP 
+\fIevent_len\fP
+This is the length of the data for the current event and the offset to the
+next event in the buffer.  Unless the group identifies filesystem objects by
+file handles, the value of \fIevent_len\fP is always
+\fBFAN_EVENT_METADATA_LEN\fP.  For a group that identifies filesystem objects
+by file handles, \fIevent_len\fP also includes the variable length file
+identifier records.
+.TP 
+\fIvers\fP
+このフィールドには構造体のバージョン番号が入る。 実行時に返された構造体がコンパイル時の構造体と一致しているかを検査するには、 この値を
+\fBFANOTIFY_METADATA_VERSION\fP を比較すること。 一致しない場合、 アプリケーションはその fanotify
+ファイルディスクリプターを使用するのを諦めるべきである。
+.TP 
+\fIreserved\fP
+このフィールドは使用されない。
+.TP 
+\fImetadata_len\fP
+この構造体の長さである。 このフィールドは、 イベント種別単位のオプションヘッダーの実装を扱うために導入された。
+現在の実装ではこのようなオプションヘッダーは存在しない。
+.TP 
+\fImask\fP
+イベントを示すビットマスクである (下記参照)
+.TP 
+\fIfd\fP
+This is an open file descriptor for the object being accessed, or
+\fBFAN_NOFD\fP if a queue overflow occurred.  With an fanotify group that
+identifies filesystem objects by file handles, applications should expect
+this value to be set to \fBFAN_NOFD\fP for each event that is received.  The
+file descriptor can be used to access the contents of the monitored file or
+directory.  The reading application is responsible for closing this file
+descriptor.
+.IP
+\fBfanotify_init\fP(2) を呼び出す際、
+呼び出し元はこのファイルディスクリプターに対応するオープンファイル記述にセットされた様々なファイル状態フラグを (\fIevent_f_flags\fP
+引き数を使って) 指定することができる。 さらに、 (カーネル内部の) \fBFMODE_NONOTIFY\fP
+ファイル状態フラグがオープンファイル記述にセットされる。 このフラグは fanotify イベントの生成を抑制する。 したがって、 fanotify
+イベントの受信者がこのファイルディスクリプターを使って通知されたファイルやディレクトリにアクセスした際に、 これ以上イベントが作成されなくなる。
+.TP 
+\fIpid\fP
+If flag \fBFAN_REPORT_TID\fP was set in \fBfanotify_init\fP(2), this is the TID of
+the thread that caused the event.  Otherwise, this the PID of the process
+that caused the event.
+.PP
+fanotify イベントを監視しているプログラムは、 この PID を \fBgetpid\fP(2) が返す PID と比較することで、
+イベントが監視しているプログラム自身から発生したかどうか、 別のプロセスによるファイルアクセスにより発生したか、を判定できる。
+.PP
+\fImask\fP のビットマスクは、1 つのファイルシステムオブジェクトに対してどのイベントが発生したかを示す。
+監視対象のファイルシステムオブジェクトに複数のイベントが発生した場合は、 このマスクに複数のビットがセットされることがある。 特に、
+同じファイルシステムオブジェクトに対する連続するイベントが同じプロセスから生成された場合には、 一つのイベントにまとめられることがある。 例外として、
+2 つのアクセス許可イベントが一つのキューエントリーにまとめられることは決してない。
+.PP
+\fImask\fP でセットされている可能性のあるビットは以下のとおりである。
+.TP 
+\fBFAN_ACCESS\fP
+ファイルやディレクトリがアクセスされた (読み出しが行われた) (ただし、「バグ」の節も参照)。
+.TP 
+\fBFAN_OPEN\fP
+ファイルやディレクトリがオープンされた。
+.TP 
+\fBFAN_OPEN_EXEC\fP
+A file was opened with the intent to be executed.  See NOTES in
+\fBfanotify_mark\fP(2)  for additional details.
+.TP 
+\fBFAN_ATTRIB\fP
+ファイルかディレクトリのメタデータが変更された。
+.TP 
+\fBFAN_CREATE\fP
+A child file or directory was created in a watched parent.
+.TP 
+\fBFAN_DELETE\fP
+A child file or directory was deleted in a watched parent.
+.TP 
+\fBFAN_DELETE_SELF\fP
+A watched file or directory was deleted.
+.TP 
+\fBFAN_MOVED_FROM\fP
+A file or directory has been moved from a watched parent directory.
+.TP 
+\fBFAN_MOVED_TO\fP
+A file or directory has been moved to a watched parent directory.
+.TP 
+\fBFAN_MOVE_SELF\fP
+監視対象のディレクトリやファイルが移動された。
+.TP 
+\fBFAN_MODIFY\fP
+ファイルが変更された。
+.TP 
+\fBFAN_CLOSE_WRITE\fP
+書き込み用 (\fBO_WRONLY\fP か \fBO_RDWR\fP) にオープンされたファイルがクローズされた。
+.TP 
+\fBFAN_CLOSE_NOWRITE\fP
+読み出し用 (\fBO_RDONLY\fP) にオープンされたファイルがクローズされた。
+.TP 
+\fBFAN_Q_OVERFLOW\fP
+イベントキューが 16384 エントリーの上限を超過した。 この上限は \fBfanotify_init\fP(2) 呼び出し時に
+\fBFAN_UNLIMITED_QUEUE\fP フラグを指定することで上書きできる。
+.TP 
+\fBFAN_ACCESS_PERM\fP
+アプリケーションが例えば \fBread\fP(2) や \fBreaddir\fP(2) などを使ってファイルやディレクトリを読み出そうとした。
+このイベントを読み出したプログラムは、 そのファイルシステムオブジェクトへのアクセス許可を承認するかを判定し (下記で説明するとおり)
+応答を書き込まなければならない。
+.TP 
+\fBFAN_OPEN_PERM\fP
+アプリケーションがファイルやディレクトリをオープンしようとした。 このイベントを読み出したプログラムは、
+そのファイルシステムオブジェクトのオープンを承認するかを判定し (下記で説明するとおり) 応答を書き込まなければならない。
+.TP 
+\fBFAN_OPEN_EXEC_PERM\fP
+An application wants to open a file for execution.  The reader must write a
+response that determines whether the permission to open the filesystem
+object for execution shall be granted.  See NOTES in \fBfanotify_mark\fP(2)
+for additional details.
+.PP
+クローズイベントを確認するために以下のビットマスクを使うことができる。
+.TP 
+\fBFAN_CLOSE\fP
+ファイルがクローズされた。 以下の同義語である。
+.IP
+    FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE
+.PP
+移動イベントを確認するために以下のビットマスクを使うことができる。
+.TP 
+\fBFAN_MOVE\fP
+ファイルやディレクトリが移動された。 以下の同義語である。
+.IP
+    FAN_MOVED_FROM | FAN_MOVED_TO
+.PP
+The following bits may appear in \fImask\fP only in conjunction with other
+event type bits:
+.TP 
+\fBFAN_ONDIR\fP
+The events described in the \fImask\fP have occurred on a directory object.
+Reporting events on directories requires setting this flag in the mark
+mask.  See \fBfanotify_mark\fP(2)  for additional details.  The \fBFAN_ONDIR\fP
+flag is reported in an event mask only if the fanotify group identifies
+filesystem objects by file handles.
+.PP
+\fIfanotify_event_info_fid\fP 構造体のフィールドは以下のとおりである。
+.TP 
+\fIhdr\fP
+This is a structure of type \fIfanotify_event_info_header\fP.  It is a generic
+header that contains information used to describe an additional information
+record attached to the event.  For example, when an fanotify file descriptor
+is created using \fBFAN_REPORT_FID\fP, a single information record is expected
+to be attached to the event with \fIinfo_type\fP field value of
+\fBFAN_EVENT_INFO_TYPE_FID\fP.  When an fanotify file descriptor is created
+using the combination of \fBFAN_REPORT_FID\fP and \fBFAN_REPORT_DIR_FID\fP, there
+may be two information records attached to the event: one with \fIinfo_type\fP
+field value of \fBFAN_EVENT_INFO_TYPE_DFID\fP, identifying a parent directory
+object, and one with \fIinfo_type\fP field value of \fBFAN_EVENT_INFO_TYPE_FID\fP,
+identifying a non\-directory object.  The \fIfanotify_event_info_header\fP
+contains a \fIlen\fP field.  The value of \fIlen\fP is the size of the additional
+information record including the \fIfanotify_event_info_header\fP itself.  The
+total size of all additional information records is not expected to be
+bigger than ( \fIevent_len\fP \- \fImetadata_len\fP ).
+.TP 
+\fIfsid\fP
+This is a unique identifier of the filesystem containing the object
+associated with the event.  It is a structure of type \fI__kernel_fsid_t\fP and
+contains the same value as \fIf_fsid\fP when calling \fBstatfs\fP(2).
+.TP 
+\fIfile_handle\fP
+This is a variable length structure of type struct file_handle.  It is an
+opaque handle that corresponds to a specified object on a filesystem as
+returned by \fBname_to_handle_at\fP(2).  It can be used to uniquely identify a
+file on a filesystem and can be passed as an argument to
+\fBopen_by_handle_at\fP(2).  Note that for the directory entry modification
+events \fBFAN_CREATE\fP, \fBFAN_DELETE\fP, and \fBFAN_MOVE\fP, the \fIfile_handle\fP
+identifies the modified directory and not the created/deleted/moved child
+object.  If the value of \fIinfo_type\fP field is
+\fBFAN_EVENT_INFO_TYPE_DFID_NAME\fP, the file handle is followed by a null
+terminated string that identifies the created/deleted/moved directory entry
+name.  For other events such as \fBFAN_OPEN\fP, \fBFAN_ATTRIB\fP,
+\fBFAN_DELETE_SELF\fP, and \fBFAN_MOVE_SELF\fP, if the value of \fIinfo_type\fP field
+is \fBFAN_EVENT_INFO_TYPE_FID\fP, the \fIfile_handle\fP identifies the object
+correlated to the event.  If the value of \fIinfo_type\fP field is
+\fBFAN_EVENT_INFO_TYPE_DFID\fP, the \fIfile_handle\fP identifies the directory
+object correlated to the event or the parent directory of a non\-directory
+object correlated to the event.  If the value of \fIinfo_type\fP field is
+\fBFAN_EVENT_INFO_TYPE_DFID_NAME\fP, the \fIfile_handle\fP identifies the same
+directory object that would be reported with \fBFAN_EVENT_INFO_TYPE_DFID\fP and
+the file handle is followed by a null terminated string that identifies the
+name of a directory entry in that directory, or '.' to identify the
+directory object itself.
+.PP
+fanotify ファイルディスクリプターからの \fBread\fP(2) が返した fanotify
+イベントメタデータを含むバッファーに対して繰り返しを行うため、 以下のマクロが提供されている。
+.TP 
+\fBFAN_EVENT_OK(meta, len)\fP
+このマクロは、 バッファー \fImeta\fP の残りの長さ \fIlen\fP を、 メタデータ構造体の長さとバッファーの最初のメタデータ構造体の
+\fIevent_len\fP フィールドと比較して検査する。
+.TP 
+\fBFAN_EVENT_NEXT(meta, len)\fP
+This macro uses the length indicated in the \fIevent_len\fP field of the
+metadata structure pointed to by \fImeta\fP to calculate the address of the
+next metadata structure that follows \fImeta\fP.  \fIlen\fP is the number of bytes
+of metadata that currently remain in the buffer.  The macro returns a
+pointer to the next metadata structure that follows \fImeta\fP, and reduces
+\fIlen\fP by the number of bytes in the metadata structure that has been
+skipped over (i.e., it subtracts \fImeta\->event_len\fP from \fIlen\fP).
+.PP
+また、 以下のマクロも用意されている。
+.TP 
+\fBFAN_EVENT_METADATA_LEN\fP
+.\"
+このマクロは \fIfanotify_event_metadata\fP 構造体の (バイト単位の) サイズを返す。
+返される値はイベントメタデータの最小値である (現在のところ、これが唯一のサイズである)。
+.SS "fanotify ファイルディスクリプターのイベントを監視する"
+fanotify イベントが発生すると、 \fBepoll\fP(7), \fBpoll\fP(2), \fBselect\fP(2) に fanotify
+ファイルディスクリプターが渡された場合には、そのファイルディスクリプターが読み出し可能であると通知される。
+.SS アクセス許可イベントの取り扱い
+アクセス許可イベントでは、 アプリケーションは以下の形式の構造体を fanotify ファイルディスクリプターに \fBwrite\fP(2)
+しなければならない。
+.PP
+.in +4n
+.EX
+struct fanotify_response {
+    __s32 fd;
+    __u32 response;
+};
+.EE
+.in
+.PP
+この構造体のフィールドは以下のとおりである。
+.TP 
+\fIfd\fP
+このフィールドは \fIfanotify_event_metadata\fP 構造体で返されたファイルディスクリプターである。
+.TP 
+\fIresponse\fP
+このフィールドはアクセス許可を承認するかどうかを示す。 値は、このファイル操作を許可する \fBFAN_ALLOW\fP か、 このファイル操作を拒否する
+\fBFAN_DENY\fP のいずれかでなければならない。
+.PP
+.\"
+アクセスを拒否した場合、 アクセスを要求したアプリケーションは \fBEPERM\fP エラーを受け取ることになる。
+.SS "fanotify ファイルディスクリプターのクローズ"
+fanotify 通知グループを参照するすべてのファイルディスクリプターがクローズされると、 fanotify グループは解放され、
+カーネルが再利用できるようにそのリソースは解放される。 \fBclose\fP(2) の際に、 処理中であったアクセス許可イベントには許可が設定される。
+.SS /proc/[pid]/fdinfo
+ファイル \fI/proc/[pid]/fdinfo/[fd]\fP には、 プロセス \fIpid\fP のファイルディスクリプター \fIfd\fP の
+fanotify マークに関する情報が格納される。 詳細は \fBproc\fP(5) を参照。
+.SH エラー
+通常の \fBread\fP(2) のエラーに加え、 fanotify ファイルディスクリプターから読み出しを行った際に以下のエラーが発生することがある。
+.TP 
+\fBEINVAL\fP
+バッファーがイベントを保持するには小さすぎる。
+.TP 
+\fBEMFILE\fP
+オープンしたファイル数のプロセス毎の上限に達した。 \fBgetrlimit\fP(2) の \fBRLIMIT_NOFILE\fP の説明を参照。
+.TP 
+\fBENFILE\fP
+オープンされたファイルの総数のシステム全体の上限に達した。 \fBproc\fP(5) の \fI/proc/sys/fs/file\-max\fP を参照。
+.TP 
+\fBETXTBSY\fP
+\fBfanotify_init\fP(2) の呼び出し時に \fBO_RDWR\fP か \fBO_WRONLY\fP が \fIevent_f_flags\fP
+引き数に指定されており、 現在実行中の監視対象のファイルに対してイベントが発生した際に、 このエラーが \fBread\fP(2) から返される。
+.PP
+通常の \fBwrite\fP(2) のエラーに加え、 fanotify ファイルディスクリプターに書き込みを行った際に以下のエラーが発生することがある。
+.TP 
+\fBEINVAL\fP
+fanotify アクセス許可がカーネルの設定で有効になっていない。 応答構造体の \fIresponse\fP 値が無効である。
+.TP 
+\fBENOENT\fP
+応答構造体のファイルディスクリプター \fIfd\fP が無効である。 このエラーはアクセス許可イベントに対する応答がすでに書き込まれている際に発生する。
+.SH バージョン
+fanotify API は Linux カーネルのバージョン 2.6.36 で導入され、 バージョン 2.6.37 で有効にされた。 fdinfo
+のサポートはバージョン 3.8 で追加された。
+.SH 準拠
+fanotify API は Linux 独自のものである。
+.SH 注意
+fanotify API が利用できるのは、 カーネルが \fBCONFIG_FANOTIFY\fP 設定オプションを有効にして作成されている場合だけである。
+また、 fanotify アクセス許可の処理が利用できるのは \fBCONFIG_FANOTIFY_ACCESS_PERMISSIONS\fP
+設定オプションが有効になっている場合だけである。
+.SS 制限と警告
+fanotify が報告するのはユーザー空間プログラムがファイルシステム API 経由で行ったイベントだけである。 その結果、 fanotify
+ではネットワークファイルシステム上で発生したリモートイベントは捕捉できない。
+.PP
+inotify API は \fBmmap\fP(2), \fBmsync\fP(2), \fBmunmap\fP(2)
+により起こったファイルのアクセスと変更を報告しない。
+.PP
+ディレクトリのイベントは、ディレクトリ自身がオープン、読み出し、クローズされた場合にしか作成されない。
+マークされたディレクトリでの子要素の追加、削除、変更では、監視対象のディレクトリ自身へのイベントは作成されない。
+.PP
+Fanotify monitoring of directories is not recursive: to monitor
+subdirectories under a directory, additional marks must be created.  The
+\fBFAN_CREATE\fP event can be used for detecting when a subdirectory has been
+created under a marked directory.  An additional mark must then be set on
+the newly created subdirectory.  This approach is racy, because it can lose
+events that occurred inside the newly created subdirectory, before a mark is
+added on that subdirectory.  Monitoring mounts offers the capability to
+monitor a whole directory tree in a race\-free manner.  Monitoring
+filesystems offers the capability to monitor changes made from any mount of
+a filesystem instance in a race\-free manner.
+.PP
+ベントキューはオーバーフローすることがある。 この場合、 イベントは失われる。
+.SH バグ
+.\" commit 820c12d5d6c0890bc93dd63893924a13041fdc35
+Before Linux 3.19, \fBfallocate\fP(2)  did not generate fanotify events.  Since
+Linux 3.19, calls to \fBfallocate\fP(2)  generate \fBFAN_MODIFY\fP events.
+.PP
+Linux 3.17 時点では、 以下のバグが存在する。
+.IP * 3
+Linux では、ファイルシステムオブジェクトは複数のパスでアクセス可能である。 例えば、 ファイルシステムの一部は \fBmount\fP(8) の
+\fI\-\-bind\fP オプションを使って再マウントされることがある。 マークされたマウントの監視者は、
+同じマウントを使ったファイルオブジェクトについてのみイベント通知を受ける。 それ以外のイベントは通知されない。
+.IP *
+.\" FIXME . A patch was proposed.
+イベントが生成された際に、 そのファイルのファイルディスクリプターを渡す前に、 イベントを受信するプロセスのユーザー ID
+がそのファイルに対する読み出し/書き込み許可があるかの確認は行われない。 非特権ユーザーによって実行されたプログラムに \fBCAP_SYS_ADMIN\fP
+ケーパビリティーがセットされている場合には、 このことはセキュリティーリスクとなる。
+.IP *
+\fBread\fP(2) の呼び出しが fanotify キューから複数のイベントを処理している際に、 エラーが発生した場合、
+返り値はエラーが発生する前までにユーザー空間バッファーに正常にコピーされたイベントの合計長となる。 返り値は \-1 にならず、 \fIerrno\fP
+もセットされない。 したがって、 読み出しを行うアプリケーションではエラーを検出する方法はない。
+.SH 例
+The two example programs below demonstrate the usage of the fanotify API.
+.SS "Example program: fanotify_example.c"
+The first program is an example of fanotify being used with its event object
+information passed in the form of a file descriptor.  The program marks the
+mount point passed as a command\-line argument and waits for events of type
+\fBFAN_OPEN_PERM\fP and \fBFAN_CLOSE_WRITE\fP.  When a permission event occurs, a
+\fBFAN_ALLOW\fP response is given.
+.PP
+The following shell session shows an example of running this program.  This
+session involved editing the file \fI/home/user/temp/notes\fP.  Before the file
+was opened, a \fBFAN_OPEN_PERM\fP event occurred.  After the file was closed, a
+\fBFAN_CLOSE_WRITE\fP event occurred.  Execution of the program ends when the
+user presses the ENTER key.
+.PP
+.in +4n
+.EX
+# \fB./fanotify_example /home\fP
+Press enter key to terminate.
+Listening for events.
+FAN_OPEN_PERM: File /home/user/temp/notes
+FAN_CLOSE_WRITE: File /home/user/temp/notes
+
+Listening for events stopped.
+.EE
+.in
+.SS "プログラムのソース: fanotify_example.c"
+\&
+.EX
+#define _GNU_SOURCE     /* O_LARGEFILE の定義を得るために必要 */
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <poll.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/fanotify.h>
+#include <unistd.h>
+
+/* ファイルディスクリプター \(aqfd\(aq から読み出しできる全 fanotify イベントを読み出す */
+
+static void
+handle_events(int fd)
+{
+    const struct fanotify_event_metadata *metadata;
+    struct fanotify_event_metadata buf[200];
+    ssize_t len;
+    char path[PATH_MAX];
+    ssize_t path_len;
+    char procfd_path[PATH_MAX];
+    struct fanotify_response response;
+
+    /* fanotify ファイルディスクリプターからイベントが読み出せる間はループする */
+
+    for (;;) {
+
+        /* イベントを読み出す */
+
+        len = read(fd, buf, sizeof(buf));
+        if (len == \-1 && errno != EAGAIN) {
+            perror("read");
+            exit(EXIT_FAILURE);
+        }
+
+        /* 読み出せるデータの最後に達しているかチェックする */
+
+        if (len <= 0)
+            break;
+
+        /* バッファーの最初のイベントを参照する */
+
+        metadata = buf;
+
+        /* バッファー内の全イベントを処理する */
+
+        while (FAN_EVENT_OK(metadata, len)) {
+
+            /* 実行時とコンパイル時の構造体が一致するか確認する */
+
+            if (metadata\->vers != FANOTIFY_METADATA_VERSION) {
+                fprintf(stderr,
+                        "Mismatch of fanotify metadata version.\en");
+                exit(EXIT_FAILURE);
+            }
+
+            /* metadata\->fd には、キューのオーバーフローを示す FAN_NOFD か、
+               ファイルディスクリプター (負でない整数) のいずれかが入っている。
+               ここではキューのオーバーフローは無視している。 */
+
+            if (metadata\->fd >= 0) {
+
+                /* オープン許可イベントを処理する */
+
+                if (metadata\->mask & FAN_OPEN_PERM) {
+                    printf("FAN_OPEN_PERM: ");
+
+                    /* ファイルのオープンを許可する */
+
+                    response.fd = metadata\->fd;
+                    response.response = FAN_ALLOW;
+                    write(fd, &response, sizeof(response));
+                }
+
+                /* 書き込み可能ファイルのクローズイベントを処理する */
+
+                if (metadata\->mask & FAN_CLOSE_WRITE)
+                    printf("FAN_CLOSE_WRITE: ");
+
+                /* アクセスされたファイルのパス名を取得し表示する */
+
+                snprintf(procfd_path, sizeof(procfd_path),
+                         "/proc/self/fd/%d", metadata\->fd);
+                path_len = readlink(procfd_path, path,
+                                    sizeof(path) \- 1);
+                if (path_len == \-1) {
+                    perror("readlink");
+                    exit(EXIT_FAILURE);
+                }
+
+                path[path_len] = \(aq\e0\(aq;
+                printf("File %s\en", path);
+
+                /* イベントのファイルディスクリプターをクローズする */
+
+                close(metadata\->fd);
+            }
+
+            /* 次のイベントに進む */
+
+            metadata = FAN_EVENT_NEXT(metadata, len);
+        }
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    char buf;
+    int fd, poll_num;
+    nfds_t nfds;
+    struct pollfd fds[2];
+
+    /* マウントポイントが指定されたか確認する */
+
+    if (argc != 2) {
+        fprintf(stderr, "Usage: %s MOUNT\en", argv[0]);
+        exit(EXIT_FAILURE);
+    }
+
+    printf("Press enter key to terminate.\en");
+
+    /* fanotify API にアクセスするためのファイルディスクリプターを作成する */
+
+    fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,
+                       O_RDONLY | O_LARGEFILE);
+    if (fd == \-1) {
+        perror("fanotify_init");
+        exit(EXIT_FAILURE);
+    }
+
+    /* 指定されたマウントに対して以下を監視するようにマークを付ける:
+       \- ファイルのオープン前のアクセス許可イベント
+       \- 書き込み可能なファイルディスクリプターのクローズ後の
+         通知イベント */
+
+    if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,
+                      FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,
+                      argv[1]) == \-1) {
+        perror("fanotify_mark");
+        exit(EXIT_FAILURE);
+    }
+
+    /* ポーリングの準備 */
+
+    nfds = 2;
+
+    /* コンソールの入力 */
+
+    fds[0].fd = STDIN_FILENO;
+    fds[0].events = POLLIN;
+
+    /* fanotify の入力 */
+
+    fds[1].fd = fd;
+    fds[1].events = POLLIN;
+
+    /* イベントの発生を待つループ */
+
+    printf("Listening for events.\en");
+
+    while (1) {
+        poll_num = poll(fds, nfds, \-1);
+        if (poll_num == \-1) {
+            if (errno == EINTR)     /* シグナルに割り込まれた場合 */
+                continue;           /* poll() を再開する */
+
+            perror("poll");         /* 予期しないエラー */
+            exit(EXIT_FAILURE);
+        }
+
+        if (poll_num > 0) {
+            if (fds[0].revents & POLLIN) {
+
+                /* コンソールからの入力がある場合: 空の標準入力であれば終了 */
+
+                while (read(STDIN_FILENO, &buf, 1) > 0 && buf != \(aq\en\(aq)
+                    continue;
+                break;
+            }
+
+            if (fds[1].revents & POLLIN) {
+
+                /* fanotify イベントがある場合 */
+
+                handle_events(fd);
+            }
+        }
+    }
+
+    printf("Listening for events stopped.\en");
+    exit(EXIT_SUCCESS);
+}
+.EE
+.\"
+.SS "Example program: fanotify_fid.c"
+The second program is an example of fanotify being used with a group that
+identifies objects by file handles.  The program marks the filesystem object
+that is passed as a command\-line argument and waits until an event of type
+\fBFAN_CREATE\fP has occurred.  The event mask indicates which type of
+filesystem object\(emeither a file or a directory\(emwas created.  Once all
+events have been read from the buffer and processed accordingly, the program
+simply terminates.
+.PP
+The following shell sessions show two different invocations of this program,
+with different actions performed on a watched object.
+.PP
+The first session shows a mark being placed on \fI/home/user\fP.  This is
+followed by the creation of a regular file, \fI/home/user/testfile.txt\fP.
+This results in a \fBFAN_CREATE\fP event being generated and reported against
+the file's parent watched directory object and with the created file name.
+Program execution ends once all events captured within the buffer have been
+processed.
+.PP
+.in +4n
+.EX
+# \fB./fanotify_fid /home/user\fP
+Listening for events.
+FAN_CREATE (file created):
+        Directory /home/user has been modified.
+        Entry \(aqtestfile.txt\(aq is not a subdirectory.
+All events processed successfully. Program exiting.
+
+$ \fBtouch /home/user/testfile.txt\fP              # In another terminal
+.EE
+.in
+.PP
+The second session shows a mark being placed on \fI/home/user\fP.  This is
+followed by the creation of a directory, \fI/home/user/testdir\fP.  This
+specific action results in a \fBFAN_CREATE\fP event being generated and is
+reported with the \fBFAN_ONDIR\fP flag set and with the created directory name.
+.PP
+.in +4n
+.EX
+# \fB./fanotify_fid /home/user\fP
+Listening for events.
+FAN_CREATE | FAN_ONDIR (subdirectory created):
+        Directory /home/user has been modified.
+        Entry \(aqtestdir\(aq is a subdirectory.
+All events processed successfully. Program exiting.
+
+$ \fBmkdir \-p /home/user/testdir\fP          # In another terminal
+.EE
+.in
+.SS "プログラムのソース: fanotify_fid.c"
+\&
+.EX
+#define _GNU_SOURCE
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/fanotify.h>
+#include <unistd.h>
+
+#define BUF_SIZE 256
+
+int
+main(int argc, char **argv)
+{
+    int fd, ret, event_fd, mount_fd;
+    ssize_t len, path_len;
+    char path[PATH_MAX];
+    char procfd_path[PATH_MAX];
+    char events_buf[BUF_SIZE];
+    struct file_handle *file_handle;
+    struct fanotify_event_metadata *metadata;
+    struct fanotify_event_info_fid *fid;
+    const char *file_name;
+    struct stat sb;
+
+    if (argc != 2) {
+        fprintf(stderr, "Invalid number of command line arguments.\en");
+        exit(EXIT_FAILURE);
+    }
+
+    mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);
+    if (mount_fd == \-1) {
+        perror(argv[1]);
+        exit(EXIT_FAILURE);
+    }
+
+
+    /* Create an fanotify file descriptor with FAN_REPORT_DFID_NAME as
+       a flag so that program can receive fid events with directory
+       entry name. */
+
+    fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);
+    if (fd == \-1) {
+        perror("fanotify_init");
+        exit(EXIT_FAILURE);
+    }
+
+    /* Place a mark on the filesystem object supplied in argv[1]. */
+
+    ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,
+                        FAN_CREATE | FAN_ONDIR,
+                        AT_FDCWD, argv[1]);
+    if (ret == \-1) {
+        perror("fanotify_mark");
+        exit(EXIT_FAILURE);
+    }
+
+    printf("Listening for events.\en");
+
+    /* Read events from the event queue into a buffer */
+
+    len = read(fd, events_buf, sizeof(events_buf));
+    if (len == \-1 && errno != EAGAIN) {
+        perror("read");
+        exit(EXIT_FAILURE);
+    }
+
+        /* バッファー内の全イベントを処理する */
+
+    for (metadata = (struct fanotify_event_metadata *) events_buf;
+            FAN_EVENT_OK(metadata, len);
+            metadata = FAN_EVENT_NEXT(metadata, len)) {
+        fid = (struct fanotify_event_info_fid *) (metadata + 1);
+        file_handle = (struct file_handle *) fid\->handle;
+
+        /* Ensure that the event info is of the correct type */
+
+        if (fid\->hdr.info_type == FAN_EVENT_INFO_TYPE_FID ||
+            fid\->hdr.info_type == FAN_EVENT_INFO_TYPE_DFID) {
+            file_name = NULL;
+        } else if (fid\->hdr.info_type == FAN_EVENT_INFO_TYPE_DFID_NAME) {
+            file_name = file_handle\->f_handle +
+                        file_handle\->handle_bytes;
+        } else {
+            fprintf(stderr, "Received unexpected event info type.\en");
+            exit(EXIT_FAILURE);
+        }
+
+        if (metadata\->mask == FAN_CREATE)
+            printf("FAN_CREATE (file created):\en");
+
+        if (metadata\->mask == (FAN_CREATE | FAN_ONDIR))
+            printf("FAN_CREATE | FAN_ONDIR (subdirectory created):\en");
+
+       /* metadata\->fd is set to FAN_NOFD when the group identifies
+          objects by file handles.  To obtain a file descriptor for
+          the file object corresponding to an event you can use the
+          struct file_handle that\(aqs provided within the
+          fanotify_event_info_fid in conjunction with the
+          open_by_handle_at(2) system call.  A check for ESTALE is
+          done to accommodate for the situation where the file handle
+          for the object was deleted prior to this system call. */
+
+        event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);
+        if (event_fd == \-1) {
+            if (errno == ESTALE) {
+                printf("File handle is no longer valid. "
+                        "File has been deleted\en");
+                continue;
+            } else {
+                perror("open_by_handle_at");
+                exit(EXIT_FAILURE);
+            }
+        }
+
+        snprintf(procfd_path, sizeof(procfd_path), "/proc/self/fd/%d",
+                event_fd);
+
+                /* 変更された dentry のパスを取得し表示する */
+
+        path_len = readlink(procfd_path, path, sizeof(path) \- 1);
+        if (path_len == \-1) {
+            perror("readlink");
+            exit(EXIT_FAILURE);
+        }
+
+        path[path_len] = \(aq\e0\(aq;
+        printf("\etDirectory \(aq%s\(aq has been modified.\en", path);
+
+        if (file_name) {
+            ret = fstatat(event_fd, file_name, &sb, 0);
+            if (ret == \-1) {
+                if (errno != ENOENT) {
+                    perror("fstatat");
+                    exit(EXIT_FAILURE);
+                }
+                printf("\etEntry \(aq%s\(aq does not exist.\en", file_name);
+            } else if ((sb.st_mode & S_IFMT) == S_IFDIR) {
+                printf("\etEntry \(aq%s\(aq is a subdirectory.\en", file_name);
+            } else {
+                printf("\etEntry \(aq%s\(aq is not a subdirectory.\en",
+                        file_name);
+            }
+        }
+
+        /* Close associated file descriptor for this event */
+
+        close(event_fd);
+    }
+
+    printf("All events processed successfully. Program exiting.\en");
+    exit(EXIT_SUCCESS);
+}
+.EE
+.SH 関連項目
+.ad l
+\fBfanotify_init\fP(2), \fBfanotify_mark\fP(2), \fBinotify\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
+\%https://www.kernel.org/doc/man\-pages/ に書かれている。
index 6ed6625..1c5eed0 100644 (file)
@@ -70,12 +70,10 @@ inotify \- ファイルシステムイベントを監視する
 inotify インスタンスを指している 全てのファイルディスクリプターが (\fBclose\fP(2) を使って) クローズされた場合、
 その下層にあるオブジェクトとそのリソースは、 カーネルで再利用するために解放される。 関連が切られた監視対象は自動的に解放される。
 .PP
-With careful programming, an application can use inotify to efficiently
-monitor and cache the state of a set of filesystem objects.  However, robust
-applications should allow for the fact that bugs in the monitoring logic or
-races of the kind described below may leave the cache inconsistent with the
-filesystem state.  It is probably wise to do some consistency checking, and
-rebuild the cache when inconsistencies are detected.
+注意深くプログラミングすることで、 アプリケーションは inotify
+を使ってファイルシステムオブジェクトの集合の状態を効率的に監視しキャッシュしておくことができる。
+しかしながら、ロバストなアプリケーションでは、監視ロジックのバグや以下に説明があるような種類の競合条件によりファイルシステムの状態とキャッシュが一致しない状態になることがあるという事実も考慮に入れておくべきである。
+おそらく何らかの一貫性のチェックを行い、不一致が検出された場合にはキャッシュを再構築するのが懸命だろう。
 .SS "inotify ファイルディスクリプターからのイベントの読み出し"
 どのようなイベントが起こっていたかを知るには、 アプリケーションで inotify ファイルディスクリプターを \fBread\fP(2)  すればよい。
 これまでに何もイベントが起こっていない場合、 停止 (blocking) モードのファイルディスクリプターであれば、 少なくとも 1
@@ -106,16 +104,15 @@ struct inotify_event {
 .PP
 \fImask\fP には発生したイベント (下記参照) を記述するためのビットが含まれる。
 .PP
-\fIcookie\fP is a unique integer that connects related events.  Currently, this
-is used only for rename events, and allows the resulting pair of
-\fBIN_MOVED_FROM\fP and \fBIN_MOVED_TO\fP events to be connected by the
-application.  For all other event types, \fIcookie\fP is set to 0.
+\fIcookie\fP は関連するイベントを関連づけるための一意な整数である。
+現在のところ、この値は rename イベントに対してのみ使われており、
+結果のペアである \fBIN_MOVED_FROM\fP と \fBIN_MOVED_TO\fP イベントを
+アプリケーションで関連づけることができる。
+他のイベント種別の場合には、 \fIcookie\fP は 0 に設定する。
 .PP
-The \fIname\fP field is present only when an event is returned for a file
-inside a watched directory; it identifies the filename within the watched
-directory.  This filename is null\-terminated, and may include further null
-bytes (\(aq\e0\(aq) to align subsequent reads to a suitable address
-boundary.
+\fIname\fP フィールドは監視しているディレクトリ内のファイルに対して イベントが返される場合のためにだけ存在する。
+監視するディレクトリ内のファイル名を表す。 このファイル名はヌルで終端され、 その後の読み込みで適切なアドレス境界に調整するために、 さらにヌルバイト
+(\(aq\e0\(aq) が含まれる場合もある。
 .PP
 \fIlen\fP フィールドはヌルバイトを含む \fIname\fP の全てのバイト数を表す。
 よって、 \fIinotify_event\fP 構造体のサイズは
@@ -241,7 +238,7 @@ Watch \fIpathname\fP only if it is a directory; the error \fBENOTDIR\fP results
 \fIpathname\fP is not a directory.  Using this flag provides an application
 with a race\-free way of ensuring that the monitored object is a directory.
 .TP 
-\fBIN_MASK_CREATE\fP (since Linux 4.18)
+\fBIN_MASK_CREATE\fP (Linux 4.18 以降)
 Watch \fIpathname\fP only if it does not already have a watch associated with
 it; the error \fBEEXIST\fP results if \fIpathname\fP is already being watched.
 .IP
@@ -467,10 +464,9 @@ inotify キューで処理待ちの未読み出しイベントがあるかの確
 個の監視対象ディスクリプターが一周させて、 キューに未読み出しイベントが残っている監視対象ディスクリプターを解放し、
 その監視対象ディスクリプターを再利用する必要があるからである。 この理由と、実世界のアプリケーションで発生したというバグ報告がないことから、 Linux
 3.15 時点では、この計算上は起こりうるバグを取り除くためのカーネルの変更は行われていない。
-.SH EXAMPLES
-The following program demonstrates the usage of the inotify API.  It marks
-the directories passed as a command\-line arguments and waits for events of
-type \fBIN_OPEN\fP, \fBIN_CLOSE_NOWRITE\fP, and \fBIN_CLOSE_WRITE\fP.
+.SH 例
+以下のプログラムは inotify API の使用例を示したものである。 コマンドライン引き数で渡されたディレクトリに印を付け、 タイプが
+\fBIN_OPEN\fP, \fBIN_CLOSE_NOWRITE\fP \fBIN_CLOSE_WRITE\fP のイベントを待つ。
 .PP
 以下は、 ファイル \fI/home/user/temp/foo\fP を編集し、 ディレクトリ \fI/tmp\fP の一覧表示を行った場合の出力である。
 対象のファイルとディレクトリがオープンされる前に、イベント \fBIN_OPEN\fP が発生している。 対象ファイルがクローズされた後にイベント
index c2533a5..c663187 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "POT-Creation-Date: 2021-03-12 14:01+0900\n"
-"PO-Revision-Date: 2021-03-12 21:56+0900\n"
+"PO-Revision-Date: 2021-04-06 17:39+0900\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "Language: \n"
@@ -132,30 +132,14 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:62
-#, fuzzy
-#| msgid ""
-#| "An fanotify notification group is a kernel-internal object that holds a "
-#| "list of files, directories, and mount points for which events shall be "
-#| "created."
 msgid ""
 "An fanotify notification group is a kernel-internal object that holds a list "
 "of files, directories, filesystems, and mount points for which events shall "
 "be created."
-msgstr ""
-"fanotify 通知グループはカーネル内部のオブジェクトで、 イベントが作成される"
-"ファイル、 ディレクトリ、 マウントポイントのリストを保持する。"
+msgstr "fanotify 通知グループはカーネル内部のオブジェクトで、 イベントが作成されるファイル、ディレクトリ、ファイルシステム、マウントポイントのリストを保持する。"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:73
-#, fuzzy
-#| msgid ""
-#| "For each entry in an fanotify notification group, two bit masks exist: "
-#| "the I<mark> mask and the I<ignore> mask.  The mark mask defines file "
-#| "activities for which an event shall be created.  The ignore mask defines "
-#| "activities for which no event shall be generated.  Having these two types "
-#| "of masks permits a mount point or directory to be marked for receiving "
-#| "events, while at the same time ignoring events for specific objects under "
-#| "that mount point or directory."
 msgid ""
 "For each entry in an fanotify notification group, two bit masks exist: the "
 "I<mark> mask and the I<ignore> mask.  The mark mask defines file activities "
@@ -164,30 +148,15 @@ msgid ""
 "a filesystem, mount point, or directory to be marked for receiving events, "
 "while at the same time ignoring events for specific objects under a mount "
 "point or directory."
-msgstr ""
-"fanotify 通知グループの各エントリーには 2 つのビットマスクがある。 I<mark> マ"
-"スクと I<ignore> マスクである。 mark マスクはどのファイル操作についてイベント"
-"を作成するかを定義する。 ignore マスクはどの操作についてイベントを作成しない"
-"かを定義する。 これらの 2 種類のマスクがあることで、 マウントポイントやディレ"
-"クトリに対してイベントの受信を mark しておきつつ、 同時にそのマウントポイント"
-"やディレクトリ配下の特定のオブジェクトに対するイベントを無視する、 といったこ"
-"とができる。"
+msgstr "fanotify 通知グループの各エントリーには 2 つのビットマスクがある。 I<mark> マスクと I<ignore> マスクである。 mark マスクはどのファイル操作についてイベントを作成するかを定義する。 ignore マスクはどの操作についてイベントを作成しないかを定義する。 これらの 2 種類のマスクがあることで、 ファイルシステム、マウントポイント、ディレクトリに対してイベントの受信を mark しておきつつ、 同時にそのマウントポイントやディレクトリ配下の特定のオブジェクトに対するイベントを無視する、 といったことができる。"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:79
-#, fuzzy
-#| msgid ""
-#| "The B<fanotify_mark>(2)  system call adds a file, directory, or mount to "
-#| "a notification group and specifies which events shall be reported (or "
-#| "ignored), or removes or modifies such an entry."
 msgid ""
 "The B<fanotify_mark>(2)  system call adds a file, directory, filesystem or "
 "mount point to a notification group and specifies which events shall be "
 "reported (or ignored), or removes or modifies such an entry."
-msgstr ""
-"B<fanotify_mark>(2) システムコールは、ファイル、ディレクトリ、マウントを通知"
-"グループに追加し、 どのイベントを報告 (もしくは無視) するかを指定する。 ま"
-"た、このようなエントリーの削除、変更も行う。"
+msgstr "B<fanotify_mark>(2) システムコールは、ファイル、ディレクトリ、ファイルシステム、マウントポイントを通知グループに追加し、 どのイベントを報告 (もしくは無視) するかを指定する。 また、このようなエントリーの削除、変更も行う。"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:92
@@ -331,19 +300,13 @@ msgstr ""
 #: build/C/man7/fanotify.7:150
 #, no-wrap
 msgid "After a successful"
-msgstr ""
+msgstr "B<read>(2) が成功すると、"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:154
-#, fuzzy
-#| msgid ""
-#| "After a successful B<read>(2), the read buffer contains one or more of "
-#| "the following structures:"
 msgid ""
 "B<read>(2), the read buffer contains one or more of the following structures:"
-msgstr ""
-"B<read>(2) が成功すると、読み出しバッファーには以下の構造体が 1 つ以上格納さ"
-"れる。"
+msgstr "読み出しバッファーには以下の構造体が 1 つ以上格納される。"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:166
@@ -380,12 +343,7 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:182
-#, fuzzy, no-wrap
-#| msgid ""
-#| "struct fanotify_response {\n"
-#| "    __s32 fd;\n"
-#| "    __u32 response;\n"
-#| "};\n"
+#, no-wrap
 msgid ""
 "struct fanotify_event_info_header {\n"
 "    __u8 info_type;\n"
@@ -393,9 +351,10 @@ msgid ""
 "    __u16 len;\n"
 "};\n"
 msgstr ""
-"struct fanotify_response {\n"
-"    __s32 fd;\n"
-"    __u32 response;\n"
+"struct fanotify_event_info_header {\n"
+"    __u8 info_type;\n"
+"    __u8 pad;\n"
+"    __u16 len;\n"
 "};\n"
 
 #. type: Plain text
@@ -468,13 +427,6 @@ msgstr "I<vers>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:224
-#, fuzzy
-#| msgid ""
-#| "This field holds a version number for the structure.  It must be compared "
-#| "to B<FANOTIFY_METADATA_VERSION> to verify that the structures returned at "
-#| "runtime match the structures defined at compile time.  In case of a "
-#| "mismatch, the application should abandon trying to use the fanotify file "
-#| "descriptor."
 msgid ""
 "This field holds a version number for the structure.  It must be compared to "
 "B<FANOTIFY_METADATA_VERSION> to verify that the structures returned at run "
@@ -590,21 +542,11 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:275
-#, fuzzy
-#| msgid ""
-#| "This is the ID of the process that caused the event.  A program listening "
-#| "to fanotify events can compare this PID to the PID returned by "
-#| "B<getpid>(2), to determine whether the event is caused by the listener "
-#| "itself, or is due to a file access by another process."
 msgid ""
 "A program listening to fanotify events can compare this PID to the PID "
 "returned by B<getpid>(2), to determine whether the event is caused by the "
 "listener itself, or is due to a file access by another process."
-msgstr ""
-"これはイベントが発生する原因となったプロセス ID である。 fanotify イベントを"
-"監視しているプログラムは、 この PID を B<getpid>(2) が返す PID と比較すること"
-"で、 イベントが監視しているプログラム自身から発生したかどうか、 別のプロセス"
-"によるファイルアクセスにより発生したか、を判定できる。"
+msgstr "fanotify イベントを監視しているプログラムは、 この PID を B<getpid>(2) が返す PID と比較することで、 イベントが監視しているプログラム自身から発生したかどうか、 別のプロセスによるファイルアクセスにより発生したか、を判定できる。"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:285
@@ -655,10 +597,9 @@ msgstr "ファイルやディレクトリがオープンされた。"
 
 #. type: TP
 #: build/C/man7/fanotify.7:295
-#, fuzzy, no-wrap
-#| msgid "B<FAN_OPEN>"
+#, no-wrap
 msgid "B<FAN_OPEN_EXEC>"
-msgstr "B<FAN_OPEN>"
+msgstr "B<FAN_OPEN_EXEC>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:301
@@ -669,24 +610,20 @@ msgstr ""
 
 #. type: TP
 #: build/C/man7/fanotify.7:301
-#, fuzzy, no-wrap
-#| msgid "B<IN_ATTRIB> (*)"
+#, no-wrap
 msgid "B<FAN_ATTRIB>"
-msgstr "B<IN_ATTRIB> (*)"
+msgstr "B<FAN_ATTRIB>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:304
-#, fuzzy
-#| msgid "A file or a directory was opened."
 msgid "A file or directory metadata was changed."
-msgstr "ã\83\95ã\82¡ã\82¤ã\83«ã\82\84ã\83\87ã\82£ã\83¬ã\82¯ã\83\88ã\83ªã\81\8cã\82ªã\83¼ã\83\97ã\83³された。"
+msgstr "ã\83\95ã\82¡ã\82¤ã\83«ã\81\8bã\83\87ã\82£ã\83¬ã\82¯ã\83\88ã\83ªã\81®ã\83¡ã\82¿ã\83\87ã\83¼ã\82¿ã\81\8cå¤\89æ\9b´された。"
 
 #. type: TP
 #: build/C/man7/fanotify.7:304
-#, fuzzy, no-wrap
-#| msgid "B<IN_CREATE> (+)"
+#, no-wrap
 msgid "B<FAN_CREATE>"
-msgstr "B<IN_CREATE> (+)"
+msgstr "B<FAN_CREATE>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:307
@@ -697,10 +634,9 @@ msgstr "ファイルやディレクトリがオープンされた。"
 
 #. type: TP
 #: build/C/man7/fanotify.7:307
-#, fuzzy, no-wrap
-#| msgid "B<IN_DELETE> (+)"
+#, no-wrap
 msgid "B<FAN_DELETE>"
-msgstr "B<IN_DELETE> (+)"
+msgstr "B<FAN_DELETE>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:310
@@ -711,10 +647,9 @@ msgstr "監視対象ディレクトリ内でファイルやディレクトリが
 
 #. type: TP
 #: build/C/man7/fanotify.7:310
-#, fuzzy, no-wrap
-#| msgid "B<IN_DELETE_SELF>"
+#, no-wrap
 msgid "B<FAN_DELETE_SELF>"
-msgstr "B<IN_DELETE_SELF>"
+msgstr "B<FAN_DELETE_SELF>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:313
@@ -725,10 +660,9 @@ msgstr "ファイルやディレクトリがオープンされた。"
 
 #. type: TP
 #: build/C/man7/fanotify.7:313
-#, fuzzy, no-wrap
-#| msgid "B<IN_MOVED_FROM> (+)"
+#, no-wrap
 msgid "B<FAN_MOVED_FROM>"
-msgstr "B<IN_MOVED_FROM> (+)"
+msgstr "B<FAN_MOVED_FROM>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:316
@@ -739,10 +673,9 @@ msgstr "監視対象ディレクトリ内でファイルやディレクトリが
 
 #. type: TP
 #: build/C/man7/fanotify.7:316
-#, fuzzy, no-wrap
-#| msgid "B<IN_MOVED_TO> (+)"
+#, no-wrap
 msgid "B<FAN_MOVED_TO>"
-msgstr "B<IN_MOVED_TO> (+)"
+msgstr "B<FAN_MOVED_TO>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:319
@@ -753,17 +686,14 @@ msgstr "監視対象ディレクトリ内でファイルやディレクトリが
 
 #. type: TP
 #: build/C/man7/fanotify.7:319
-#, fuzzy, no-wrap
-#| msgid "B<IN_MOVE_SELF>"
+#, no-wrap
 msgid "B<FAN_MOVE_SELF>"
-msgstr "B<IN_MOVE_SELF>"
+msgstr "B<FAN_MOVE_SELF>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:322
-#, fuzzy
-#| msgid "Watched file/directory was itself moved."
 msgid "A watched file or directory was moved."
-msgstr "ç\9b£è¦\96対象ã\81®ã\83\87ã\82£ã\83¬ã\82¯ã\83\88ã\83ªã\81¾ã\81\9fã\81¯ã\83\95ã\82¡ã\82¤ã\83«è\87ªèº«ã\81\8c移å\8b\95ã\81\95ã\82\8cã\81\9fã\80\82"
+msgstr "ç\9b£è¦\96対象ã\81®ã\83\87ã\82£ã\83¬ã\82¯ã\83\88ã\83ªã\82\84ã\83\95ã\82¡ã\82¤ã\83«ã\81\8c移å\8b\95ã\81\95ã\82\8cã\81\9fã\80\82"
 
 #. type: TP
 #: build/C/man7/fanotify.7:322 build/C/man2/fanotify_mark.2:173
@@ -774,7 +704,7 @@ msgstr "B<FAN_MODIFY>"
 #. type: Plain text
 #: build/C/man7/fanotify.7:325
 msgid "A file was modified."
-msgstr "ã\83\95ã\82¡ã\82¤ã\83«ã\82\84ã\83\87ã\82£ã\83¬ã\82¯ã\83\88ã\83ªã\81\8cå¤\89æ\9b´ã\81\95ã\82\8cã\81\9fã\80\82"
+msgstr "ファイルが変更された。"
 
 #. type: TP
 #: build/C/man7/fanotify.7:325 build/C/man2/fanotify_mark.2:176
@@ -857,10 +787,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man7/fanotify.7:358
-#, fuzzy, no-wrap
-#| msgid "B<FAN_OPEN_PERM>"
+#, no-wrap
 msgid "B<FAN_OPEN_EXEC_PERM>"
-msgstr "B<FAN_OPEN_PERM>"
+msgstr "B<FAN_OPEN_EXEC_PERM>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:366
@@ -903,31 +832,25 @@ msgstr "    FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:376
-#, fuzzy
-#| msgid "To check for any close event, the following bit mask may be used:"
 msgid "To check for any move event, the following bit mask may be used:"
-msgstr "クローズイベントを確認するために以下のビットマスクを使うことができる。"
+msgstr "移動イベントを確認するために以下のビットマスクを使うことができる。"
 
 #. type: TP
 #: build/C/man7/fanotify.7:376 build/C/man2/fanotify_mark.2:311
-#, fuzzy, no-wrap
-#| msgid "B<IN_MOVE>"
+#, no-wrap
 msgid "B<FAN_MOVE>"
-msgstr "B<IN_MOVE>"
+msgstr "B<FAN_MOVE>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:380
-#, fuzzy
-#| msgid "A file was closed.  This is a synonym for:"
 msgid "A file or directory was moved.  This is a synonym for:"
-msgstr "ã\83\95ã\82¡ã\82¤ã\83«ã\81\8cã\82¯ã\83­ã\83¼ã\82ºされた。 以下の同義語である。"
+msgstr "ã\83\95ã\82¡ã\82¤ã\83«ã\82\84ã\83\87ã\82£ã\83¬ã\82¯ã\83\88ã\83ªã\81\8c移å\8b\95された。 以下の同義語である。"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:382
 #, fuzzy, no-wrap
-#| msgid "Equates to B<IN_MOVED_FROM | IN_MOVED_TO>."
 msgid "    FAN_MOVED_FROM | FAN_MOVED_TO\n"
-msgstr "B<IN_MOVED_FROM | IN_MOVED_TO> と等価。"
+msgstr "    FAN_MOVED_FROM | FAN_MOVED_TO\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:386
@@ -954,17 +877,14 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:403
-#, fuzzy
-#| msgid ""
-#| "The fields of the I<fanotify_event_metadata> structure are as follows:"
 msgid "The fields of the I<fanotify_event_info_fid> structure are as follows:"
-msgstr "I<fanotify_event_metadata> 構造体のフィールドは以下のとおりである。"
+msgstr "I<fanotify_event_info_fid> 構造体のフィールドは以下のとおりである。"
 
 #. type: TP
 #: build/C/man7/fanotify.7:403
 #, no-wrap
 msgid "I<hdr>"
-msgstr ""
+msgstr "I<hdr>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:446
@@ -990,7 +910,7 @@ msgstr ""
 #: build/C/man7/fanotify.7:446
 #, no-wrap
 msgid "I<fsid>"
-msgstr ""
+msgstr "I<fsid>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:456
@@ -1004,7 +924,7 @@ msgstr ""
 #: build/C/man7/fanotify.7:456
 #, no-wrap
 msgid "I<file_handle>"
-msgstr ""
+msgstr "I<file_handle>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:512
@@ -1228,19 +1148,11 @@ msgstr "/proc/[pid]/fdinfo"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:610
-#, fuzzy
-#| msgid ""
-#| "The file I</proc/[pid]/fdinfo/[fd]> contains information about fanotify "
-#| "marks for file descriptor I<fd> of process I<pid>.  See the kernel source "
-#| "file I<Documentation/filesystems/proc.txt> for details."
 msgid ""
 "The file I</proc/[pid]/fdinfo/[fd]> contains information about fanotify "
 "marks for file descriptor I<fd> of process I<pid>.  See B<proc>(5)  for "
 "details."
-msgstr ""
-"ファイル I</proc/[pid]/fdinfo/[fd]> には、 プロセス I<pid> のファイルディスク"
-"リプター I<fd> の fanotify マークに関する情報が格納される。 詳細はカーネルの"
-"ソースファイル I<Documentation/filesystems/proc.txt> を参照。"
+msgstr "ファイル I</proc/[pid]/fdinfo/[fd]> には、 プロセス I<pid> のファイルディスクリプター I<fd> の fanotify マークに関する情報が格納される。 詳細は B<proc>(5) を参照。"
 
 #. type: SH
 #: build/C/man7/fanotify.7:610 build/C/man2/fanotify_init.2:343
@@ -1298,16 +1210,10 @@ msgstr "B<ENFILE>"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:632
-#, fuzzy
-#| msgid ""
-#| "The system-wide limit on the number of open files has been reached.  See "
-#| "I</proc/sys/fs/file-max> in B<proc>(5)."
 msgid ""
 "The system-wide limit on the total number of open files has been reached.  "
 "See I</proc/sys/fs/file-max> in B<proc>(5)."
-msgstr ""
-"オープンされたファイル数のシステム全体の上限に達した。 B<proc>(5) の I</proc/"
-"sys/fs/file-max> を参照。"
+msgstr "オープンされたファイルの総数のシステム全体の上限に達した。 B<proc>(5) の I</proc/sys/fs/file-max> を参照。"
 
 #. type: TP
 #: build/C/man7/fanotify.7:632
@@ -1567,8 +1473,7 @@ msgstr ""
 #. type: SH
 #: build/C/man7/fanotify.7:752 build/C/man7/inotify.7:879
 #: build/C/man2/inotify_add_watch.2:143
-#, fuzzy, no-wrap
-#| msgid "EXAMPLE"
+#, no-wrap
 msgid "EXAMPLES"
 msgstr "例"
 
@@ -1627,13 +1532,7 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:786
-#, fuzzy, no-wrap
-#| msgid ""
-#| "# ./fanotify_example /home\n"
-#| "Press enter key to terminate.\n"
-#| "Listening for events.\n"
-#| "FAN_OPEN_PERM: File /home/user/temp/notes\n"
-#| "FAN_CLOSE_WRITE: File /home/user/temp/notes\n"
+#, no-wrap
 msgid ""
 "# B<./fanotify_example /home>\n"
 "Press enter key to terminate.\n"
@@ -1641,7 +1540,7 @@ msgid ""
 "FAN_OPEN_PERM: File /home/user/temp/notes\n"
 "FAN_CLOSE_WRITE: File /home/user/temp/notes\n"
 msgstr ""
-"# ./fanotify_example /home\n"
+"# B<./fanotify_example /home>\n"
 "Press enter key to terminate.\n"
 "Listening for events.\n"
 "FAN_OPEN_PERM: File /home/user/temp/notes\n"
@@ -1657,7 +1556,7 @@ msgstr "Listening for events stopped.\n"
 #: build/C/man7/fanotify.7:790
 #, no-wrap
 msgid "Program source: fanotify_example.c"
-msgstr ""
+msgstr "プログラムのソース: fanotify_example.c"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:802
@@ -1685,10 +1584,9 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:804
-#, fuzzy, no-wrap
-#| msgid "/* Read all available fanotify events from the file descriptor 'fd' */\n"
+#, no-wrap
 msgid "/* Read all available fanotify events from the file descriptor \\(aqfd\\(aq */\n"
-msgstr "/* ファイルディスクリプター 'fd' から読み出しできる全 fanotify イベントを読み出す */\n"
+msgstr "/* ファイルディスクリプター \\(aqfd\\(aq から読み出しできる全 fanotify イベントを読み出す */\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:815
@@ -1736,13 +1634,7 @@ msgstr "        /* イベントを読み出す */\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:827 build/C/man7/inotify.7:958
-#, fuzzy, no-wrap
-#| msgid ""
-#| "        len = read(fd, buf, sizeof buf);\n"
-#| "        if (len == -1 && errno != EAGAIN) {\n"
-#| "            perror(\"read\");\n"
-#| "            exit(EXIT_FAILURE);\n"
-#| "        }\n"
+#, no-wrap
 msgid ""
 "        len = read(fd, buf, sizeof(buf));\n"
 "        if (len == -1 && errno != EAGAIN) {\n"
@@ -1750,7 +1642,7 @@ msgid ""
 "            exit(EXIT_FAILURE);\n"
 "        }\n"
 msgstr ""
-"        len = read(fd, buf, sizeof buf);\n"
+"        len = read(fd, buf, sizeof(buf));\n"
 "        if (len == -1 && errno != EAGAIN) {\n"
 "            perror(\"read\");\n"
 "            exit(EXIT_FAILURE);\n"
@@ -1860,13 +1752,7 @@ msgstr "                    /* ファイルのオープンを許可する */\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:866
-#, fuzzy, no-wrap
-#| msgid ""
-#| "                    response.fd = metadata-E<gt>fd;\n"
-#| "                    response.response = FAN_ALLOW;\n"
-#| "                    write(fd, &response,\n"
-#| "                          sizeof(struct fanotify_response));\n"
-#| "                }\n"
+#, no-wrap
 msgid ""
 "                    response.fd = metadata-E<gt>fd;\n"
 "                    response.response = FAN_ALLOW;\n"
@@ -1875,8 +1761,7 @@ msgid ""
 msgstr ""
 "                    response.fd = metadata-E<gt>fd;\n"
 "                    response.response = FAN_ALLOW;\n"
-"                    write(fd, &response,\n"
-"                          sizeof(struct fanotify_response));\n"
+"                    write(fd, &response, sizeof(response));\n"
 "                }\n"
 
 #. type: Plain text
@@ -1925,15 +1810,12 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:885
-#, fuzzy, no-wrap
-#| msgid ""
-#| "                path[path_len] = '\\e0';\n"
-#| "                printf(\"File %s\\en\", path);\n"
+#, no-wrap
 msgid ""
 "                path[path_len] = \\(aq\\e0\\(aq;\n"
 "                printf(\"File %s\\en\", path);\n"
 msgstr ""
-"                path[path_len] = '\\e0';\n"
+"                path[path_len] = \\(aq\\e0\\(aq;\n"
 "                printf(\"File %s\\en\", path);\n"
 
 #. type: Plain text
@@ -2176,19 +2058,14 @@ msgstr "                /* コンソールからの入力がある場合: 空の
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:973 build/C/man7/inotify.7:1088
-#, fuzzy, no-wrap
-#| msgid ""
-#| "                while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != '\\en')\n"
-#| "                    continue;\n"
-#| "                break;\n"
-#| "            }\n"
+#, no-wrap
 msgid ""
 "                while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\(aq\\en\\(aq)\n"
 "                    continue;\n"
 "                break;\n"
 "            }\n"
 msgstr ""
-"                while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != '\\en')\n"
+"                while (read(STDIN_FILENO, &buf, 1) E<gt> 0 && buf != \\(aq\\en\\(aq)\n"
 "                    continue;\n"
 "                break;\n"
 "            }\n"
@@ -2310,28 +2187,17 @@ msgstr ""
 #: build/C/man7/fanotify.7:1048
 #, no-wrap
 msgid "$ B<mkdir -p /home/user/testdir>          # In another terminal\n"
-msgstr ""
+msgstr "$ B<mkdir -p /home/user/testdir>          # In another terminal\n"
 
 #. type: SS
 #: build/C/man7/fanotify.7:1050
-#, fuzzy, no-wrap
-#| msgid "Program source"
+#, no-wrap
 msgid "Program source: fanotify_fid.c"
-msgstr "ã\83\97ã\83­ã\82°ã\83©ã\83 ã\82½ã\83¼ã\82¹"
+msgstr "ã\83\97ã\83­ã\82°ã\83©ã\83 ã\81®ã\82½ã\83¼ã\82¹: fanotify_fid.c"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1063
-#, fuzzy, no-wrap
-#| msgid ""
-#| "#define _GNU_SOURCE     /* Needed to get O_LARGEFILE definition */\n"
-#| "#include E<lt>errno.hE<gt>\n"
-#| "#include E<lt>fcntl.hE<gt>\n"
-#| "#include E<lt>limits.hE<gt>\n"
-#| "#include E<lt>poll.hE<gt>\n"
-#| "#include E<lt>stdio.hE<gt>\n"
-#| "#include E<lt>stdlib.hE<gt>\n"
-#| "#include E<lt>sys/fanotify.hE<gt>\n"
-#| "#include E<lt>unistd.hE<gt>\n"
+#, no-wrap
 msgid ""
 "#define _GNU_SOURCE\n"
 "#include E<lt>errno.hE<gt>\n"
@@ -2344,13 +2210,14 @@ msgid ""
 "#include E<lt>sys/fanotify.hE<gt>\n"
 "#include E<lt>unistd.hE<gt>\n"
 msgstr ""
-"#define _GNU_SOURCE     /* O_LARGEFILE の定義を得るために必要 */\n"
+"#define _GNU_SOURCE\n"
 "#include E<lt>errno.hE<gt>\n"
 "#include E<lt>fcntl.hE<gt>\n"
 "#include E<lt>limits.hE<gt>\n"
-"#include E<lt>poll.hE<gt>\n"
 "#include E<lt>stdio.hE<gt>\n"
 "#include E<lt>stdlib.hE<gt>\n"
+"#include E<lt>sys/types.hE<gt>\n"
+"#include E<lt>sys/stat.hE<gt>\n"
 "#include E<lt>sys/fanotify.hE<gt>\n"
 "#include E<lt>unistd.hE<gt>\n"
 
@@ -2358,7 +2225,7 @@ msgstr ""
 #: build/C/man7/fanotify.7:1065
 #, no-wrap
 msgid "#define BUF_SIZE 256\n"
-msgstr ""
+msgstr "#define BUF_SIZE 256\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1079
@@ -2381,12 +2248,7 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1084
-#, fuzzy, no-wrap
-#| msgid ""
-#| "    if (argc != 2) {\n"
-#| "        fprintf(stderr, \"Usage: %s MOUNT\\en\", argv[0]);\n"
-#| "        exit(EXIT_FAILURE);\n"
-#| "    }\n"
+#, no-wrap
 msgid ""
 "    if (argc != 2) {\n"
 "        fprintf(stderr, \"Invalid number of command line arguments.\\en\");\n"
@@ -2394,19 +2256,13 @@ msgid ""
 "    }\n"
 msgstr ""
 "    if (argc != 2) {\n"
-"        fprintf(stderr, \"Usage: %s MOUNT\\en\", argv[0]);\n"
+"        fprintf(stderr, \"Invalid number of command line arguments.\\en\");\n"
 "        exit(EXIT_FAILURE);\n"
 "    }\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1090
-#, fuzzy, no-wrap
-#| msgid ""
-#| "    fd = inotify_init1(IN_NONBLOCK);\n"
-#| "    if (fd == -1) {\n"
-#| "        perror(\"inotify_init1\");\n"
-#| "        exit(EXIT_FAILURE);\n"
-#| "    }\n"
+#, no-wrap
 msgid ""
 "    mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
 "    if (mount_fd == -1) {\n"
@@ -2414,9 +2270,9 @@ msgid ""
 "        exit(EXIT_FAILURE);\n"
 "    }\n"
 msgstr ""
-"    fd = inotify_init1(IN_NONBLOCK);\n"
-"    if (fd == -1) {\n"
-"        perror(\"inotify_init1\");\n"
+"    mount_fd = open(argv[1], O_DIRECTORY | O_RDONLY);\n"
+"    if (mount_fd == -1) {\n"
+"        perror(argv[1]);\n"
 "        exit(EXIT_FAILURE);\n"
 "    }\n"
 
@@ -2431,13 +2287,7 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1101
-#, fuzzy, no-wrap
-#| msgid ""
-#| "    fd = inotify_init1(IN_NONBLOCK);\n"
-#| "    if (fd == -1) {\n"
-#| "        perror(\"inotify_init1\");\n"
-#| "        exit(EXIT_FAILURE);\n"
-#| "    }\n"
+#, no-wrap
 msgid ""
 "    fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
 "    if (fd == -1) {\n"
@@ -2445,9 +2295,9 @@ msgid ""
 "        exit(EXIT_FAILURE);\n"
 "    }\n"
 msgstr ""
-"    fd = inotify_init1(IN_NONBLOCK);\n"
+"    fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_DFID_NAME, 0);\n"
 "    if (fd == -1) {\n"
-"        perror(\"inotify_init1\");\n"
+"        perror(\"fanotify_init\");\n"
 "        exit(EXIT_FAILURE);\n"
 "    }\n"
 
@@ -2459,14 +2309,7 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1111
-#, fuzzy, no-wrap
-#| msgid ""
-#| "    if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
-#| "                      FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
-#| "                      argv[1]) == -1) {\n"
-#| "        perror(\"fanotify_mark\");\n"
-#| "        exit(EXIT_FAILURE);\n"
-#| "    }\n"
+#, no-wrap
 msgid ""
 "    ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
 "                        FAN_CREATE | FAN_ONDIR,\n"
@@ -2476,9 +2319,10 @@ msgid ""
 "        exit(EXIT_FAILURE);\n"
 "    }\n"
 msgstr ""
-"    if (fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT,\n"
-"                      FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD,\n"
-"                      argv[1]) == -1) {\n"
+"    ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_ONLYDIR,\n"
+"                        FAN_CREATE | FAN_ONDIR,\n"
+"                        AT_FDCWD, argv[1]);\n"
+"    if (ret == -1) {\n"
 "        perror(\"fanotify_mark\");\n"
 "        exit(EXIT_FAILURE);\n"
 "    }\n"
@@ -2492,13 +2336,7 @@ msgstr "        /* バッファーの最初のイベントを参照する */\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1121
-#, fuzzy, no-wrap
-#| msgid ""
-#| "        len = read(fd, buf, sizeof buf);\n"
-#| "        if (len == -1 && errno != EAGAIN) {\n"
-#| "            perror(\"read\");\n"
-#| "            exit(EXIT_FAILURE);\n"
-#| "        }\n"
+#, no-wrap
 msgid ""
 "    len = read(fd, events_buf, sizeof(events_buf));\n"
 "    if (len == -1 && errno != EAGAIN) {\n"
@@ -2506,16 +2344,15 @@ msgid ""
 "        exit(EXIT_FAILURE);\n"
 "    }\n"
 msgstr ""
-"        len = read(fd, buf, sizeof buf);\n"
-"        if (len == -1 && errno != EAGAIN) {\n"
-"            perror(\"read\");\n"
-"            exit(EXIT_FAILURE);\n"
-"        }\n"
+"    len = read(fd, events_buf, sizeof(events_buf));\n"
+"    if (len == -1 && errno != EAGAIN) {\n"
+"        perror(\"read\");\n"
+"        exit(EXIT_FAILURE);\n"
+"    }\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1123
-#, fuzzy, no-wrap
-#| msgid "        /* Loop over all events in the buffer */\n"
+#, no-wrap
 msgid "    /* Process all events within the buffer */\n"
 msgstr "        /* バッファー内の全イベントを処理する */\n"
 
@@ -2555,29 +2392,23 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1145
-#, fuzzy, no-wrap
-#| msgid ""
-#| "                if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
-#| "                    printf(\"FAN_CLOSE_WRITE: \");\n"
+#, no-wrap
 msgid ""
 "        if (metadata-E<gt>mask == FAN_CREATE)\n"
 "            printf(\"FAN_CREATE (file created):\\en\");\n"
 msgstr ""
-"                if (metadata-E<gt>mask & FAN_CLOSE_WRITE)\n"
-"                    printf(\"FAN_CLOSE_WRITE: \");\n"
+"        if (metadata-E<gt>mask == FAN_CREATE)\n"
+"            printf(\"FAN_CREATE (file created):\\en\");\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1148
-#, fuzzy, no-wrap
-#| msgid ""
-#| "                if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
-#| "                    printf(\"FAN_OPEN_PERM: \");\n"
+#, no-wrap
 msgid ""
 "        if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
 "            printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\en\");\n"
 msgstr ""
-"                if (metadata-E<gt>mask & FAN_OPEN_PERM) {\n"
-"                    printf(\"FAN_OPEN_PERM: \");\n"
+"        if (metadata-E<gt>mask == (FAN_CREATE | FAN_ONDIR))\n"
+"            printf(\"FAN_CREATE | FAN_ONDIR (subdirectory created):\\en\");\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1157
@@ -2595,16 +2426,7 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1169
-#, fuzzy, no-wrap
-#| msgid ""
-#| "                snprintf(procfd_path, sizeof(procfd_path),\n"
-#| "                         \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
-#| "                path_len = readlink(procfd_path, path,\n"
-#| "                                    sizeof(path) - 1);\n"
-#| "                if (path_len == -1) {\n"
-#| "                    perror(\"readlink\");\n"
-#| "                    exit(EXIT_FAILURE);\n"
-#| "                }\n"
+#, no-wrap
 msgid ""
 "        event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
 "        if (event_fd == -1) {\n"
@@ -2618,14 +2440,17 @@ msgid ""
 "            }\n"
 "        }\n"
 msgstr ""
-"                snprintf(procfd_path, sizeof(procfd_path),\n"
-"                         \"/proc/self/fd/%d\", metadata-E<gt>fd);\n"
-"                path_len = readlink(procfd_path, path,\n"
-"                                    sizeof(path) - 1);\n"
-"                if (path_len == -1) {\n"
-"                    perror(\"readlink\");\n"
-"                    exit(EXIT_FAILURE);\n"
-"                }\n"
+"        event_fd = open_by_handle_at(mount_fd, file_handle, O_RDONLY);\n"
+"        if (event_fd == -1) {\n"
+"            if (errno == ESTALE) {\n"
+"                printf(\"File handle is no longer valid. \"\n"
+"                        \"File has been deleted\\en\");\n"
+"                continue;\n"
+"            } else {\n"
+"                perror(\"open_by_handle_at\");\n"
+"                exit(EXIT_FAILURE);\n"
+"            }\n"
+"        }\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1172
@@ -2637,20 +2462,13 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1174
-#, fuzzy, no-wrap
-#| msgid "                /* Retrieve and print pathname of the accessed file */\n"
+#, no-wrap
 msgid "        /* Retrieve and print the path of the modified dentry */\n"
-msgstr "                /* アクセスされたファイルのパス名を取得し表示する */\n"
+msgstr "                /* 変更された dentry のパスを取得し表示する */\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1180
-#, fuzzy, no-wrap
-#| msgid ""
-#| "        len = read(fd, buf, sizeof buf);\n"
-#| "        if (len == -1 && errno != EAGAIN) {\n"
-#| "            perror(\"read\");\n"
-#| "            exit(EXIT_FAILURE);\n"
-#| "        }\n"
+#, no-wrap
 msgid ""
 "        path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
 "        if (path_len == -1) {\n"
@@ -2658,24 +2476,21 @@ msgid ""
 "            exit(EXIT_FAILURE);\n"
 "        }\n"
 msgstr ""
-"        len = read(fd, buf, sizeof buf);\n"
-"        if (len == -1 && errno != EAGAIN) {\n"
-"            perror(\"read\");\n"
+"        path_len = readlink(procfd_path, path, sizeof(path) - 1);\n"
+"        if (path_len == -1) {\n"
+"            perror(\"readlink\");\n"
 "            exit(EXIT_FAILURE);\n"
 "        }\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1183
-#, fuzzy, no-wrap
-#| msgid ""
-#| "                path[path_len] = '\\e0';\n"
-#| "                printf(\"File %s\\en\", path);\n"
+#, no-wrap
 msgid ""
 "        path[path_len] = \\(aq\\e0\\(aq;\n"
 "        printf(\"\\etDirectory \\(aq%s\\(aq has been modified.\\en\", path);\n"
 msgstr ""
-"                path[path_len] = '\\e0';\n"
-"                printf(\"File %s\\en\", path);\n"
+"        path[path_len] = \\(aq\\e0\\(aq;\n"
+"        printf(\"\\etDirectory \\(aq%s\\(aq has been modified.\\en\", path);\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1199
@@ -2707,26 +2522,23 @@ msgstr "                /* イベントのファイルディスクリプター
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1204
-#, fuzzy, no-wrap
-#| msgid "    close(fd);\n"
+#, no-wrap
 msgid ""
 "        close(event_fd);\n"
 "    }\n"
-msgstr "    close(fd);\n"
+msgstr ""
+"        close(event_fd);\n"
+"    }\n"
 
 #. type: Plain text
 #: build/C/man7/fanotify.7:1208
-#, fuzzy, no-wrap
-#| msgid ""
-#| "    printf(\"Listening for events stopped.\\en\");\n"
-#| "    exit(EXIT_SUCCESS);\n"
-#| "}\n"
+#, no-wrap
 msgid ""
 "    printf(\"All events processed successfully. Program exiting.\\en\");\n"
 "    exit(EXIT_SUCCESS);\n"
 "}\n"
 msgstr ""
-"    printf(\"Listening for events stopped.\\en\");\n"
+"    printf(\"All events processed successfully. Program exiting.\\en\");\n"
 "    exit(EXIT_SUCCESS);\n"
 "}\n"
 
@@ -2819,15 +2631,6 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man2/fanotify_init.2:51
-#, fuzzy
-#| msgid ""
-#| "The file descriptor is used in calls to B<fanotify_mark>(2)  to specify "
-#| "the files, directories, and mounts for which fanotify events shall be "
-#| "created.  These events are received by reading from the file descriptor.  "
-#| "Some events are only informative, indicating that a file has been "
-#| "accessed.  Other events can be used to determine whether another "
-#| "application is permitted to access a file or directory.  Permission to "
-#| "access filesystem objects is granted by writing to the file descriptor."
 msgid ""
 "The file descriptor is used in calls to B<fanotify_mark>(2)  to specify the "
 "files, directories, mounts or filesystems for which fanotify events shall be "
@@ -2836,15 +2639,7 @@ msgid ""
 "Other events can be used to determine whether another application is "
 "permitted to access a file or directory.  Permission to access filesystem "
 "objects is granted by writing to the file descriptor."
-msgstr ""
-"このファイルディスクリプターは、 B<fanotify_mark>(2) の呼び出しで fanotify イ"
-"ベントが作成されるファイル、 ディレクトリ、 マウントを指定するのに使用でき"
-"る。 B<fanotify_mark>(2) で指定したファイル、 これらのイベントは、 このファイ"
-"ルディスクリプターからの読み出しで受信する。 いくつかのイベントは、 ファイル"
-"がアクセスされたことを示す単なる情報である。 他のいくつかのイベントは、 別の"
-"アプリケーションがファイルやディレクトリにアクセスする許可を与えるかを判定す"
-"るのに使用される。 ファイルシステムオブジェクトへのアクセス許可イベントについ"
-"ては、 承認結果をこのファイルディスクリプターに書き込む。"
+msgstr "このファイルディスクリプターは、 B<fanotify_mark>(2) の呼び出しで fanotify イベントが作成されるファイル、 ディレクトリ、 マウント、ファイルシステムを指定するのに使用できる。 B<fanotify_mark>(2) で指定したファイル、 これらのイベントは、 このファイルディスクリプターからの読み出しで受信する。 いくつかのイベントは、 ファイルがアクセスされたことを示す単なる情報である。 他のいくつかのイベントは、 別のアプリケーションがファイルやディレクトリにアクセスする許可を与えるかを判定するのに使用される。 ファイルシステムオブジェクトへのアクセス許可イベントについては、 承認結果をこのファイルディスクリプターに書き込む。"
 
 #. type: Plain text
 #: build/C/man2/fanotify_init.2:54
@@ -3001,11 +2796,6 @@ msgstr "B<FAN_NONBLOCK>"
 
 #. type: Plain text
 #: build/C/man2/fanotify_init.2:133
-#, fuzzy
-#| msgid ""
-#| "Enable the nonblocking flag (B<O_NONBLOCK>)  for the file descriptor.  "
-#| "Reading from the file descriptor will not block.  Instead, if no data is "
-#| "available, B<read>(2)  will fail with the error B<EAGAIN>."
 msgid ""
 "Enable the nonblocking flag (B<O_NONBLOCK>)  for the file descriptor.  "
 "Reading from the file descriptor will not block.  Instead, if no data is "
@@ -3048,10 +2838,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_init.2:145
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_REPORT_TID> (since Linux 4.20)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_REPORT_TID> (Linux 4.20 以降)"
 
 #.  commit d0a6a87e40da49cfc7954c491d3065a25a641b29
 #. type: Plain text
@@ -3064,10 +2853,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_init.2:157
-#, fuzzy, no-wrap
-#| msgid "B<IN_DONT_FOLLOW> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_REPORT_FID> (since Linux 5.1)"
-msgstr "B<IN_DONT_FOLLOW> (Linux 2.6.15 以降)"
+msgstr "B<FAN_REPORT_FID> (Linux 5.1 以降)"
 
 #.  commit a8b13aa20afb69161b5123b4f1acc7ea0a03d360
 #. type: Plain text
@@ -3095,10 +2883,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_init.2:195
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_REPORT_DIR_FID> (since Linux 5.9)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_REPORT_DIR_FID> (Linux 5.9 以降)"
 
 #. type: Plain text
 #: build/C/man2/fanotify_init.2:227
@@ -3125,10 +2912,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_init.2:227
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_REPORT_NAME> (since Linux 5.9)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_REPORT_NAME> (Linux 5.9 以降)"
 
 #. type: Plain text
 #: build/C/man2/fanotify_init.2:277
@@ -3240,26 +3026,17 @@ msgstr "B<O_LARGEFILE>"
 
 #. type: Plain text
 #: build/C/man2/fanotify_init.2:314
-#, fuzzy
-#| msgid ""
-#| "Enable support for files exceeding 2 GB.  Failing to set this flag will "
-#| "result in an B<EOVERFLOW> error when trying to open a large file which is "
-#| "monitored by an fanotify group on a 32-bit system."
 msgid ""
 "Enable support for files exceeding 2\\ GB.  Failing to set this flag will "
 "result in an B<EOVERFLOW> error when trying to open a large file which is "
 "monitored by an fanotify group on a 32-bit system."
-msgstr ""
-"2 GB を超えるファイルのサポートを有効にする。 このフラグのセットに失敗する"
-"と、 32 ビットシステムで fanotify グループが監視するラージファイルをオープン"
-"しようとした際に B<EOVERFLOW> エラーとなる。"
+msgstr "2\\ GB を超えるファイルのサポートを有効にする。 このフラグのセットに失敗すると、 32 ビットシステムで fanotify グループが監視するラージファイルをオープンしようとした際に B<EOVERFLOW> エラーとなる。"
 
 #. type: TP
 #: build/C/man2/fanotify_init.2:314
-#, fuzzy, no-wrap
-#| msgid "B<IN_DONT_FOLLOW> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<O_CLOEXEC> (since Linux 3.18)"
-msgstr "B<IN_DONT_FOLLOW> (Linux 2.6.15 以降)"
+msgstr "B<O_CLOEXEC> (Linux 3.18 以降)"
 
 #.  commit 0b37e097a648aa71d4db1ad108001e95b69a2da4
 #. type: Plain text
@@ -3457,19 +3234,11 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:44
-#, fuzzy
-#| msgid ""
-#| "B<fanotify_mark>(2)  adds, removes, or modifies an fanotify mark on a "
-#| "filesystem object.  The caller must have read permission on the "
-#| "filesystem object that is to be marked."
 msgid ""
 "B<fanotify_mark>()  adds, removes, or modifies an fanotify mark on a "
 "filesystem object.  The caller must have read permission on the filesystem "
 "object that is to be marked."
-msgstr ""
-"B<fanotify_mark>(2) はファイルシステムオブジェクトに対する fanotify マークの"
-"追加、削除、変更を行う。 呼び出し元はマークを付けるファイルシステムオブジェク"
-"トに対する読み出し許可を持っていなければならない。"
+msgstr "B<fanotify_mark>() はファイルシステムオブジェクトに対する fanotify マークの追加、削除、変更を行う。 呼び出し元はマークを付けるファイルシステムオブジェクトに対する読み出し許可を持っていなければならない。"
 
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:49
@@ -3631,10 +3400,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:145
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_MARK_FILESYSTEM> (since Linux 4.20)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_MARK_FILESYSTEM> (Linux 4.20 以降)"
 
 #.  commit d54f4fba889b205e9cd8239182ca5d27d0ac3bc2
 #. type: Plain text
@@ -3724,10 +3492,9 @@ msgstr "ファイルやディレクトリがオープンされた際にイベン
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:185
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_OPEN_EXEC> (since Linux 5.0)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_OPEN_EXEC> (Linux 5.0 以降)"
 
 #.  commit 9b076f1c0f4869b838a1b7aa0edb5664d47ec8aa
 #. type: Plain text
@@ -3739,10 +3506,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:190
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_ATTRIB> (since Linux 5.1)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_ATTRIB> (Linux 5.1 以降)"
 
 #.  commit 235328d1fa4251c6dcb32351219bb553a58838d2
 #. type: Plain text
@@ -3755,10 +3521,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:196
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_CREATE> (since Linux 5.1)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_CREATE> (Linux 5.1 以降)"
 
 #.  commit 235328d1fa4251c6dcb32351219bb553a58838d2
 #. type: Plain text
@@ -3771,10 +3536,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:203
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_DELETE> (since Linux 5.1)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_DELETE> (Linux 5.1 以降)"
 
 #.  commit 235328d1fa4251c6dcb32351219bb553a58838d2
 #. type: Plain text
@@ -3787,10 +3551,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:210
-#, fuzzy, no-wrap
-#| msgid "B<IN_DONT_FOLLOW> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_DELETE_SELF> (since Linux 5.1)"
-msgstr "B<IN_DONT_FOLLOW> (Linux 2.6.15 以降)"
+msgstr "B<FAN_DELETE_SELF> (Linux 5.1 以降)"
 
 #.  commit 235328d1fa4251c6dcb32351219bb553a58838d2
 #. type: Plain text
@@ -3803,10 +3566,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:216
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_MOVED_FROM> (since Linux 5.1)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_MOVED_FROM> (Linux 5.1 以降)"
 
 #.  commit 235328d1fa4251c6dcb32351219bb553a58838d2
 #. type: Plain text
@@ -3819,10 +3581,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:223
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_MOVED_TO> (since Linux 5.1)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_MOVED_TO> (Linux 5.1 以降)"
 
 #.  commit 235328d1fa4251c6dcb32351219bb553a58838d2
 #. type: Plain text
@@ -3835,10 +3596,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:230
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<FAN_MOVE_SELF> (since Linux 5.1)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<FAN_MOVE_SELF> (Linux 5.1 以降)"
 
 #.  commit 235328d1fa4251c6dcb32351219bb553a58838d2
 #. type: Plain text
@@ -4066,10 +3826,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man2/fanotify_mark.2:391
-#, fuzzy, no-wrap
-#| msgid "B<ENOENT>"
+#, no-wrap
 msgid "B<ENODEV>"
-msgstr "B<ENOENT>"
+msgstr "B<ENODEV>"
 
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:401
@@ -4141,7 +3900,7 @@ msgstr ""
 #: build/C/man2/fanotify_mark.2:435
 #, no-wrap
 msgid "B<EOPNOTSUPP>"
-msgstr ""
+msgstr "B<EOPNOTSUPP>"
 
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:443
@@ -4156,7 +3915,7 @@ msgstr ""
 #: build/C/man2/fanotify_mark.2:443
 #, no-wrap
 msgid "B<EXDEV>"
-msgstr ""
+msgstr "B<EXDEV>"
 
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:454
@@ -4180,7 +3939,7 @@ msgstr ""
 #: build/C/man2/fanotify_mark.2:461
 #, no-wrap
 msgid "FAN_OPEN_EXEC and FAN_OPEN_EXEC_PERM"
-msgstr ""
+msgstr "FAN_OPEN_EXEC と FAN_OPEN_EXEC_PERM"
 
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:478
@@ -4213,7 +3972,7 @@ msgstr ""
 #: build/C/man2/fanotify_mark.2:493
 #, no-wrap
 msgid "$ /bin/echo foo\n"
-msgstr ""
+msgstr "$ /bin/echo foo\n"
 
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:499
@@ -4229,6 +3988,8 @@ msgid ""
 "/bin/echo\n"
 "/lib64/ld-linux-x86-64.so.2\n"
 msgstr ""
+"/bin/echo\n"
+"/lib64/ld-linux-x86-64.so.2\n"
 
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:508
@@ -4238,10 +3999,6 @@ msgstr "バージョン 3.16 より前の Linux カーネルでは以下のバ
 #.  Fixed by commit 0a8dd2db579f7a0ac7033d6b857c3d5dbaa77563
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:518
-#, fuzzy
-#| msgid ""
-#| "If I<flags> contains B<FAN_MARK_FLUSH>, I<dirfd> and I<pathname> must "
-#| "specify a valid filesystem object, even though this object is not used."
 msgid ""
 "If I<flags> contains B<FAN_MARK_FLUSH>, I<dirfd>, and I<pathname> must "
 "specify a valid filesystem object, even though this object is not used."
@@ -4259,16 +4016,10 @@ msgstr "B<readdir>(2) は B<FAN_ACCESS> イベントを生成しない。"
 #.  Fixed by commit cc299a98eb13a9853675a9cbb90b30b4011e1406
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:532
-#, fuzzy
-#| msgid ""
-#| "If B<fanotify_mark>(2)  is called with B<FAN_MARK_FLUSH>, I<flags> is not "
-#| "checked for invalid values."
 msgid ""
 "If B<fanotify_mark>()  is called with B<FAN_MARK_FLUSH>, I<flags> is not "
 "checked for invalid values."
-msgstr ""
-"B<fanotify_mark>(2) が B<FAN_MARK_FLUSH> 付きで呼び出された場合、 I<flags> の"
-"値が無効かはチェックされない。"
+msgstr "B<fanotify_mark>() が B<FAN_MARK_FLUSH> 付きで呼び出された場合、 I<flags> の値が無効かはチェックされない。"
 
 #. type: Plain text
 #: build/C/man2/fanotify_mark.2:535
@@ -4367,15 +4118,6 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/inotify.7:88
-#, fuzzy
-#| msgid ""
-#| "With careful programming, an application can use inotify to efficiently "
-#| "monitor and cache the state of a set of filesystem objects.  However, "
-#| "robust applications should allow for the fact that bugs in the monitoring "
-#| "logic or races of the kind described below may leave the cache "
-#| "inconsistent with the filesystem state.  It is probably wise to to do "
-#| "some consistency checking, and rebuild the cache when inconsistencies are "
-#| "detected."
 msgid ""
 "With careful programming, an application can use inotify to efficiently "
 "monitor and cache the state of a set of filesystem objects.  However, robust "
@@ -4467,12 +4209,6 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/inotify.7:142
-#, fuzzy
-#| msgid ""
-#| "I<cookie> is a unique integer that connects related events.  Currently "
-#| "this is used only for rename events, and allows the resulting pair of "
-#| "B<IN_MOVED_FROM> and B<IN_MOVED_TO> events to be connected by the "
-#| "application.  For all other event types, I<cookie> is set to 0."
 msgid ""
 "I<cookie> is a unique integer that connects related events.  Currently, this "
 "is used only for rename events, and allows the resulting pair of "
@@ -4487,24 +4223,13 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/inotify.7:151
-#, fuzzy
-#| msgid ""
-#| "The I<name> field is present only when an event is returned for a file "
-#| "inside a watched directory; it identifies the file pathname relative to "
-#| "the watched directory.  This pathname is null-terminated, and may include "
-#| "further null bytes (\\(aq\\e0\\(aq) to align subsequent reads to a "
-#| "suitable address boundary."
 msgid ""
 "The I<name> field is present only when an event is returned for a file "
 "inside a watched directory; it identifies the filename within the watched "
 "directory.  This filename is null-terminated, and may include further null "
 "bytes (\\(aq\\e0\\(aq) to align subsequent reads to a suitable address "
 "boundary."
-msgstr ""
-"I<name> フィールドは監視しているディレクトリ内のファイルに対して イベントが返"
-"される場合のためにだけ存在する。 監視するディレクトリからのファイルの相対パス"
-"名を表す。 このパス名はヌルで終端され、 その後の読み込みで適切なアドレス境界"
-"に調整するために、 さらにヌルバイト (\\(aq\\e0\\(aq) が含まれる場合もある。"
+msgstr "I<name> フィールドは監視しているディレクトリ内のファイルに対して イベントが返される場合のためにだけ存在する。 監視するディレクトリ内のファイル名を表す。 このファイル名はヌルで終端され、 その後の読み込みで適切なアドレス境界に調整するために、 さらにヌルバイト (\\(aq\\e0\\(aq) が含まれる場合もある。"
 
 #. type: Plain text
 #: build/C/man7/inotify.7:161
@@ -4930,10 +4655,9 @@ msgstr ""
 
 #. type: TP
 #: build/C/man7/inotify.7:373
-#, fuzzy, no-wrap
-#| msgid "B<IN_ONLYDIR> (since Linux 2.6.15)"
+#, no-wrap
 msgid "B<IN_MASK_CREATE> (since Linux 4.18)"
-msgstr "B<IN_ONLYDIR> (Linux 2.6.15 以降)"
+msgstr "B<IN_MASK_CREATE> (Linux 4.18 以降)"
 
 #. type: Plain text
 #: build/C/man7/inotify.7:383
@@ -5655,11 +5379,6 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/inotify.7:887
-#, fuzzy
-#| msgid ""
-#| "The following program demonstrates the usage of the inotify API.  It "
-#| "marks the directories passed as a command-line arguments and waits for "
-#| "events of type B<IN_OPEN>, B<IN_CLOSE_NOWRITE> and B<IN_CLOSE_WRITE>."
 msgid ""
 "The following program demonstrates the usage of the inotify API.  It marks "
 "the directories passed as a command-line arguments and waits for events of "
@@ -5720,14 +5439,7 @@ msgstr "プログラムソース"
 
 #. type: Plain text
 #: build/C/man7/inotify.7:926
-#, fuzzy, no-wrap
-#| msgid ""
-#| "#include E<lt>errno.hE<gt>\n"
-#| "#include E<lt>poll.hE<gt>\n"
-#| "#include E<lt>stdio.hE<gt>\n"
-#| "#include E<lt>stdlib.hE<gt>\n"
-#| "#include E<lt>sys/inotify.hE<gt>\n"
-#| "#include E<lt>unistd.hE<gt>\n"
+#, no-wrap
 msgid ""
 "#include E<lt>errno.hE<gt>\n"
 "#include E<lt>poll.hE<gt>\n"
@@ -5743,16 +5455,11 @@ msgstr ""
 "#include E<lt>stdlib.hE<gt>\n"
 "#include E<lt>sys/inotify.hE<gt>\n"
 "#include E<lt>unistd.hE<gt>\n"
+"#include E<lt>string.hE<gt>\n"
 
 #. type: Plain text
 #: build/C/man7/inotify.7:932
-#, fuzzy, no-wrap
-#| msgid ""
-#| "/* Read all available inotify events from the file descriptor 'fd'.\n"
-#| "   wd is the table of watch descriptors for the directories in argv.\n"
-#| "   argc is the length of wd and argv.\n"
-#| "   argv is the list of watched directories.\n"
-#| "   Entry 0 of wd and argv is unused. */\n"
+#, no-wrap
 msgid ""
 "/* Read all available inotify events from the file descriptor \\(aqfd\\(aq.\n"
 "   wd is the table of watch descriptors for the directories in argv.\n"
@@ -5760,7 +5467,7 @@ msgid ""
 "   argv is the list of watched directories.\n"
 "   Entry 0 of wd and argv is unused. */\n"
 msgstr ""
-"/* Read all available inotify events from the file descriptor 'fd'.\n"
+"/* Read all available inotify events from the file descriptor \\(aqfd\\(aq.\n"
 "   wd is the table of watch descriptors for the directories in argv.\n"
 "   argc is the length of wd and argv.\n"
 "   argv is the list of watched directories.\n"
@@ -5790,14 +5497,7 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/inotify.7:946
-#, fuzzy, no-wrap
-#| msgid ""
-#| "    char buf[4096]\n"
-#| "        __attribute__ ((aligned(__alignof__(struct inotify_event))));\n"
-#| "    const struct inotify_event *event;\n"
-#| "    int i;\n"
-#| "    ssize_t len;\n"
-#| "    char *ptr;\n"
+#, no-wrap
 msgid ""
 "    char buf[4096]\n"
 "        __attribute__ ((aligned(__alignof__(struct inotify_event))));\n"
@@ -5807,9 +5507,7 @@ msgstr ""
 "    char buf[4096]\n"
 "        __attribute__ ((aligned(__alignof__(struct inotify_event))));\n"
 "    const struct inotify_event *event;\n"
-"    int i;\n"
 "    ssize_t len;\n"
-"    char *ptr;\n"
 
 #. type: Plain text
 #: build/C/man7/inotify.7:948
@@ -5837,15 +5535,12 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/inotify.7:970
-#, fuzzy, no-wrap
-#| msgid ""
-#| "        for (ptr = buf; ptr E<lt> buf + len;\n"
-#| "                ptr += sizeof(struct inotify_event) + event-E<gt>len) {\n"
+#, no-wrap
 msgid ""
 "        for (char *ptr = buf; ptr E<lt> buf + len;\n"
 "                ptr += sizeof(struct inotify_event) + event-E<gt>len) {\n"
 msgstr ""
-"        for (ptr = buf; ptr E<lt> buf + len;\n"
+"        for (char *ptr = buf; ptr E<lt> buf + len;\n"
 "                ptr += sizeof(struct inotify_event) + event-E<gt>len) {\n"
 
 #. type: Plain text
@@ -5886,14 +5581,7 @@ msgstr "            /* Print the name of the watched directory */\n"
 
 #. type: Plain text
 #: build/C/man7/inotify.7:990
-#, fuzzy, no-wrap
-#| msgid ""
-#| "            for (i = 1; i E<lt> argc; ++i) {\n"
-#| "                if (wd[i] == event-E<gt>wd) {\n"
-#| "                    printf(\"%s/\", argv[i]);\n"
-#| "                    break;\n"
-#| "                }\n"
-#| "            }\n"
+#, no-wrap
 msgid ""
 "            for (int i = 1; i E<lt> argc; ++i) {\n"
 "                if (wd[i] == event-E<gt>wd) {\n"
@@ -5902,7 +5590,7 @@ msgid ""
 "                }\n"
 "            }\n"
 msgstr ""
-"            for (i = 1; i E<lt> argc; ++i) {\n"
+"            for (int i = 1; i E<lt> argc; ++i) {\n"
 "                if (wd[i] == event-E<gt>wd) {\n"
 "                    printf(\"%s/\", argv[i]);\n"
 "                    break;\n"
@@ -6051,17 +5739,7 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man7/inotify.7:1051
-#, fuzzy, no-wrap
-#| msgid ""
-#| "    for (i = 1; i E<lt> argc; i++) {\n"
-#| "        wd[i] = inotify_add_watch(fd, argv[i],\n"
-#| "                                  IN_OPEN | IN_CLOSE);\n"
-#| "        if (wd[i] == -1) {\n"
-#| "            fprintf(stderr, \"Cannot watch '%s'\\en\", argv[i]);\n"
-#| "            perror(\"inotify_add_watch\");\n"
-#| "            exit(EXIT_FAILURE);\n"
-#| "        }\n"
-#| "    }\n"
+#, no-wrap
 msgid ""
 "    for (i = 1; i E<lt> argc; i++) {\n"
 "        wd[i] = inotify_add_watch(fd, argv[i],\n"
@@ -6077,8 +5755,8 @@ msgstr ""
 "        wd[i] = inotify_add_watch(fd, argv[i],\n"
 "                                  IN_OPEN | IN_CLOSE);\n"
 "        if (wd[i] == -1) {\n"
-"            fprintf(stderr, \"Cannot watch '%s'\\en\", argv[i]);\n"
-"            perror(\"inotify_add_watch\");\n"
+"            fprintf(stderr, \"Cannot watch \\(aq%s\\(aq: %s\\en\",\n"
+"                    argv[i], strerror(errno));\n"
 "            exit(EXIT_FAILURE);\n"
 "        }\n"
 "    }\n"
@@ -6214,7 +5892,7 @@ msgstr "INOTIFY_ADD_WATCH"
 #: build/C/man2/inotify_add_watch.2:28 build/C/man2/inotify_init.2:29
 #, no-wrap
 msgid "2020-04-11"
-msgstr ""
+msgstr "2020-04-11"
 
 #. type: Plain text
 #: build/C/man2/inotify_add_watch.2:31
@@ -6257,15 +5935,6 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man2/inotify_add_watch.2:66
-#, fuzzy
-#| msgid ""
-#| "A successful call to B<inotify_add_watch>()  returns a unique watch "
-#| "descriptor for this inotify instance, for the filesystem object that "
-#| "corresponds to I<pathname>.  If the filesystem object was not previously "
-#| "being watched by this inotify instance, then the watch descriptor is "
-#| "newly allocated.  If the filesystem object was already being watched "
-#| "(perhaps via a different link to the same object), then the descriptor "
-#| "for the existing watch is returned."
 msgid ""
 "A successful call to B<inotify_add_watch>()  returns a unique watch "
 "descriptor for this inotify instance, for the filesystem object (inode) that "
@@ -6274,14 +5943,7 @@ msgid ""
 "allocated.  If the filesystem object was already being watched (perhaps via "
 "a different link to the same object), then the descriptor for the existing "
 "watch is returned."
-msgstr ""
-"B<inotify_add_watch>() の呼び出しが成功すると、 I<pathname> に対応するファイ"
-"ルシステムオブジェクトに対する、 一意な監視対象ディスクリプター (watch "
-"descriptor) を、 対象の inotify インスタンスに対して返す。 そのファイルシステ"
-"ムオブジェクトが対象の inotify インスタンスによって以前に監視されていない場合"
-"には、 監視対象ディスクリプターは新規に割り当てられる。 ファイルシステムオブ"
-"ジェクトが (おそらく同じオブジェクトに対する異なるリンク経由で) すでに監視さ"
-"れている場合には、 既存の監視に対するディスクリプターが返される。"
+msgstr "B<inotify_add_watch>() の呼び出しが成功すると、 I<pathname> に対応するファイルシステムオブジェクト (inode) に対する、 一意な監視対象ディスクリプター (watch descriptor) を、 対象の inotify インスタンスに対して返す。 そのファイルシステムオブジェクトが対象の inotify インスタンスによって以前に監視されていない場合には、 監視対象ディスクリプターは新規に割り当てられる。 ファイルシステムオブジェクトが (おそらく同じオブジェクトに対する異なるリンク経由で) すでに監視されている場合には、 既存の監視に対するディスクリプターが返される。"
 
 #. type: Plain text
 #: build/C/man2/inotify_add_watch.2:77
@@ -6299,17 +5961,11 @@ msgstr ""
 
 #. type: Plain text
 #: build/C/man2/inotify_add_watch.2:84
-#, fuzzy
-#| msgid ""
-#| "On success, B<inotify_add_watch>()  returns a nonnegative watch "
-#| "descriptor.  On error, -1 is returned and I<errno> is set appropriately."
 msgid ""
 "On success, B<inotify_add_watch>()  returns a watch descriptor (a "
 "nonnegative integer).  On error, -1 is returned and I<errno> is set "
 "appropriately."
-msgstr ""
-"成功すると、 B<inotify_add_watch>()  は非負の監視対象ディスクリプターを返"
-"す。 エラーの場合、-1 を返し、 I<errno> を適切に設定する。"
+msgstr "成功すると、 B<inotify_add_watch>()  は非負の監視対象ディスクリプター (非負の整数) を返す。 エラーの場合、-1 を返し、 I<errno> を適切に設定する。"
 
 #. type: TP
 #: build/C/man2/inotify_add_watch.2:85
@@ -6331,7 +5987,7 @@ msgstr "指定されたファイルディスクリプターが有効ではない
 #: build/C/man2/inotify_add_watch.2:91
 #, no-wrap
 msgid "B<EEXIST>"
-msgstr ""
+msgstr "B<EEXIST>"
 
 #. type: Plain text
 #: build/C/man2/inotify_add_watch.2:100
@@ -6419,7 +6075,7 @@ msgstr "inotify は Linux カーネル 2.6.13 に組み込まれた。"
 #. type: Plain text
 #: build/C/man2/inotify_add_watch.2:146
 msgid "See B<inotify>(7)."
-msgstr ""
+msgstr "B<inotify>(7) 参照。"
 
 #. type: Plain text
 #: build/C/man2/inotify_add_watch.2:150
@@ -6540,12 +6196,9 @@ msgstr "inotify インスタンスの総数がユーザー単位の上限に達
 
 #. type: Plain text
 #: build/C/man2/inotify_init.2:96
-#, fuzzy
-#| msgid ""
-#| "The system limit on the total number of file descriptors has been reached."
 msgid ""
 "The system-wide limit on the total number of open files has been reached."
-msgstr "inotify ファイルディスクリプターの総数がシステムの上限に達していた。"
+msgstr "オープンされたファイルの総数がシステム全体の上限に達していた。"
 
 #. type: Plain text
 #: build/C/man2/inotify_init.2:99
@@ -6584,7 +6237,7 @@ msgstr "INOTIFY_RM_WATCH"
 #: build/C/man2/inotify_rm_watch.2:27
 #, no-wrap
 msgid "2017-09-15"
-msgstr ""
+msgstr "2017-09-15"
 
 #. type: Plain text
 #: build/C/man2/inotify_rm_watch.2:30
@@ -6647,34 +6300,9 @@ msgstr ""
 msgid "B<inotify_add_watch>(2), B<inotify_init>(2), B<inotify>(7)"
 msgstr "B<inotify_add_watch>(2), B<inotify_init>(2), B<inotify>(7)"
 
-#~ msgid "2014-12-31"
-#~ msgstr "2014-12-31"
-
 #~ msgid "Calling B<fallocate>(2)  does not create any fanotify events."
 #~ msgstr "B<fallocate>(2) の呼び出しでは fanotify イベントが作成されない。"
 
-#~ msgid "    for(;;) {\n"
-#~ msgstr "    for(;;) {\n"
-
-#~ msgid ""
-#~ "        len = read(fd, (void *) &buf, sizeof(buf));\n"
-#~ "        if (len == -1 && errno != EAGAIN) {\n"
-#~ "            perror(\"read\");\n"
-#~ "            exit(EXIT_FAILURE);\n"
-#~ "        }\n"
-#~ msgstr ""
-#~ "        len = read(fd, (void *) &buf, sizeof(buf));\n"
-#~ "        if (len == -1 && errno != EAGAIN) {\n"
-#~ "            perror(\"read\");\n"
-#~ "            exit(EXIT_FAILURE);\n"
-#~ "        }\n"
-
-#~ msgid "2014-10-02"
-#~ msgstr "2014-10-02"
-
-#~ msgid "B<O_CLOEXEC>"
-#~ msgstr "B<O_CLOEXEC>"
-
 #~ msgid "As of Linux 3.17, the following bug exists:"
 #~ msgstr "Linux 3.17 時点では、 以下のバグが存在する。"
 
@@ -6701,12 +6329,3 @@ msgstr "B<inotify_add_watch>(2), B<inotify_init>(2), B<inotify>(7)"
 #~ msgstr ""
 #~ "カーネル 3.17 時点では、 B<fallocate>(2) の呼び出しでは inotify イベントが"
 #~ "生成されない。"
-
-#~ msgid "2014-07-08"
-#~ msgstr "2014-07-08"
-
-#~ msgid "2014-03-28"
-#~ msgstr "2014-03-28"
-
-#~ msgid "2010-10-15"
-#~ msgstr "2010-10-15"
index 6df4e59..6a1648b 100644 (file)
@@ -1,8 +1,7 @@
 # pagename,#complete,#remaining,#all
-fanotify.7,164,103,267
-fanotify_init.2,71,18,89
-fanotify_mark.2,91,45,136
-inotify.7,198,24,222
-inotify_add_watch.2,37,9,46
-inotify_init.2,34,4,38
-inotify_rm_watch.2,26,1,27
+fanotify.7,218,49,267
+fanotify_init.2,79,10,89
+fanotify_mark.2,110,26,136
+inotify.7,212,10,222
+inotify_add_watch.2,43,3,46
+inotify_init.2,36,2,38
index 3962ef0..63f9415 100644 (file)
 <TR class="over80"><TD>netlink.7</TD><TD>14/149</TD><TD>90.60</TD></TR>
 <TR class="over80"><TD>rtnetlink.7</TD><TD>19/318</TD><TD>94.03</TD></TR>
 <TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>notify</B></TD></TR>
-<TR><TD>fanotify.7</TD><TD>103/267</TD><TD>61.42</TD></TR>
-<TR class="over70"><TD>fanotify_init.2</TD><TD>18/89</TD><TD>79.78</TD></TR>
-<TR><TD>fanotify_mark.2</TD><TD>45/136</TD><TD>66.91</TD></TR>
-<TR class="over80"><TD>inotify.7</TD><TD>24/222</TD><TD>89.19</TD></TR>
-<TR class="over80"><TD>inotify_add_watch.2</TD><TD>9/46</TD><TD>80.43</TD></TR>
-<TR class="over80"><TD>inotify_init.2</TD><TD>4/38</TD><TD>89.47</TD></TR>
-<TR class="over80"><TD>inotify_rm_watch.2</TD><TD>1/27</TD><TD>96.30</TD></TR>
+<TR class="over80"><TD>fanotify.7</TD><TD>49/267</TD><TD>81.65</TD></TR>
+<TR class="over80"><TD>fanotify_init.2</TD><TD>10/89</TD><TD>88.76</TD></TR>
+<TR class="over80"><TD>fanotify_mark.2</TD><TD>26/136</TD><TD>80.88</TD></TR>
+<TR class="over80"><TD>inotify.7</TD><TD>10/222</TD><TD>95.50</TD></TR>
+<TR class="over80"><TD>inotify_add_watch.2</TD><TD>3/46</TD><TD>93.48</TD></TR>
+<TR class="over80"><TD>inotify_init.2</TD><TD>2/38</TD><TD>94.74</TD></TR>
 <TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>numa</B></TD></TR>
 <TR class="over80"><TD>get_mempolicy.2</TD><TD>1/38</TD><TD>97.37</TD></TR>
 <TR class="over80"><TD>getcpu.2</TD><TD>2/29</TD><TD>93.10</TD></TR>
 <TR class="over80"><TD>login.3</TD><TD>1/46</TD><TD>97.83</TD></TR>
 <TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>wchar</B></TD></TR>
 <TR class="over80"><TD>mbsnrtowcs.3</TD><TD>1/47</TD><TD>97.87</TD></TR>
-<TR><TD COLSPAN=3>Total 642 pages</TD></TR>
+<TR><TD COLSPAN=3>Total 641 pages</TD></TR>
 </TABLE>
 </BODY></HTML>