version 1.83.2.10, 2005/11/10 14:09:45 |
version 1.115.2.3, 2005/12/31 11:34:26 |
Line 105 int somaxconn = SOMAXCONN; |
|
Line 105 int somaxconn = SOMAXCONN; |
|
#ifdef SOSEND_COUNTERS |
#ifdef SOSEND_COUNTERS |
#include <sys/device.h> |
#include <sys/device.h> |
|
|
struct evcnt sosend_loan_big = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, |
static struct evcnt sosend_loan_big = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, |
NULL, "sosend", "loan big"); |
NULL, "sosend", "loan big"); |
struct evcnt sosend_copy_big = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, |
static struct evcnt sosend_copy_big = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, |
NULL, "sosend", "copy big"); |
NULL, "sosend", "copy big"); |
struct evcnt sosend_copy_small = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, |
static struct evcnt sosend_copy_small = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, |
NULL, "sosend", "copy small"); |
NULL, "sosend", "copy small"); |
struct evcnt sosend_kvalimit = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, |
static struct evcnt sosend_kvalimit = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, |
NULL, "sosend", "kva limit"); |
NULL, "sosend", "kva limit"); |
|
|
#define SOSEND_COUNTER_INCR(ev) (ev)->ev_count++ |
#define SOSEND_COUNTER_INCR(ev) (ev)->ev_count++ |
Line 142 int use_sosend_loan = 0; |
|
Line 142 int use_sosend_loan = 0; |
|
int use_sosend_loan = 1; |
int use_sosend_loan = 1; |
#endif |
#endif |
|
|
struct simplelock so_pendfree_slock = SIMPLELOCK_INITIALIZER; |
static struct simplelock so_pendfree_slock = SIMPLELOCK_INITIALIZER; |
struct mbuf *so_pendfree; |
static struct mbuf *so_pendfree; |
|
|
#ifndef SOMAXKVA |
#ifndef SOMAXKVA |
#define SOMAXKVA (16 * 1024 * 1024) |
#define SOMAXKVA (16 * 1024 * 1024) |
#endif |
#endif |
int somaxkva = SOMAXKVA; |
int somaxkva = SOMAXKVA; |
int socurkva; |
static int socurkva; |
int sokvawaiters; |
static int sokvawaiters; |
|
|
#define SOCK_LOAN_THRESH 4096 |
#define SOCK_LOAN_THRESH 4096 |
#define SOCK_LOAN_CHUNK 65536 |
#define SOCK_LOAN_CHUNK 65536 |
|
|
static size_t sodopendfree(struct socket *); |
static size_t sodopendfree(struct socket *); |
static size_t sodopendfreel(struct socket *); |
static size_t sodopendfreel(struct socket *); |
static __inline vsize_t sokvareserve(struct socket *, vsize_t); |
|
static __inline void sokvaunreserve(vsize_t); |
|
|
|
static __inline vsize_t |
static vsize_t |
sokvareserve(struct socket *so, vsize_t len) |
sokvareserve(struct socket *so, vsize_t len) |
{ |
{ |
int s; |
int s; |
Line 200 sokvareserve(struct socket *so, vsize_t |
|
Line 198 sokvareserve(struct socket *so, vsize_t |
|
return len; |
return len; |
} |
} |
|
|
static __inline void |
static void |
sokvaunreserve(vsize_t len) |
sokvaunreserve(vsize_t len) |
{ |
{ |
int s; |
int s; |
Line 392 sosend_loan(struct socket *so, struct ui |
|
Line 390 sosend_loan(struct socket *so, struct ui |
|
vaddr_t lva, va; |
vaddr_t lva, va; |
int npgs, i, error; |
int npgs, i, error; |
|
|
if (uio->uio_segflg != UIO_USERSPACE) |
if (VMSPACE_IS_KERNEL(uio->uio_vmspace)) |
return (0); |
return (0); |
|
|
if (iov->iov_len < (size_t) space) |
if (iov->iov_len < (size_t) space) |
Line 407 sosend_loan(struct socket *so, struct ui |
|
Line 405 sosend_loan(struct socket *so, struct ui |
|
|
|
/* XXX KDASSERT */ |
/* XXX KDASSERT */ |
KASSERT(npgs <= M_EXT_MAXPAGES); |
KASSERT(npgs <= M_EXT_MAXPAGES); |
KASSERT(uio->uio_lwp != NULL); |
|
|
|
lva = sokvaalloc(len, so); |
lva = sokvaalloc(len, so); |
if (lva == 0) |
if (lva == 0) |
return 0; |
return 0; |
|
|
error = uvm_loan(&uio->uio_lwp->l_proc->p_vmspace->vm_map, sva, len, |
error = uvm_loan(&uio->uio_vmspace->vm_map, sva, len, |
m->m_ext.ext_pgs, UVM_LOAN_TOPAGE); |
m->m_ext.ext_pgs, UVM_LOAN_TOPAGE); |
if (error) { |
if (error) { |
sokvafree(lva, len); |
sokvafree(lva, len); |
Line 455 socreate(int dom, struct socket **aso, i |
|
Line 452 socreate(int dom, struct socket **aso, i |
|
{ |
{ |
const struct protosw *prp; |
const struct protosw *prp; |
struct socket *so; |
struct socket *so; |
struct proc *p; |
uid_t uid; |
int error, s; |
int error, s; |
|
|
p = l->l_proc; |
|
if (proto) |
if (proto) |
prp = pffindproto(dom, proto, type); |
prp = pffindproto(dom, proto, type); |
else |
else |
Line 481 socreate(int dom, struct socket **aso, i |
|
Line 477 socreate(int dom, struct socket **aso, i |
|
so->so_snd.sb_mowner = &prp->pr_domain->dom_mowner; |
so->so_snd.sb_mowner = &prp->pr_domain->dom_mowner; |
so->so_mowner = &prp->pr_domain->dom_mowner; |
so->so_mowner = &prp->pr_domain->dom_mowner; |
#endif |
#endif |
if (p != 0) |
if (l != NULL) { |
so->so_uidinfo = uid_find(p->p_ucred->cr_uid); |
uid = l->l_proc->p_ucred->cr_uid; |
else |
} else { |
so->so_uidinfo = uid_find(0); |
uid = 0; |
|
} |
|
so->so_uidinfo = uid_find(uid); |
error = (*prp->pr_usrreq)(so, PRU_ATTACH, (struct mbuf *)0, |
error = (*prp->pr_usrreq)(so, PRU_ATTACH, (struct mbuf *)0, |
(struct mbuf *)(long)proto, (struct mbuf *)0, l); |
(struct mbuf *)(long)proto, (struct mbuf *)0, l); |
if (error) { |
if (error) { |
|
|
soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio, |
soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio, |
struct mbuf **mp0, struct mbuf **controlp, int *flagsp) |
struct mbuf **mp0, struct mbuf **controlp, int *flagsp) |
{ |
{ |
struct lwp *l; |
struct lwp *l = curlwp; |
struct mbuf *m, **mp; |
struct mbuf *m, **mp; |
int flags, len, error, s, offset, moff, type, orig_resid; |
int flags, len, error, s, offset, moff, type, orig_resid; |
const struct protosw *pr; |
const struct protosw *pr; |
Line 946 soreceive(struct socket *so, struct mbuf |
|
Line 944 soreceive(struct socket *so, struct mbuf |
|
mp = mp0; |
mp = mp0; |
type = 0; |
type = 0; |
orig_resid = uio->uio_resid; |
orig_resid = uio->uio_resid; |
l = uio->uio_lwp; |
|
|
|
if (paddr) |
if (paddr) |
*paddr = 0; |
*paddr = 0; |