From 35d2d7f5f8b0ce98c0acd8b66007bbae02380fdc Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 18 Nov 2005 01:15:54 +0000 Subject: [PATCH] on linux certain interfaces such as VMware vmnic are not returned by ioctl(SIOCGIFCONF). check /proc/net/dev for any ioctl missed. --- src/sigar.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/sigar.c b/src/sigar.c index 8ce777c8..08be5a33 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -1273,6 +1273,69 @@ static int sigar_netif_configured(sigar_t *sigar, char *name) } #endif +#ifdef __linux__ +static SIGAR_INLINE int has_interface(sigar_net_interface_list_t *iflist, + char *name) +{ + register int i; + register int num = iflist->number; + register char **data = iflist->data; + for (i=0; idata[iflist->number++] = + sigar_strdup(dev); + } + + fclose(fp); + + return SIGAR_OK; +} +#endif + int sigar_net_interface_list_get(sigar_t *sigar, sigar_net_interface_list_t *iflist) { @@ -1346,6 +1409,10 @@ int sigar_net_interface_list_get(sigar_t *sigar, sigar_strdup(ifr->ifr_name); } +#ifdef __linux__ + proc_net_interface_list_get(sigar, iflist); +#endif + return SIGAR_OK; }