Date: Sun, 7 Jun 2009 10:38:52 GMT From: Gabor Pali <pgj@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 163698 for review Message-ID: <200906071038.n57AcqVM081848@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=163698 Change 163698 by pgj@petymeg-current on 2009/06/07 10:38:26 Replace arguments of unixdomainpr() for a socket_type Affected files ... .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#3 edit .. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/unix.c#4 edit Differences ... ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#3 (text+ko) ==== @@ -65,7 +65,7 @@ /* Keep active PCBs only. */ if (xunp->xu_unp.unp_gencnt <= oxug->xug_gen) { stp = _netstat_st_allocate(list, PF_LOCAL, type, - ""); + socktype[type]); stp->xup = *((struct xunpcb *)xug); } } @@ -144,7 +144,8 @@ list->stl_error = NETSTAT_ERROR_UNDEFINED; return (-1); } - stp = _netstat_st_allocate(list, PF_LOCAL, type, ""); + stp = _netstat_st_allocate(list, PF_LOCAL, type, + socktype[type]); stp->xup = xu; } ==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/unix.c#4 (text+ko) ==== @@ -66,19 +66,14 @@ #include <netstat.h> #include "extern.h" -static void unixdomainpr(struct xunpcb *, struct xsocket *); - -static const char *const socktype[] = - { "#0", "stream", "dgram", "raw", "rdm", "seqpacket" }; +static void unixdomainpr(struct socket_type *); void unixpr(void *kvmd) { int ret, type; - struct xsocket *so; struct socket_type_list *stlp; struct socket_type *stp; - struct xunpcb *xunp; int error; kvm_t *kvm; @@ -112,21 +107,23 @@ for (stp = netstat_stl_first(stlp); stp != NULL; stp = netstat_stl_next(stp)) { - xunp = (struct xunpcb *)netstat_st_get_pcb(stp); - so = &xunp->xu_socket; - unixdomainpr(xunp, so); + unixdomainpr(stp); } } } static void -unixdomainpr(struct xunpcb *xunp, struct xsocket *so) +unixdomainpr(struct socket_type *stp) { struct unpcb *unp; struct sockaddr_un *sa; static int first = 1; char buf1[15]; + struct xunpcb *xunp; + struct xsocket *so; + xunp = netstat_st_get_pcb(stp); + so = &xunp->xu_socket; unp = &xunp->xu_unp; if (unp->unp_addr) sa = &xunp->xu_addr; @@ -151,8 +148,9 @@ 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)so->so_pcb, netstat_st_get_name(stp), + 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)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906071038.n57AcqVM081848>