mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
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 <eblake@redhat.com>
This commit is contained in:
parent
c0788af07d
commit
478d93ad1f
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virstats.c: Block and network stats.
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -29,7 +29,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
|
||||||
#ifdef HAVE_GETIFADDRS
|
#if defined(HAVE_GETIFADDRS) && defined(AF_LINK)
|
||||||
# include <net/if.h>
|
# include <net/if.h>
|
||||||
# include <ifaddrs.h>
|
# include <ifaddrs.h>
|
||||||
#endif
|
#endif
|
||||||
@ -119,7 +119,7 @@ virNetInterfaceStats(const char *path,
|
|||||||
_("/proc/net/dev: Interface not found"));
|
_("/proc/net/dev: Interface not found"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_GETIFADDRS)
|
#elif defined(HAVE_GETIFADDRS) && defined(AF_LINK)
|
||||||
int
|
int
|
||||||
virNetInterfaceStats(const char *path,
|
virNetInterfaceStats(const char *path,
|
||||||
struct _virDomainInterfaceStats *stats)
|
struct _virDomainInterfaceStats *stats)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user