[libvirt] [PATCH] build: work around FreeBSD stdlib.h bug

Eric Blake eblake at redhat.com
Tue Mar 4 13:59:53 UTC 2014


On 03/04/2014 06:47 AM, Daniel P. Berrange wrote:
> On Tue, Mar 04, 2014 at 06:28:17AM -0700, Eric Blake wrote:
>> POSIX requires that <stdlib.h> expose WIFEXITED and friends,
>> but FreeBSD and others fail to comply.  We can work around it
>> manually by including <sys/wait.h>, or we can work around it
>> automatically by using gnulib's system-posix module.
>>
>> * bootstrap.conf (gnulib_modules): Add system-posix.
>>
>> Signed-off-by: Eric Blake <eblake at redhat.com>
>> ---
>>
>> I'll wait for a review on this one - we don't use system(),
>> and it feels a little bit odd to list the system() module
>> merely for its side effect of a fixed <stdlib.h>.  The alternative
>> is to continue using <sys/wait.h> everywhere that we use
>> WIFEXITED and friends.
> 
> Perhaps we should have a helper in util/virprocess.{c,h} for
> this, so no code outside that file ever need use WIFEXITED ?

We already have a couple of helper functions, and my recent virFork
cleanups got rid of even more clients of WIFEXITED (that is,
virCommandRun now defaults to returning sanitized rather than raw exit
values).  At this point, there are very few reasons for any new code to
need to use WIFEXITED; it's mostly limited to existing code (but where
my virFork cleanups tripped up on the FreeBSD header bug due to
refactoring).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140304/287b9ae0/attachment-0001.sig>


More information about the libvir-list mailing list