1
linux/fs/notify
Eric Paris a1014f1023 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>
2010-07-28 09:58:56 -04:00
..
dnotify fsnotify: take inode->i_lock inside fsnotify_find_mark_entry() 2010-07-28 09:58:54 -04:00
fanotify fanotify: send events using read 2010-07-28 09:58:56 -04:00
inotify fsnotify: take inode->i_lock inside fsnotify_find_mark_entry() 2010-07-28 09:58:54 -04:00
fsnotify.c fsnotify: kill FSNOTIFY_EVENT_FILE 2010-07-28 09:58:53 -04:00
fsnotify.h fsnotify: mount point listeners list and global mask 2010-07-28 09:58:52 -04:00
group.c fsnotify: rename mark_entry to just mark 2010-07-28 09:58:53 -04:00
inode_mark.c fsnotify: take inode->i_lock inside fsnotify_find_mark_entry() 2010-07-28 09:58:54 -04:00
Kconfig fanotify: fscking all notification system 2010-07-28 09:58:54 -04:00
Makefile fanotify: fscking all notification system 2010-07-28 09:58:54 -04:00
notification.c fsnotify: kill FSNOTIFY_EVENT_FILE 2010-07-28 09:58:53 -04:00