diff options
author | maxim <maxim@FreeBSD.org> | 2008-12-31 08:56:49 +0000 |
---|---|---|
committer | maxim <maxim@FreeBSD.org> | 2008-12-31 08:56:49 +0000 |
commit | 21750937a7237874f3b78cae9b4f522d2bf161d4 (patch) | |
tree | 9aeb7c4f4019d5b604a7383f01fb7f6ce51359c8 /usr.bin/netstat/unix.c | |
parent | c625343c9a898ae660944f287951a55b498230dd (diff) | |
download | FreeBSD-src-21750937a7237874f3b78cae9b4f522d2bf161d4.zip FreeBSD-src-21750937a7237874f3b78cae9b4f522d2bf161d4.tar.gz |
o With -L flag show unix sockets listen queues stats. It is useful
to know number of not accepted connections for monitoring purposes.
PR: bin/128871
Submitted by: Anton Yuzhaninov
MFC after: 1 month
Diffstat (limited to 'usr.bin/netstat/unix.c')
-rw-r--r-- | usr.bin/netstat/unix.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c index 0778bac..209fc8d 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -247,6 +247,7 @@ unixdomainpr(struct xunpcb *xunp, struct xsocket *so) 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 xsocket *so) 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 xsocket *so) "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)), |