Пришлось доточить до приличного состояния. Перво-наперво обнаружил глюк с зомбями, которые стали собираться в толпы после каждого вызова. Добавил wait(), это решило проблему.
Затем, добавил опции командной строки, мониторинг с использованием флагов и фильтрацию по маске или регулярному выражению. Для этого погрузился в документацию по glibc.
Результат:
kilork@pantogan:~/projects/notify$ ./inotify -?
Usage: inotify [OPTION...] CMD DIR1 [DIR2 ... DIRN]
inotify - simple file monitoring utility
-s, --silent Don't produce any output (no effect to
subprogramms)
-v, --verbose Produce verbose output
-f, --filter=FILTER Filter FILTER input on certain files
-i, --ignore Ignore case where possible
-r, --regular Filter use regular expression expansion
-w, --wildcard Filter use wildcard expansion (*.c for example)
-e, --events=EVENTS Events to monitor
Possible flags for EVENTS:
a - file was accessed
A - metadata (permissions, timestamps, etc) changed
W - file opened for writing closed
N - file not opened for writing closed
c - file/directory created
d - file/directory deleted
s - watched file/directory was itself deleted
m - modify file
v - watched file/directory was itself moved
f - file moved out of watched directory
t - file moved into watched directory
o - file was opened
-?, --help Give this help list
--usage Give a short usage message
-V, --version Print program version
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
Report bugs to <kilork@yandex.ru>.Последняя версия доступна тут.