Let suppose a kqueue listening for files modifications:
kqueue
(Note: error management is removed for convenience in the example)
#include