I need to monitor events on a regular file using file descriptors. I'm working on a machine with CentOS 4.1, and kernel version 2.6.18.128.
After realizing that regular file cannot be monitored using epoll
, I found this task can be accomplished using inotify
. However, I read elsewhere that the required library interfaces for inotify
were added to glibc in version 2.4, and my machine has version 2.3.4 installed. So my kernel has inotify support by not glibc. Unfortunately, I cannot update glibc to a newer version because it would break certain other parts of the project.
So my questions are:
- Can I still use
inotify
to monitor regular file? Could I get a newer version of glibc and place it at a local folder(relative to my code), include the path in my Makefile and use calls associated withinotify
? If so, what kind of problems could I run into? - An alternative could be using
fstat
, by keeping track of thest_mtime
member of thestruct stat
structure. Any caveats against taking this route?
If my questions reveal any lack of understanding with these concepts please bear with me as I just started using them.