FSEvents API

The FSEvents notification mechanism is a runloop source, sitting around waiting for stuff to happen. A C callback function is called when a message from fseventsd shows up. The FSEventsStreamRef type is what you use to reference a particular event stream.

Creating the stream

Before you can start receiving events, you need to create the event stream with one of these two functions:

FSEventStreamRef FSEventStreamCreate (CFAllocatorRef allocator,
                                      FSEventStreamCallback callback,
                                      FSEventStreamContext *context,
                                      CFArrayRef pathsToWatch,
                                      FSEventStreamEventId sinceWhen,
                                      CFTimeInterval latency,
                                      FSEventStreamCreateFlags flags);

or

FSEventStreamRef 
FSEventStreamCreateRelativeToDevice (CFAllocatorRef allocator, FSEventStreamCallback callback, ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.