fanotify

How to find out whether CONFIG_FANOTIFY_ACCESS_PERMISSIONS is enabled?

会有一股神秘感。 提交于 2021-02-07 20:16:53
问题 I want to make use of fanotify(7) and the problem I run into is that on some kernels CONFIG_FANOTIFY_ACCESS_PERMISSIONS does not work, although CONFIG_FANOTIFY is configured. At the very least I'd like to report this condition. Now on Debian and Ubuntu I could use the equivalent of grep CONFIG_FANOTIFY_ACCESS_PERMISSIONS /boot/config-$(uname -r) to verify that the feature is available. On some other systems I could use the equivalent of zgrep CONFIG_FANOTIFY_ACCESS_PERMISSIONS /proc/config.gz

How to find out whether CONFIG_FANOTIFY_ACCESS_PERMISSIONS is enabled?

本小妞迷上赌 提交于 2021-02-07 20:16:53
问题 I want to make use of fanotify(7) and the problem I run into is that on some kernels CONFIG_FANOTIFY_ACCESS_PERMISSIONS does not work, although CONFIG_FANOTIFY is configured. At the very least I'd like to report this condition. Now on Debian and Ubuntu I could use the equivalent of grep CONFIG_FANOTIFY_ACCESS_PERMISSIONS /boot/config-$(uname -r) to verify that the feature is available. On some other systems I could use the equivalent of zgrep CONFIG_FANOTIFY_ACCESS_PERMISSIONS /proc/config.gz

fanotify: What I'm doing wrong?

北城以北 提交于 2019-12-13 05:50:40
问题 I want to monitor a single directory using fanotify, but what I got is monitoring the whole filesystem. This is the code: fa_fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT, O_RDONLY | O_LARGEFILE | O_CLOEXEC); static uint64_t event_mask = (FAN_ACCESS | /* File accessed */ FAN_MODIFY | /* File modified */ FAN_CLOSE_WRITE | /* Writable file closed */ FAN_OPEN | /* File was opened */ FAN_EVENT_ON_CHILD); /* We want to be reported of events in files of the directory */ filesystem::path path(

How to tell which path a fanotify event refers to

天大地大妈咪最大 提交于 2019-12-12 13:27:09
问题 I'd like to find out which files are opened on my system in which order, in order to prefetch them from disk. It seems that fanotify should be well suited to monitor the whole system for open events. But as far as I can tell, the fanotify_event_metadata structure does not have a field to contain the path. So how can I tell which path a given event refers to? Or is fanotify the wrong approach to find path names, and do I have to recursively register watches for the whole tree using inotify?

fanotify recursivity does really works?

与世无争的帅哥 提交于 2019-12-02 00:13:52
问题 I'm using code like following to monitor the whole file system: fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_OPEN | FAN_EVENT_ON_CHILD, AT_FDCWD, "/" ) But I need write some tests, so, I want monitor just a specific dir, let say "/tmp/test_dir". The problem is when I change code this way: fanotify_mark(fd, FAN_MARK_ADD, FAN_OPEN | FAN_EVENT_ON_CHILD, AT_FDCWD, "/tmp/test_dir" ) fanotify only watchs to events on "/tmp/test_dir" ignoring whatever happen in deeper folders. For instance:

How do I program for Linux's new `fanotify` file system monitoring feature?

非 Y 不嫁゛ 提交于 2019-11-28 19:32:56
fanotify , built on top of fsnotify , is supposed to replace inotify which replaced dnotify . Are there some good programming examples or existing utilities that use fanotify to watch for changes in a filesystem? How much detail does fanotify provide? MvG This LWN article is often quoted as a source of documentation for fanotify. But the description there appears to be out of date. fanotify no longer works using a socket connection. Instead, there are two new libc functions wrapping syscalls, declared in sys/fanotify.h . One is called fanotify_init , the other is fanotify_mark . At the time of

How do I program for Linux's new `fanotify` file system monitoring feature?

醉酒当歌 提交于 2019-11-27 12:21:59
问题 fanotify , built on top of fsnotify , is supposed to replace inotify which replaced dnotify . Are there some good programming examples or existing utilities that use fanotify to watch for changes in a filesystem? How much detail does fanotify provide? 回答1: This LWN article is often quoted as a source of documentation for fanotify. But the description there appears to be out of date. fanotify no longer works using a socket connection. Instead, there are two new libc functions wrapping syscalls