From fa2622f284fb7eedcb68476008e6d8b5f6975568 Mon Sep 17 00:00:00 2001 From: kn Date: Thu, 8 Sep 2022 13:18:47 +0000 Subject: [PATCH] Remove useless -t "Make if.c kvm free by fetching the interface stats via sysctl ..." if.c r1.56 in 2008 neutered the -d and -t flags. -d functionality was eventually restored with if.c r1.76 in 2015. -t has been printing zeroes for over fourteen now; this cannot have been useful to anyone and noone complained about a wrong watchdog timer values. Remove -t entirely without printing a warning; `netstat -t ...' now fails. Feedback jsg OK jsg bluhm --- usr.bin/netstat/if.c | 8 +------- usr.bin/netstat/main.c | 12 ++++-------- usr.bin/netstat/netstat.1 | 12 ++++-------- usr.bin/netstat/netstat.h | 3 +-- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index f72415a2a1f..c51e158a5e6 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.79 2022/08/26 18:37:44 kn Exp $ */ +/* $OpenBSD: if.c,v 1.80 2022/09/08 13:18:47 kn Exp $ */ /* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */ /* @@ -120,8 +120,6 @@ intpr(int interval, int repeatcount) "Ipkts", if_errs->iname, "Opkts", if_errs->oname, "Colls"); } - if (tflag) - printf(" %s", "Time"); putchar('\n'); lim = buf + len; @@ -165,8 +163,6 @@ intpr(int interval, int repeatcount) ifd->ifi_iqdrops); total += if_errs->count(ifd->ifi_oerrors, ifd->ifi_oqdrops); - if (tflag) - total += 0; // XXX ifnet.if_timer; if (total == 0) continue; } @@ -300,8 +296,6 @@ hexprint: ifd->ifi_opackets, if_errs->count(ifd->ifi_oerrors, ifd->ifi_oqdrops), ifd->ifi_collisions); - if (tflag) - printf(" %4d", 0 /* XXX ifnet.if_timer */); putchar('\n'); } diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index f9c9ef5fb09..b168bc5855e 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.121 2021/01/26 18:22:45 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.122 2022/09/08 13:18:47 kn Exp $ */ /* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */ /* @@ -125,7 +125,6 @@ int qflag; /* only display non-zero values for output */ int rflag; /* show routing tables (or routing stats) */ int Rflag; /* show rdomain and rtable summary */ int sflag; /* show protocol statistics */ -int tflag; /* show i/f watchdog timers */ int vflag; /* be verbose */ int Wflag; /* show net80211 protocol statistics */ @@ -156,7 +155,7 @@ main(int argc, char *argv[]) tableid = getrtable(); while ((ch = getopt(argc, argv, - "AaBbc:deFf:ghI:iLlM:mN:np:P:qRrsT:tuvW:w:")) != -1) + "AaBbc:deFf:ghI:iLlM:mN:np:P:qRrsT:uvW:w:")) != -1) switch (ch) { case 'A': Aflag = 1; @@ -269,9 +268,6 @@ main(int argc, char *argv[]) errx(1, "invalid table id: %s", errstr); Tflag = 1; break; - case 't': - tflag = 1; - break; case 'u': af = AF_UNIX; break; @@ -485,8 +481,8 @@ usage(void) "usage: netstat [-AaBln] [-M core] [-N system] [-p protocol] [-T rtable]\n" " netstat -W interface\n" " netstat -m\n" - " netstat -I interface | -i [-bdehnqt]\n" - " netstat -w wait [-bdehnqt] [-c count] [-I interface]\n" + " netstat -I interface | -i [-bdehnq]\n" + " netstat -w wait [-bdehnq] [-c count] [-I interface]\n" " netstat -s [-gru] [-f address_family] [-p protocol]\n" " netstat -g [-lnu] [-f address_family]\n" " netstat -R\n" diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1 index 6d2d2a66561..40a11f7bae6 100644 --- a/usr.bin/netstat/netstat.1 +++ b/usr.bin/netstat/netstat.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: netstat.1,v 1.94 2022/06/19 13:59:22 claudio Exp $ +.\" $OpenBSD: netstat.1,v 1.95 2022/09/08 13:18:47 kn Exp $ .\" $NetBSD: netstat.1,v 1.11 1995/10/03 21:42:43 thorpej Exp $ .\" .\" Copyright (c) 1983, 1990, 1992, 1993 @@ -30,7 +30,7 @@ .\" .\" from: @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" -.Dd $Mdocdate: June 19 2022 $ +.Dd $Mdocdate: September 8 2022 $ .Dt NETSTAT 1 .Os .Sh NAME @@ -49,10 +49,10 @@ .Fl m .Nm .Fl I Ar interface | Fl i -.Op Fl bdehnqt +.Op Fl bdehnq .Nm .Fl w Ar wait -.Op Fl bdehnqt +.Op Fl bdehnq .Op Fl c Ar count .Op Fl I Ar interface .Nm @@ -277,10 +277,6 @@ If this option is repeated, counters with a value of zero are suppressed. .It Fl T Ar rtable Select an alternate routing table to query. The default is to use the current routing table. -.It Fl t -With the -.Fl i -option, display the current value of the watchdog timer function. .It Fl u Limit statistics or address control block reports to the .Dv AF_UNIX diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index 055223261a9..34ed48b339d 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.h,v 1.76 2021/01/26 18:22:45 deraadt Exp $ */ +/* $OpenBSD: netstat.h,v 1.77 2022/09/08 13:18:47 kn Exp $ */ /* $NetBSD: netstat.h,v 1.6 1996/05/07 02:55:05 thorpej Exp $ */ /* @@ -59,7 +59,6 @@ extern int qflag; /* only display non-zero values for output */ extern int rflag; /* show routing tables (or routing stats) */ extern int Rflag; /* show rdomain and rtable summary */ extern int sflag; /* show protocol statistics */ -extern int tflag; /* show i/f watchdog timers */ extern int vflag; /* be verbose */ extern int Wflag; /* show net80211 protocol statistics */ -- 2.20.1