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
..
2010-05-27 09:12:41 -07:00
2010-05-19 22:41:57 -04:00
2010-04-30 14:52:51 -05:00
2010-06-04 17:16:30 -04:00
2010-07-28 09:58:56 -04:00
2010-05-27 22:15:33 -04:00
2010-03-19 08:05:10 +01:00
2010-05-27 22:15:33 -04:00
2010-05-21 18:31:16 -04:00
2010-05-11 17:43:58 +02:00
2010-03-06 11:26:29 -08:00
2010-05-21 18:31:16 -04:00
2010-03-08 16:55:37 +01:00
2010-05-21 18:31:17 -04:00
2010-05-18 08:57:00 +10:00
2010-06-10 19:08:34 +02:00
2010-03-12 15:52:32 -08:00
2010-05-21 18:31:17 -04:00
2010-06-29 10:38:22 -07:00
2010-06-01 12:42:12 +02:00