This module wraps Linux's inotify interface for directory change notification. This Haddock doesn't provide full documentation about the semantics of this system. For that you should read the manual pages for inotify which can be found at http://linux.die.net/man/7/inotify
- data ChangeEvent
- = Accessed
- | Modified
- | AttributeModified
- | WritableClosed
- | Closed
- | Opened
- | MovedFrom
- | MovedTo
- | SelfMoved
- | Created
- | Deleted
- | SelfDeleted
- data Option
- = DontFollow
- | MaskAdd
- | Oneshot
- | OnlyDir
- data Alert
- = Ignored
- | QueueOverflowed
- | Unmounted
- data Event = Event {
- evwatch :: Watch
- evevents :: [ChangeEvent]
- evalerts :: [Alert]
- evcookie :: Word32
- evname :: ByteString
- data Inotify
- data Watch
- inotify :: IO Inotify
- addWatch :: Inotify -> FilePath -> [ChangeEvent] -> [Option] -> IO Watch
- next :: Inotify -> IO Event
- allChangeEvents :: [ChangeEvent]
Documentation
data ChangeEvent Source
These are the events which can be observed
Accessed | |
Modified | |
AttributeModified | |
WritableClosed | writable file was closed |
Closed | non writable file was closed |
Opened | |
MovedFrom | |
MovedTo | |
SelfMoved | the watched directory/file was moved |
Created | |
Deleted | subfile was deleted |
SelfDeleted | the watch directory/file was deleted |
When registering a watch, you can also give a number of options
DontFollow | don't dereference target if it's a symbolic link |
MaskAdd | Add events to a watch if that given path is already being watched |
Oneshot | Monitor for one event only |
OnlyDir | Only watch if the target is a directory |
The kernel can also report one of these alerts
Ignored | watch was implicitly removed |
QueueOverflowed | |
Unmounted |
These are the events which the kernel reports back to us.
Create a new Inotify object. Each inotify object has its own stream of
events which can be read and it's own Watch namespace (so n.b. that
Watch
objects from different Inotify's can compare equal).
addWatch :: Inotify -> FilePath -> [ChangeEvent] -> [Option] -> IO WatchSource
Add a watch on a file or directory
allChangeEvents :: [ChangeEvent]Source
A list containing all change events