-
Notifications
You must be signed in to change notification settings - Fork 19
/
ANNOUNCE
58 lines (43 loc) · 1.59 KB
/
ANNOUNCE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Greetings!
I'm pleased to announce hinotify 0.1, a library to inotify[1] 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.
The API basically consists of:
inotify_init :: IO INotify
inotify_add_watch :: INotify
-> [EventVariety] -- different events to listen on
-> FilePath -- file/directory to watch
-> (Event -> IO ()) -- event handler
-> IO WatchDescriptor
inotify_rm_watch :: INotify -> WatchDescriptor -> IO ()
A sample program:
> import System.Directory
> import System.IO
>
> import System.INotify
>
> main :: IO ()
> main = do
> inotify <- inotify_init
> print inotify
> home <- getHomeDirectory
> wd <- inotify_add_watch inotify
> [Open,Close,Access,Modify,Move]
> home
> print
> print wd
> putStrLn "Listens to your home directory. Hit enter to terminate."
> getLine
> inotify_rm_watch inotify wd
The code is available via www:
http://haskell.org/~kolmodin/code/hinotify/download/hinotify-0.1.tar.gz
and via darcs:
darcs get http://haskell.org/~kolmodin/code/hinotify/
The API is available at:
http://haskell.org/~kolmodin/code/hinotify/docs/api/
The library is very young and I'm most grateful for feedback on the API,
and what else you might have to suggest.
Cheers,
Lennart Kolmodin
[1] http://www.kernel.org/pub/linux/kernel/people/rml/inotify/