From owner-p4-projects@FreeBSD.ORG Fri Jul 31 22:32:18 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 229C71065674; Fri, 31 Jul 2009 22:32:18 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7E691065672 for ; Fri, 31 Jul 2009 22:32:17 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BB7038FC15 for ; Fri, 31 Jul 2009 22:32:17 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n6VMWH93092373 for ; Fri, 31 Jul 2009 22:32:17 GMT (envelope-from pgj@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n6VMWH3D092371 for perforce@freebsd.org; Fri, 31 Jul 2009 22:32:17 GMT (envelope-from pgj@FreeBSD.org) Date: Fri, 31 Jul 2009 22:32:17 GMT Message-Id: <200907312232.n6VMWH3D092371@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to pgj@FreeBSD.org using -f From: Gabor Pali To: Perforce Change Reviews Cc: Subject: PERFORCE change 166884 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2009 22:32:18 -0000 http://perforce.freebsd.org/chv.cgi?CH=166884 Change 166884 by pgj@petymeg-current on 2009/07/31 22:31:31 The old statistics "framework" has been replaced for a new one by applying libnetstat(3). Affected files ... .. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/main.c#44 edit Differences ... ==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/main.c#44 (text+ko) ==== @@ -103,109 +103,108 @@ u_char pr_wanted; /* 1 if wanted, 0 otherwise */ void (*pr_cblocks)(u_long, const char *, int, int); /* control blocks printing routine */ - void (*pr_nstats)(const struct stat_type *); + void (*pr_stats)(const struct stat_type *); + /* statistics printing routine */ enum stat pr_stx; - void (*pr_stats)(u_long, const char *, int, int); - /* statistics printing routine */ void (*pr_istats)(char *); /* per/if statistics printing routine */ const char *pr_name; /* well-known name */ int pr_usesysctl; /* non-zero if we use sysctl, not kvm */ int pr_protocol; } protox[] = { { 0, 1, NULL, tcp_stats, stat_TCP, - NULL, NULL, "tcp", 1, IPPROTO_TCP }, + NULL, "tcp", 1, IPPROTO_TCP }, { 0, 1, NULL, udp_stats, stat_UDP, - NULL, NULL, "udp", 1, IPPROTO_UDP }, + NULL, "udp", 1, IPPROTO_UDP }, #ifdef SCTP { -1, 1, sctp_protopr, sctp_stats, stat_SCTP, - NULL, NULL, "sctp", 1, IPPROTO_SCTP }, + NULL, "sctp", 1, IPPROTO_SCTP }, #endif { 0, 1, NULL, NULL, stat_MAX, - NULL, NULL, "divert", 1, IPPROTO_DIVERT }, + NULL, "divert", 1, IPPROTO_DIVERT }, { 0, 1, NULL, ip_stats, stat_IP, - NULL, NULL, "ip", 1, IPPROTO_RAW }, + NULL, "ip", 1, IPPROTO_RAW }, { 0, 1, NULL, icmp_stats, stat_ICMP, - NULL, NULL, "icmp", 1, IPPROTO_ICMP }, + NULL, "icmp", 1, IPPROTO_ICMP }, { 0, 1, NULL, igmp_stats, stat_IGMP, - NULL, NULL, "igmp", 1, IPPROTO_IGMP }, + NULL, "igmp", 1, IPPROTO_IGMP }, #ifdef IPSEC { -1, 1, NULL, ipsec_stats, stat_IPsec, /* keep as compat */ - NULL, NULL, "ipsec", 0, 0}, + NULL, "ipsec", 0, 0}, { -1, 1, NULL, ah_stats, stat_AH, - NULL, NULL, "ah", 0, 0}, + NULL, "ah", 0, 0}, { -1, 1, NULL, esp_stats, stat_ESP, - NULL, NULL, "esp", 0, 0}, + NULL, "esp", 0, 0}, { -1, 1, NULL, ipcomp_stats, stat_IPcomp, - NULL, NULL, "ipcomp", 0, 0}, + NULL, "ipcomp", 0, 0}, #endif { 0, 1, NULL, pim_stats, stat_PIM, - NULL, NULL, "pim", 1, IPPROTO_PIM }, + NULL, "pim", 1, IPPROTO_PIM }, { -1, 1, NULL, carp_stats, stat_CARP, - NULL, NULL, "carp", 1, 0 }, + NULL, "carp", 1, 0 }, { -1, 1, NULL, pfsync_stats, stat_pfsync, - NULL, NULL, "pfsync", 1, 0 }, + NULL, "pfsync", 1, 0 }, { -1, 0, NULL, NULL, stat_MAX, - NULL, NULL, NULL, 0, 0 } + NULL, NULL, 0, 0 } }; #ifdef INET6 struct protox ip6protox[] = { { 0, 1, NULL, tcp_stats, stat_TCP, - NULL, NULL, "tcp", 1, IPPROTO_TCP }, + NULL, "tcp", 1, IPPROTO_TCP }, { 0, 1, NULL, udp_stats, stat_UDP, - NULL, NULL, "udp", 1, IPPROTO_UDP }, + NULL, "udp", 1, IPPROTO_UDP }, { 0, 1, NULL, ip6_stats, stat_IP6, - NULL, ip6_ifstats, "ip6", 1, IPPROTO_RAW }, + ip6_ifstats, "ip6", 1, IPPROTO_RAW }, { 0, 1, NULL, icmp6_stats, stat_ICMP6, - NULL, icmp6_ifstats, "icmp6", 1, IPPROTO_ICMPV6 }, + icmp6_ifstats, "icmp6", 1, IPPROTO_ICMPV6 }, #ifdef IPSEC { -1, 1, NULL, ipsec_stats, stat_IPsec, - NULL, NULL, "ipsec6", 0, 0 }, + NULL, "ipsec6", 0, 0 }, #endif #ifdef notyet { -1, 1, NULL, pim6_stats, stat_PIM6, - NULL, NULL, "pim6", 1, 0 }, + NULL, "pim6", 1, 0 }, #endif { -1, 1, NULL, rip6_stats, stat_RIP6, - NULL, NULL, "rip6", 1, 0 }, + NULL, "rip6", 1, 0 }, { -1, 0, NULL, NULL, stat_MAX, - NULL, NULL, NULL, 0, 0 } + NULL, NULL, 0, 0 } }; #endif /*INET6*/ #ifdef IPSEC struct protox pfkeyprotox[] = { { -1, 1, NULL, pfkey_stats, stat_pfkey, - NULL, NULL, "pfkey", 0, 0 }, + NULL, "pfkey", 0, 0 }, { -1, 0, NULL, NULL, stat_MAX, - NULL, NULL, NULL, 0, 0 } + NULL, NULL, 0, 0 } }; #endif struct protox atalkprotox[] = { { N_DDPCB, 1, atalkprotopr, ddp_stats, stat_DDP, - NULL, NULL, "ddp", 0, 0 }, + NULL, "ddp", 0, 0 }, { -1, 0, NULL, NULL, stat_MAX, - NULL, NULL, NULL, 0, 0 } + NULL, NULL, 0, 0 } }; #ifdef NETGRAPH struct protox netgraphprotox[] = { { N_NGSOCKS, 1, netgraphprotopr, NULL, stat_MAX, - NULL, NULL, "ctrl", 0, 0 }, + NULL, "ctrl", 0, 0 }, { N_NGSOCKS, 1, netgraphprotopr, NULL, stat_MAX, - NULL, NULL, "data", 0, 0 }, + NULL, "data", 0, 0 }, { -1, 0, NULL, NULL, stat_MAX, - NULL, NULL, NULL, 0, 0 } + NULL, NULL, 0, 0 } }; #endif #ifdef IPX struct protox ipxprotox[] = { { N_IPX, 1, ipxprotopr, ipx_stats, stat_IPX, - NULL, NULL, "ipx", 0, 0 }, + NULL, "ipx", 0, 0 }, { N_IPX, 1, ipxprotopr, spx_stats, stat_SPX, - NULL, NULL, "spx", 0, 0 }, + NULL, "spx", 0, 0 }, { -1, 0, NULL, NULL, stat_MAX, - NULL, NULL, 0, 0, 0 } + NULL, 0, 0, 0 } }; #endif @@ -610,8 +609,8 @@ tp->pr_name); return; } else { - if (tp->pr_nstats != NULL) - statpr(tp->pr_nstats, tp->pr_stx, tp->pr_name); + if (tp->pr_stats != NULL) + statpr(tp->pr_stats, tp->pr_stx, tp->pr_name); else if (pflag) { printf("%s: no stats routine\n",