dsoprea / PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
GNU General Public License v2.0
242 stars 73 forks source link

Add support for BSD's libinotify #86

Open iteratee opened 3 years ago

iteratee commented 3 years ago

libinotify emulates linux's inotify interface via a worker thread and kqueue watches on the files.

The interface is compatible, but we need to change two things: First, where we find the symbols for inotify, as they are in libinotify and not in libc. Second, we can't use epoll, so we instead use kqueue on the watch descriptor. There are scaling limits on the number of watches as each watched file consumes a file descriptor, but for many small projects this is sufficient.

I'm welcome to restructure the conditionals if there's a cleaner way. This is just a good start to compatibility.