aboutsummaryrefslogtreecommitdiff
path: root/Inotify.dcl
blob: f340df0198b569e409711223ff1a4e32f84d6249 (plain) (blame)
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
definition module Inotify

from Data.Either import ::Either
from Data.Maybe import ::Maybe

:: *Inotify st
:: INWatch

:: INMask :== Int

:: INEvent :== Int
:: INCallback st :== INEvent st *World -> *(st, *World)

(|-) infixl 6 :: (INMask INMask -> INMask)

inotify_init :: st -> Maybe *(Inotify st)
inotify_close :: *(Inotify st) -> st
inotify_add_watch :: (INCallback st) !Int !String !*(Inotify st) -> *(Either Int INWatch, *Inotify st)
inotify_rm_watch :: !INWatch !*(Inotify st) -> *(Bool, *Inotify st)
inotify_poll :: *(Inotify st) -> *Inotify st
inotify_check :: *(Inotify st) *World -> *(*Inotify st, *World)

IN_ACCESS        :== 0x00000001 // File was accessed
IN_MODIFY        :== 0x00000002 // File was modified
IN_ATTRIB        :== 0x00000004 // Metadata changed
IN_CLOSE_WRITE   :== 0x00000008 // Writtable file was closed
IN_CLOSE_NOWRITE :== 0x00000010 // Unwrittable file closed
IN_OPEN          :== 0x00000020 // File was opened
IN_MOVED_FROM    :== 0x00000040 // File was moved from X
IN_MOVED_TO      :== 0x00000080 // File was moved to Y
IN_CREATE        :== 0x00000100 // Subfile was created
IN_DELETE        :== 0x00000200 // Subfile was deleted
IN_DELETE_SELF   :== 0x00000400 // Self was deleted
IN_MOVE_SELF     :== 0x00000800 // Self was moved
IN_UNMOUNT       :== 0x00002000 // Backing fs was unmounted
IN_Q_OVERFLOW    :== 0x00004000 // Event queued overflowed
IN_IGNORED       :== 0x00008000 // File was ignored
IN_CLOSE         :== (IN_CLOSE_WRITE |- IN_CLOSE_NOWRITE) // close
IN_MOVE          :== (IN_MOVED_FROM |- IN_MOVED_TO) // moves
IN_ONLYDIR       :== 0x01000000 // only watch the path if it is a directory
IN_DONT_FOLLOW   :== 0x02000000 // don't follow a sym link
IN_EXCL_UNLINK   :== 0x04000000 // exclude events on unlinked objects
IN_MASK_ADD      :== 0x20000000 // add to the mask of an already existing watch
IN_ISDIR         :== 0x40000000 // event occurred against dir
IN_ONESHOT       :== 0x80000000 // only send event once
IN_ALL_EVENTS    :==
	(IN_ACCESS |- IN_MODIFY |- IN_ATTRIB |- IN_CLOSE_WRITE |- IN_CLOSE_NOWRITE
	|- IN_OPEN |- IN_MOVED_FROM |- IN_MOVED_TO |- IN_DELETE |- IN_CREATE |-
	IN_DELETE_SELF |- IN_MOVE_SELF)