Date: Thu, 30 Jul 2009 17:59:00 GMT From: Gabor Pali <pgj@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 166816 for review Message-ID: <200907301759.n6UHx0NG000744@repoman.freebsd.org>
index | next in thread | raw e-mail
http://perforce.freebsd.org/chv.cgi?CH=166816 Change 166816 by pgj@petymeg-current on 2009/07/30 17:58:16 Now netstat(1) uses libnetstat(3) for working with IPX statistics. Affected files ... .. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/extern.h#23 edit .. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/ipx.c#3 edit .. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/main.c#31 edit Differences ... ==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/extern.h#23 (text+ko) ==== @@ -139,7 +139,7 @@ void ipxprotopr(u_long, const char *, int, int); void spx_stats(u_long, const char *, int, int); -void ipx_stats(u_long, const char *, int, int); +void ipx_stats(const struct stat_type *); void ipxerr_stats(u_long, const char *, int, int); void nsprotopr(u_long, const char *, int, int); ==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/ipx.c#3 (text+ko) ==== @@ -230,25 +230,26 @@ * Dump IPX statistics structure. */ void -ipx_stats(u_long off, const char *name, int af1 __unused, int proto __unused) +ipx_stats(const struct stat_type *sttp) { - struct ipxstat ipxstat; - - if (off == 0) - return; - kread(off, (char *)&ipxstat, sizeof (ipxstat)); - printf("%s:\n", name); - ANYl(ipxstat.ipxs_total, "total packet", " received"); - ANYl(ipxstat.ipxs_badsum, "packet", " with bad checksums"); - ANYl(ipxstat.ipxs_tooshort, "packet", " smaller than advertised"); - ANYl(ipxstat.ipxs_toosmall, "packet", " smaller than a header"); - ANYl(ipxstat.ipxs_forward, "packet", " forwarded"); - ANYl(ipxstat.ipxs_cantforward, "packet", " not forwardable"); - ANYl(ipxstat.ipxs_delivered, "packet", " for this host"); - ANYl(ipxstat.ipxs_localout, "packet", " sent from this host"); - ANYl(ipxstat.ipxs_odropped, "packet", " dropped due to no bufs, etc."); - ANYl(ipxstat.ipxs_noroute, "packet", " discarded due to no route"); - ANYl(ipxstat.ipxs_mtutoosmall, "packet", " too big"); + const struct ipx_stat *s; +#define p(x,y,z) \ + if (netstat_ipxs_get_##x(s) || sflag <= 1) \ + printf("\t%ju %s%s%s\n", netstat_ipxs_get_##x(s), y, \ + plural(netstat_ipxs_get_##x(s)), z) + s = netstat_get_ipxstats(sttp); + p(total, "total packet", " received"); + p(badsum, "packet", " with bad checksums"); + p(tooshort, "packet", " smaller than advertised"); + p(toosmall, "packet", " smaller than a header"); + p(forward, "packet", " forwarded"); + p(cantforward, "packet", " not forwardable"); + p(delivered, "packet", " for this host"); + p(localout, "packet", " sent from this host"); + p(odropped, "packet", " dropped due to no bufs, etc."); + p(noroute, "packet", " discarded due to no route"); + p(mtutoosmall, "packet", " too big"); +#undef p } #ifdef IPXERRORMSGS ==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/main.c#31 (text+ko) ==== @@ -89,39 +89,37 @@ { .n_name = "_viftable" }, #define N_IPX 5 { .n_name = "_ipxpcb_list"}, -#define N_IPXSTAT 6 - { .n_name = "_ipxstat"}, -#define N_SPXSTAT 7 +#define N_SPXSTAT 6 { .n_name = "_spx_istat"}, -#define N_DDPCB 8 +#define N_DDPCB 7 { .n_name = "_ddpcb"}, -#define N_NGSOCKS 9 +#define N_NGSOCKS 8 { .n_name = "_ngsocklist"}, -#define N_IP6STAT 10 +#define N_IP6STAT 9 { .n_name = "_ip6stat" }, -#define N_IPSECSTAT 11 +#define N_IPSECSTAT 10 { .n_name = "_ipsec4stat" }, -#define N_IPSEC6STAT 12 +#define N_IPSEC6STAT 11 { .n_name = "_ipsec6stat" }, -#define N_MRT6STAT 13 +#define N_MRT6STAT 12 { .n_name = "_mrt6stat" }, -#define N_MF6CTABLE 14 +#define N_MF6CTABLE 13 { .n_name = "_mf6ctable" }, -#define N_MIF6TABLE 15 +#define N_MIF6TABLE 14 { .n_name = "_mif6table" }, -#define N_PFKEYSTAT 16 +#define N_PFKEYSTAT 15 { .n_name = "_pfkeystat" }, -#define N_RTTRASH 17 +#define N_RTTRASH 16 { .n_name = "_rttrash" }, -#define N_PFSYNCSTAT 18 +#define N_PFSYNCSTAT 17 { .n_name = "_pfsyncstats" }, -#define N_AHSTAT 19 +#define N_AHSTAT 18 { .n_name = "_ahstat" }, -#define N_ESPSTAT 20 +#define N_ESPSTAT 19 { .n_name = "_espstat" }, -#define N_IPCOMPSTAT 21 +#define N_IPCOMPSTAT 20 { .n_name = "_ipcompstat" }, -#define N_MFCTABLESIZE 22 +#define N_MFCTABLESIZE 21 { .n_name = "_mfctablesize" }, { .n_name = NULL }, }; @@ -229,8 +227,8 @@ #endif #ifdef IPX struct protox ipxprotox[] = { - { N_IPX, N_IPXSTAT, 1, ipxprotopr, NULL, stat_MAX, - ipx_stats, NULL, "ipx", 0, 0 }, + { N_IPX, 0, 1, ipxprotopr, ipx_stats, stat_IPX, + NULL, NULL, "ipx", 0, 0 }, { N_IPX, N_SPXSTAT, 1, ipxprotopr, NULL, stat_MAX, spx_stats, NULL, "spx", 0, 0 }, { -1, -1, 0, NULL, NULL, stat_MAX,help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907301759.n6UHx0NG000744>
