From caed405144c70958347e03baf932ead636ee78ba Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 8 Mar 2004 22:41:05 +0000 Subject: [PATCH] Add -B to display buffer limits instead of current buffer usage. --- usr.bin/netstat/inet.c | 6 +++++- usr.bin/netstat/main.c | 8 ++++++-- usr.bin/netstat/netstat.1 | 8 ++++++-- usr.bin/netstat/netstat.h | 3 ++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 85bc18f486..69855f1d33 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -32,7 +32,7 @@ * * @(#)inet.c 8.5 (Berkeley) 5/24/95 * $FreeBSD: src/usr.bin/netstat/inet.c,v 1.37.2.11 2003/11/27 14:46:49 ru Exp $ - * $DragonFly: src/usr.bin/netstat/inet.c,v 1.9 2004/03/08 00:44:36 hsu Exp $ + * $DragonFly: src/usr.bin/netstat/inet.c,v 1.10 2004/03/08 22:41:05 dillon Exp $ */ #include @@ -246,6 +246,10 @@ protopr(u_long proto, /* for sysctl version we pass proto # */ snprintf(buf, 15, "%d/%d/%d", so->so_qlen, so->so_incqlen, so->so_qlimit); printf("%-14.14s ", buf); + } else if (Bflag) { + printf("%6ld %6ld ", + so->so_rcv.sb_hiwat, + so->so_snd.sb_hiwat); } else { printf("%6ld %6ld ", so->so_rcv.sb_cc, diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index a4280923e6..f1ba48d847 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1983, 1988, 1993 Regents of the University of California. All rights reserved. * @(#)main.c 8.4 (Berkeley) 3/1/94 * $FreeBSD: src/usr.bin/netstat/main.c,v 1.34.2.12 2001/09/17 15:17:46 ru Exp $ - * $DragonFly: src/usr.bin/netstat/main.c,v 1.5 2003/10/04 20:36:49 hmp Exp $ + * $DragonFly: src/usr.bin/netstat/main.c,v 1.6 2004/03/08 22:41:05 dillon Exp $ */ #include @@ -313,6 +313,7 @@ static int pflag; /* show given protocol */ int rflag; /* show routing tables (or routing stats) */ int sflag; /* show protocol statistics */ int tflag; /* show i/f watchdog timers */ +int Bflag; /* show buffer limit instead of buffer use */ int Wflag; /* wide display */ int zflag; /* zero stats */ @@ -331,7 +332,7 @@ main(int argc, char **argv) af = AF_UNSPEC; - while ((ch = getopt(argc, argv, "Aabdf:gI:iLlM:mN:np:rSstuWw:z")) != -1) + while ((ch = getopt(argc, argv, "Aabdf:gI:iLlM:mN:np:rSsBtuWw:z")) != -1) switch(ch) { case 'A': Aflag = 1; @@ -427,6 +428,9 @@ main(int argc, char **argv) case 'S': numeric_addr = 1; break; + case 'B': + Bflag = 1; + break; case 't': tflag = 1; break; diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1 index 71eba1c936..d8346bd2ac 100644 --- a/usr.bin/netstat/netstat.1 +++ b/usr.bin/netstat/netstat.1 @@ -31,7 +31,7 @@ .\" .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD: src/usr.bin/netstat/netstat.1,v 1.22.2.13 2003/05/03 22:10:02 keramida Exp $ -.\" $DragonFly: src/usr.bin/netstat/netstat.1,v 1.3 2003/08/24 23:16:53 hsu Exp $ +.\" $DragonFly: src/usr.bin/netstat/netstat.1,v 1.4 2004/03/08 22:41:05 dillon Exp $ .\" .Dd September 7, 2001 .Dt NETSTAT 1 @@ -90,7 +90,7 @@ but show ports symbolically. .Bk -words .Nm .Fl i | I Ar interface -.Op Fl abdnt +.Op Fl aBbdnt .Op Fl f Ar address_family .Op Fl M Ar core .Op Fl N Ar system @@ -120,6 +120,10 @@ is also present, show the number of dropped packets. If .Fl t is also present, show the contents of watchdog timers. +If +.Fl B +is also present, the maximum buffer sizes are displayed instead +of current buffer usage. .It Xo .Bk -words .Nm diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index 8ffc14105a..01f98b89c2 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -32,7 +32,7 @@ * * @(#)netstat.h 8.2 (Berkeley) 1/4/94 * $FreeBSD: src/usr.bin/netstat/netstat.h,v 1.16.2.7 2001/09/17 15:17:46 ru Exp $ - * $DragonFly: src/usr.bin/netstat/netstat.h,v 1.3 2003/08/24 23:16:53 hsu Exp $ + * $DragonFly: src/usr.bin/netstat/netstat.h,v 1.4 2004/03/08 22:41:05 dillon Exp $ */ #include @@ -50,6 +50,7 @@ extern int numeric_port; /* show ports numerically */ extern int rflag; /* show routing tables (or routing stats) */ extern int sflag; /* show protocol statistics */ extern int tflag; /* show i/f watchdog timers */ +extern int Bflag; /* show buffer limit instead of buffer use */ extern int Wflag; /* wide display */ extern int zflag; /* zero stats */ -- 2.41.0