I want to get notify for each time a file is accessed in a certain directory using fanotify. I'm familiar with fanotify and generally know how to do it, my problem is with fanotify_mark
function and what flags and mask should I use for this? I must use FAN_ACCESS_PERM
flag for permission events, and probably FAN_MARK_ADD
mask. what other masks should I use? I think it's documentation is very bad and not clear at all.
Asked
Active
Viewed 105 times
0

Mostafa Sarmad
- 21
- 2
- 5
1 Answers
0
Fanotify isn't recursive. It only works that way when working on mounted directories.
then in code:
fanotify_mark(fd,
FAN_MARK_ADD | FAN_MARK_MOUNT,
FAN_ACCESS_PERM | FAN_EVENT_ON_CHILD,
AT_FDCWD, "/your-directory")
All access events on the same mountpoint of /your-directory will be notified.

seamaner
- 91
- 6