[libvirt] [PATCH] MacOS: Handle changes to xdrproc_t definition

Doug Goldstein cardoe at cardoe.com
Sun Nov 3 15:36:03 UTC 2013


On Fri, Nov 1, 2013 at 9:55 PM, Eric Blake <eblake at redhat.com> wrote:
> On 10/30/2013 10:28 AM, Doug Goldstein wrote:
>> With Mac OS X 10.9, xdrproc_t is no longer defined as:
>>
>> typedef bool_t (*xdrproc_t)(XDR *, ...);
>>
>> but instead as:
>>
>> typdef bool_t (*xdrproc_t)(XDR *, void *, unsigned int);
>>
>> For reference, Linux systems typically define it as:
>>
>> typedef bool_t (*xdrproc_t)(XDR *, void *, ...);
>>
>> The rationale explained in the header is that using a vararg is
>> incorrect and has a potential to change the ABI slightly do to compiler
>> optimizations taken and the undefined behavior. They decided
>> to specify the exact number of parameters and for compatibility with old
>> code decided to make the signature require 3 arguments. The third
>> argument is ignored for cases that its not used and its recommended to
>> supply a 0.
>> ---
>>  src/rpc/virnetmessage.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> ACK; passed my testing on Linux and Cygwin, and seems to be reasonable
> to avoid undefined C behavior where varargs ABI on some platforms could
> indeed give undesired results.  Worth having in 1.1.4.

Thanks. Pushed.
-- 
Doug Goldstein




More information about the libvir-list mailing list