[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 eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org