1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

No longer borken for ELF. Honor PREFIX and CFLAGS. Fix build on alpha.

Use X11BASE to find the X11R6 directory.  Give rid up a bunch of extra
cruft in patch-aa and split into one patch per file.
This commit is contained in:
Steve Price 1999-01-26 02:56:30 +00:00
parent 3cf6d3ef12
commit 1265dc060e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=16329
8 changed files with 437 additions and 1107 deletions

View File

@ -3,7 +3,7 @@
# Date created: 30 January 1998
# Whom: Sean Cole <scole@aracnet.com>
#
# $Id: Makefile,v 1.7 1998/10/13 23:53:28 jseger Exp $
# $Id: Makefile,v 1.8 1998/11/21 07:27:39 steve Exp $
#
DISTNAME= pppload-1.0
@ -12,8 +12,6 @@ MASTER_SITES= http://sunsite.unc.edu/pub/Linux/system/network/serial/ppp/
MAINTAINER= ports@FreeBSD.ORG
BROKEN_ELF= yes
USE_QT= yes
USE_GMAKE= yes

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
diff -u --new-file pppload-1.0/Options.C ./Options.C
--- pppload-1.0/Options.C Tue Sep 10 16:55:27 1996
+++ ./Options.C Fri Jan 30 20:01:38 1998
@@ -24,7 +24,7 @@
#include "Options.H"
Options::Options( int argc, char* argv[] )
-: _divider( 512 ), _interval( 5 ), _link( 0 ), _period( 60 ), _retry( 60 ), _showTx( true ), _showRx( true ), _txColor( "forestgreen" ), _rxColor( "red" )
+: _divider( 512 ), _interval( 5 ), _device("tun"), _link( 0 ), _period( 60 ), _retry( 60 ), _showTx( true ), _showRx( true ), _txColor( "forestgreen" ), _rxColor( "red" )
{
for ( int i = 1; i < argc; i++ ) {
if ( !strcmp( argv[i], "-cmd" ) ) {
@@ -33,6 +33,8 @@
sscanf( argv[++i], "%d", &_divider );
} else if ( !strcmp( argv[i], "-i" ) ) {
sscanf( argv[++i], "%d", &_interval );
+ } else if ( !strcmp( argv[i], "-device" ) ) {
+ strcpy(_device,argv[++i]);
} else if ( !strcmp( argv[i], "-link" ) ) {
sscanf( argv[++i], "%d", &_link );
} else if ( !strcmp( argv[i], "-p" ) ) {
@@ -60,6 +62,7 @@
fprintf( stderr, "-d n Horizontal divider spacing in bytes per second (default: %d).\n", divider() );
fprintf( stderr, "-h Print this help.\n" );
fprintf( stderr, "-i interval Set the polling interval to be 'interval' seconds (default: %d).\n", interval() );
+ fprintf( stderr, "-device name Name of the device to monitor (default is tun). \n");
fprintf( stderr, "-link link The PPP link number to monitor (default: %d).\n", link() );
fprintf( stderr, "-p period Set the load averaging period to be 'period seconds (default: %d).\n", period() );
fprintf( stderr, "-retry interval Time between retries when dialling PPP link (default: %d).\n", retry() );
@@ -74,7 +77,7 @@
fprintf( stderr, "pppload comes with ABSOLUTELY NO WARRANTY; for details see the LICENSE file.\n" );
fprintf( stderr, "This is free software, and you are welcome to redistribute it\n" );
fprintf( stderr, "under certain conditions; see the LICENSE file for details.\n" );
-
+ fprintf( stderr, "Modified for FreeBSD 1998 \n");
exit( 1 );
}
}

View File

@ -0,0 +1,27 @@
diff -u --new-file pppload-1.0/Options.H ./Options.H
--- pppload-1.0/Options.H Tue Sep 10 16:53:36 1996
+++ ./Options.H Thu Jan 29 21:12:01 1998
@@ -31,6 +31,8 @@
int _divider;
//: Statistics polling interval in seconds.
int _interval;
+ //: Network device to monitor
+ char _device[4];
//: PPP link number to monitor.
int _link;
//: Load averaging interval in seconds.
@@ -49,9 +51,12 @@
//: Extract command line opotions from argc and argv.
Options( int argc, char* argv[] );
- //: Return the PPP command.
- QString& cmd() { return _cmd; }
+ //: Return the PPP command.
+ QString& cmd() { return _cmd; }
+ //: Return the name of the device being monitored
+ char * device() { return _device; }
+
//: Return the spacing between horizontal dividers.
int divider() { return _divider; }

115
net/pppload/files/patch-ad Normal file
View File

@ -0,0 +1,115 @@
diff -u --new-file pppload-1.0/PPPStats.C ./PPPStats.C
--- pppload-1.0/PPPStats.C Wed Sep 11 19:50:13 1996
+++ ./PPPStats.C Fri Jan 30 20:16:04 1998
@@ -19,16 +19,22 @@
extern "C" {
#include <stdlib.h>
-#include <errno.h>
#include <stdio.h>
+#include <sys/types.h>
+#include <sys/select.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <net/if.h>
-#include <linux/ppp_defs.h>
+#include <sys/time.h>
+#include <net/if.h>
+#include <net/if_ppp.h>
}
#include "PPPStats.H"
#include "Options.H"
+#include <iostream.h>
+
+void get_command(char *);
+char command[200];
typedef struct
{
@@ -53,38 +59,42 @@
system( (const char*)options->cmd() );
}
- DclPPPInfo PPPInfo[1];
- struct ifreq ifreq;
+ DclPPPInfo PPPInfo[1];
+ struct ifpppstatsreq ifreq;
struct ppp_stats* PPPStat;
- struct ppp_stats LastPPPStat[1];
-
- memset (& ifreq, 0, sizeof (ifreq));
- sprintf (ifreq.ifr_ifrn.ifrn_name, "ppp%d", options->link());
+ struct ppp_stats LastPPPStat[1];
- ifreq.ifr_ifru.ifru_data = (caddr_t) PPPInfo;
+ memset (&ifreq, 0, sizeof (ifreq));
+ sprintf (ifreq.ifr_name, "%s%d",(const char*)options->device(),options->link());
+
PPPStat = & PPPInfo->stats;
memset (LastPPPStat, 0, sizeof (LastPPPStat));
- if ( (ioctl (_s, SIOCDEVPRIVATE, (caddr_t) & ifreq) < 0) ||
- ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) ||
- ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 ) )
- ) {
- if ( _isUp ) {
- _isUp = false;
- emit linkDown();
- if ( options->cmd().length() ) {
- _retryId = startTimer( options->retry() * 1000 );
- system( (const char*)options->cmd() );
- }
- }
- PPPStat->p.ppp_ibytes = 0;
- PPPStat->p.ppp_obytes = 0;
+ get_command(ifreq.ifr_name);
+ FILE * fptr;
+ fptr=popen(command,"r+");
+ fscanf(fptr,"%u%u",&PPPStat->p.ppp_ibytes,&PPPStat->p.ppp_obytes);
+ pclose(fptr);
+
+ if ( ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) ||
+ ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 ))
+ ) {
+ if ( _isUp ) {
+ _isUp = false;
+ emit linkDown();
+ if ( options->cmd().length() ) {
+ _retryId = startTimer( options->retry() * 1000 );
+ system( (const char*)options->cmd() );
+ }
+ }
+ PPPStat->p.ppp_ibytes = 0;
+ PPPStat->p.ppp_obytes = 0;
} else if ( !_isUp ) {
- _isUp = true;
- killTimer( _retryId );
- _retryId = -1;
+ _isUp = true;
+ killTimer( _retryId );
+ _retryId = -1;
}
-
+
unsigned int rxDelta = PPPStat->p.ppp_ibytes - _rxTotal;
unsigned int txDelta = PPPStat->p.ppp_obytes - _txTotal;
_rxTotal = PPPStat->p.ppp_ibytes;
@@ -92,4 +102,17 @@
if ( rxDelta == _rxTotal ) rxDelta = 0;
if ( txDelta == _txTotal ) txDelta = 0;
emit changeStats( rxDelta, txDelta, _rxTotal, _txTotal );
+
+}
+
+void get_command(char * interface) {
+ /*"/usr/bin/netstat -b -I tun0 | /usr/bin/grep Link | awk '{print $(NF-4),$(NF-1)}' */
+ const char * netstat_command ="/usr/bin/netstat -n -b -I ";
+ const char * grep_command =" | /usr/bin/grep Link | /usr/bin/awk '{print $(NF-4),$(NF-1)}'";
+ command[0]='\0';
+ strcat(command,netstat_command);
+ strcat(command,interface);
+ strcat(command,grep_command);
}
+
+

124
net/pppload/files/patch-ae Normal file
View File

@ -0,0 +1,124 @@
diff -u --new-file pppload-1.0/PPPStats.C.ppp ./PPPStats.C.ppp
--- pppload-1.0/PPPStats.C.ppp Wed Dec 31 16:00:00 1969
+++ ./PPPStats.C.ppp Wed Jan 28 18:27:30 1998
@@ -0,0 +1,120 @@
+// pppload - A PPP Load Monitor
+// Copyright (C) 1996 Sean Vyain
+// svyain@mail.tds.net
+// smvyain@softart.com
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+extern "C" {
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/select.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <net/if.h>
+#include <net/if_ppp.h>
+#include <net/if_var.h>
+#include <net/if_tun.h>
+}
+
+#include "PPPStats.H"
+#include "Options.H"
+#include <iostream.h>
+
+
+typedef struct
+{
+ struct ppp_stats stats;
+} DclPPPInfo;
+
+PPPStats::PPPStats()
+: _rxTotal( 0 ), _txTotal( 0 ), _isUp( true ), _retryId( -1 )
+{
+ if ((_s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ perror("couldn't create IP socket");
+ exit(1);
+ }
+
+ startTimer( options->interval() * 1000 );
+}
+
+void PPPStats::timerEvent( QTimerEvent* e )
+{
+ if ( e->timerId() == _retryId )
+ {
+ system( (const char*)options->cmd() );
+ }
+
+ DclPPPInfo PPPInfo[1]; // what is this var for?
+ struct ifpppstatsreq ifreq; // ifreq ifreq;
+ struct ppp_stats* PPPStat;
+ struct ppp_stats LastPPPStat[1]; // what is this var for?
+
+ memset (&ifreq, 0, sizeof (ifreq));
+// sprintf (ifreq.ifr_ifrn.ifrn_name, "ppp%d", options->link());
+ sprintf (ifreq.ifr_name, "tun%d", options->link());
+
+// ifreq.ifr_ifru.ifru_data = (caddr_t) PPPInfo;
+
+ PPPStat = & PPPInfo->stats;
+ memset (LastPPPStat, 0, sizeof (LastPPPStat));
+
+
+
+// if ( (ioctl (_s, SIOCDEVPRIVATE, (caddr_t) & ifreq) < 0) ||
+// ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) ||
+// ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 ) )
+ if ( (ioctl (_s, SIOCGPPPSTATS , &ifreq) < 0) ||
+ ( _isUp && ( ifreq.stats.p.ppp_ibytes < _rxTotal ) ) ||
+ ( !_isUp && ( ifreq.stats.p.ppp_ibytes == 0 ))
+ ) {
+ if ( _isUp ) {
+ _isUp = false;
+ emit linkDown();
+ if ( options->cmd().length() ) {
+ _retryId = startTimer( options->retry() * 1000 );
+ system( (const char*)options->cmd() );
+ }
+ }
+ PPPStat->p.ppp_ibytes = 0;
+ PPPStat->p.ppp_obytes = 0;
+ } else if ( !_isUp ) {
+ _isUp = true;
+ killTimer( _retryId );
+ _retryId = -1;
+ }
+
+ PPPStat->p.ppp_ibytes=ifreq.stats.p.ppp_ibytes;
+ PPPStat->p.ppp_obytes=ifreq.stats.p.ppp_obytes;
+
+
+cout<<ifreq.stats.p.ppp_ibytes<<" "<<ifreq.stats.p.ppp_ipackets<<" "
+ <<ifreq.stats.p.ppp_ierrors<<" "<<ifreq.stats.p.ppp_obytes <<" "
+ <<ifreq.stats.p.ppp_opackets<<" "<<ifreq.stats.p.ppp_oerrors<<endl
+ <<PPPStat->p.ppp_ibytes<<" "<<PPPStat->p.ppp_ipackets<<" "
+ <<PPPStat->p.ppp_ierrors<<" "<<PPPStat->p.ppp_obytes <<" "
+ <<PPPStat->p.ppp_opackets<<" "<<PPPStat->p.ppp_oerrors<<endl;
+ unsigned int rxDelta = PPPStat->p.ppp_ibytes - _rxTotal;
+ unsigned int txDelta = PPPStat->p.ppp_obytes - _txTotal;
+ _rxTotal = PPPStat->p.ppp_ibytes;
+ _txTotal = PPPStat->p.ppp_obytes;
+ if ( rxDelta == _rxTotal ) rxDelta = 0;
+ if ( txDelta == _txTotal ) txDelta = 0;
+ emit changeStats( rxDelta, txDelta, _rxTotal, _txTotal );
+
+}
+

View File

@ -0,0 +1,49 @@
diff -u --new-file pppload-1.0/README.freebsd ./README.freebsd
--- pppload-1.0/README.freebsd Wed Dec 31 16:00:00 1969
+++ ./README.freebsd Fri Jan 30 20:14:36 1998
@@ -0,0 +1,45 @@
+PPPLoad is designed to display the current throughput of a particular
+PPP link in a format that is similar to xload. Written by Sean Vyain.
+
+This is a FreeBSD port of the linux program called pppload, available at
+http://sunsite.unc.edu/pub/Linux/system/network/serial/ppp/pppload-1.0.tar.gz
+
+Original program homepage at:
+http://www.geocities.com/SiliconValley/Pines/1029/pppload.html
+
+I have modified the FreeBSD port to be able to show the throughput of
+any network device that will work with netstat, e.g. tun, ppp, ed,
+etc. I just wanted a program to nicely display throughput
+statistics for the tun device.
+
+ Examples of usage:
+For tun0 (tun is the default device,0 is the default link number):
+% pppload &
+
+For first ne2000 clone:
+% pppload -device ed -link 0 &
+
+for ppp2:
+% pppload -device ppp -link 2 &
+
+BUGS
+Command line is awkward with -device and -link.
+
+Can't detect whether the network device is up or not, so any command
+line options like -cmd -percmd -retry probably don't work. This is
+different that the original linux version.
+
+Keeps track of all packets network device has ever used, even if it
+has gone down then up again. This is also different than the linux
+version.
+
+Requires awk, grep, and netstat to get the data. Very short polling
+time are definitely not recommended.
+
+Network interface names are limited to a total of 4 characters or less
+at the moment, e.g. ppp0 ed3 ze1.
+
+
+Documentation of this FreeBSD port is not complete.
+
+

View File

@ -0,0 +1,64 @@
diff -u --new-file pppload-1.0/pppload.1 ./pppload.1
--- pppload-1.0/pppload.1 Tue Sep 10 16:56:20 1996
+++ ./pppload.1 Fri Jan 30 21:35:55 1998
@@ -3,7 +3,7 @@
pppload \- display an xload-style graph of PPP activity
.SH SYNOPSIS
.B pppload
-[\-cmd ppp_cmd] [\-i interval] [\-p period] [\-retry interval] [\-rx] [\-norx]
+[\-cmd ppp_cmd] [\-i interval] [\-device name] [\-p period] [\-retry interval] [\-rx] [\-norx]
[\-rxcolor color] [\-tx] [\-notx] [\-txcolor color]
.SH DESCRIPTION
.BR pppload
@@ -28,6 +28,9 @@
.I "\-h"
Print command line usage.
.TP
+.I "\-device name"
+Network device to monitor (default: tun)
+.TP
.I "\-i interval"
The statistics polling interval in seconds (default: 5).
.TP
@@ -60,3 +63,41 @@
The name of the color to draw transmit rates in (default: red).
.SH AUTHOR
Sean Vyain <svyain@mail.tds.net, smvyain@softart.com>
+www.geocities.com/SiliconValley/Pines/1029/pppload.html
+
+.SH FREEBSD PORT
+Examples of usage for the FreeBSD port:
+
+For tun0 (tun is the default device,0 is the default link number):
+
+% pppload &
+
+For the first ne2000 ethernet card:
+
+% pppload -device ed -link 0 &
+
+for the third ppp device:
+
+% pppload -device ppp -link 2 &
+
+.SH BUGS
+The port to FreeBSD can't determine when the link is up or down, so
+some of the command line options like
+.I "\-cmd"
+.I "\-percmd"
+may not work.
+
+Command line is awkward with -device and -link.
+
+Keeps track of all packets network device has ever used, even if it
+has gone down then up again. This is different than the linux
+version.
+
+Requires awk, grep, and netstat to get the data. Very short polling
+times are definitely not recommended.
+
+Network interface names are limited to a total of 4 characters or less
+at the moment, e.g. ppp0 ed3 ze1.
+
+
+Modified January 1998