Index of /hinotify

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[TXT]README.html2010-05-12 21:30 4.5K 
[   ]README2010-05-12 21:30 2.5K 
[   ]ANNOUNCE2010-05-12 21:30 1.6K 
[   ]LICENSE2010-05-12 21:30 1.4K 
[TXT]hinotify.css2010-05-12 21:30 1.4K 
[   ]hinotify.cabal2010-05-12 21:30 1.0K 
[   ]Makefile2010-05-12 21:30 92  
[TXT]Setup.lhs2010-05-12 21:30 72  
[DIR]tests/2010-05-12 21:30 -  
[DIR]src/2010-05-12 21:30 -  
[DIR]examples/2010-05-12 21:30 -  
[DIR]docs/2010-05-12 21:30 -  
[DIR]_darcs/2010-05-12 21:30 -  

hinotify: inotify for Haskell

hinotify: inotify for Haskell

About

hinotify, a library to inotify which has been part of the Linux kernel since 2.6.13.

inotify provides file system event notification, simply add a watcher to a file or directory and get an event when it is accessed or modified.

This module is named hinotify.

See example code in the examples directory, distributed with the source code.

News

hinotify 0.3.1
  • Use inotify.h from glibc rather than from the linux headers, as recommended upstream.
hinotify 0.3
  • Compiles with GHC 6.12, GHC 6.10.4, GHC 6.8.2 and GHC 6.6.1
hinotify 0.2
  • Updates to the API
    • Function names is now in semiCamelCase
    • Restructure event parameters to make it more consistent
  • Small test suit in tests/
  • Compiles with GHC 6.8.2 and GHC 6.6.1
  • Requires Cabal 1.2
hinotify 0.1
Initial release

API

The API basically consists of:

initINotify :: IO INotify
addWatch :: INotify
         -> [EventVariety]   -- different events to listen on
         -> FilePath         -- file/directory to watch
         -> (Event -> IO ()) -- event handler
         -> IO WatchDescriptor
removeWatch :: INotify -> WatchDescriptor -> IO ()

A sample program:

import System.Directory
import System.IO

import System.INotify

main :: IO ()
main = do
    inotify <- initINotify
    print inotify
    home <- getHomeDirectory
    wd <- addWatch
            inotify
            [Open,Close,Access,Modify,Move]
            home
            print
    print wd
    putStrLn "Listens to your home directory. Hit enter to terminate."
    getLine
    removeWatch inotify wd

Download

The code is available via the homepage, and via darcs:

darcs get --partial http://haskell.org/~kolmodin/code/hinotify/

The API is available online.

I’m most grateful for feedback on the API, and what else you might have to suggest.

Author

Lennart Kolmodin

kolmodin at gentoo.org