From owner-svn-src-projects@FreeBSD.ORG Thu Oct 8 21:42:54 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65814106568F; Thu, 8 Oct 2009 21:42:54 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B5988FC13; Thu, 8 Oct 2009 21:42:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n98Lgs0N034166; Thu, 8 Oct 2009 21:42:54 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n98LgsaG034162; Thu, 8 Oct 2009 21:42:54 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200910082142.n98LgsaG034162@svn.freebsd.org> From: Robert Watson Date: Thu, 8 Oct 2009 21:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197875 - projects/capabilities8/usr.bin/netstat X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Oct 2009 21:42:54 -0000 Author: rwatson Date: Thu Oct 8 21:42:53 2009 New Revision: 197875 URL: http://svn.freebsd.org/changeset/base/197875 Log: Manually merge r197777 from head to capabilities8: netstat(1) support for UNIX SOCK_SEQPACKET sockets -- changes were required only for the kvm case, as we supported SOCK_SEQPACKET via sysctl already. Sponsored by: Google Modified: projects/capabilities8/usr.bin/netstat/main.c projects/capabilities8/usr.bin/netstat/netstat.h projects/capabilities8/usr.bin/netstat/unix.c Modified: projects/capabilities8/usr.bin/netstat/main.c ============================================================================== --- projects/capabilities8/usr.bin/netstat/main.c Thu Oct 8 21:37:40 2009 (r197874) +++ projects/capabilities8/usr.bin/netstat/main.c Thu Oct 8 21:42:53 2009 (r197875) @@ -184,6 +184,8 @@ static struct nlist nl[] = { { .n_name = "_sctpstat" }, #define N_MFCTABLESIZE 54 { .n_name = "_mfctablesize" }, +#define N_UNP_SPHEAD 55 + { .n_name = "unp_sphead" }, { .n_name = NULL }, }; @@ -597,7 +599,8 @@ main(int argc, char *argv[]) #endif /* NETGRAPH */ if ((af == AF_UNIX || af == AF_UNSPEC) && !sflag) unixpr(nl[N_UNP_COUNT].n_value, nl[N_UNP_GENCNT].n_value, - nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value); + nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value, + nl[N_UNP_SPHEAD].n_value); exit(0); } Modified: projects/capabilities8/usr.bin/netstat/netstat.h ============================================================================== --- projects/capabilities8/usr.bin/netstat/netstat.h Thu Oct 8 21:37:40 2009 (r197874) +++ projects/capabilities8/usr.bin/netstat/netstat.h Thu Oct 8 21:42:53 2009 (r197875) @@ -149,7 +149,7 @@ void ddp_stats(u_long, const char *, int void netgraphprotopr(u_long, const char *, int, int); #endif -void unixpr(u_long, u_long, u_long, u_long); +void unixpr(u_long, u_long, u_long, u_long, u_long); void esis_stats(u_long, const char *, int, int); void clnp_stats(u_long, const char *, int, int); Modified: projects/capabilities8/usr.bin/netstat/unix.c ============================================================================== --- projects/capabilities8/usr.bin/netstat/unix.c Thu Oct 8 21:37:40 2009 (r197874) +++ projects/capabilities8/usr.bin/netstat/unix.c Thu Oct 8 21:42:53 2009 (r197875) @@ -193,21 +193,37 @@ fail: } void -unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off) +unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off, + u_long sphead_off) { char *buf; int ret, type; struct xsocket *so; struct xunpgen *xug, *oxug; struct xunpcb *xunp; + u_long head_off; for (type = SOCK_STREAM; type <= SOCK_SEQPACKET; type++) { if (live) ret = pcblist_sysctl(type, &buf); - else - ret = pcblist_kvm(count_off, gencnt_off, - type == SOCK_STREAM ? shead_off : - (type == SOCK_DGRAM ? dhead_off : 0), &buf); + else { + head_off = 0; + switch (type) { + case SOCK_STREAM: + head_off = shead_off; + break; + + case SOCK_DGRAM: + head_off = dhead_off; + break; + + case SOCK_SEQPACKET: + head_off = sphead_off; + break; + } + ret = pcblist_kvm(count_off, gencnt_off, head_off, + &buf); + } if (ret == -1) continue; if (ret < 0)