Re: File/folder creation/deletion/modification notification in mac os x 10.3
Re: File/folder creation/deletion/modification notification in mac os x 10.3
- Subject: Re: File/folder creation/deletion/modification notification in mac os x 10.3
- From: Quinn <email@hidden>
- Date: Fri, 16 Sep 2005 10:45:46 +0100
At 20:28 +0530 14/9/05, Mekhala Patil wrote:
Is there any other mechanism that does the same thing supported on
mac os x 10.3??
Not really. There are a number of file notification APIs, but each
one has a fatal flaw (like any good superhero :-).
o FNSubscribe -- This requires cooperation from the process that's
making the change (it must call FNNotify). This is fine for
user-visible files (the Finder and open/save dialogs call FNNotify),
but it isn't a general solution.
o kqueues -- These will only let you monitor specific directories.
If you want to monitor a directory hierarchy (or an entire volume),
you're out of luck.
o Auditing -- Apple ships a supplementary package, the Common
Criteria Tools, that allow you to enable auditing an the system.
<http://www.apple.com/support/downloads/commoncriteriatoolsfor104.html>
This only supports a single client (auditd). However, most folks are
not running that client, so it's technically feasible for you to hook
up to this. However, the connection between auditd and the kernel is
not considered a supported API.
o fmodwatch -- This also supports a single client only. Also, it
isn't available on 10.4 and later. An equivalent service is
available on 10.4 and later (/dev/fsevents, see below), but it still
only supports a single client.
o /dev/fsevents -- In 10.4 we introduced a new driver, /dev/fsevents,
that returns information about file system changes. It only supports
a single client and that client (Spotlight) is always running. Also,
the /dev/fsevents interface is not considered a supported API.
o file system stacking (aka filters) -- This isn't supported. See
DTS Q&A 1242 "Developing for VFS" for details.
<http://developer.apple.com/qa/qa2001/qa1242.html>
o Kernel Authorization -- This stuff is documented in DTS Technote
2127 "Kernel Authorization".
<http://developer.apple.com/technotes/tn2005/tn2127.html>
If you read the technote, you'll see that some of the authorization
scopes (specifically, KAUTH_SCOPE_FILEOP) are actually used for
notification. However, the other scopes (more critically,
KAUTH_SCOPE_VNODE) are solely design for authorization, and thus
don't promise to call your listener for each individual operation.
So, it's probably not a good match for your requirements.
o kernel hacking (patching sysent) -- You might be able to get
something working on 10.3, but it won't work on 10.4, where sysent
isn't exported.
* * *
If you post some higher level details of the problem you're trying to
solve, I might be able to suggest an alternative approach.
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden