/* size of the event structure, not counting name */ #define EVENT_SIZE (sizeof (struct inotify_event)) /* reasonable guess as to size of 1024 events */ #define BUF_LEN (1024 * (EVENT_SIZE + 16) char buf[BUF_LEN]; int len, i = 0;
int fd = inotify_init(); int wd = inotify_add_watch(fd, "/usr/local/hoge", IN_ACCESS | IN_MODIFY); while(1){ len = read (fd, buf, BUF_LEN); }