diff options
author | Hajimu UMEMOTO <ume@FreeBSD.org> | 2003-01-03 17:14:41 +0000 |
---|---|---|
committer | Hajimu UMEMOTO <ume@FreeBSD.org> | 2003-01-03 17:14:41 +0000 |
commit | 04fc3b11cee835a51ad29b4ce3bcb6ea57e8b6b7 (patch) | |
tree | 04d9673b1ee8d3e6a2d6c4d731319ead1a616dd1 /sysutils/gkrellm2 | |
parent | Use getifaddr() where it is available to gather informaiton (diff) |
Use getifaddr() where it is available to gather informaiton
for a network monitor.
Notes
Notes:
svn path=/head/; revision=72414
Diffstat (limited to 'sysutils/gkrellm2')
-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 36d5ae1173f4..1151f2069aa5 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 000000000000..f7b8f2d41a88 --- /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. |