From abd1027a01880a215e2c2f5c955c21a22e7424bd Mon Sep 17 00:00:00 2001 From: alfred Date: Tue, 23 Dec 2003 13:24:03 +0000 Subject: Restore old netstat -m output. A new flag '-c' can be used to ask for the cache stats. --- usr.bin/netstat/main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'usr.bin/netstat/main.c') diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 145f740..6d70371 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -256,6 +256,7 @@ static char *nlistf = NULL, *memf = NULL; int Aflag; /* show addresses of protocol control block */ int aflag; /* show all sockets (including servers) */ int bflag; /* show i/f total bytes in/out */ +int cflag; /* show mbuf cache information */ int dflag; /* show i/f dropped packets */ int gflag; /* show group (multicast) routing or stats */ int iflag; /* show interfaces */ @@ -285,7 +286,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, "Aabcdf:gI:iLlM:mN:np:rSstuWw:z")) != -1) switch(ch) { case 'A': Aflag = 1; @@ -296,6 +297,9 @@ main(int argc, char *argv[]) case 'b': bflag = 1; break; + case 'c': + cflag = 1; + break; case 'd': dflag = 1; break; @@ -421,6 +425,10 @@ main(int argc, char *argv[]) if (nlistf != NULL || memf != NULL) setgid(getgid()); + if (cflag && !mflag) { + (void)fprintf(stderr, "-c only valid with -m\n"); + usage(); + } if (mflag) { if (memf != NULL) { if (kread(0, 0, 0) == 0) @@ -686,8 +694,8 @@ usage(void) " netstat -s [-s] [-z] [-f protocol_family | -p protocol] [-M core]", " netstat -i | -I interface -s [-f protocol_family | -p protocol]\n" " [-M core] [-N system]", -" netstat -m [-M core] [-N system]", -" netstat -r [-AanW] [-f address_family] [-M core] [-N system]", +" netstat -m [-c] [-M core] [-N system]", +" netstat -r [-AenW] [-f address_family] [-M core] [-N system]", " netstat -rs [-s] [-M core] [-N system]", " netstat -g [-W] [-f address_family] [-M core] [-N system]", " netstat -gs [-s] [-f address_family] [-M core] [-N system]"); -- cgit v1.1