| version 1.205.6.2, 2012/04/05 21:33:40 |
version 1.206, 2011/12/20 23:56:28 |
| 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 197 sokvaunreserve(vsize_t len) |
|
| Line 199 sokvaunreserve(vsize_t len) |
|
| */ |
*/ |
| |
|
| vaddr_t |
vaddr_t |
| sokvaalloc(vaddr_t sva, vsize_t len, struct socket *so) |
sokvaalloc(vsize_t len, struct socket *so) |
| { |
{ |
| vaddr_t lva; |
vaddr_t lva; |
| |
|
| Line 212 sokvaalloc(vaddr_t sva, vsize_t len, str |
|
| Line 214 sokvaalloc(vaddr_t sva, vsize_t len, str |
|
| * allocate kva. |
* allocate kva. |
| */ |
*/ |
| |
|
| lva = uvm_km_alloc(kernel_map, len, atop(sva) & uvmexp.colormask, |
lva = uvm_km_alloc(kernel_map, len, 0, UVM_KMF_VAONLY | UVM_KMF_WAITVA); |
| UVM_KMF_COLORMATCH | UVM_KMF_VAONLY | UVM_KMF_WAITVA); |
|
| if (lva == 0) { |
if (lva == 0) { |
| sokvaunreserve(len); |
sokvaunreserve(len); |
| return (0); |
return (0); |
| Line 350 sosend_loan(struct socket *so, struct ui |
|
| Line 351 sosend_loan(struct socket *so, struct ui |
|
| |
|
| KASSERT(npgs <= M_EXT_MAXPAGES); |
KASSERT(npgs <= M_EXT_MAXPAGES); |
| |
|
| lva = sokvaalloc(sva, len, so); |
lva = sokvaalloc(len, so); |
| if (lva == 0) |
if (lva == 0) |
| return 0; |
return 0; |
| |
|
| Line 383 sosend_loan(struct socket *so, struct ui |
|
| Line 384 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 572 fsocreate(int domain, struct socket **so |
|
| Line 589 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 622 solisten(struct socket *so, int backlog, |
|
| Line 638 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 (EINVAL); |
return (EOPNOTSUPP); |
| } |
} |
| 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 1703 sosetopt1(struct socket *so, const struc |
|
| Line 1719 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 1904 sogetopt1(struct socket *so, struct sock |
|
| Line 1919 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 |