Don't count mbufs with m_type == MT_HEADER or MT_OOBDATA as control data
in sballoc(), sbcompress(), sbdrop() and sbfree(). Fixes fstat() st_size reporting and kevent() EVFILT_READ on TCP sockets.
This commit is contained in:
parent
f7550ecf3f
commit
b3f1af6b8e
@ -705,7 +705,9 @@ sbcompress(sb, m, n)
|
||||
(unsigned)m->m_len);
|
||||
n->m_len += m->m_len;
|
||||
sb->sb_cc += m->m_len;
|
||||
if (m->m_type != MT_DATA) /* XXX: Probably don't need.*/
|
||||
if (m->m_type != MT_DATA && m->m_type != MT_HEADER &&
|
||||
m->m_type != MT_OOBDATA)
|
||||
/* XXX: Probably don't need.*/
|
||||
sb->sb_ctl += m->m_len;
|
||||
m = m_free(m);
|
||||
continue;
|
||||
@ -776,7 +778,8 @@ sbdrop(sb, len)
|
||||
m->m_len -= len;
|
||||
m->m_data += len;
|
||||
sb->sb_cc -= len;
|
||||
if (m->m_type != MT_DATA)
|
||||
if (m->m_type != MT_DATA && m->m_type != MT_HEADER &&
|
||||
m->m_type != MT_OOBDATA)
|
||||
sb->sb_ctl -= len;
|
||||
break;
|
||||
}
|
||||
|
@ -705,7 +705,9 @@ sbcompress(sb, m, n)
|
||||
(unsigned)m->m_len);
|
||||
n->m_len += m->m_len;
|
||||
sb->sb_cc += m->m_len;
|
||||
if (m->m_type != MT_DATA) /* XXX: Probably don't need.*/
|
||||
if (m->m_type != MT_DATA && m->m_type != MT_HEADER &&
|
||||
m->m_type != MT_OOBDATA)
|
||||
/* XXX: Probably don't need.*/
|
||||
sb->sb_ctl += m->m_len;
|
||||
m = m_free(m);
|
||||
continue;
|
||||
@ -776,7 +778,8 @@ sbdrop(sb, len)
|
||||
m->m_len -= len;
|
||||
m->m_data += len;
|
||||
sb->sb_cc -= len;
|
||||
if (m->m_type != MT_DATA)
|
||||
if (m->m_type != MT_DATA && m->m_type != MT_HEADER &&
|
||||
m->m_type != MT_OOBDATA)
|
||||
sb->sb_ctl -= len;
|
||||
break;
|
||||
}
|
||||
|
@ -228,7 +228,8 @@ struct xsocket {
|
||||
/* adjust counters in sb reflecting allocation of m */
|
||||
#define sballoc(sb, m) { \
|
||||
(sb)->sb_cc += (m)->m_len; \
|
||||
if ((m)->m_type != MT_DATA) \
|
||||
if ((m)->m_type != MT_DATA && (m)->m_type != MT_HEADER && \
|
||||
(m)->m_type != MT_OOBDATA) \
|
||||
(sb)->sb_ctl += (m)->m_len; \
|
||||
(sb)->sb_mbcnt += MSIZE; \
|
||||
if ((m)->m_flags & M_EXT) \
|
||||
@ -238,7 +239,8 @@ struct xsocket {
|
||||
/* adjust counters in sb reflecting freeing of m */
|
||||
#define sbfree(sb, m) { \
|
||||
(sb)->sb_cc -= (m)->m_len; \
|
||||
if ((m)->m_type != MT_DATA) \
|
||||
if ((m)->m_type != MT_DATA && (m)->m_type != MT_HEADER && \
|
||||
(m)->m_type != MT_OOBDATA) \
|
||||
(sb)->sb_ctl -= (m)->m_len; \
|
||||
(sb)->sb_mbcnt -= MSIZE; \
|
||||
if ((m)->m_flags & M_EXT) \
|
||||
|
Loading…
Reference in New Issue
Block a user