| version 1.66, 2002/05/07 08:06:35 |
version 1.66.4.1, 2002/06/11 01:59:49 |
| Line 797 soreceive(struct socket *so, struct mbuf |
|
| Line 797 soreceive(struct socket *so, struct mbuf |
|
| int flags, len, error, s, offset, moff, type, orig_resid; |
int flags, len, error, s, offset, moff, type, orig_resid; |
| struct protosw *pr; |
struct protosw *pr; |
| struct mbuf *nextrecord; |
struct mbuf *nextrecord; |
| |
int mbuf_removed = 0; |
| |
|
| pr = so->so_proto; |
pr = so->so_proto; |
| mp = mp0; |
mp = mp0; |
| Line 918 soreceive(struct socket *so, struct mbuf |
|
| Line 919 soreceive(struct socket *so, struct mbuf |
|
| m = m->m_next; |
m = m->m_next; |
| } else { |
} else { |
| sbfree(&so->so_rcv, m); |
sbfree(&so->so_rcv, m); |
| |
mbuf_removed = 1; |
| if (paddr) { |
if (paddr) { |
| *paddr = m; |
*paddr = m; |
| so->so_rcv.sb_mb = m->m_next; |
so->so_rcv.sb_mb = m->m_next; |
| Line 936 soreceive(struct socket *so, struct mbuf |
|
| Line 938 soreceive(struct socket *so, struct mbuf |
|
| m = m->m_next; |
m = m->m_next; |
| } else { |
} else { |
| sbfree(&so->so_rcv, m); |
sbfree(&so->so_rcv, m); |
| |
mbuf_removed = 1; |
| if (controlp) { |
if (controlp) { |
| if (pr->pr_domain->dom_externalize && |
if (pr->pr_domain->dom_externalize && |
| mtod(m, struct cmsghdr *)->cmsg_type == |
mtod(m, struct cmsghdr *)->cmsg_type == |
| Line 992 soreceive(struct socket *so, struct mbuf |
|
| Line 995 soreceive(struct socket *so, struct mbuf |
|
| splx(s); |
splx(s); |
| error = uiomove(mtod(m, caddr_t) + moff, (int)len, uio); |
error = uiomove(mtod(m, caddr_t) + moff, (int)len, uio); |
| s = splsoftnet(); |
s = splsoftnet(); |
| if (error) |
if (error) { |
| |
/* |
| |
* If any part of the record has been removed |
| |
* (such as the MT_SONAME mbuf, which will |
| |
* happen when PR_ADDR, and thus also |
| |
* PR_ATOMIC, is set), then drop the entire |
| |
* record to maintain the atomicity of the |
| |
* receive operation. |
| |
* |
| |
* This avoids a later panic("receive 1a") |
| |
* when compiled with DIAGNOSTIC. |
| |
*/ |
| |
if (m && mbuf_removed |
| |
&& (pr->pr_flags & PR_ATOMIC)) |
| |
(void) sbdroprecord(&so->so_rcv); |
| |
|
| goto release; |
goto release; |
| |
} |
| } else |
} else |
| uio->uio_resid -= len; |
uio->uio_resid -= len; |
| if (len == m->m_len - moff) { |
if (len == m->m_len - moff) { |