Version 7 of directory notification package in Tcl

Updated 2002-07-06 01:09:52

I (Colin McCormack) have written a quick package to take advantage of the Linux directory modification facility.

What this means is that you can open a directory, register your interest, and have an asynchronous script invoked when a file is added to, modified in, deleted from that directory.

I have it in mind to use this under tclhttpd.

You can get the package here: http://sourceforge.net/projects/libtclpq/

Documentation available here: http://sourceforge.net/docman/display_doc.php?docid=11924&group_id=18733

Written with CriTcl.


AK - Now this is a useful thing. Note that the documentation about directory notification [L1 ] mentions that this can trigger when files in a directory change. In other words, this can be used to write a more efficient tail.

Also note that this is restricted to Linux kernel 2.4 and higher.

Regarding the described interface of dnotify I have one nit: That the caller is burdened with the task to extract the fd to watch out of a channel handle. A better interface (IMHO) would be to accept channel handles and have the C code determine the file handle (There are functions in the Tcl C API for this: Tcl_GetChannelHandle IIRC). Channel handles for non-files (like sockets) would simply cause the command to throw an error.

CMcC Good suggestion, I'll make the change you suggest (I didn't know the function existed, and I'm lazy)


CL has a still-too-vague memory that much of this is possible in Windows, also. More on this, in time.


Category Package