Date: Sat, 21 Jun 2014 22:53:21 GMT From: zkorchev@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r269833 - soc2014/zkorchev/freebsd_head/usr.bin/netstat Message-ID: <201406212253.s5LMrLvd067741@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zkorchev Date: Sat Jun 21 22:53:21 2014 New Revision: 269833 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=269833 Log: netstat fixes Modified: soc2014/zkorchev/freebsd_head/usr.bin/netstat/inet.c soc2014/zkorchev/freebsd_head/usr.bin/netstat/inet6.c soc2014/zkorchev/freebsd_head/usr.bin/netstat/main.c soc2014/zkorchev/freebsd_head/usr.bin/netstat/route.c soc2014/zkorchev/freebsd_head/usr.bin/netstat/unix.c Modified: soc2014/zkorchev/freebsd_head/usr.bin/netstat/inet.c ============================================================================== --- soc2014/zkorchev/freebsd_head/usr.bin/netstat/inet.c Sat Jun 21 21:31:41 2014 (r269832) +++ soc2014/zkorchev/freebsd_head/usr.bin/netstat/inet.c Sat Jun 21 22:53:21 2014 (r269833) @@ -463,9 +463,9 @@ if (Oflag) { SOL_MAP_KEYL(&sol_stream, "socket"); if (istcp) - sol_integer(&sol_stream, (u_long)inp->inp_ppcb); // TODO hex? + sol_uinteger(&sol_stream, (u_long)inp->inp_ppcb); else - sol_integer(&sol_stream, (u_long)so->so_pcb); // TODO hex? + sol_uinteger(&sol_stream, (u_long)so->so_pcb); } else #endif @@ -710,9 +710,9 @@ } if (Rflag) { SOL_MAP_KEYL(&sol_stream, "inp flowid"); - sol_integer(&sol_stream, inp->inp_flowid); // TODO hex + sol_uinteger(&sol_stream, inp->inp_flowid); SOL_MAP_KEYL(&sol_stream, "inp flowtype"); - sol_integer(&sol_stream, inp->inp_flowtype); // TODO hex + sol_uinteger(&sol_stream, inp->inp_flowtype); } sol_map_end(&sol_stream); Modified: soc2014/zkorchev/freebsd_head/usr.bin/netstat/inet6.c ============================================================================== --- soc2014/zkorchev/freebsd_head/usr.bin/netstat/inet6.c Sat Jun 21 21:31:41 2014 (r269832) +++ soc2014/zkorchev/freebsd_head/usr.bin/netstat/inet6.c Sat Jun 21 22:53:21 2014 (r269833) @@ -485,7 +485,7 @@ SOL_MAP_KEYL(&sol_stream, "other");\ sol_integer(&sol_stream, (uintmax_t)ip6stat.s);\ SOL_MAP_KEYL(&sol_stream, "addresses scope");\ - sol_integer(&sol_stream, i); /* TODO hex? */\ + sol_uinteger(&sol_stream, i);\ }\ sol_map_end(&sol_stream);\ } while (0) Modified: soc2014/zkorchev/freebsd_head/usr.bin/netstat/main.c ============================================================================== --- soc2014/zkorchev/freebsd_head/usr.bin/netstat/main.c Sat Jun 21 21:31:41 2014 (r269832) +++ soc2014/zkorchev/freebsd_head/usr.bin/netstat/main.c Sat Jun 21 22:53:21 2014 (r269833) @@ -421,13 +421,6 @@ case 'n': numeric_addr = numeric_port = 1; break; - case 'O': -#if defined(SOL_ON) - Oflag = 1; -#else - errx(1, "-O support is not compiled in"); -#endif - break; case 'p': if ((tp = name2protox(optarg)) == NULL) { errx(1, @@ -502,7 +495,7 @@ #endif #if defined(SOL_ON) - if (Oflag) sol_init(&sol_stream, SOL_JSON); + Oflag = sol_init(&sol_stream); #endif /* @@ -902,20 +895,20 @@ { (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 [-46AaLnRSTWx] [-f protocol_family | -p protocol]\n" -" [-M core] [-N system] [-O]", +" [-M core] [-N system]", " netstat -i | -I interface [-46abdhnW] [-f address_family]\n" -" [-M core] [-N system] [-O]", -" netstat -w wait [-I interface] [-46d] [-M core] [-N system] [-q howmany] [-O]", +" [-M core] [-N system]", +" netstat -w wait [-I interface] [-46d] [-M core] [-N system] [-q howmany]", " netstat -s [-s] [-46z] [-f protocol_family | -p protocol]\n" -" [-M core] [-N system] [-O]", +" [-M core] [-N system]", " netstat -i | -I interface [-46s] [-f protocol_family | -p protocol]\n" -" [-M core] [-N system] [-O]", -" netstat -m [-M core] [-N system] [-O]", -" netstat -B [-I interface] [-O]", -" netstat -r [-46AanW] [-f address_family] [-M core] [-N system] [-O]", -" netstat -rs [-s] [-M core] [-N system] [-O]", -" netstat -g [-46W] [-f address_family] [-M core] [-N system] [-O]", -" netstat -gs [-46s] [-f address_family] [-M core] [-N system] [-O]", -" netstat -Q [-O]"); +" [-M core] [-N system]", +" netstat -m [-M core] [-N system]", +" netstat -B [-I interface]", +" netstat -r [-46AanW] [-f address_family] [-M core] [-N system]", +" netstat -rs [-s] [-M core] [-N system]", +" netstat -g [-46W] [-f address_family] [-M core] [-N system]", +" netstat -gs [-46s] [-f address_family] [-M core] [-N system]", +" netstat -Q"); exit(1); } Modified: soc2014/zkorchev/freebsd_head/usr.bin/netstat/route.c ============================================================================== --- soc2014/zkorchev/freebsd_head/usr.bin/netstat/route.c Sat Jun 21 21:31:41 2014 (r269832) +++ soc2014/zkorchev/freebsd_head/usr.bin/netstat/route.c Sat Jun 21 22:53:21 2014 (r269833) @@ -518,7 +518,7 @@ #if defined(SOL_ON) if (Oflag) { SOL_MAP_KEYL(&sol_stream, "address"); - sol_integer(&sol_stream, (u_long)rn); // TODO hex? + sol_uinteger(&sol_stream, (u_long)rn); } else #endif @@ -571,7 +571,7 @@ #if defined(SOL_ON) if (Oflag) { SOL_MAP_KEYL(&sol_stream, "address"); - sol_integer(&sol_stream, (u_long)rn); // TODO hex? + sol_uinteger(&sol_stream, (u_long)rn); } else #endif @@ -613,9 +613,9 @@ SOL_MAP_KEYL(&sol_stream, "bit"); sol_integer(&sol_stream, rnode.rn_bit); SOL_MAP_KEYL(&sol_stream, "left"); - sol_integer(&sol_stream, (u_long)rnode.rn_left); // TODO hex? + sol_uinteger(&sol_stream, (u_long)rnode.rn_left); SOL_MAP_KEYL(&sol_stream, "right"); - sol_integer(&sol_stream, (u_long)rnode.rn_right); // TODO hex? + sol_uinteger(&sol_stream, (u_long)rnode.rn_right); } else #endif @@ -634,7 +634,7 @@ if (Oflag) { SOL_MAP_KEYL(&sol_stream, "mk"); - sol_integer(&sol_stream, (u_long)rm); // TODO hex? + sol_uinteger(&sol_stream, (u_long)rm); SOL_MAP_KEYL(&sol_stream, "int?"); // TODO what is this field? sol_integer(&sol_stream, -1 - rmask.rm_bit); Modified: soc2014/zkorchev/freebsd_head/usr.bin/netstat/unix.c ============================================================================== --- soc2014/zkorchev/freebsd_head/usr.bin/netstat/unix.c Sat Jun 21 21:31:41 2014 (r269832) +++ soc2014/zkorchev/freebsd_head/usr.bin/netstat/unix.c Sat Jun 21 22:53:21 2014 (r269833) @@ -329,21 +329,21 @@ sol_string(&sol_stream, buf1, strlen(buf1)); } else { SOL_MAP_KEYL(&sol_stream, "address"); - sol_integer(&sol_stream, (long)so->so_pcb); + sol_uinteger(&sol_stream, (u_long)so->so_pcb); SOL_MAP_KEYL(&sol_stream, "type"); sol_string(&sol_stream, socktype[so->so_type], strlen(socktype[so->so_type])); SOL_MAP_KEYL(&sol_stream, "recv"); - sol_integer(&sol_stream, so->so_rcv.sb_cc); + sol_uinteger(&sol_stream, so->so_rcv.sb_cc); SOL_MAP_KEYL(&sol_stream, "send"); - sol_integer(&sol_stream, so->so_snd.sb_cc); + sol_uinteger(&sol_stream, so->so_snd.sb_cc); SOL_MAP_KEYL(&sol_stream, "inode"); - sol_integer(&sol_stream, (long)unp->unp_vnode); + sol_uinteger(&sol_stream, (u_long)unp->unp_vnode); SOL_MAP_KEYL(&sol_stream, "conn"); - sol_integer(&sol_stream, (long)unp->unp_conn); + sol_uinteger(&sol_stream, (u_long)unp->unp_conn); SOL_MAP_KEYL(&sol_stream, "refs"); - sol_integer(&sol_stream, (long)LIST_FIRST(&unp->unp_refs)); + sol_uinteger(&sol_stream, (u_long)LIST_FIRST(&unp->unp_refs)); SOL_MAP_KEYL(&sol_stream, "nextref"); - sol_integer(&sol_stream, (long)LIST_NEXT(unp, unp_reflink)); + sol_uinteger(&sol_stream, (u_long)LIST_NEXT(unp, unp_reflink)); } if (sa) { SOL_MAP_KEYL(&sol_stream, "path"); @@ -373,10 +373,10 @@ printf("unix %-14.14s", buf1); } else { printf("%8lx %-6.6s %6u %6u %8lx %8lx %8lx %8lx", - (long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc, - so->so_snd.sb_cc, (long)unp->unp_vnode, (long)unp->unp_conn, - (long)LIST_FIRST(&unp->unp_refs), - (long)LIST_NEXT(unp, unp_reflink)); + (u_long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc, + so->so_snd.sb_cc, (u_long)unp->unp_vnode, (u_long)unp->unp_conn, + (u_long)LIST_FIRST(&unp->unp_refs), + (u_long)LIST_NEXT(unp, unp_reflink)); } if (sa) printf(" %.*s",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406212253.s5LMrLvd067741>