summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2014-11-30 12:52:33 +0000
committerglebius <glebius@FreeBSD.org>2014-11-30 12:52:33 +0000
commit25da94eb3ed654f7181ce453c6c5cc7e77d38133 (patch)
tree6aca46c356e9150741198b08512009a1b5138ca0 /usr.bin/netstat
parentc85f514c6e5d4847bf79f47d5ca098ce086a4c26 (diff)
downloadFreeBSD-src-25da94eb3ed654f7181ce453c6c5cc7e77d38133.zip
FreeBSD-src-25da94eb3ed654f7181ce453c6c5cc7e77d38133.tar.gz
Merge from projects/sendfile:
o Introduce a notion of "not ready" mbufs in socket buffers. These mbufs are now being populated by some I/O in background and are referenced outside. This forces following implications: - An mbuf which is "not ready" can't be taken out of the buffer. - An mbuf that is behind a "not ready" in the queue neither. - If sockbet buffer is flushed, then "not ready" mbufs shouln't be freed. o In struct sockbuf the sb_cc field is split into sb_ccc and sb_acc. The sb_ccc stands for ""claimed character count", or "committed character count". And the sb_acc is "available character count". Consumers of socket buffer API shouldn't already access them directly, but use sbused() and sbavail() respectively. o Not ready mbufs are marked with M_NOTREADY, and ready but blocked ones with M_BLOCKED. o New field sb_fnrdy points to the first not ready mbuf, to avoid linear search. o New function sbready() is provided to activate certain amount of mbufs in a socket buffer. A special note on SCTP: SCTP has its own sockbufs. Unfortunately, FreeBSD stack doesn't yet allow protocol specific sockbufs. Thus, SCTP does some hacks to make itself compatible with FreeBSD: it manages sockbufs on its own, but keeps sb_cc updated to inform the stack of amount of data in them. The new notion of "not ready" data isn't supported by SCTP. Instead, only a mechanical substitute is done: s/sb_cc/sb_ccc/. A proper solution would be to take away struct sockbuf from struct socket and allow protocols to implement their own socket buffers, like SCTP already does. This was discussed with rrs@. Sponsored by: Netflix Sponsored by: Nginx, Inc.
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/inet.c5
-rw-r--r--usr.bin/netstat/netgraph.c2
-rw-r--r--usr.bin/netstat/unix.c3
3 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 10d0698..c22e49f 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -137,7 +137,7 @@ pcblist_sysctl(int proto, const char *name, char **bufp, int istcp __unused)
static void
sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb)
{
- xsb->sb_cc = sb->sb_cc;
+ xsb->sb_cc = sb->sb_ccc;
xsb->sb_hiwat = sb->sb_hiwat;
xsb->sb_mbcnt = sb->sb_mbcnt;
xsb->sb_mcnt = sb->sb_mcnt;
@@ -479,7 +479,8 @@ protopr(u_long off, const char *name, int af1, int proto)
printf("%6u %6u %6u ", tp->t_sndrexmitpack,
tp->t_rcvoopack, tp->t_sndzerowin);
} else {
- printf("%6u %6u ", so->so_rcv.sb_cc, so->so_snd.sb_cc);
+ printf("%6u %6u ",
+ so->so_rcv.sb_cc, so->so_snd.sb_cc);
}
if (numeric_port) {
if (inp->inp_vflag & INP_IPV4) {
diff --git a/usr.bin/netstat/netgraph.c b/usr.bin/netstat/netgraph.c
index 95578af..9a08b6d 100644
--- a/usr.bin/netstat/netgraph.c
+++ b/usr.bin/netstat/netgraph.c
@@ -119,7 +119,7 @@ netgraphprotopr(u_long off, const char *name, int af1 __unused,
if (Aflag)
printf("%8lx ", (u_long) this);
printf("%-5.5s %6u %6u ",
- name, sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc);
+ name, sockb.so_rcv.sb_ccc, sockb.so_snd.sb_ccc);
/* Get info on associated node */
if (ngpcb.node_id == 0 || csock == -1)
diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c
index 027e812..a5cc037 100644
--- a/usr.bin/netstat/unix.c
+++ b/usr.bin/netstat/unix.c
@@ -287,7 +287,8 @@ unixdomainpr(struct xunpcb *xunp, struct xsocket *so)
} 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,
+ 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));
}
OpenPOWER on IntegriCloud