summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/netstat/inet.c82
1 files changed, 37 insertions, 45 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 29595af..1653018 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -411,44 +411,47 @@ protopr(u_long off, const char *name, int af1, int proto)
"Current listen queue sizes (qlen/incqlen/maxqlen)");
putchar('\n');
if (Aflag)
- printf("%-8.8s ", "Tcpcb");
+ printf("%-*s ", 2 * (int)sizeof(void *), "Tcpcb");
if (Lflag)
- printf("%-5.5s %-14.14s %-22.22s\n",
+ printf((Aflag && !Wflag) ?
+ "%-5.5s %-14.14s %-18.18s" :
+ "%-5.5s %-14.14s %-22.22s",
"Proto", "Listen", "Local Address");
- if (Tflag)
+ else if (Tflag)
printf((Aflag && !Wflag) ?
- "%-5.5s %-6.6s %-6.6s %-6.6s %-18.18s %s\n" :
- "%-5.5s %-6.6s %-6.6s %-6.6s %-22.22s %s\n",
+ "%-5.5s %-6.6s %-6.6s %-6.6s %-18.18s %s" :
+ "%-5.5s %-6.6s %-6.6s %-6.6s %-22.22s %s",
"Proto", "Rexmit", "OOORcv", "0-win",
"Local Address", "Foreign Address");
+ else {
+ printf((Aflag && !Wflag) ?
+ "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s" :
+ "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s",
+ "Proto", "Recv-Q", "Send-Q",
+ "Local Address", "Foreign Address");
+ if (!xflag)
+ printf(" (state)");
+ }
if (xflag) {
- printf("%-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s ",
+ printf(" %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s",
"R-MBUF", "S-MBUF", "R-CLUS",
"S-CLUS", "R-HIWA", "S-HIWA",
"R-LOWA", "S-LOWA", "R-BCNT",
"S-BCNT", "R-BMAX", "S-BMAX");
- printf("%7.7s %7.7s %7.7s %7.7s %7.7s %7.7s %s\n",
+ printf(" %7.7s %7.7s %7.7s %7.7s %7.7s %7.7s",
"rexmt", "persist", "keep",
- "2msl", "delack", "rcvtime",
- "(state)");
- }
- if (!xflag && !Tflag) {
- printf((Aflag && !Wflag) ?
- "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s" :
- "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s",
- "Proto", "Recv-Q", "Send-Q",
- "Local Address", "Foreign Address");
- printf("(state)\n");
+ "2msl", "delack", "rcvtime");
}
+ putchar('\n');
first = 0;
}
if (Lflag && so->so_qlimit == 0)
continue;
if (Aflag) {
if (istcp)
- printf("%8lx ", (u_long)inp->inp_ppcb);
+ printf("%*lx ", 2 * (int)sizeof(void *), (u_long)inp->inp_ppcb);
else
- printf("%8lx ", (u_long)so->so_pcb);
+ printf("%*lx ", 2 * (int)sizeof(void *), (u_long)so->so_pcb);
}
#ifdef INET6
if ((inp->inp_vflag & INP_IPV6) != 0)
@@ -527,32 +530,21 @@ protopr(u_long off, const char *name, int af1, int proto)
#endif /* INET6 */
}
if (xflag) {
- if (Lflag)
- printf("%21s %6u %6u %6u %6u %6u %6u %6u %6u %6u %6u %6u %6u ",
- " ",
- so->so_rcv.sb_mcnt, so->so_snd.sb_mcnt,
- so->so_rcv.sb_ccnt, so->so_snd.sb_ccnt,
- so->so_rcv.sb_hiwat, so->so_snd.sb_hiwat,
- so->so_rcv.sb_lowat, so->so_snd.sb_lowat,
- so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt,
- so->so_rcv.sb_mbmax, so->so_snd.sb_mbmax);
- else {
- printf("%6u %6u %6u %6u %6u %6u %6u %6u %6u %6u %6u %6u ",
- so->so_rcv.sb_mcnt, so->so_snd.sb_mcnt,
- so->so_rcv.sb_ccnt, so->so_snd.sb_ccnt,
- so->so_rcv.sb_hiwat, so->so_snd.sb_hiwat,
- so->so_rcv.sb_lowat, so->so_snd.sb_lowat,
- so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt,
- so->so_rcv.sb_mbmax, so->so_snd.sb_mbmax);
- if (timer != NULL)
- printf("%4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d ",
- timer->tt_rexmt / 1000, (timer->tt_rexmt % 1000) / 10,
- timer->tt_persist / 1000, (timer->tt_persist % 1000) / 10,
- timer->tt_keep / 1000, (timer->tt_keep % 1000) / 10,
- timer->tt_2msl / 1000, (timer->tt_2msl % 1000) / 10,
- timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
- timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
- }
+ printf("%6u %6u %6u %6u %6u %6u %6u %6u %6u %6u %6u %6u",
+ so->so_rcv.sb_mcnt, so->so_snd.sb_mcnt,
+ so->so_rcv.sb_ccnt, so->so_snd.sb_ccnt,
+ so->so_rcv.sb_hiwat, so->so_snd.sb_hiwat,
+ so->so_rcv.sb_lowat, so->so_snd.sb_lowat,
+ so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt,
+ so->so_rcv.sb_mbmax, so->so_snd.sb_mbmax);
+ if (timer != NULL)
+ printf(" %4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d",
+ timer->tt_rexmt / 1000, (timer->tt_rexmt % 1000) / 10,
+ timer->tt_persist / 1000, (timer->tt_persist % 1000) / 10,
+ timer->tt_keep / 1000, (timer->tt_keep % 1000) / 10,
+ timer->tt_2msl / 1000, (timer->tt_2msl % 1000) / 10,
+ timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
+ timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
}
if (istcp && !Lflag && !xflag && !Tflag) {
if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
OpenPOWER on IntegriCloud