Re: Filesystem notifications - panther, carbon and kqueue: an odyssey
Re: Filesystem notifications - panther, carbon and kqueue: an odyssey
- Subject: Re: Filesystem notifications - panther, carbon and kqueue: an odyssey
- From: Alastair Houghton <email@hidden>
- Date: Thu, 27 Nov 2003 14:17:33 +0000
On 27 Nov 2003, at 05:44, Bob T. Quone wrote:
>
If you do find a way to do this nicely, please please please post it
>
on this list. I'm in the exact same situation (started with Java,
>
moved to Obj-C) and one of the apps I'm working on would like to know
>
when files anywhere on the drive change in certain ways to update its
>
representation of the filesystem. We (meaning my friend, who's better
>
with carbon and kernel apis) have gotten kqueue kinda-sorta-maybe
>
working, but it's far less than ideal. Feel free to email me if you
>
want some info about what we have done. Currently it works, but you
>
have to "subscribe" to every file on the disk, and it apparently can't
>
handle huge numbers of files without some tweaking (specifically,
>
changing the maxvnodes setting, which we'd rather not change without
>
understanding).
Have you looked at SGI's FAM library? It provides a portable way of
watching for changes on filesystems, using polling or support in the
kernel if present (I don't think it supports kqueue yet, but it
probably will at some point in the future; it has kernel support on
Linux and Irix). One major benefit of FAM is that multiple
applications can watch for changes without individually polling the
filesystem.
One thing you do need to realise, however you choose to do this, is
that polling is the *only* technique that works across all filesystem
types. NFS and other distributed filesystems typically don't support
change notification, because of the scalability problem that it would
present (consider what happens if every client of a fileserver wanted
to know about changes in every file on every disk accessible on the
machine...) You may retort that Windows (SMB/CIFS) *does* have support
for this, but then SMB has a number of other mis-features as well (for
example, it supports mandatory locks, even from clients... if a client
resets or loses connectivity, this can cause administrative problems).
If you're doing a GUI application, you can fake it to some extent; for
example, you can update your cache of the filesystem when your
applications' windows are brought to the front or when the user clicks
in your outline view (or whatever you're using to display filesystem
contents). That approach works quite well in practice and doesn't seem
to cause too much confusion for users.
Kind regards,
Alastair.
p.s. FAM is here:
http://oss.sgi.com/projects/fam/
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.