diff options
author | ume <ume@FreeBSD.org> | 2003-01-03 17:14:41 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2003-01-03 17:14:41 +0000 |
commit | cb2209e6be91a6d9a30a934aa8c0a599f90973c0 (patch) | |
tree | 3c96be3f8bbc19517199fe133d92ffc9feb53ab4 /sysutils | |
parent | a72fe3223e7baa94c84ada7957692cd9bb1ff260 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sysutils/gkrellm2/Makefile | 2 | ||||
-rw-r--r-- | sysutils/gkrellm2/files/patch-src::sysdeps::bsd-common.c | 59 |
2 files changed, 60 insertions, 1 deletions
diff --git a/sysutils/gkrellm2/Makefile b/sysutils/gkrellm2/Makefile index 36d5ae1..1151f20 100644 --- a/sysutils/gkrellm2/Makefile +++ b/sysutils/gkrellm2/Makefile @@ -7,7 +7,7 @@ PORTNAME= gkrellm PORTVERSION= 2.1.4 -#PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= sysutils ipv6 MASTER_SITES= http://web.wt.net/~billw/gkrellm/ \ ${MASTER_SITE_LOCAL} 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. |