New extension: Inotify
| From: | Arnaud.lb | Date: | Fri, 04 Jul 2008 05:59:00 +0000 |
| Subject: | New extension: Inotify | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-5595@lists.php.net to get a copy of this message | ||
Hi,
I have written an extension for the Linux' Inotify API:
http://en.wikipedia.org/wiki/Inotify
The extension exposes the inotify functions inotify_init(),
inotify_add_watch() and inotify_rm_watch().
As the C inotify_init() function returns a file descriptor, PHP's
inotify_init() returns a stream resource, so you can use the standard
stream functions on it, like stream_select(), stream_set_blocking(),
and also fclose(), used to close an inotify instance and all its
watches.
It also exports two additional functions:
inotify_queue_len(resource $inotify_instance), which returns a number
upper than zero if their are waiting events
inotify_read(resource $inotify_instance), which replaces the C way
of reading inotify events. It returns arrays of events, in which keys
represents the members of the inotify_event structure.
The code can be found here, released under the PHP license:
http://php-inotify.s3.amazonaws.com/php-inotify-0.1.tar.bz2
Regards,
Arnaud