0 | module System.Linux.Inotify
 1 |
 2 | import System.Linux.Inotify.Prim as P
 3 |
 4 | import Data.C.Array
 5 | import public System.Linux.Inotify.Flags
 6 | import public System.Linux.Inotify.Inotify
 7 | import public System.Posix.File
 8 |
 9 | %default total
10 |
11 | --------------------------------------------------------------------------------
12 | -- API
13 | --------------------------------------------------------------------------------
14 |
15 | ||| Opens a new `inotify` file descriptor.
16 | export %inline
17 | inotifyInit : Has Errno es => EIO1 f => InotifyFlags -> f es Inotify
18 | inotifyInit fs = elift1 (P.inotifyInit fs)
19 |
20 | ||| Watches a file for the given events.
21 | export %inline
22 | inotifyAddWatch : Has Errno es => EIO1 f => Inotify -> String -> InotifyMask -> f es Watch
23 | inotifyAddWatch fd s m = elift1 (P.inotifyAddWatch fd s m)
24 |
25 | export %inline
26 | inotifyRm : Has Errno es => EIO1 f => Inotify -> Watch -> f es ()
27 | inotifyRm fd w = elift1 (P.inotifyRm fd w)
28 |
29 | ||| Reads at most `buf` from an `inotify` file descriptor.
30 | export
31 | inotifyRead : Has Errno es => EIO1 f => (buf : Bits32) -> Inotify -> f es (List InotifyRes)
32 | inotifyRead buf i = elift1 (P.inotifyRead buf i)
33 |