"a" // 0x00000001 File was accessed
"c" // 0x00000002 File was modified
"e" // 0x00000004 Metadata changed
- "w" // 0x00000008 Writtable file was closed
- "0" // 0x00000010 Unwrittable file closed
+ "w" // 0x00000008 Writable file was closed
+ "0" // 0x00000010 Unwritable file closed
"r" // 0x00000020 File was opened
"m" // 0x00000040 File was moved from X
"y" // 0x00000080 File was moved to Y
MASK_BITS = sizeof(mask_names) - 1
};
-extern int inotify_init(void);
-extern int inotify_add_watch(int fd, const char *path, uint32_t mask);
-
int inotifyd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int inotifyd_main(int argc, char **argv)
{
args[3] = ie->len ? ie->name : NULL;
wait4pid(xspawn((char **)args));
// we are done if all files got final x event
- if (ie->mask & 0x8000)
+ if (ie->mask & 0x8000) {
if (--argc <= 0)
goto done;
+ inotify_rm_watch(pfd.fd, ie->wd);
+ }
}
// next event
i = sizeof(struct inotify_event) + ie->len;