bug-gnulib
[Top][All Lists]
Advanced

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

broken OpenBSD <net/if.h> [was: [libvirt] [PATCH] Include some extra hea


From: Eric Blake
Subject: broken OpenBSD <net/if.h> [was: [libvirt] [PATCH] Include some extra headers needed for OpenBSD.]
Date: Tue, 04 Sep 2012 11:08:30 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

[adding gnulib]

On 09/04/2012 10:52 AM, Jasper Lievisse Adriaanse wrote:
>> I'd still like to know the compiler error you got when <sys/socket.h>
>> was not present, but just guessing from the source code, I see one call
>> of socket() (protected behind #if defined(HAVE_NET_IF_H) &&
>> defined(SIOCBRADDBR), but maybe those are both true for OpenBSD?).  Even
>> though I'm pushing, I would STILL like to know why.
> Of course, here it is:
> 
> In file included from util/virnetdevbridge.c:35:
> /usr/include/net/if.h:276: warning: 'struct sockaddr' declared inside
> parameter list

Ouch.  The POSIX definition of <net/if.h> doesn't include any interface
that needs to use struct sockaddr.  Which OpenBSD extension function is
triggering this warning? According to POSIX, this .c file should compile:

#define _POSIX_C_SOURCE 200809L
#include <net/if.h>
#include <sys/socket.h>
struct if_nameindex i;

and it might just compile on OpenBSD (I haven't checked myself); the
difference is that we have explicitly asked for namespace pollution
beyond what _POSIX_C_SOURCE guarantees, which may explain why 'struct
sockaddr' is interfering.  But since <net/if.h> is required to be
self-contained when in a strict environment, it makes sense for it to
also be self-contained in an extension environment.  It sounds like
gnulib should consider providing a replacement <net/if.h> function to
work around this lameness.

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]