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

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

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

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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library

libvir-list mailing list

[Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

Powered by Linux