aboutsummaryrefslogtreecommitdiff
path: root/sysutils/gkrellm
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2003-01-03 17:13:30 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2003-01-03 17:13:30 +0000
commit28625e5aa0d4e67aad71267c0aee86a25e5f3006 (patch)
tree692062c55fcaaea4bc74948525cda0b5fdc5f75d /sysutils/gkrellm
parent61e7c912c1cd73d024ae13601744a3c3789f556d (diff)
downloadports-28625e5aa0d4e67aad71267c0aee86a25e5f3006.tar.gz
ports-28625e5aa0d4e67aad71267c0aee86a25e5f3006.zip
Notes
Diffstat (limited to 'sysutils/gkrellm')
-rw-r--r--sysutils/gkrellm/Makefile1
-rw-r--r--sysutils/gkrellm/files/patch-src::net.c132
2 files changed, 133 insertions, 0 deletions
diff --git a/sysutils/gkrellm/Makefile b/sysutils/gkrellm/Makefile
index 292b33169d28..b4f322a1273d 100644
--- a/sysutils/gkrellm/Makefile
+++ b/sysutils/gkrellm/Makefile
@@ -7,6 +7,7 @@
PORTNAME= gkrellm
PORTVERSION= 1.2.13
+PORTREVISION= 1
CATEGORIES= sysutils ipv6
MASTER_SITES= http://web.wt.net/~billw/gkrellm/ \
${MASTER_SITE_LOCAL}
diff --git a/sysutils/gkrellm/files/patch-src::net.c b/sysutils/gkrellm/files/patch-src::net.c
new file mode 100644
index 000000000000..648dc036e5ca
--- /dev/null
+++ b/sysutils/gkrellm/files/patch-src::net.c
@@ -0,0 +1,132 @@
+Index: src/net.c
+diff -u src/net.c.orig src/net.c
+--- src/net.c.orig Mon Jul 1 11:17:27 2002
++++ src/net.c Fri Jan 3 19:11:51 2003
+@@ -120,10 +120,6 @@
+
+ /* -------- FreeBSD / NetBSD / OpenBSD ------------------------------------ */
+ #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
+-#include <sys/sysctl.h>
+-#include <net/if.h>
+-#include <net/if_dl.h>
+-#include <net/route.h>
+
+ #define LOCK_DIRECTORY "/var/spool/lock"
+
+@@ -133,6 +129,107 @@
+ {"ppp0", TIMER_TYPE_PPP }
+ };
+
++#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
++read_bsd_net_data()
++ {
++ GList *list;
++ NetMon *net;
++ 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;
++ for (list = net_mon_list; list; list = list->next)
++ {
++ net = (NetMon *) list->data;
++ if (strcmp(net->name, ifa->ifa_name) == 0)
++ {
++ ifd = (struct if_data *)ifa->ifa_data;
++ net->rx = ifd->ifi_ibytes;
++ net->tx = ifd->ifi_obytes;
++ net->rxtx_units = NET_UNITS_BYTES;
++ break;
++ }
++ }
++ }
++ }
++
++ freeifaddrs(ifap);
++ }
++
++static void
++sync_bsd_net_interfaces()
++ {
++ GList *list;
++ NetMon *net;
++ struct ifaddrs *ifap, *ifa;
++
++ for (list = net_mon_list; list; list = list->next)
++ {
++ net = (NetMon *) list->data;
++ net->old_state = net->state;
++ net->state = NET_DOWN;
++ }
++
++ 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;
++ for (list = net_mon_list; list; list = list->next)
++ {
++ net = (NetMon *) list->data;
++ if (strcmp(net->name, ifa->ifa_name) == 0)
++ {
++ net->state = NET_UP;
++ break;
++ }
++ }
++ if (list == NULL)
++ {
++ net = g_new0(NetMon, 1);
++ net->name = g_strdup(ifa->ifa_name);
++ net_mon_list = g_list_append(net_mon_list, net);
++ net->state = NET_UP;
++ net->old_state = NET_DOWN;
++ }
++ }
++ }
++
++ freeifaddrs(ifap);
++ }
++
++#else /* HAVE_GETIFADDRS */
++
++#include <sys/sysctl.h>
++#include <net/if.h>
++#include <net/if_dl.h>
++#include <net/route.h>
++
+ static int mib[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 };
+ static char *buf;
+ static int alloc;
+@@ -289,6 +386,8 @@
+ }
+ }
+ }
++
++#endif /* HAVE_GETIFADDRS */
+ #endif
+
+