[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] main: fix some compilation issues on non-linux platforms



On 08/16/2011 12:07 PM, Stefan Berger wrote:
I split this off and pushed the rest.
If procfs's are different, then maybe we should use #if
PROCFS_PID_EXE_LINK_AVAIL here.

Seems like a reasonable name.

What is needed in this case seems to be that /proc/<pid>/exe is a
symbolic link to the executable. This works in Linux and cygwin. Would
testing via

stat /proc/<pid>/exe | sed -n 's/.*\(symbolic link\).*/\1/p'

be a valid test for this that works on all targeted platforms?

stat(1) is not universal, and while it is on both Linux and Cygwin, it might not be present on some other platform that has a procfs that does what we want. It may be sufficient to just use 'test -h /proc/pid/exe' to see if there is a symlink.

Also, you'd need to wrap the test in a cache variable (to allow overrides if we guessed wrong), as well as to skip the test (and assume the worst or at least make some default guesses based on known $host_os) when cross-compiling, since the existence of procfs on the host machine says nothing about it being on the target machine.

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]