TOC
Previous
Next
inotify
How
-
Create an
inotify
instance,
and obtain a file descriptor that refers to it (inotify_init())
-
Tell kernel about which files are of interest:
add/modify and remove watches for the
inotify
file instance.
-
inotify_add_watch(), inotify_rm_watch().
-
Each watch specifies a pathname and a bit-mask of events to monitor.
-
The kernel assigns each watch a unique number
(a watch descriptor).
-
Obtain event notifications by reading
from the
inotify
file descriptor.
-
read() blocks if there are no events.
-
Each read()
returns a buffer containing one or more
inotify_event structures
describing file system events.
-
Events associated with an
inotify
instance form an
ordered queue.
-
An
inotify
file descriptor can be monitored using
select(), poll(), or
epoll.
-
close() the
inotify
file descriptor
(automatically frees all watches).
(C) 2006, Michael Kerrisk