First release of pyfsevents

Aahz aahz at pythoncraft.com
Tue Sep 8 00:19:50 EDT 2009


In article <mailman.1104.1252376076.2854.python-list at python.org>,
 <exarkun at twistedmatrix.com> wrote:
>On 12:57 am, aahz at pythoncraft.com wrote:
>>In article <d103be2b-3f1e- =
>>46f3-9a03-46f7125f5579 at r5g2000yqi.googlegroups.com>,
>>Nicolas Dumazet  <nicdumz at gmail.com> wrote:
>>>
>>>kqueue has the limitation that kern.kq_calloutmax is usually set
>>>at 4096. Meaning that one could not use this on a big (Mercurial)
>>>repository with 5k files. FSEvents on the other hand saves us the
>>>trouble to have to register each file individually.  Also, I am not
>>>quite sure if we can use kqueue to register a directory, to be warned
>>>when a file is created in this directory.
>>
>><sigh>  %(obscenity)s  I didn't realize that you had to register each
>>file individually with kqueue.  We were hoping to avoid having to write
>>watcher code because that is not reliable for renames (especially
>>multiple renames in quick succession).
>>
>>Maybe we'll try using /dev/fsevents directly....
>
>Just a guess, but since the kqueue interface is based on file
>descriptors, not on file names, following renames reliably shouldn't be
>a problem with it.  If someone knows about this for sure though, it'd
>be nice to hear about it. :) All of the kqueue documentation I've seen
>has been rather incomplete.

You misunderstood:

* The problem with kqueue is that you are limited in the number of files
you can watch

* The problem with FSEVents is that you don't get informed about changes
to individual files

There's no direct equivalent to Linux inotify or Windows
ReadDirectoryChangesW.  Supposedly you can use /dev/fsevents directly to
obtain the raw info used by FSEvents, but you have to run as root, and
it's not a documented API.  There's the kauth API (designed for virus
checkers), but that requires writing code that hooks directly into the
kernel, with concommitant care.

http://www.osxbook.com/blog/2008/07/23/extending-hfsdebug/
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"To me vi is Zen.  To use vi is to practice zen.  Every command is a
koan.  Profound to the user, unintelligible to the uninitiated.  You
discover truth everytime you use it."  --reddy at lion.austin.ibm.com



More information about the Python-list mailing list