And there is also code to "steal", http://jnotify.sourceforge.net/.

On 1/12/2012 1:19 AM, Eric Wasylishen wrote:
There is an api in glib for file system monitoring; I've never tried it though.

http://developer.gnome.org/gio/stable/GFileMonitor.html

Eric

On 2012-01-11, at 9:33 AM, Lucas Holt wrote:

There isn't a good, portable way to do this. On BSD, most kqueue approaches to this problem use up a lot of file descriptors. Kqueue is generalized for events so inotify does a better job with this specific problem. Someone tried to implement inotify for the linuxolator aka Linux emulation on FreeBSD a few years back but got stuck on some nasty process accounting. That code is in their perforce repository and might have been a summer of code project.

There are several existing open source daemons that provide this functionality you can look at. Gamin for instance

Lucas Holt

On Jan 11, 2012, at 9:28 AM, Ivan Vuc(ica <[email protected] <mailto:[email protected]>> wrote:

>From what I could Google around, apparently this is done on OS X with FSEvent APIs. Quickly skimming through GNUstep's NSFileManager.m, I did not find any salient reference to "monitor", "watch" or "observe".

Here's what appears to be a Linux-related documentation for a C-based API called "inotify":
http://www.linuxjournal.com/article/8478
This IBM article also describes "inotify" on Linux:
http://www.ibm.com/developerworks/linux/library/l-ubuntu-inotify/index.html
but also mentions how to accomplish this on BSD OSes using something called kqueues. Quote:

    *Note:* FreeBSD and thus Mac OS X provide an analog of inotify
    called /kqueue./ Type |man 2 kqueue| on a FreeBSD machine for
    more information.


I have never experimented with either of these three mentioned APIs.

On Wed, Jan 11, 2012 at 10:28, Andreas Höschler <[email protected] <mailto:[email protected]>> wrote:

    Hi all,

    my tool needs to get aware of any changes in the file system
    under a given directory (e.g. /home), for example if

    . a new file is created in /home/tommy/Documents
    . a file is removed anywhere below /home
    . a file /home/herbert/test.conf gets modified
    . ...

    I think I have once seen some method of NSFileManager or
    NSWorkspace that does exactly that, but I don't know this for
    sure and I can't find anything suitable in the class references.

    Any idea?

    I could for sure iterate through the dir with
    contentsOfDirectoryAtPath: and compare the size and attributes
    of any file with log entries, but this seems rather cumbersome! :-(

    Hints greatly appreciated!

    Thanks a lot,

     Andreas


    _______________________________________________
    Discuss-gnustep mailing list
    [email protected] <mailto:[email protected]>
    https://lists.gnu.org/mailman/listinfo/discuss-gnustep




--
Ivan Vuc(ica - [email protected] <mailto:[email protected]>


_______________________________________________
Discuss-gnustep mailing list
[email protected] <mailto:[email protected]>
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
_______________________________________________
Discuss-gnustep mailing list
[email protected] <mailto:[email protected]>
https://lists.gnu.org/mailman/listinfo/discuss-gnustep



_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to