diff options
author | pav <pav@FreeBSD.org> | 2004-10-19 04:41:21 +0800 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2004-10-19 04:41:21 +0800 |
commit | fcb3d9a697b2570c09a7ea27ad855675797d59d5 (patch) | |
tree | 5c3d7383802d3cd7c4f49bf38886d44d585f0fea /net/pload | |
parent | abc533dd640e99ae8b8fa4cf0374084962cd8ae5 (diff) | |
download | freebsd-ports-gnome-fcb3d9a697b2570c09a7ea27ad855675797d59d5.tar.gz freebsd-ports-gnome-fcb3d9a697b2570c09a7ea27ad855675797d59d5.tar.zst freebsd-ports-gnome-fcb3d9a697b2570c09a7ea27ad855675797d59d5.zip |
Add pload, an X11 program to monitor network device statistics.
It graphs information using Athena stripchart widgets.
PR: ports/72013
Submitted by: J.R. Oldroyd <fbsd@opal.com>
Diffstat (limited to 'net/pload')
-rw-r--r-- | net/pload/Makefile | 23 | ||||
-rw-r--r-- | net/pload/distinfo | 2 | ||||
-rw-r--r-- | net/pload/files/patch-Imakefile | 20 | ||||
-rw-r--r-- | net/pload/files/patch-ioctl_stats.c | 80 | ||||
-rw-r--r-- | net/pload/files/patch-pload.c | 73 | ||||
-rw-r--r-- | net/pload/files/patch-pload.man | 33 | ||||
-rw-r--r-- | net/pload/pkg-descr | 6 |
7 files changed, 237 insertions, 0 deletions
diff --git a/net/pload/Makefile b/net/pload/Makefile new file mode 100644 index 000000000000..b6fbafdcfa77 --- /dev/null +++ b/net/pload/Makefile @@ -0,0 +1,23 @@ +# New ports collection makefile for: pload +# Date created: 22 Septemper 2004 +# Whom: J.R. Oldroyd <fbsd@opal.com> +# +# $FreeBSD$ +# + +PORTNAME= pload +PORTVERSION= 0.9.5 +CATEGORIES= net sysutils +MASTER_SITES= http://www.engr.utk.edu/~mdsmith/pload/ + +MAINTAINER= fbsd@opal.com +COMMENT= An X11 program to display network traffic graphs + +USE_IMAKE= yes +HAS_CONFIGURE= yes + +MAN1= pload.1 +MANCOMPRESSED= yes +PLIST_FILES= bin/pload + +.include <bsd.port.mk> diff --git a/net/pload/distinfo b/net/pload/distinfo new file mode 100644 index 000000000000..adac342aed8c --- /dev/null +++ b/net/pload/distinfo @@ -0,0 +1,2 @@ +MD5 (pload-0.9.5.tar.gz) = f109f3984212627f9955d1ac57c7a4f7 +SIZE (pload-0.9.5.tar.gz) = 22423 diff --git a/net/pload/files/patch-Imakefile b/net/pload/files/patch-Imakefile new file mode 100644 index 000000000000..ae8cc75f98c7 --- /dev/null +++ b/net/pload/files/patch-Imakefile @@ -0,0 +1,20 @@ +diff -c Imakefile.orig Imakefile +*** Imakefile.orig Tue Feb 1 02:11:24 2000 +--- Imakefile Tue Aug 3 10:02:12 2004 +*************** +*** 15,21 **** + + ComplexProgramTarget(pload) + +! distclean: clean + $(RM) Makefile osdefs.mk core \ + pload-$(VER).tar.gz \ + pload-$(VER)-1.i386.rpm \ +--- 15,21 ---- + + ComplexProgramTarget(pload) + +! distclean:: clean + $(RM) Makefile osdefs.mk core \ + pload-$(VER).tar.gz \ + pload-$(VER)-1.i386.rpm \ diff --git a/net/pload/files/patch-ioctl_stats.c b/net/pload/files/patch-ioctl_stats.c new file mode 100644 index 000000000000..ba61ce4d94bc --- /dev/null +++ b/net/pload/files/patch-ioctl_stats.c @@ -0,0 +1,80 @@ +--- ioctl_stat.c.orig Tue Feb 1 08:11:24 2000 ++++ ioctl_stat.c Mon Oct 18 22:32:49 2004 +@@ -30,6 +30,12 @@ + #include <fcntl.h> /* open */ + #include <sys/ioctl.h> /* ioctl */ + #include <errno.h> ++#ifdef __FreeBSD__ ++#include <sys/sysctl.h> ++#include <sys/socket.h> ++#include <net/if.h> ++#include <net/if_mib.h> ++#endif + + #ifndef STREAMS /* Linux, FreeBSD, NetBSD, Ultrix */ + # include <sys/socket.h> /* socket */ +@@ -63,6 +69,16 @@ + struct ifreq ifr; + struct ifpppstatsreq req; + ++#ifdef __FreeBSD__ ++ static int if_ix = -1; ++ struct ifmibdata ifmd; ++ size_t ifmd_sz = sizeof(ifmd); ++ int nr_ifs; ++ size_t nr_ifs_sz = sizeof(nr_ifs); ++ int name[6]; ++ int i; ++#endif ++ + if (!ifd->s) getsocket(ifd); + + memset(&ifr, 0, sizeof(ifr)); +@@ -84,18 +100,36 @@ + #define ifr_name ifr__name + #endif + +- strncpy(req.ifr_name, ifd->device, sizeof(req.ifr_name)); +- if (ioctl(ifd->s, SIOCGPPPSTATS, &req) != 0) +- { +- /* shouldn't fail if SIOCGIFFLAGS worked... */ +- ifd->in_bytes = 0UL; +- ifd->out_bytes = 0UL; +- return; ++#ifdef __FreeBSD__ ++ name[0] = CTL_NET; ++ name[1] = PF_LINK; ++ name[2] = NETLINK_GENERIC; ++ name[3] = IFMIB_IFDATA; ++ name[5] = IFDATA_GENERAL; ++ ++ if (if_ix < 0) { ++ if (sysctlbyname("net.link.generic.system.ifcount", (void *) &nr_ifs, &nr_ifs_sz, (void *) 0, 0) < 0) { ++ return; ++ } ++ for (i = 1; i <= nr_ifs; i++) { ++ name[4] = i; /* row of the ifmib table */ ++ ++ if (sysctl(name, 6, (void *) &ifmd, &ifmd_sz, (void *) 0, 0) < 0) { ++ continue; ++ } ++ if (strncmp(ifmd.ifmd_name, ifr.ifr_name, strlen(ifr.ifr_name)) == 0) { ++ if_ix = i; ++ break; ++ } ++ } + } +- +- ifd->in_bytes = (unsigned long)req.stats.p.ppp_ibytes; +- ifd->out_bytes = (unsigned long)req.stats.p.ppp_obytes; +- ++ name[4] = if_ix; ++ if (sysctl(name, 6, (void *) &ifmd, &ifmd_sz, (void *) 0, 0) >= 0) { ++ ifd->in_bytes = ifmd.ifmd_data.ifi_ibytes; ++ ifd->out_bytes = ifmd.ifmd_data.ifi_obytes; ++ } ++#endif ++ + return; + } + diff --git a/net/pload/files/patch-pload.c b/net/pload/files/patch-pload.c new file mode 100644 index 000000000000..0fb88df906b1 --- /dev/null +++ b/net/pload/files/patch-pload.c @@ -0,0 +1,73 @@ +diff -c pload.c.orig pload.c +*** pload.c.orig Tue Feb 1 02:11:24 2000 +--- pload.c Wed Sep 22 13:13:46 2004 +*************** +*** 596,608 **** + void do_total(char *b, double total) + { + if (total < 1024.0) +! sprintf(b, "%s%0.0f b", b, total); + else if (total < (1024.0*1024.0)) +! sprintf(b, "%s%0.2f k", b, total/1024.0); + else if (total < (1024.0*1024.0*1024.0)) +! sprintf(b, "%s%0.2f M", b, total/1024.0/1024.0); + else +! sprintf(b, "%s%0.2f G", b, total/1024.0/1024.0/1024.0); + + return; + } +--- 596,608 ---- + void do_total(char *b, double total) + { + if (total < 1024.0) +! sprintf(b, "%s%0.0f B", b, total); + else if (total < (1024.0*1024.0)) +! sprintf(b, "%s%0.2f kB", b, total/1024.0); + else if (total < (1024.0*1024.0*1024.0)) +! sprintf(b, "%s%0.2f MB", b, total/1024.0/1024.0); + else +! sprintf(b, "%s%0.2f GB", b, total/1024.0/1024.0/1024.0); + + return; + } +*************** +*** 610,622 **** + void do_rate(char *b, double rate) + { + if (rate < 1024.0) +! sprintf(b, "%s%0.0f b/s",b, rate); + else if (rate < (1024.0*1024.0)) +! sprintf(b, "%s%0.2f k/s",b, rate/1024.0); + else if (rate < (1024.0*1024.0*1024.0)) +! sprintf(b, "%s%0.2f M/s",b, rate/1024.0/1024.0); + else +! sprintf(b, "%s%0.2f G/s", b, rate/1024.0/1024.0/1024.0); + return; + } + +--- 610,622 ---- + void do_rate(char *b, double rate) + { + if (rate < 1024.0) +! sprintf(b, "%s%0.0f B/s",b, rate); + else if (rate < (1024.0*1024.0)) +! sprintf(b, "%s%0.2f kB/s",b, rate/1024.0); + else if (rate < (1024.0*1024.0*1024.0)) +! sprintf(b, "%s%0.2f MB/s",b, rate/1024.0/1024.0); + else +! sprintf(b, "%s%0.2f GB/s", b, rate/1024.0/1024.0/1024.0); + return; + } + +*************** +*** 643,648 **** +--- 643,651 ---- + break; + case 'M': + do_rate(buff, max); ++ break; ++ case 'd': ++ sprintf(buff, "%s", resources.device); + break; + case '%': /* literal % */ + i = strlen(buff); diff --git a/net/pload/files/patch-pload.man b/net/pload/files/patch-pload.man new file mode 100644 index 000000000000..61c502ef5e87 --- /dev/null +++ b/net/pload/files/patch-pload.man @@ -0,0 +1,33 @@ +--- pload.man.orig Tue Feb 1 02:11:24 2000 ++++ pload.man Wed Sep 22 16:44:12 2004 +@@ -18,7 +18,7 @@ + .TH PLOAD 1 "" "January 2000" + + .SH NAME +-pload \- display ppp throughput statistics in an X window ++pload \- display network interface statistics in an X window + + .SH SYNOPSIS + .ta 6n +@@ -30,9 +30,9 @@ + [-iformat \fIfmt\fP] [-oformat \fIfmt\fP] + + .SH DESCRIPTION +-The \fBpload\fP program displays information about network interface (ppp) statistics. +-Additionally, for Linux 2.2 it can display statistics for any interface that +-reports to /proc/net/dev . ++The \fBpload\fP program displays network throughput statistics in an X window ++Athena stripchart graph. ++On FreeBSD, \fBpload\fP can handle any network interface. + + .SH OPTIONS + .PP +@@ -144,7 +144,7 @@ + .TP 8 + .B \-iformat \fIfmt\fP + Use string \fIfmt\fP for the inbound label. The \fIfmt\fP string will be displayed +-literally with the special tags %t %r and %M expanding to the interface total, current ++literally with the special tags %d %t %r and %M expanding to the interface name, interface total, current + rate, and maximum rate respectively. The default is "%t %r in". + + .TP 8 diff --git a/net/pload/pkg-descr b/net/pload/pkg-descr new file mode 100644 index 000000000000..bb9734c9622b --- /dev/null +++ b/net/pload/pkg-descr @@ -0,0 +1,6 @@ +Pload is an X11 program to monitor network device statistics. It +graphs information using Athena stripchart widgets. + +Original author: Matt Smith <mdsmith@engr.utk.edu> + +WWW: http://www.engr.utk.edu/~mdsmith/pload/ |