Index of /~kolmodin/code/hinotify

Icon  Name                    Last modified      Size  Description
[DIR] Parent Directory - [TXT] ANNOUNCE 08-Mar-2007 01:14 1.6K [TXT] LICENSE 22-Dec-2007 12:26 1.4K [   ] Makefile 22-Dec-2007 12:26 92 [   ] Setup.lhs 21-Jan-2007 07:09 72 [DIR] _darcs/ 02-Jul-2009 01:52 - [DIR] docs/ 04-Oct-2006 14:02 - [DIR] download/ 04-Oct-2006 13:40 - [DIR] examples/ 04-Oct-2006 13:32 - [TXT] hinotify.cabal 26-Dec-2007 06:47 1.0K [TXT] hinotify.css 23-Dec-2007 13:21 1.4K [DIR] include/ 08-Sep-2006 16:36 - [DIR] src/ 08-Sep-2006 16:36 - [DIR] tests/ 26-Dec-2007 06:00 -
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.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

This software is released under a BSD-style license. See LICENSE for more details.

Copyright © 2007 Lennart Kolmodin