#include #include #include #include #include #include int main(int argc, char *argv[]) { int notify_fd; int wd, ret; notify_fd = inotify_init(); for (;;) { wd = inotify_add_watch(notify_fd, argv[1], IN_MODIFY | IN_CREATE | IN_DELETE ); if (wd < 0) { perror("inotify_add_watch"); } ret = inotify_rm_watch(notify_fd, wd); if (ret < 0) { perror("inotify_rm_watch"); } } out: close(notify_fd); return 0; }