diff options
author | jhb <jhb@FreeBSD.org> | 2007-03-12 19:27:36 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2007-03-12 19:27:36 +0000 |
commit | d8d45f52d70f4df842f685783ac61b1c8633601f (patch) | |
tree | a41a377204ccab8fc2ceb835914c6dc8f0811ff0 /sys/kern | |
parent | 8bfc297b1477ee40c3d278707eaec1bc1ad4b000 (diff) | |
download | FreeBSD-src-d8d45f52d70f4df842f685783ac61b1c8633601f.zip FreeBSD-src-d8d45f52d70f4df842f685783ac61b1c8633601f.tar.gz |
- Use m_gethdr(), m_get(), and m_clget() instead of the macros in
sosend_copyin().
- Use M_WAITOK instead of M_TRYWAIT in sosend_copyin().
- Don't check for NULL from M_WAITOK and return ENOBUFS.
M_WAITOK/M_TRYWAIT allocations don't fail with NULL.
Reviewed by: andre
Requested by: andre (2)
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_socket.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index eaf45a01..e4e35d5 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -863,20 +863,11 @@ sosend_copyin(struct uio *uio, struct mbuf **retmp, int atomic, long *space, if (resid >= MINCLSIZE) { #ifdef ZERO_COPY_SOCKETS if (top == NULL) { - MGETHDR(m, M_TRYWAIT, MT_DATA); - if (m == NULL) { - error = ENOBUFS; - goto out; - } + m = m_gethdr(M_WAITOK, MT_DATA); m->m_pkthdr.len = 0; m->m_pkthdr.rcvif = NULL; - } else { - MGET(m, M_TRYWAIT, MT_DATA); - if (m == NULL) { - error = ENOBUFS; - goto out; - } - } + } else + m = m_get(M_WAITOK, MT_DATA); if (so_zero_copy_send && resid>=PAGE_SIZE && *space>=PAGE_SIZE && @@ -887,14 +878,8 @@ sosend_copyin(struct uio *uio, struct mbuf **retmp, int atomic, long *space, len = cow_send; } if (!cow_send) { - MCLGET(m, M_TRYWAIT); - if ((m->m_flags & M_EXT) == 0) { - m_free(m); - m = NULL; - } else { - len = min(min(MCLBYTES, resid), - *space); - } + m_clget(m, M_WAITOK); + len = min(min(MCLBYTES, resid), *space); } #else /* ZERO_COPY_SOCKETS */ if (top == NULL) { |