discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tracking changes in the filesystem


From: Vasileios Anagnostopoulos
Subject: Re: Tracking changes in the filesystem
Date: Thu, 12 Jan 2012 12:04:29 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1

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.


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 Vučica <ivucica@gmail.com> 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":
This IBM article also describes "inotify" on Linux:
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 <ahoesch@smartsoft.de> 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
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep



--
Ivan Vučica - ivan@vucica.net


_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep



_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep


reply via email to

[Prev in Thread] Current Thread [Next in Thread]