Date: Thu, 1 Nov 2001 13:37:55 +0100 (CET) From: Flag <flag@gufi.org> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/31690: new port: wmnd (dock app net monitor) Message-ID: <200111011237.fA1Cbte75338@libero.it>
next in thread | raw e-mail | index | archive | help
>Number: 31690 >Category: ports >Synopsis: new port: wmnd (dock app net monitor) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Nov 01 04:50:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Flag >Release: FreeBSD 4.4-STABLE i386 >Organization: GUFI >Environment: System: FreeBSD newluxor.skynet.org 4.4-STABLE FreeBSD 4.4-STABLE #2: Mon Sep 17 21:45:23 CEST 2001 flag@newluxor.skynet.org:/usr/obj/usr/src/sys/NEWLUXOR i386 AMD K6-III@400Mhz, 192MBRAM, MatroxG400 16MB, 15GB HD-ATA66, FreeBSD4.4-STABLE >Description: new port for window maker fans: wmnd - an extremly configurable net monitor >How-To-Repeat: just add it to the main ports tree! =) >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # wmnd # wmnd/distinfo # wmnd/pkg-comment # wmnd/pkg-descr # wmnd/Makefile # wmnd/files # wmnd/files/patch-aa # wmnd/files/patch-ab # wmnd/files/patch-ac # wmnd/files/patch-ad # wmnd/files/patch-ae # wmnd/pkg-plist # echo c - wmnd mkdir -p wmnd > /dev/null 2>&1 echo x - wmnd/distinfo sed 's/^X//' >wmnd/distinfo << 'END-of-wmnd/distinfo' XMD5 (wmnd_0.3.3.tar.gz) = eadd01d602e8d9ef4c5aec8125e10a49 END-of-wmnd/distinfo echo x - wmnd/pkg-comment sed 's/^X//' >wmnd/pkg-comment << 'END-of-wmnd/pkg-comment' XImproved network monitoring dock app (with tons of features) END-of-wmnd/pkg-comment echo x - wmnd/pkg-descr sed 's/^X//' >wmnd/pkg-descr << 'END-of-wmnd/pkg-descr' XWMND (WindowMaker Network Devices) is a network monitoring Xdock app improved and based on WMiFS 1.3b. The version 0.2 of Xwmnd is almost totally written by Timecop, given the optimization Xand flexibility. Enjoy! X XWWW: http://www.wingeer.org/wmnd/ X X- Paolo Xflag@gufi.org END-of-wmnd/pkg-descr echo x - wmnd/Makefile sed 's/^X//' >wmnd/Makefile << 'END-of-wmnd/Makefile' X# New ports collection makefile for: wmnd X# Date created: 29 October 2001 X# Whom: Paolo Pisati <flag@gufi.org> X# X# $FreeBSD$ X# X XPORTNAME= wmnd XPORTVERSION= 0.3.3 XCATEGORIES= net XMASTER_SITES= http://www.wingeer.org/wmnd/pkg/ XDISTNAME= wmnd_${PORTVERSION} X XMAINTAINER= flag@gufi.org X XUSE_GMAKE= yes X XWRKSRC= ${WRKDIR}/wmnd X XMAN1= wmnd.1 XMANCOMPRESSED= yes X X.include <bsd.port.mk> END-of-wmnd/Makefile echo c - wmnd/files mkdir -p wmnd/files > /dev/null 2>&1 echo x - wmnd/files/patch-aa sed 's/^X//' >wmnd/files/patch-aa << 'END-of-wmnd/files/patch-aa' X*** /home/flag/ports/wmnd-orig/src/wmnd.h Tue May 22 11:06:36 2001 X--- ./src/wmnd.h Mon Oct 15 19:14:40 2001 X*************** X*** 25,28 **** X--- 25,59 ---- X #include <X11/extensions/shape.h> X X+ #ifdef USE_FREEBSD_SYSCTL X+ X+ #include <sys/types.h> X+ #include <sys/socket.h> X+ #include <sys/sysctl.h> X+ #include <sys/time.h> X+ #include <net/if.h> X+ #include <net/if_mib.h> X+ X+ /* internal structure used for freebsd-systcl */ X+ X+ int freebsd_interface_count=0; X+ X+ int get_ifmib_general(int row, struct ifmibdata *ifmd) { X+ X+ int name[6], len; X+ X+ len=sizeof(struct ifmibdata); X+ X+ name[0] = CTL_NET; X+ name[1] = PF_LINK; X+ name[2] = NETLINK_GENERIC; X+ name[3] = IFMIB_IFDATA; X+ name[4] = row; X+ name[5] = IFDATA_GENERAL; X+ X+ return sysctl(name, 6, ifmd, &len, NULL, 0); X+ } X+ X+ #endif X+ X /* X * Wmnd version number, do not modify line layout or sed will not find X*************** X*** 39,43 **** X case 0: \ X break; \ X! case 1: \ X fprintf(stderr, __FUNCTION__": " fmt, ##arg); \ X fprintf(stderr, "\n"); \ X--- 70,74 ---- X case 0: \ X break; \ X! case 1: \ X fprintf(stderr, __FUNCTION__": " fmt, ##arg); \ X fprintf(stderr, "\n"); \ END-of-wmnd/files/patch-aa echo x - wmnd/files/patch-ab sed 's/^X//' >wmnd/files/patch-ab << 'END-of-wmnd/files/patch-ab' X*** /home/flag/ports/wmnd-orig/Makefile Tue May 22 13:30:58 2001 X--- Makefile Mon Oct 29 12:48:15 2001 X*************** X*** 21,25 **** X # X11LDFLAGS = -L/usr/openwin/lib -lXpm -lXext -lX11 -lsocket -lnsl X # Solaris specific (for use with kstat) X! LDFLAGS = -lkstat -lsocket -lnsl X X ################## X--- 21,25 ---- X # X11LDFLAGS = -L/usr/openwin/lib -lXpm -lXext -lX11 -lsocket -lnsl X # Solaris specific (for use with kstat) X! #LDFLAGS = -lkstat -lsocket -lnsl X X ################## X*************** X*** 33,37 **** X X # Optimizing X! CFLAGS = -Wall -O3 -fomit-frame-pointer -fstrict-aliasing -pipe X X # Profiling X--- 33,39 ---- X X # Optimizing X! #CFLAGS = -Wall -O -fomit-frame-pointer -fstrict-aliasing -pipe X! X! CFLAGS += -Wall -pipe X X # Profiling X*************** X*** 42,46 **** X X # Debugging X! # DEBUG = -ggdb X X ####################### X--- 44,48 ---- X X # Debugging X! #DEBUG = -g X X ####################### X*************** X*** 94,95 **** X--- 96,101 ---- X X # vim:nosta X+ X+ X+ X+ END-of-wmnd/files/patch-ab echo x - wmnd/files/patch-ac sed 's/^X//' >wmnd/files/patch-ac << 'END-of-wmnd/files/patch-ac' X*** /home/flag/ports/wmnd-orig/src/config.h Fri May 18 20:06:47 2001 X--- ./src/config.h Mon Oct 15 18:18:06 2001 X*************** X*** 12,26 **** X /* #define WORDS_BIGENDIAN */ X X /* linux /proc/net/dev driver */ X /* #define USE_LINUX_PROC */ X X /* free pppd for Solaris 2.x and compatible streams ppp devices */ X! #define USE_SOLARIS_FPPPD X X /* solaris kstat driver, also works on kstat compatible OSs */ X! #define USE_SOLARIS_KSTAT X X /* dummy driver for testing purposes, it's safe to leave it defined */ X! #define USE_TESTING_DUMMY X X #endif X--- 12,35 ---- X /* #define WORDS_BIGENDIAN */ X X+ /*FreeBSD dev driver*/ X+ #define USE_FREEBSD_SYSCTL X+ X /* linux /proc/net/dev driver */ X /* #define USE_LINUX_PROC */ X X /* free pppd for Solaris 2.x and compatible streams ppp devices */ X! //#define USE_SOLARIS_FPPPD X X /* solaris kstat driver, also works on kstat compatible OSs */ X! //#define USE_SOLARIS_KSTAT X X /* dummy driver for testing purposes, it's safe to leave it defined */ X! //#define USE_TESTING_DUMMY X X #endif X+ X+ X+ X+ X+ X+ END-of-wmnd/files/patch-ac echo x - wmnd/files/patch-ad sed 's/^X//' >wmnd/files/patch-ad << 'END-of-wmnd/files/patch-ad' X*** /home/flag/ports/wmnd-orig/src/drivers.c Tue May 22 17:11:25 2001 X--- ./src/drivers.c Mon Oct 15 19:24:52 2001 X*************** X*** 10,13 **** X--- 10,14 ---- X #include "drivers.h" X X+ X /* X * short explanation of what a function must do X*************** X*** 18,21 **** X--- 19,133 ---- X */ X X+ #ifdef USE_FREEBSD_SYSCTL X+ X+ /* functions prototypes */ X+ int freebsd_dev_list(const char *devname, struct Devices *list) { X+ char *devn; X+ struct Devices *ndev; X+ int mib[5], len; X+ int i; X+ struct ifmibdata ifmd; X+ X+ mib[0]=CTL_NET; X+ mib[1]=PF_LINK; X+ mib[2]=NETLINK_GENERIC; X+ mib[3]=IFMIB_SYSTEM; X+ mib[4]=IFMIB_IFCOUNT; X+ X+ len=sizeof(int); X+ X+ if (sysctl(mib, 5, &freebsd_interface_count, &len ,NULL, 0)==-1) {perror("systcl failed");exit(-1);} X+ printf("freebsd_interface_count: %d\n",freebsd_interface_count); X+ X+ printf("devname: %s\n", devname); X+ if (devname != NULL) { X+ // fill in the Devices structure X+ ndev=malloc(sizeof(struct Devices)); X+ list->next=ndev; X+ // name of device X+ devn=strdup(devname); X+ ndev->name=devn; X+ // next Devices field used to create the chain X+ ndev->next=NULL; X+ // internale driver data X+ ndev->drvdata=NULL; X+ // driver number X+ ndev->drvnum=0; X+ // status indicator (0 online, 1 offline) X+ ndev->online=0; X+ // device activity start X+ ndev->devstart=time(NULL); X+ // end of initialization X+ printf("freebsd_dev_list finished ok!!!\n"); X+ return 1; X+ } X+ else { // we don't have a specific interface to monitor, so we must first retrieve the name of all available interfaces X+ printf("any interface defined!\n"); X+ X+ len=sizeof(ifmd); X+ X+ for(i=1;i<=freebsd_interface_count;i++) { X+ X+ X+ if (get_ifmib_general(i, &ifmd)==-1) {perror("sysctl2");exit(-1);} X+ X+ // fill in the Devices structure X+ ndev=malloc(sizeof(struct Devices)); X+ list->next=ndev; X+ // name of device X+ devn=strdup(ifmd.ifmd_name); X+ ndev->name=devn; X+ // next Devices field used to create the chain X+ ndev->next=NULL; X+ // internale driver data X+ ndev->drvdata=NULL; X+ // driver number X+ ndev->drvnum=0; X+ // status indicator (0 online, 1 offline) X+ ndev->online=0; X+ // device activity start X+ ndev->devstart=time(NULL); X+ //update the list pointer X+ list=ndev; X+ // end of initialization X+ X+ } X+ X+ return 1; X+ } X+ } X+ X+ int freebsd_dev_init(struct Devices *dev) { X+ printf("nothing to do here!\n"); X+ return 0; X+ } X+ X+ int freebsd_dev_get(struct Devices *dev, unsigned long *ip, unsigned long *op, unsigned long *ib, unsigned long *ob) { X+ struct ifmibdata ifmd; X+ int i; X+ for(i=1;i<=freebsd_interface_count;i++) { X+ if(get_ifmib_general(i, &ifmd)==-1) {perror("systcl3");exit(-1);} X+ //printf("comparing devname: %s with ifmdname: %s\n",dev->name, ifmd.ifmd_name); X+ if(strcmp(dev->name,ifmd.ifmd_name)==0) { X+ //printf("interface name: %s\n",ifmd.ifmd_name); X+ //printf("ipacktes: %ld opackets: %ld\n",ifmd.ifmd_data.ifi_ipackets,ifmd.ifmd_data.ifi_opackets); X+ //printf("ibytes: %ld obytes: %ld\n",ifmd.ifmd_data.ifi_ibytes,ifmd.ifmd_data.ifi_obytes); X+ //printf("\n"); X+ *ip=ifmd.ifmd_data.ifi_ipackets; *op=ifmd.ifmd_data.ifi_opackets; X+ *ib=ifmd.ifmd_data.ifi_ibytes; *ob=ifmd.ifmd_data.ifi_obytes; X+ return 0; X+ } X+ } printf("interface %s not found!\n",dev->name); exit(-1); X+ X+ return 0; X+ } X+ X+ void freebsd_dev_term(struct Devices *dev) { X+ printf("freebsd_dev_term: %s\n",dev->name); X+ //free(dev); X+ } X+ X+ #endif /*USE_FREESD_SYSCTL*/ X+ X #ifdef USE_SOLARIS_FPPPD X X*************** X*** 429,430 **** X--- 541,549 ---- X X #endif /* USE_LINUX_PROC */ X+ X+ X+ X+ X+ X+ X+ END-of-wmnd/files/patch-ad echo x - wmnd/files/patch-ae sed 's/^X//' >wmnd/files/patch-ae << 'END-of-wmnd/files/patch-ae' X*** /home/flag/ports/wmnd-orig/src/drivers.h Sun May 20 16:19:01 2001 X--- ./src/drivers.h Mon Oct 15 18:19:14 2001 X*************** X*** 33,39 **** X X /* driver vars */ X #ifdef USE_SOLARIS_FPPPD X X! #include <sys/stropts.h> X #include "support/ppp_defs.h" X #include "support/pppio.h" X--- 33,51 ---- X X /* driver vars */ X+ #ifdef USE_FREEBSD_SYSCTL X+ X+ X+ /* functions prototypes */ X+ int freebsd_dev_list(const char *devname, struct Devices *list); X+ int freebsd_dev_init(struct Devices *dev); X+ int freebsd_dev_get(struct Devices *dev, unsigned long *ip, unsigned long *op, X+ unsigned long *ib, unsigned long *ob); X+ void freebsd_dev_term(struct Devices *dev); X+ X+ #endif /*USE_FREESD_SYSCTL*/ X+ X #ifdef USE_SOLARIS_FPPPD X X! //#include <sys/stropts.h> X #include "support/ppp_defs.h" X #include "support/pppio.h" X*************** X*** 135,140 **** X--- 147,158 ---- X {"testing_dummy", testing_dummy_list, testing_dummy_init, testing_dummy_get, testing_dummy_term}, X #endif X+ #ifdef USE_FREEBSD_SYSCTL X+ {"FreeBSD_sysctl", freebsd_dev_list, freebsd_dev_init, freebsd_dev_get, freebsd_dev_term}, X+ #endif X {NULL, NULL, NULL, NULL, NULL} X }; X X #endif X+ X+ X+ END-of-wmnd/files/patch-ae echo x - wmnd/pkg-plist sed 's/^X//' >wmnd/pkg-plist << 'END-of-wmnd/pkg-plist' Xbin/wmnd Xshare/doc/wmnd/example/wmndrc X@dirrm share/doc/wmnd/example/ X@unexec rmdir %D/share/doc/wmnd/ 2>/dev/null || true END-of-wmnd/pkg-plist exit >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111011237.fA1Cbte75338>