diff options
Diffstat (limited to 'freebsd/usr.bin/netstat/main.c')
-rw-r--r-- | freebsd/usr.bin/netstat/main.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/freebsd/usr.bin/netstat/main.c b/freebsd/usr.bin/netstat/main.c index acb256d5..e4e7dce1 100644 --- a/freebsd/usr.bin/netstat/main.c +++ b/freebsd/usr.bin/netstat/main.c @@ -348,10 +348,14 @@ int noutputs = 0; /* how much outputs before we exit */ int numeric_addr; /* show addresses numerically */ int numeric_port; /* show ports numerically */ static int pflag; /* show given protocol */ +#ifndef __rtems__ +int Qflag; /* show netisr information */ +#endif /* __rtems__ */ int rflag; /* show routing tables (or routing stats) */ int sflag; /* show protocol statistics */ int tflag; /* show i/f watchdog timers */ int Wflag; /* wide display */ +int Tflag; /* TCP Information */ int xflag; /* extra information, includes all socket buffer info */ int zflag; /* zero stats */ @@ -431,7 +435,8 @@ main(int argc, char *argv[]) af = AF_UNSPEC; - while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:q:rSstuWw:xz")) != -1) + while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:Qq:rSTstuWw:xz")) + != -1) switch(ch) { case 'A': Aflag = 1; @@ -517,6 +522,11 @@ main(int argc, char *argv[]) } pflag = 1; break; +#ifndef __rtems__ + case 'Q': + Qflag = 1; + break; +#endif /* __rtems__ */ case 'q': noutputs = atoi(optarg); if (noutputs != 0) @@ -545,6 +555,9 @@ main(int argc, char *argv[]) interval = atoi(optarg); iflag = 1; break; + case 'T': + Tflag = 1; + break; case 'x': xflag = 1; break; @@ -584,6 +597,9 @@ main(int argc, char *argv[]) if (!live) setgid(getgid()); + if (xflag && Tflag) + errx(1, "-x and -T are incompatible, pick one."); + if (Bflag) { if (!live) usage(); @@ -598,6 +614,16 @@ main(int argc, char *argv[]) mbpr(NULL, 0); exit(0); } +#ifndef __rtems__ + if (Qflag) { + if (!live) { + if (kread(0, NULL, 0) == 0) + netisr_stats(kvmd); + } else + netisr_stats(NULL); + exit(0); + } +#endif /* __rtems__ */ #if 0 /* * Keep file descriptors open to avoid overhead @@ -864,8 +890,8 @@ name2protox(const char *name) static void usage(void) { - (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", -"usage: netstat [-AaLnSWx] [-f protocol_family | -p protocol]\n" + (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", +"usage: netstat [-AaLnSTWx] [-f protocol_family | -p protocol]\n" " [-M core] [-N system]", " netstat -i | -I interface [-abdhntW] [-f address_family]\n" " [-M core] [-N system]", @@ -879,6 +905,7 @@ usage(void) " netstat -r [-AanW] [-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]"); +" netstat -gs [-s] [-f address_family] [-M core] [-N system]", +" netstat -Q"); exit(1); } |