On 08/16/2011 11:29 AM, Eric Blake wrote:
> +++ b/src/util/virpidfile.c
> @@ -213,6 +213,8 @@ int virPidFileReadPathIfAlive(const char *path,
> #ifdef __linux__
> if (virFileLinkPointsTo(procpath, binpath) == 0)
> *pid = -1;
> +#else
> + (void)binpath;
> #endif
Here, I'd rather mark binpath as ATTRIBUTE_UNUSED than add the #else
preprocessor conditional. That is, ATTRIBUTE_UNUSED means only that the
variable might be unused, not that it can't be used (so used on linux,
unused otherwise qualifies).
Food for a separate patch: I see no reason why virFileLinkPointsTo won't
work on cygwin. That is, the fact that we used #ifdef __linux__ is
wrong, since cygwin also has a working /proc/pid/ file tree to determine
if an executable is still valid; we should instead be doing #if
PROCFS_AVAIL, along with some sort of configuration check that accepts
both linux and cygwin procfs (or at least whatever aspect of procfs that
we are relying on in this function).
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org