| version 1.6, 1993/09/08 21:12:49 |
version 1.7, 1993/10/26 22:36:25 |
| Line 332 sosend(so, addr, uio, top, control, flag |
|
| Line 332 sosend(so, addr, uio, top, control, flag |
|
| resid = uio->uio_resid; |
resid = uio->uio_resid; |
| else |
else |
| resid = top->m_pkthdr.len; |
resid = top->m_pkthdr.len; |
| |
/* |
| |
* In theory resid should be unsigned. |
| |
* However, space must be signed, as it might be less than 0 |
| |
* if we over-committed, and we must use a signed comparison |
| |
* of space and resid. On the other hand, a negative resid |
| |
* causes us to loop sending 0-length segments to the protocol. |
| |
*/ |
| |
if (resid < 0) |
| |
return (EINVAL); |
| dontroute = |
dontroute = |
| (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 && |
(flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 && |
| (so->so_proto->pr_flags & PR_ATOMIC); |
(so->so_proto->pr_flags & PR_ATOMIC); |
|
|
| #ifdef MAPPED_MBUFS |
#ifdef MAPPED_MBUFS |
| len = min(MCLBYTES, resid); |
len = min(MCLBYTES, resid); |
| #else |
#else |
| if (top == 0) { |
if (atomic && top == 0) { |
| len = min(MCLBYTES - max_hdr, resid); |
len = min(MCLBYTES - max_hdr, resid); |
| m->m_data += max_hdr; |
m->m_data += max_hdr; |
| } else |
} else |
|
|
| so->so_state |= SS_RCVATMARK; |
so->so_state |= SS_RCVATMARK; |
| break; |
break; |
| } |
} |
| } else |
} else { |
| offset += len; |
offset += len; |
| |
if (offset == so->so_oobmark) |
| |
break; |
| |
} |
| } |
} |
| if (flags & MSG_EOR) |
if (flags & MSG_EOR) |
| break; |
break; |