fanotify.7: Minor wording and formatting fixes

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2014-05-07 10:07:26 +02:00
parent d4a12c12eb
commit 4a57583f50
1 changed files with 29 additions and 19 deletions

View File

@ -36,7 +36,9 @@ for details of an API that does notify those events.)
Additional capabilities compared to the
.BR inotify (7)
API are monitoring of complete mounts, access permission decisions, and the
API include the ability to monitor all of the objects
in a mounted filesystem,
the ability to make access permission decisions, and the
possibility to read or modify files before access by other applications.
The following system calls are used with this API:
@ -103,11 +105,14 @@ returned by
.BR fanotify_init (2).
Two types of events are generated:
notification events and permission events.
.I notification
events and
.I permission
events.
Notification events are merely informative
and require no action to be taken by
the receiving application except for closing the file descriptor passed
in the event.
in the event (see below).
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
@ -153,7 +158,9 @@ struct fanotify_event_metadata {
.fi
.in
.PP
The fields of this structure as follows:
The fields of the
.I fanotify_event_metadata
structure are as follows:
.TP
.I event_len
This is the length of the data for the current event and the offset
@ -186,7 +193,7 @@ optional headers per event type.
No such optional headers exist in the current implementation.
.TP
.I mask
This is a bit mask describing the event.
This is a bit mask describing the event (see below).
.TP
.I fd
This is an open file descriptor for the object being accessed, or
@ -194,13 +201,15 @@ This is an open file descriptor for the object being accessed, or
if a queue overflow occurred.
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
The
.B FMODE_NONOTIFY
file status flag is set on the corresponding open file description.
file status flag is set on the open file description
that corresponds to this file descriptor.
This flag suppresses fanotify event generation.
Hence, when the receiver of the fanotify event accesses the notified file or
directory using this file descriptor, no additional events will be created.
The reading application is responsible for closing the file descriptor.
.TP
.I pid
This is the ID of the process that caused the event.
@ -208,11 +217,11 @@ A program listening to fanotify events can compare this PID
to the PID returned by
.BR getpid (2),
to determine whether the event is caused by the listener itself,
or is due to a file access by another program.
or is due to a file access by another process.
.PP
The bit mask in
.I mask
signals which events have occurred for a single filesystem object.
indicates which events have occurred for a single filesystem object.
Multiple bits may be set in this mask,
if more than one event occurred for the monitored filesystem object.
In particular,
@ -247,17 +256,18 @@ was closed.
.TP
.B FAN_Q_OVERFLOW
The event queue exceeded the limit of 16384 entries.
This limit can be overridden in the call to
.BR fanotify_init (2)
by setting the flag
.BR FAN_UNLIMITED_QUEUE .
This limit can be overridden by specifying the
.BR FAN_UNLIMITED_QUEUE
flag when calling
.BR fanotify_init (2).
.TP
.B FAN_ACCESS_PERM
An application wants to read a file or directory, for example using
.BR read (2)
or
.BR readdir (2).
The reader must write a response that determines whether the permission to
The reader must write a response (as described below)
that determines whether the permission to
access the filesystem object shall be granted.
.TP
.B FAN_OPEN_PERM
@ -269,14 +279,14 @@ To check for any close event, the following bit mask may be used:
.TP
.B FAN_CLOSE
A file was closed.
This is a synonym for;
This is a synonym for:
FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE
.PP
The following macros are provided to iterate over a buffer containing
fanotify event metadata returned by a
fanotify event metadata returned by a
.BR read (2)
from an fanotify file descriptor.
from an fanotify file descriptor:
.TP
.B FAN_EVENT_OK(meta, len)
This macro checks the remaining length
@ -359,7 +369,7 @@ the following errors can occur when reading from the
fanotify file descriptor:
.TP
.B EINVAL
The buffer is too short to hold the event.
The buffer is too small to hold the event.
.TP
.B EMFILE
The per-process limit on the number of open files has been reached.
@ -459,7 +469,7 @@ This poses a security risk, when the
capability is set for programs executed by unprivileged users.
.SH EXAMPLE
The following program demonstrates the usage of the fanotify API.
It marks the mount point passed as command-line argument
It marks the mount point passed as a command-line argument
and waits for events of type
.B FAN_PERM_OPEN
and