| version 1.205, 2011/07/02 17:53:50 |
version 1.205.2.1, 2012/04/17 00:08:30 |
| Line 136 EVCNT_ATTACH_STATIC(sosend_kvalimit); |
|
| Line 136 EVCNT_ATTACH_STATIC(sosend_kvalimit); |
|
| |
|
| #endif /* SOSEND_COUNTERS */ |
#endif /* SOSEND_COUNTERS */ |
| |
|
| static struct callback_entry sokva_reclaimerentry; |
|
| |
|
| #if defined(SOSEND_NO_LOAN) || defined(MULTIPROCESSOR) |
#if defined(SOSEND_NO_LOAN) || defined(MULTIPROCESSOR) |
| int sock_loan_thresh = -1; |
int sock_loan_thresh = -1; |
| #else |
#else |
| Line 199 sokvaunreserve(vsize_t len) |
|
| Line 197 sokvaunreserve(vsize_t len) |
|
| */ |
*/ |
| |
|
| vaddr_t |
vaddr_t |
| sokvaalloc(vsize_t len, struct socket *so) |
sokvaalloc(vaddr_t sva, vsize_t len, struct socket *so) |
| { |
{ |
| vaddr_t lva; |
vaddr_t lva; |
| |
|
| Line 214 sokvaalloc(vsize_t len, struct socket *s |
|
| Line 212 sokvaalloc(vsize_t len, struct socket *s |
|
| * allocate kva. |
* allocate kva. |
| */ |
*/ |
| |
|
| lva = uvm_km_alloc(kernel_map, len, 0, UVM_KMF_VAONLY | UVM_KMF_WAITVA); |
lva = uvm_km_alloc(kernel_map, len, atop(sva) & uvmexp.colormask, |
| |
UVM_KMF_COLORMATCH | UVM_KMF_VAONLY | UVM_KMF_WAITVA); |
| if (lva == 0) { |
if (lva == 0) { |
| sokvaunreserve(len); |
sokvaunreserve(len); |
| return (0); |
return (0); |
| Line 351 sosend_loan(struct socket *so, struct ui |
|
| Line 350 sosend_loan(struct socket *so, struct ui |
|
| |
|
| KASSERT(npgs <= M_EXT_MAXPAGES); |
KASSERT(npgs <= M_EXT_MAXPAGES); |
| |
|
| lva = sokvaalloc(len, so); |
lva = sokvaalloc(sva, len, so); |
| if (lva == 0) |
if (lva == 0) |
| return 0; |
return 0; |
| |
|
| Line 384 sosend_loan(struct socket *so, struct ui |
|
| Line 383 sosend_loan(struct socket *so, struct ui |
|
| return (space); |
return (space); |
| } |
} |
| |
|
| static int |
|
| sokva_reclaim_callback(struct callback_entry *ce, void *obj, void *arg) |
|
| { |
|
| |
|
| KASSERT(ce == &sokva_reclaimerentry); |
|
| KASSERT(obj == NULL); |
|
| |
|
| if (!vm_map_starved_p(kernel_map)) { |
|
| return CALLBACK_CHAIN_ABORT; |
|
| } |
|
| return CALLBACK_CHAIN_CONTINUE; |
|
| } |
|
| |
|
| struct mbuf * |
struct mbuf * |
| getsombuf(struct socket *so, int type) |
getsombuf(struct socket *so, int type) |
| { |
{ |
|
|
| if (sb_max_set(sb_max)) |
if (sb_max_set(sb_max)) |
| panic("bad initial sb_max value: %lu", sb_max); |
panic("bad initial sb_max value: %lu", sb_max); |
| |
|
| callback_register(&vm_map_to_kernel(kernel_map)->vmk_reclaim_callback, |
|
| &sokva_reclaimerentry, NULL, sokva_reclaim_callback); |
|
| |
|
| socket_listener = kauth_listen_scope(KAUTH_SCOPE_NETWORK, |
socket_listener = kauth_listen_scope(KAUTH_SCOPE_NETWORK, |
| socket_listener_cb, NULL); |
socket_listener_cb, NULL); |
| } |
} |
| Line 589 fsocreate(int domain, struct socket **so |
|
| Line 572 fsocreate(int domain, struct socket **so |
|
| if ((error = fd_allocfile(&fp, &fd)) != 0) |
if ((error = fd_allocfile(&fp, &fd)) != 0) |
| return error; |
return error; |
| fd_set_exclose(l, fd, (flags & SOCK_CLOEXEC) != 0); |
fd_set_exclose(l, fd, (flags & SOCK_CLOEXEC) != 0); |
| fp->f_flag = FREAD|FWRITE|((flags & SOCK_NONBLOCK) ? FNONBLOCK : 0); |
fp->f_flag = FREAD|FWRITE|((flags & SOCK_NONBLOCK) ? FNONBLOCK : 0)| |
| |
((flags & SOCK_NOSIGPIPE) ? FNOSIGPIPE : 0); |
| fp->f_type = DTYPE_SOCKET; |
fp->f_type = DTYPE_SOCKET; |
| fp->f_ops = &socketops; |
fp->f_ops = &socketops; |
| error = socreate(domain, &so, type, protocol, l, NULL); |
error = socreate(domain, &so, type, protocol, l, NULL); |
| Line 638 solisten(struct socket *so, int backlog, |
|
| Line 622 solisten(struct socket *so, int backlog, |
|
| if ((so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING | |
if ((so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING | |
| SS_ISDISCONNECTING)) != 0) { |
SS_ISDISCONNECTING)) != 0) { |
| sounlock(so); |
sounlock(so); |
| return (EOPNOTSUPP); |
return (EINVAL); |
| } |
} |
| error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL, |
error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL, |
| NULL, NULL, l); |
NULL, NULL, l); |
| Line 741 soclose(struct socket *so) |
|
| Line 725 soclose(struct socket *so) |
|
| goto drop; |
goto drop; |
| } |
} |
| if (so->so_options & SO_LINGER) { |
if (so->so_options & SO_LINGER) { |
| if ((so->so_state & SS_ISDISCONNECTING) && so->so_nbio) |
if ((so->so_state & (SS_ISDISCONNECTING|SS_NBIO)) == |
| |
(SS_ISDISCONNECTING|SS_NBIO)) |
| goto drop; |
goto drop; |
| while (so->so_state & SS_ISCONNECTED) { |
while (so->so_state & SS_ISCONNECTED) { |
| error = sowait(so, true, so->so_linger * hz); |
error = sowait(so, true, so->so_linger * hz); |
| Line 961 sosend(struct socket *so, struct mbuf *a |
|
| Line 946 sosend(struct socket *so, struct mbuf *a |
|
| } |
} |
| if (space < resid + clen && |
if (space < resid + clen && |
| (atomic || space < so->so_snd.sb_lowat || space < clen)) { |
(atomic || space < so->so_snd.sb_lowat || space < clen)) { |
| if (so->so_nbio) { |
if ((so->so_state & SS_NBIO) || (flags & MSG_NBIO)) { |
| error = EWOULDBLOCK; |
error = EWOULDBLOCK; |
| goto release; |
goto release; |
| } |
} |
| Line 1257 soreceive(struct socket *so, struct mbuf |
|
| Line 1242 soreceive(struct socket *so, struct mbuf |
|
| } |
} |
| if (uio->uio_resid == 0) |
if (uio->uio_resid == 0) |
| goto release; |
goto release; |
| if (so->so_nbio || (flags & MSG_DONTWAIT)) { |
if ((so->so_state & SS_NBIO) || |
| |
(flags & (MSG_DONTWAIT|MSG_NBIO))) { |
| error = EWOULDBLOCK; |
error = EWOULDBLOCK; |
| goto release; |
goto release; |
| } |
} |
| Line 1717 sosetopt1(struct socket *so, const struc |
|
| Line 1703 sosetopt1(struct socket *so, const struc |
|
| case SO_REUSEPORT: |
case SO_REUSEPORT: |
| case SO_OOBINLINE: |
case SO_OOBINLINE: |
| case SO_TIMESTAMP: |
case SO_TIMESTAMP: |
| |
case SO_NOSIGPIPE: |
| #ifdef SO_OTIMESTAMP |
#ifdef SO_OTIMESTAMP |
| case SO_OTIMESTAMP: |
case SO_OTIMESTAMP: |
| #endif |
#endif |
| Line 1917 sogetopt1(struct socket *so, struct sock |
|
| Line 1904 sogetopt1(struct socket *so, struct sock |
|
| case SO_BROADCAST: |
case SO_BROADCAST: |
| case SO_OOBINLINE: |
case SO_OOBINLINE: |
| case SO_TIMESTAMP: |
case SO_TIMESTAMP: |
| |
case SO_NOSIGPIPE: |
| #ifdef SO_OTIMESTAMP |
#ifdef SO_OTIMESTAMP |
| case SO_OTIMESTAMP: |
case SO_OTIMESTAMP: |
| #endif |
#endif |