I'm trying to use libevent to monitor a set of directories -- and receive events, whenever a new file is created in one of them.
The attached program works on BSD, but does not work on Solaris and Linux. On Solaris I'm simply flooded with events (both read and write are set), whereas on Linux the initialization fails upfront:
[warn] Epoll ADD(-2147483643) on fd 3 failed. Old events were 0; read change was 33 (add); write change was 33 (add): Operation not permitted
On FreeBSD I can run it as:
% ./libevent-test /tmp/
/tmp/ (3) triggered by event(s) 38
After the first event is triggered as above, whenever I create or remove a file in /tmp, or simply ls the directory, there is an event created...