I have a piece of software that works on Windows. The software has two components: file system minifilter driver that works in kernel mode and a user mode component that talks to the driver. Driver receives notifications on IO interrupt requests, such as IRP_MJ_READ
. A sample application that does this can be found on github. This works for any user and most file systems supported by Windows.
I need to develop similar piece of software for OS X (desktop and server only). Things I looked at:
- FSEvent
- Kernel Queues
- System call table API hooking/hijacking
- kprobe
- fanotify
My reservations are: FSEvents may not be very performant, as I need to monitor root /
folder and any mounted devices. I have very limited understanding of kernel queues and syscalls API hijacking may make it very hard to port to different OS X versions and can cause conflicts with AV or OS protection (such as PaX hardening).
Question: how can I get notifications that a file in any (recursive) folder in root /
is being read by any user on OS X?