summaryrefslogtreecommitdiffstats
path: root/sysutils/gkrellm2/files
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2003-01-03 17:14:41 +0000
committerume <ume@FreeBSD.org>2003-01-03 17:14:41 +0000
commitcb2209e6be91a6d9a30a934aa8c0a599f90973c0 (patch)
tree3c96be3f8bbc19517199fe133d92ffc9feb53ab4 /sysutils/gkrellm2/files
parenta72fe3223e7baa94c84ada7957692cd9bb1ff260 (diff)
downloadFreeBSD-ports-cb2209e6be91a6d9a30a934aa8c0a599f90973c0.zip
FreeBSD-ports-cb2209e6be91a6d9a30a934aa8c0a599f90973c0.tar.gz
Use getifaddr() where it is available to gather informaiton
for a network monitor.
Diffstat (limited to 'sysutils/gkrellm2/files')
-rw-r--r--sysutils/gkrellm2/files/patch-src::sysdeps::bsd-common.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/sysutils/gkrellm2/files/patch-src::sysdeps::bsd-common.c b/sysutils/gkrellm2/files/patch-src::sysdeps::bsd-common.c
new file mode 100644
index 0000000..f7b8f2d
--- /dev/null
+++ b/sysutils/gkrellm2/files/patch-src::sysdeps::bsd-common.c
@@ -0,0 +1,59 @@
+Index: src/sysdeps/bsd-common.c
+diff -u src/sysdeps/bsd-common.c.orig src/sysdeps/bsd-common.c
+--- src/sysdeps/bsd-common.c.orig Sun Oct 13 12:26:29 2002
++++ src/sysdeps/bsd-common.c Fri Jan 3 19:15:29 2003
+@@ -22,6 +22,45 @@
+ | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
++#if !(defined(__FreeBSD__) && __FreeBSD_version < 410000) && \
++ !(defined(__NetBSD__) && __NetBSD_version < 105000000) && \
++ !(defined(__OpenBSD__) && OpenBSD < 200006)
++#define HAVE_GETIFADDRS 1
++#endif
++
++#if defined(HAVE_GETIFADDRS)
++
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <net/if.h>
++#include <ifaddrs.h>
++
++void
++gkrellm_sys_net_read_data(void)
++ {
++ struct ifaddrs *ifap, *ifa;
++ struct if_data *ifd;
++
++ if (getifaddrs(&ifap) < 0)
++ return;
++
++ for (ifa = ifap; ifa; ifa = ifa->ifa_next)
++ {
++ if (ifa->ifa_flags & IFF_UP)
++ {
++ if (ifa->ifa_addr->sa_family != AF_LINK)
++ continue;
++ ifd = (struct if_data *)ifa->ifa_data;
++ gkrellm_net_assign_data(ifa->ifa_name,
++ ifd->ifi_ibytes, ifd->ifi_obytes);
++ }
++ }
++
++ freeifaddrs(ifap);
++ }
++
++#else /* HAVE_GETIFADDRS */
++
+ #include <sys/sysctl.h>
+ #include <sys/socket.h> // For PF_ROUTE, etc
+ #include <net/if.h>
+@@ -86,6 +125,8 @@
+ }
+ }
+ }
++
++#endif /* HAVE_GETIFADDRS */
+
+ /* This would be needed only if net up (or routed) state is available in
+ | a different way than for reading net stats.
OpenPOWER on IntegriCloud