fseventsd

Rather than having multiple programs listening to /dev/fsevents, OS X introduces a daemon, fseventsd, that reads from the device, as shown in Figure 16.3. fseventsd coalesces the change stream into fewer events and then notifies other programs that have registered an interest in particular directories. Apple provides an API that talks to fseventsd under the hood and feeds you file system changes via a callback function whenever an interesting event happens.

Figure 16.3  fseventsd notifying a file system change

fseventsd notifying a file system change

You will not be able to get events in absolutely real time because of this intermediary daemon. This is fine for most applications, ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.