fanotify: Document FAN_REPORT_FD_ERROR
PATCH 1/1 fanotify: Document FAN_REPORT_FD_ERROR
This flag from v6.13 allows reporting detailed errors on failure to open a file descriptor for an event.
This API was backported to LTS kernels v6.12.4 and v6.6.66.
--- man/man2/fanotify_init.2 | 29 +++++++++++++++++++++++++++++ man/man7/fanotify.7 | 12 ++++++++++++ 2 files changed, 41 insertions(+)
man/man2/fanotify_init.2 +29 -0
@@ -364,6 +364,35 @@ so this restriction may eventually be lifted. For more details on information records, see .BR fanotify (7). +.TP +.BR FAN_REPORT_FD_ERROR " (since Linux 6.13 and 6.12.4 and 6.6.66)" +.\" commit 522249f05c5551aec9ec0ba9b6438f1ec19c138d +Events for fanotify groups initialized with this flag may contain +an error code that explains the reason for failure to open a file descriptor. +The +.I fd +memeber of struct +.I fanotify_event_metadata +normally contains +an open file descriptor associated with the object of the event +or FAN_NOFD in case a file descriptor could not be opened. +For a group initialized with this flag, instead of FAN_NOFD, +the +.I fd +memeber of struct +.I fanotify_event_metadata +will contain +a negative error value. +When the group is also initialized with flag +.BR FAN_REPORT_PIDFD , +in case a process file descriptor could not be opened, +the +.I pidfd +memeber of struct +.I fanotify_event_info_pidfd +will also contain a negative error value. +For more details, see +.BR fanotify (7). .P The .I event_f_flags
man/man7/fanotify.7 +12 -0
@@ -335,6 +335,12 @@ file status flag is set on the open file description. 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. +.IP +When an fanotify group is initialized using +.BR FAN_REPORT_FD_ERROR , +this field will contain a negative error value in case a file descriptor +could not be opened and +in case of a queue overflow, the value will be -EBADF. .TP .I pid If flag
@@ -679,6 +685,12 @@ Once the event listener has dealt with an event and the pidfd is no longer required, the pidfd should be closed via .BR close (2). +.IP +When an fanotify group is initialized using +.BR FAN_REPORT_FD_ERROR , +this field will contain a negative error value +in case a pidfd creation failure and +in case of a terminated process, the value will be -ESRCH. .P The fields of the .I fanotify_event_info_error
Signature · 1 line
2.34.1
Quoted 7 lines · Amir Goldstein
This flag from v6.13 allows reporting detailed errors on failure to open a file descriptor for an event.
This API was backported to LTS kernels v6.12.4 and v6.6.66.
Cc Krishna Vivek Vitta <[email protected]>Signed-off-by Amir Goldstein <[email protected]>
The text looks correct to me. So feel free to add:
Just two typo corrections below.
Honza
Quoted 11 lines
--- man/man2/fanotify_init.2 | 29 +++++++++++++++++++++++++++++ man/man7/fanotify.7 | 12 ++++++++++++ 2 files changed, 41 insertions(+)man/man2/fanotify_init.2 +0
-0@@ -364,6 +364,35 @@ so this restriction may eventually be lifted. For more details on information records,
man/man2/fanotify_init.2 so this restriction may eventually be lifted. · line 374
Quoted 10 lines
man/man2/fanotify_init.2 +8
-0see .BR fanotify (7). +.TP +.BR FAN_REPORT_FD_ERROR " (since Linux 6.13 and 6.12.4 and 6.6.66)" +.\" commit 522249f05c5551aec9ec0ba9b6438f1ec19c138d +Events for fanotify groups initialized with this flag may contain +an error code that explains the reason for failure to open a file descriptor. +The +.I fd +memeber of struct
^^^ typo here
man/man2/fanotify_init.2 so this restriction may eventually be lifted. · line 382
Quoted 8 lines
man/man2/fanotify_init.2 +8
-0+.I fanotify_event_metadata +normally contains +an open file descriptor associated with the object of the event +or FAN_NOFD in case a file descriptor could not be opened. +For a group initialized with this flag, instead of FAN_NOFD, +the +.I fd +memeber of struct
^^^ typo here
Quoted 49 lines
man/man2/fanotify_init.2 +13
-0+.I fanotify_event_metadata +will contain +a negative error value. +When the group is also initialized with flag +.BR FAN_REPORT_PIDFD , +in case a process file descriptor could not be opened, +the +.I pidfd +memeber of struct +.I fanotify_event_info_pidfd +will also contain a negative error value. +For more details, see +.BR fanotify (7). .P The .I event_f_flagsman/man7/fanotify.7 +12
-0@@ -335,6 +335,12 @@ file status flag is set on the open file description. 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. +.IP +When an fanotify group is initialized using +.BR FAN_REPORT_FD_ERROR , +this field will contain a negative error value in case a file descriptor +could not be opened and +in case of a queue overflow, the value will be -EBADF. .TP .I pid If flag@@ -679,6 +685,12 @@ Once the event listener has dealt with an event and the pidfd is no longer required, the pidfd should be closed via .BR close (2). +.IP +When an fanotify group is initialized using +.BR FAN_REPORT_FD_ERROR , +this field will contain a negative error value +in case a pidfd creation failure and +in case of a terminated process, the value will be -ESRCH. .P The fields of the .I fanotify_event_info_errorSignature · 1 line
2.34.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 51 lines · Jan Kara
Quoted 7 lines · Amir Goldstein
This flag from v6.13 allows reporting detailed errors on failure to open a file descriptor for an event.
This API was backported to LTS kernels v6.12.4 and v6.6.66.
Cc Krishna Vivek Vitta <[email protected]>Signed-off-by Amir Goldstein <[email protected]>The text looks correct to me. So feel free to add:
Reviewed-by Jan Kara <[email protected]>Just two typo corrections below.
Honza
Quoted 11 lines
--- man/man2/fanotify_init.2 | 29 +++++++++++++++++++++++++++++ man/man7/fanotify.7 | 12 ++++++++++++ 2 files changed, 41 insertions(+)man/man2/fanotify_init.2 +0
-0@@ -364,6 +364,35 @@ so this restriction may eventually be lifted. For more details on information records,man/man2/fanotify_init.2 so this restriction may eventually be lifted. · line 374
Quoted 10 lines
man/man2/fanotify_init.2 +8
-0see .BR fanotify (7). +.TP +.BR FAN_REPORT_FD_ERROR " (since Linux 6.13 and 6.12.4 and 6.6.66)" +.\" commit 522249f05c5551aec9ec0ba9b6438f1ec19c138d +Events for fanotify groups initialized with this flag may contain +an error code that explains the reason for failure to open a file descriptor. +The +.I fd +memeber of struct^^^ typo here
man/man2/fanotify_init.2 so this restriction may eventually be lifted. · line 382
Quoted 8 lines
man/man2/fanotify_init.2 +8
-0+.I fanotify_event_metadata +normally contains +an open file descriptor associated with the object of the event +or FAN_NOFD in case a file descriptor could not be opened. +For a group initialized with this flag, instead of FAN_NOFD, +the +.I fd +memeber of struct^^^ typo here
Quoted 3 lines
man/man2/fanotify_init.2 so this restriction may eventually be lifted. · line 385
Quoted 3 lines
man/man2/fanotify_init.2 +3
-0+.I fanotify_event_metadata +will contain +a negative error value.
Right.
I also changed the phrasing to
The
.I .fd
member of the
.I fanotify_event_metadata
structure will contain a negative error value.
and formatting of:
in case of a queue overflow, the value will be
+.BR "" - EBADF .
As Alejandro requested in another review.
Will post v2 soon.
Thanks,
Amir.
Alejandro Colomar
maintainerHi Amir,
Quoted 4 lines · Amir Goldstein
and formatting of:
in case of a queue overflow, the value will be
+.BR "" - EBADF .
The '-' needs to be escaped: \-
Also, I'd keep the '-' also in bold:
.BR \-EBADF .
Have a lovely day!
Alex
Quoted 7 lines
As Alejandro requested in another review.
Will post v2 soon.
Thanks,
Amir.
Signature · 1 line
<https://www.alejandro-colomar.es/>