[PATCH] inotify 0.5

From: John McCutchan
Date: Sun Jul 18 2004 - 14:45:07 EST

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

which takes

struct inotify_watch_request {
char *dirname; // directory name
unsigned long mask; // event mask

and returns a watcher descriptor (int)

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

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.


Attachment: inotify-0.5.tar.gz
Description: application/compressed-tar