$NetBSD: patch-df,v 1.1.1.1.4.1 2002/08/20 13:03:41 wiz Exp $

--- ksysguard/ksysguardd/FreeBSD/netdev.c.orig	Tue Sep 18 15:03:53 2001
+++ ksysguard/ksysguardd/FreeBSD/netdev.c
@@ -20,4 +20,11 @@
 */
 
+#if defined(__NetBSD__)
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <ifaddrs.h>
+#include <net/if.h>
+#include <string.h>
+#else
 #include <fcntl.h>
 #include <sys/socket.h>
@@ -30,4 +37,5 @@
 #include <sys/types.h>
 #include <unistd.h>
+#endif
 
 
@@ -84,4 +92,17 @@ int numActivIfaces(void)
 {
 	int counter = 0;
+
+#if defined(__NetBSD__)
+	struct ifaddrs *ifap, *ifa;
+
+	if (getifaddrs(&ifap) != 0)
+		return 0;
+
+	for (ifa = ifap; ifa; ifa=ifa->ifa_next) {
+		if (ifa->ifa_flags & IFF_UP)
+			counter++;
+	}
+	freeifaddrs(ifap);
+#else
 	int name[6];
 	int num_iface, i;
@@ -105,4 +126,5 @@ int numActivIfaces(void)
 			counter++;
 	}
+#endif
 
 	return counter;
@@ -175,4 +197,16 @@ void exitNetDev(void)
 void updateNetDev(void)
 {
+#if defined(__NetBSD__)
+	struct ifaddrs *ifap, *ifa;
+
+	if (getifaddrs(&ifap) != 0)
+		return;
+
+	for (ifa = ifap; ifa; ifa=ifa->ifa_next) {
+		if (ifa->ifa_flags & IFF_UP)
+			;
+	}
+	freeifaddrs(ifap);
+#else
 	int name[6];
 	int num_iface, i;
@@ -209,4 +243,5 @@ void updateNetDev(void)
 		}
 	}
+#endif
 }
 
