fanotify.7: Wrap some long lines in example program

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-04-20 21:33:46 +02:00
parent 81daa1727d
commit 4c258dbcb9
1 changed files with 12 additions and 9 deletions

View File

@ -1087,7 +1087,8 @@ main(int argc, char **argv)
if (fid\->hdr.info_type == FAN_EVENT_INFO_TYPE_FID) {
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;
file_name = file_handle->f_handle +
file_handle->handle_bytes;
} else {
fprintf(stderr, "Received unexpected event info type.\en");
exit(EXIT_FAILURE);
@ -1102,13 +1103,14 @@ main(int argc, char **argv)
if (metadata\->mask == (FAN_CREATE | FAN_ONDIR))
printf("FAN_CREATE | FAN_ONDIR (subdirectory created):\en");
/* metadata\->fd is set to FAN_NOFD when FAN_REPORT_FID is enabled.
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. */
/* metadata\->fd is set to FAN_NOFD when FAN_REPORT_FID is
enabled. 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) {
@ -1147,7 +1149,8 @@ main(int argc, char **argv)
} 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);
printf("\etEntry \(aq%s\(aq is not a subdirectory.\en",
file_name);
}
}