diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 21:24:26 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:56 -0400 |
commit | a1014f102322398e67524b68b3300acf384e6c1f (patch) | |
tree | 2d9d82e6a3d84bae796e4aedfd8be3409be6a4c3 /fs/notify/fanotify/Kconfig | |
parent | 2a3edf86040a7e15684525a2aadc29f532c51325 (diff) |
fanotify: send events using read
Send events to userspace by reading the file descriptor from fanotify_init().
One will get blocks of data which look like:
struct fanotify_event_metadata {
__u32 event_len;
__u32 vers;
__s32 fd;
__u64 mask;
__s64 pid;
__u64 cookie;
} __attribute__ ((packed));
Simple code to retrieve and deal with events is below
while ((len = read(fan_fd, buf, sizeof(buf))) > 0) {
struct fanotify_event_metadata *metadata;
metadata = (void *)buf;
while(FAN_EVENT_OK(metadata, len)) {
[PROCESS HERE!!]
if (metadata->fd >= 0 && close(metadata->fd) != 0)
goto fail;
metadata = FAN_EVENT_NEXT(metadata, len);
}
}
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/fanotify/Kconfig')
0 files changed, 0 insertions, 0 deletions