PERFORCE change 164003 for review
Gabor Pali
pgj at FreeBSD.org
Wed Jun 10 15:06:15 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164003
Change 164003 by pgj at petymeg-current on 2009/06/10 15:05:55
Remove hacks for tcpcb, add a previously missed code snippet
Affected files ...
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#17 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#15 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#12 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#14 edit
.. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/inet.c#9 edit
Differences ...
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#17 (text+ko) ====
@@ -434,8 +434,6 @@
stp->st_reflink = (u_long)0;
stp->st_flags = SOCKTYPE_TCP;
/* XXX: Remove this. */
- if (tp != NULL)
- stp->XXX_tcpcb = *tp;
stp->XXX_inpcb = *inp;
stp->XXX_xsocket = *so;
/* XXX: address is missing. */
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#15 (text+ko) ====
@@ -84,7 +84,6 @@
const char *netstat_st_get_address(const struct socket_type *stp);
const char *netstat_st_get_tcpstate(const struct socket_type *stp);
/* XXX: Remove this hacks. */
-struct tcpcb XXX_netstat_st_get_tcpcb(const struct socket_type *stp);
struct inpcb XXX_netstat_st_get_inpcb(const struct socket_type *stp);
struct xsocket XXX_netstat_st_get_xsocket(const struct socket_type *stp);
__END_DECLS
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#12 (text+ko) ====
@@ -64,7 +64,6 @@
char st_tcpstate[16];
/* XXX: Removables. */
- struct tcpcb XXX_tcpcb;
struct inpcb XXX_inpcb;
struct xsocket XXX_xsocket;
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#14 (text+ko) ====
@@ -403,12 +403,6 @@
}
/* XXX: Remove this hacks. */
-struct tcpcb
-XXX_netstat_st_get_tcpcb(const struct socket_type *stp)
-{
- return (stp->XXX_tcpcb);
-}
-
struct inpcb
XXX_netstat_st_get_inpcb(const struct socket_type *stp)
{
==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/inet.c#9 (text+ko) ====
@@ -613,18 +613,11 @@
{
static int first = 1;
char buf1[15];
- struct tcpcb tp;
struct inpcb inp;
struct xsocket so;
- int istcp;
- istcp = 0;
inp = XXX_netstat_st_get_inpcb(stp);
so = XXX_netstat_st_get_xsocket(stp);
- if (netstat_st_get_protocol(stp) == IPPROTO_TCP) {
- tp = XXX_netstat_st_get_tcpcb(stp);
- istcp = 1;
- }
if (first) {
if (!Lflag) {
printf("Active Internet connections");
@@ -709,6 +702,17 @@
netstat_st_get_name(stp), 0);
} /* else nothing printed now */
#endif /* INET6 */
+ } else {
+ if (inp.inp_vflag & INP_IPV4) {
+ inetprint(&inp.inp_laddr, (int)inp.inp_lport,
+ netstat_st_get_name(stp), 0);
+ if (!Lflag)
+ inetprint(&inp.inp_faddr,
+ (int)inp.inp_fport,
+ netstat_st_get_name(stp),
+ inp.inp_lport != inp.inp_fport);
+ }
+#ifdef INET6
else if (inp.inp_vflag & INP_IPV6) {
inet6print(&inp.in6p_laddr,
(int)inp.inp_lport, netstat_st_get_name(stp), 0);
@@ -718,6 +722,7 @@
netstat_st_get_name(stp),
inp.inp_lport != inp.inp_fport);
} /* else nothing printed now */
+#endif /* INET6 */
}
if (xflag) {
if (Lflag)
@@ -734,7 +739,7 @@
netstat_st_get_rcv_mbmax(stp),
netstat_st_get_snd_mbmax(stp));
}
- if (istcp && !Lflag) {
+ if (!Lflag) {
printf("%s", netstat_st_get_tcpstate(stp));
}
putchar('\n');
More information about the p4-projects
mailing list