svn commit: r220125 - stable/8/usr.bin/netstat
Ruslan Ermilov
ru at FreeBSD.org
Tue Mar 29 11:54:23 UTC 2011
Author: ru
Date: Tue Mar 29 11:54:22 2011
New Revision: 220125
URL: http://svn.freebsd.org/changeset/base/220125
Log:
MFC r220041:
Fixed sockets display somewhat (-L, -T, -x, -Lx, with and without -A).
(I didn't try to fix negative TCP timers with -x.)
Also, fixed a mismerge of -T option in r216964 -- it erroneously added
headers for TCP timers to -x.
Modified:
stable/8/usr.bin/netstat/inet.c
Directory Properties:
stable/8/usr.bin/netstat/ (props changed)
Modified: stable/8/usr.bin/netstat/inet.c
==============================================================================
--- stable/8/usr.bin/netstat/inet.c Tue Mar 29 06:42:52 2011 (r220124)
+++ stable/8/usr.bin/netstat/inet.c Tue Mar 29 11:54:22 2011 (r220125)
@@ -404,43 +404,44 @@ protopr(u_long off, const char *name, in
"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\n",
- "rexmt", "persist", "keep",
- "2msl", "delack", "rcvtime");
- }
- 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");
}
+ 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)
@@ -521,23 +522,13 @@ protopr(u_long off, const char *name, in
#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);
+ 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 (istcp && !Lflag && !xflag && !Tflag) {
if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
More information about the svn-src-stable-8
mailing list