This is a binding for GHC 7 to the Linux Kernel's inotify interface, which provides notifications to applications regarding file system events, such as file creation, modification, deletion, etc.
linux-inotify
was motivated by a recent examination of
fsnotify and
hinotify, and not being
satisfied with the API or implementation details of hinotify
in
particular.
In contrast to hinotify
, which provides similar functionality,
linux-inotify
is a much thinner binding to the system calls and
message format. Some of the advantages are:
-
linux-inotify
provides a plaingetEvent
operator that blocks, instead of implementing a callback API. -
linux-inotify
avoids most of GHC's standard IO handling code, relying on plain system calls with minimal overhead in Haskell-land. (However, it still does make good use of GHC's IO manager via nonblocking inotify sockets andthreadWaitRead
, sogetEvent
is still efficient.) -
linux-inotify
does not callforkIO
, which means less context switching and scheduling overhead, especially in contexts wherehinotify
's particular event router isn't a very good fit for your application; e.g. you are implementing a following log file processor.
Some of the downsides are:
-
Due to the use of
inotify_init1
,linux-inotify
currently requires linux 2.6.27 or later, even thoughinotify
support debuted in linux 2.6.13. You can check which version of linux is on a machine viauname -a
. I would like to fix this at some point, but it isn't a personal priority. -
linux-inotify
requires GHC 7.0.2 or later, whereashinotify
works with many versions of GHC 6. I have no plans to fix this. -
linux-inotify
is currently just a quick proof of concept. Documentation is missing. The API is still in flux and needs expanding. I've only performed the most preliminary of smoke tests, and I haven't done any performance testing.