On 03/10/2014 10:54 AM, Daniel P. Berrange wrote:
The future QEMU capabilities cache needs to be able to invalidate
itself if the libvirtd binary or any loadable modules are changed
on disk. Record the 'ctime' value for these binaries and provide
helper APIs to query it. This approach assumes that if libvirt.so
is changed, then libvirtd will also change, which should usually
be the case with libtool's wrapper scripts that cause libvirtd to
get re-linked
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
+void virUpdateSelfLastChanged(const char *path)
+{
+ struct stat sb;
+
+ if (stat(path, &sb) < 0)
+ return;
+
+ if (sb.st_ctime > selfLastChanged) {
+ VIR_DEBUG("Setting self last changed to %lld for '%s'",
+ (long long)sb.st_ctime, path);
+ selfLastChanged = sb.st_ctime;
No sub-second resolution? I suppose it's okay, although gnulib gives
you functions to access and compare full timestamp resolution.
ACK.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org