Boost logo

Boost :

Subject: Re: [boost] [filesystem] file monitoring
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2008-10-23 09:42:44


Carlos Rafael Giani wrote:
> is a file monitor feature planned for boost.filesystem? I have been
> looking for a platform independent solution, but there is none (except
> in toolkits like Qt). Also, so far only inotify (a subsystem in the
> Linux kernel) can tell me when a file is closed after writing, which is
> absolutely necessary when watching a plugins/ directory, for example
> (you don't want to touch the plugins when they're only halfway copied).
> Several tools watch the plugin directory, but don't care if the plugins
> are being written or are fully there already. This can lead to
> instabilities.
>
> I think it is only logical to add this to boost.filesystem, something
> like set_monitor_callback(pathname, function_object);

If someone plans to do this, I could contribute some code that I wrote
to put a C++ wrapper around inotify.

However, I'm no longer using this code because of the following
misfeature: if I ask to monitor a file that is on an NFS filesystem, I
won't get notifications of changes made on other machines. This would
not be a problem if the kernel reported an error in this case as I
could then fall back to polling. However, it reports no error so I
have no way to know whether or not I will get notifications.

Phil.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk