[launchd-dev] WatchPaths

Quinn eskimo1 at apple.com
Fri Feb 19 02:02:39 PST 2010


At 12:57 -0600 18/2/10, Errol Sayre wrote:
>Is it possible to specify that a WatchPath respond to events inside 
>sub-directories?

No.  Mac OS X has technology for doing this (the FSEvents framework), 
but it's hard to integrate into launchd because of layering issues 
(launchd is the first process on the system, so it can't depend on 
services which are themselves provided by higher-level processes).

If you need to watch an entire directory hierarchy, you'll have to 
use FSEvents directly, and thus not launch on demand.  One option is 
to write a small, low-impact daemon that does the FSEvents thing, and 
have it launch (probably via a launchd-arbitrated IPC) your full 
daemon when something interesting happens.

S+E
-- 
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


More information about the launchd-dev mailing list