watching for new files: libevent vs. libev

Mikhail T. mi+thun at
Thu Apr 4 22:04:55 CEST 2013

04.04.2013 15:45, Marc Lehmann ???????(??):
>> > By adding EV_ET to the flags, I can watch a directory for changes --
>> > such as files being added or removed to it -- using libevent (at least,
>> > on FreeBSD). Sample program attached.
> I don't quite understand why edge triggering would make this
> possible. Certainly, edge triggering would have to be emulated for most
> backends, and wouldn't result in any additional expressive power w.r.t.
> directory watching.
Having used both kqueue and inotify directly in the past, I'm only just
starting searching for cross-platform libraries, that would hide
OS-specific methods from the application. So I don't have a ready
answer. But the program I posted in the previous e-mail works as
expected with EV_ET -- and does not work without it.

Whether the program works on Linux and Solaris is yet to be determined,
but it does work on FreeBSD so far.
>> > Does libev provide a similar functionality?
> libev has ev_stat watchers which watch a path for changes in stat data,
> within the limitations of portability (there is no portable way to check
> for changes than to sample stat() data).
> See the documentation for details.
Could you be more specific? I need an event, whenever a new file is
created in a directory. Can libev do that?

Thank you!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the libev mailing list