From owner-svn-src-all@FreeBSD.ORG Wed Feb 11 10:28:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4ABCC1065670; Wed, 11 Feb 2009 10:28:56 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CBC78FC17; Wed, 11 Feb 2009 10:28:56 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1BASuAF020670; Wed, 11 Feb 2009 10:28:56 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1BAStLU020668; Wed, 11 Feb 2009 10:28:55 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200902111028.n1BAStLU020668@svn.freebsd.org> From: Maxim Konovalov Date: Wed, 11 Feb 2009 10:28:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188479 - stable/7/usr.bin/netstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2009 10:28:57 -0000 Author: maxim Date: Wed Feb 11 10:28:55 2009 New Revision: 188479 URL: http://svn.freebsd.org/changeset/base/188479 Log: MFC r186644: show unix sockets listen queues stats with -L flag. Modified: stable/7/usr.bin/netstat/ (props changed) stable/7/usr.bin/netstat/main.c stable/7/usr.bin/netstat/unix.c Modified: stable/7/usr.bin/netstat/main.c ============================================================================== --- stable/7/usr.bin/netstat/main.c Wed Feb 11 09:18:09 2009 (r188478) +++ stable/7/usr.bin/netstat/main.c Wed Feb 11 10:28:55 2009 (r188479) @@ -589,7 +589,7 @@ main(int argc, char *argv[]) for (tp = netgraphprotox; tp->pr_name; tp++) printproto(tp, tp->pr_name); #endif /* NETGRAPH */ - if ((af == AF_UNIX || af == AF_UNSPEC) && !Lflag && !sflag) + 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); exit(0); Modified: stable/7/usr.bin/netstat/unix.c ============================================================================== --- stable/7/usr.bin/netstat/unix.c Wed Feb 11 09:18:09 2009 (r188478) +++ stable/7/usr.bin/netstat/unix.c Wed Feb 11 10:28:55 2009 (r188479) @@ -247,6 +247,7 @@ unixdomainpr(struct xunpcb *xunp, struct struct unpcb *unp; struct sockaddr_un *sa; static int first = 1; + char buf1[15]; unp = &xunp->xu_unp; if (unp->unp_addr) @@ -254,7 +255,7 @@ unixdomainpr(struct xunpcb *xunp, struct else sa = (struct sockaddr_un *)0; - if (first) { + if (first && !Lflag) { printf("Active UNIX domain sockets\n"); printf( "%-8.8s %-6.6s %-6.6s %-6.6s %8.8s %8.8s %8.8s %8.8s Addr\n", @@ -262,11 +263,21 @@ unixdomainpr(struct xunpcb *xunp, struct "Inode", "Conn", "Refs", "Nextref"); first = 0; } - 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)); + + if (Lflag && so->so_qlimit == 0) + return; + + if (Lflag) { + snprintf(buf1, 15, "%d/%d/%d", so->so_qlen, + so->so_incqlen, so->so_qlimit); + 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)); + } if (sa) printf(" %.*s", (int)(sa->sun_len - offsetof(struct sockaddr_un, sun_path)),