diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-10-05 15:06:14 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-10-05 15:06:14 +0000 |
commit | 39779f43a947160c4a83b0847f41cdeea2a9ed68 (patch) | |
tree | 682615d848b9a13d6e23364173a88b17dc81eeed /usr.bin/netstat/unix.c | |
parent | 736be1a8f57f73a18c5a12bb920c09a56da7c0b1 (diff) | |
download | FreeBSD-src-39779f43a947160c4a83b0847f41cdeea2a9ed68.zip FreeBSD-src-39779f43a947160c4a83b0847f41cdeea2a9ed68.tar.gz |
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
MFC after: 3 months
Diffstat (limited to 'usr.bin/netstat/unix.c')
-rw-r--r-- | usr.bin/netstat/unix.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c index 209fc8d..0ad8f34 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -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) |