[libvirt] [PATCH] build: fix build on cygwin
Cygwin has getifaddrs(), but not AF_LINK, leading to: util/virstats.c: In function 'virNetInterfaceStats': util/virstats.c:138:41: error: 'AF_LINK' undeclared (first use in this function) if (ifa-ifa_addr-sa_family != AF_LINK) ... * src/util/virstats.c (virNetInterfaceStats): Only use getifaddrs if AF_LINK is present. Signed-off-by: Eric Blake ebl...@redhat.com --- Pushing under the build-breaker rule. src/util/virstats.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virstats.c b/src/util/virstats.c index 910803f..b10fd85 100644 --- a/src/util/virstats.c +++ b/src/util/virstats.c @@ -1,7 +1,7 @@ /* * virstats.c: Block and network stats. * - * Copyright (C) 2007-2010 Red Hat, Inc. + * Copyright (C) 2007-2010, 2014 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,7 +29,7 @@ #include unistd.h #include regex.h -#ifdef HAVE_GETIFADDRS +#if defined(HAVE_GETIFADDRS) defined(AF_LINK) # include net/if.h # include ifaddrs.h #endif @@ -119,7 +119,7 @@ virNetInterfaceStats(const char *path, _(/proc/net/dev: Interface not found)); return -1; } -#elif defined(HAVE_GETIFADDRS) +#elif defined(HAVE_GETIFADDRS) defined(AF_LINK) int virNetInterfaceStats(const char *path, struct _virDomainInterfaceStats *stats) -- 1.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] build: fix build on cygwin
Now that tests are built unconditionally, this cases 'make' to fail on cygwin (previously, only 'make check' failed), since on cygwin, rpc/rpc.h lives in a different directory than /usr/include. * tests/Makefile.am (virnetmessagetest_CFLAGS): Find rpc headers. --- Pushing under the build-breaker rule. tests/Makefile.am |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index c4d550f..fbb756a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -458,7 +458,8 @@ endif virnetmessagetest_SOURCES = \ virnetmessagetest.c testutils.h testutils.c -virnetmessagetest_CFLAGS = -Dabs_builddir=\$(abs_builddir)\ $(AM_CFLAGS) +virnetmessagetest_CFLAGS = -Dabs_builddir=\$(abs_builddir)\ \ + $(XDR_CFLAGS) $(AM_CFLAGS) virnetmessagetest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS) virnetsockettest_SOURCES = \ -- 1.7.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] build: fix build on cygwin
Regression introduced when we changed types in commit 3e2c3d8f6. We've done this sort of cleanup before (see commit c685993d7). * src/conf/storage_conf.c (virStoragePoolDefFormat) (virStorageVolTargetDefFormat): Cast gid_t and uid_t. --- Pushing under the build-breaker rule. src/conf/storage_conf.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index bdf6218..2330fa1 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -915,10 +915,10 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) { virBufferAddLit(buf,permissions\n); virBufferAsprintf(buf, mode0%o/mode\n, def-target.perms.mode); -virBufferAsprintf(buf, owner%d/owner\n, - def-target.perms.uid); -virBufferAsprintf(buf, group%d/group\n, - def-target.perms.gid); +virBufferAsprintf(buf, owner%u/owner\n, + (unsigned int) def-target.perms.uid); +virBufferAsprintf(buf, group%u/group\n, + (unsigned int) def-target.perms.gid); if (def-target.perms.label) virBufferAsprintf(buf, label%s/label\n, @@ -1152,10 +1152,10 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, virBufferAddLit(buf,permissions\n); virBufferAsprintf(buf, mode0%o/mode\n, def-perms.mode); -virBufferAsprintf(buf, owner%d/owner\n, - def-perms.uid); -virBufferAsprintf(buf, group%d/group\n, - def-perms.gid); +virBufferAsprintf(buf, owner%u/owner\n, + (unsigned int) def-perms.uid); +virBufferAsprintf(buf, group%u/group\n, + (unsigned int) def-perms.gid); if (def-perms.label) -- 1.7.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] build: fix build on Cygwin
On Sat, Dec 03, 2011 at 01:03:08PM -0700, Eric Blake wrote: The RPC fixups needed on Linux are also needed on cygwin, and worked without further tweaking to the list of fixups. Also, unlike BSD, Cygwin exports 'struct ifreq', but unlike Linux, Cygwin lacks the ioctls that we were using 'struct ifreq' to access. This patch allows compilation under cygwin. * src/rpc/genprotocol.pl: Also perform fixups on cygwin. * src/util/virnetdev.c (HAVE_STRUCT_IFREQ): Also require AF_PACKET definition. * src/util/virnetdevbridge.c (virNetDevSetupControlFull): Only compile if SIOCBRADDBR works. --- Pushing under the build-breaker rule. src/rpc/genprotocol.pl |2 +- src/util/virnetdev.c |2 ++ src/util/virnetdevbridge.c |2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index 166508b..7af1b3b 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -31,7 +31,7 @@ open RPCGEN, -|, $rpcgen, $mode, $xdrdef open TARGET, $target or die cannot create $target: $!; -my $fixup = $^O eq linux; +my $fixup = $^O eq linux || $^O eq cygwin; if ($mode eq -c) { print TARGET #include config.h\n; diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 3187215..a1c62e3 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -38,6 +38,8 @@ #ifdef __linux__ # include linux/sockios.h # include linux/if_vlan.h +#elif !defined(AF_PACKET) +# undef HAVE_STRUCT_IFREQ #endif #define VIR_FROM_THIS VIR_FROM_NONE diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c index 0440a73..e246b2c 100644 --- a/src/util/virnetdevbridge.c +++ b/src/util/virnetdevbridge.c @@ -45,7 +45,7 @@ #define VIR_FROM_THIS VIR_FROM_NONE -#ifdef HAVE_NET_IF_H +#if defined(HAVE_NET_IF_H) defined(SIOCBRADDBR) static int virNetDevSetupControlFull(const char *ifname, struct ifreq *ifr, int domain, ACK Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] build: fix build on Cygwin
The RPC fixups needed on Linux are also needed on cygwin, and worked without further tweaking to the list of fixups. Also, unlike BSD, Cygwin exports 'struct ifreq', but unlike Linux, Cygwin lacks the ioctls that we were using 'struct ifreq' to access. This patch allows compilation under cygwin. * src/rpc/genprotocol.pl: Also perform fixups on cygwin. * src/util/virnetdev.c (HAVE_STRUCT_IFREQ): Also require AF_PACKET definition. * src/util/virnetdevbridge.c (virNetDevSetupControlFull): Only compile if SIOCBRADDBR works. --- Pushing under the build-breaker rule. src/rpc/genprotocol.pl |2 +- src/util/virnetdev.c |2 ++ src/util/virnetdevbridge.c |2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index 166508b..7af1b3b 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -31,7 +31,7 @@ open RPCGEN, -|, $rpcgen, $mode, $xdrdef open TARGET, $target or die cannot create $target: $!; -my $fixup = $^O eq linux; +my $fixup = $^O eq linux || $^O eq cygwin; if ($mode eq -c) { print TARGET #include config.h\n; diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 3187215..a1c62e3 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -38,6 +38,8 @@ #ifdef __linux__ # include linux/sockios.h # include linux/if_vlan.h +#elif !defined(AF_PACKET) +# undef HAVE_STRUCT_IFREQ #endif #define VIR_FROM_THIS VIR_FROM_NONE diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c index 0440a73..e246b2c 100644 --- a/src/util/virnetdevbridge.c +++ b/src/util/virnetdevbridge.c @@ -45,7 +45,7 @@ #define VIR_FROM_THIS VIR_FROM_NONE -#ifdef HAVE_NET_IF_H +#if defined(HAVE_NET_IF_H) defined(SIOCBRADDBR) static int virNetDevSetupControlFull(const char *ifname, struct ifreq *ifr, int domain, -- 1.7.7.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list