I've spent the morning looking at FAM, trying to work out how it all fits
together on my Linux system. I can't quite work it out, so maybe someone can
help. I know what the project does, it's *how* it does it that puzzles me.
The question that troubles me is basically "how does the daemon know a file
has changed?" There appear to be three options: polling, imon and dnotify.
Looking at the source code suggests that Imon is the favoured way, and this
requires a /dev/imon device. I've not yet found a Linux kernel with one, or
the imon module which appears to be required to support it. (I've checked
SUSE, Mandrake and Redhat.) The FAQ says:
qw/
Which kernel monitor should I use?
On IRIX, use IMon.
On Linux, use DNotify if it is supported by your kernel (it's standard on
Linux 2.4 and higher). Otherwise, use IMon.
/
Um, OK. But I'm not sure I understand the question, let alone the answer.
"Which kernel monitor should *I* use?" What does that mean? Do I somehow have
to employ/start a kernel monitor which FAM can connect to? Or should the
question be "Which is the prefered kernel monitor for FAM to use?"
I have a recent kernel so I investigated DNotify. There's a document in the
kernel tree describing the use of the kernel's DNotify feature but I can't
find any code in the FAM source which matches the example given (trickery
with a fcntl() syscall).
Confusingly, Google led me to another piece of code called DNotify (http://
www.student.lu.se/~nbi98oli/dnotify.html) which I thought for a long time
must be the kernel monitor the FAQ tells me I should be using. I now think
this is a red herring, but am not entirely sure.
Um, so where does that leave me? My kernel doesn't have imon, and the FAM
source doesn't appear to use the kernel's DNotify feature, so perhaps it's
just polling the filesystem? Which at least fits what I'm seeing, but seems
to negate a lot of the advantages FAM suggests it has over a "poll it
yourself" kind of approach.
Can someone explain to me how it all fits together?
|