Inotify is a replacement for dnotify. The main difference between this and my earlier inotify design, is that device numbers and inode numbers are no longer used. The interface between user and kernel space uses a watcher descriptor. inotify is a char device with two ioctls WATCH which takes struct inotify_watch_request { char *dirname; // directory name unsigned long mask; // event mask }; and returns a watcher descriptor (int) IGNORE which takes a watcher descriptor and returns nothing. After you WATCH a directory, and events that happen on the inode for the directory that match the mask you asked for will be available to read from the char device. You read this structure from the character device. struct inotify_event { int wd; int mask; }; When a directory you are watching is unmounted, you will get a UNMOUNT event. When a directory is unmounted or you use the IGNORE ioctl on the char dev. You will get a IGNORED event. I have attached a tarball, which includes the patch for linux 2.6.7 and a small test app. I have tested this on my system and AFAIK it is working. No doubt it has plenty of bugs. I plan on adding an inotify backend to gamin soon. John
Attachment:
inotify-0.5.tar.gz
Description: application/compressed-tar