version 1.74, 2002/11/27 03:36:04 |
version 1.82, 2003/06/28 14:21:58 |
Line 76 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 76 __KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
#include "opt_sock_counters.h" |
#include "opt_sock_counters.h" |
#include "opt_sosend_loan.h" |
#include "opt_sosend_loan.h" |
|
#include "opt_mbuftrace.h" |
|
|
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/systm.h> |
#include <sys/systm.h> |
Line 97 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 98 __KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
struct pool socket_pool; |
struct pool socket_pool; |
|
|
|
MALLOC_DEFINE(M_SOOPTS, "soopts", "socket options"); |
|
MALLOC_DEFINE(M_SONAME, "soname", "socket name"); |
|
|
extern int somaxconn; /* patchable (XXX sysctl) */ |
extern int somaxconn; /* patchable (XXX sysctl) */ |
int somaxconn = SOMAXCONN; |
int somaxconn = SOMAXCONN; |
|
|
Line 150 int sokvawaiters; |
|
Line 154 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 *); |
|
|
|
vaddr_t |
|
sokvaalloc(vsize_t len, struct socket *so) |
|
{ |
|
vaddr_t lva; |
|
int s; |
|
|
|
while (socurkva + len > somaxkva) { |
|
if (sodopendfree(so)) |
|
continue; |
|
SOSEND_COUNTER_INCR(&sosend_kvalimit); |
|
s = splvm(); |
|
sokvawaiters++; |
|
(void) tsleep(&socurkva, PVM, "sokva", 0); |
|
sokvawaiters--; |
|
splx(s); |
|
} |
|
|
|
lva = uvm_km_valloc_wait(kernel_map, len); |
|
if (lva == 0) |
|
return (0); |
|
socurkva += len; |
|
|
|
return lva; |
|
} |
|
|
|
void |
|
sokvafree(vaddr_t sva, vsize_t len) |
|
{ |
|
|
|
uvm_km_free(kernel_map, sva, len); |
|
socurkva -= len; |
|
if (sokvawaiters) |
|
wakeup(&socurkva); |
|
} |
|
|
static void |
static void |
sodoloanfree(caddr_t buf, u_int size) |
sodoloanfree(struct vm_page **pgs, caddr_t buf, size_t size) |
{ |
{ |
struct vm_page **pgs; |
|
vaddr_t va, sva, eva; |
vaddr_t va, sva, eva; |
vsize_t len; |
vsize_t len; |
paddr_t pa; |
paddr_t pa; |
Line 164 sodoloanfree(caddr_t buf, u_int size) |
|
Line 204 sodoloanfree(caddr_t buf, u_int size) |
|
len = eva - sva; |
len = eva - sva; |
npgs = len >> PAGE_SHIFT; |
npgs = len >> PAGE_SHIFT; |
|
|
pgs = alloca(npgs * sizeof(*pgs)); |
if (__predict_false(pgs == NULL)) { |
|
pgs = alloca(npgs * sizeof(*pgs)); |
|
|
for (i = 0, va = sva; va < eva; i++, va += PAGE_SIZE) { |
for (i = 0, va = sva; va < eva; i++, va += PAGE_SIZE) { |
if (pmap_extract(pmap_kernel(), va, &pa) == FALSE) |
if (pmap_extract(pmap_kernel(), va, &pa) == FALSE) |
panic("sodoloanfree: va 0x%lx not mapped", va); |
panic("sodoloanfree: va 0x%lx not mapped", va); |
pgs[i] = PHYS_TO_VM_PAGE(pa); |
pgs[i] = PHYS_TO_VM_PAGE(pa); |
|
} |
} |
} |
|
|
pmap_kremove(sva, len); |
pmap_kremove(sva, len); |
pmap_update(pmap_kernel()); |
pmap_update(pmap_kernel()); |
uvm_unloan(pgs, npgs, UVM_LOAN_TOPAGE); |
uvm_unloan(pgs, npgs, UVM_LOAN_TOPAGE); |
uvm_km_free(kernel_map, sva, len); |
sokvafree(sva, len); |
socurkva -= len; |
|
if (sokvawaiters) |
|
wakeup(&socurkva); |
|
} |
} |
|
|
static size_t |
static size_t |
Line 198 sodopendfree(struct socket *so) |
|
Line 237 sodopendfree(struct socket *so) |
|
splx(s); |
splx(s); |
|
|
rv += m->m_ext.ext_size; |
rv += m->m_ext.ext_size; |
sodoloanfree(m->m_ext.ext_buf, m->m_ext.ext_size); |
sodoloanfree((m->m_flags & M_EXT_PAGES) ? |
|
m->m_ext.ext_pgs : NULL, m->m_ext.ext_buf, |
|
m->m_ext.ext_size); |
s = splvm(); |
s = splvm(); |
pool_cache_put(&mbpool_cache, m); |
pool_cache_put(&mbpool_cache, m); |
} |
} |
Line 211 sodopendfree(struct socket *so) |
|
Line 252 sodopendfree(struct socket *so) |
|
splx(s); |
splx(s); |
|
|
rv += m->m_ext.ext_size; |
rv += m->m_ext.ext_size; |
sodoloanfree(m->m_ext.ext_buf, m->m_ext.ext_size); |
sodoloanfree((m->m_flags & M_EXT_PAGES) ? |
|
m->m_ext.ext_pgs : NULL, m->m_ext.ext_buf, |
|
m->m_ext.ext_size); |
s = splvm(); |
s = splvm(); |
pool_cache_put(&mbpool_cache, m); |
pool_cache_put(&mbpool_cache, m); |
} |
} |
Line 220 sodopendfree(struct socket *so) |
|
Line 263 sodopendfree(struct socket *so) |
|
return (rv); |
return (rv); |
} |
} |
|
|
static void |
void |
soloanfree(struct mbuf *m, caddr_t buf, u_int size, void *arg) |
soloanfree(struct mbuf *m, caddr_t buf, size_t size, void *arg) |
{ |
{ |
struct socket *so = arg; |
struct socket *so = arg; |
int s; |
int s; |
|
|
if (m == NULL) { |
if (m == NULL) { |
sodoloanfree(buf, size); |
sodoloanfree(NULL, buf, size); |
return; |
return; |
} |
} |
|
|
Line 245 sosend_loan(struct socket *so, struct ui |
|
Line 288 sosend_loan(struct socket *so, struct ui |
|
struct iovec *iov = uio->uio_iov; |
struct iovec *iov = uio->uio_iov; |
vaddr_t sva, eva; |
vaddr_t sva, eva; |
vsize_t len; |
vsize_t len; |
struct vm_page **pgs; |
|
vaddr_t lva, va; |
vaddr_t lva, va; |
int npgs, s, i, error; |
int npgs, i, error; |
|
|
if (uio->uio_segflg != UIO_USERSPACE) |
if (uio->uio_segflg != UIO_USERSPACE) |
return (0); |
return (0); |
Line 262 sosend_loan(struct socket *so, struct ui |
|
Line 304 sosend_loan(struct socket *so, struct ui |
|
len = eva - sva; |
len = eva - sva; |
npgs = len >> PAGE_SHIFT; |
npgs = len >> PAGE_SHIFT; |
|
|
while (socurkva + len > somaxkva) { |
/* XXX KDASSERT */ |
if (sodopendfree(so)) |
KASSERT(npgs <= M_EXT_MAXPAGES); |
continue; |
|
SOSEND_COUNTER_INCR(&sosend_kvalimit); |
|
s = splvm(); |
|
sokvawaiters++; |
|
(void) tsleep(&socurkva, PVM, "sokva", 0); |
|
sokvawaiters--; |
|
splx(s); |
|
} |
|
|
|
lva = uvm_km_valloc_wait(kernel_map, len); |
lva = sokvaalloc(len, so); |
if (lva == 0) |
if (lva == 0) |
return (0); |
return 0; |
socurkva += len; |
|
|
|
pgs = alloca(npgs * sizeof(*pgs)); |
error = uvm_loan(&uio->uio_lwp->l_proc->p_vmspace->vm_map, sva, len, |
|
m->m_ext.ext_pgs, UVM_LOAN_TOPAGE); |
error = uvm_loan(&uio->uio_procp->p_vmspace->vm_map, sva, len, |
|
pgs, UVM_LOAN_TOPAGE); |
|
if (error) { |
if (error) { |
uvm_km_free(kernel_map, lva, len); |
sokvafree(lva, len); |
socurkva -= len; |
|
return (0); |
return (0); |
} |
} |
|
|
for (i = 0, va = lva; i < npgs; i++, va += PAGE_SIZE) |
for (i = 0, va = lva; i < npgs; i++, va += PAGE_SIZE) |
pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pgs[i]), VM_PROT_READ); |
pmap_kenter_pa(va, VM_PAGE_TO_PHYS(m->m_ext.ext_pgs[i]), |
|
VM_PROT_READ); |
pmap_update(pmap_kernel()); |
pmap_update(pmap_kernel()); |
|
|
lva += (vaddr_t) iov->iov_base & PAGE_MASK; |
lva += (vaddr_t) iov->iov_base & PAGE_MASK; |
|
|
MEXTADD(m, (caddr_t) lva, space, M_MBUF, soloanfree, so); |
MEXTADD(m, (caddr_t) lva, space, M_MBUF, soloanfree, so); |
|
m->m_flags |= M_EXT_PAGES | M_EXT_ROMAP; |
|
|
uio->uio_resid -= space; |
uio->uio_resid -= space; |
/* uio_offset not updated, not set/used for write(2) */ |
/* uio_offset not updated, not set/used for write(2) */ |
Line 342 socreate(int dom, struct socket **aso, i |
|
Line 374 socreate(int dom, struct socket **aso, i |
|
so->so_proto = prp; |
so->so_proto = prp; |
so->so_send = sosend; |
so->so_send = sosend; |
so->so_receive = soreceive; |
so->so_receive = soreceive; |
|
#ifdef MBUFTRACE |
|
so->so_rcv.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; |
|
#endif |
if (p != 0) |
if (p != 0) |
so->so_uid = p->p_ucred->cr_uid; |
so->so_uid = p->p_ucred->cr_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, p); |
(struct mbuf *)(long)proto, (struct mbuf *)0, curlwp); /* XXX */ |
if (error) { |
if (error) { |
so->so_state |= SS_NOFDREF; |
so->so_state |= SS_NOFDREF; |
sofree(so); |
sofree(so); |
Line 358 socreate(int dom, struct socket **aso, i |
|
Line 395 socreate(int dom, struct socket **aso, i |
|
} |
} |
|
|
int |
int |
sobind(struct socket *so, struct mbuf *nam, struct proc *p) |
sobind(struct socket *so, struct mbuf *nam, struct lwp *l) |
{ |
{ |
int s, error; |
int s, error; |
|
|
s = splsoftnet(); |
s = splsoftnet(); |
error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, (struct mbuf *)0, |
error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, (struct mbuf *)0, |
nam, (struct mbuf *)0, p); |
nam, (struct mbuf *)0, l); |
splx(s); |
splx(s); |
return (error); |
return (error); |
} |
} |
Line 376 solisten(struct socket *so, int backlog) |
|
Line 413 solisten(struct socket *so, int backlog) |
|
|
|
s = splsoftnet(); |
s = splsoftnet(); |
error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, (struct mbuf *)0, |
error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, (struct mbuf *)0, |
(struct mbuf *)0, (struct mbuf *)0, (struct proc *)0); |
(struct mbuf *)0, (struct mbuf *)0, (struct lwp *)0); |
if (error) { |
if (error) { |
splx(s); |
splx(s); |
return (error); |
return (error); |
Line 464 soclose(struct socket *so) |
|
Line 501 soclose(struct socket *so) |
|
if (so->so_pcb) { |
if (so->so_pcb) { |
int error2 = (*so->so_proto->pr_usrreq)(so, PRU_DETACH, |
int error2 = (*so->so_proto->pr_usrreq)(so, PRU_DETACH, |
(struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, |
(struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, |
(struct proc *)0); |
(struct lwp *)0); |
if (error == 0) |
if (error == 0) |
error = error2; |
error = error2; |
} |
} |
Line 485 soabort(struct socket *so) |
|
Line 522 soabort(struct socket *so) |
|
{ |
{ |
|
|
return (*so->so_proto->pr_usrreq)(so, PRU_ABORT, (struct mbuf *)0, |
return (*so->so_proto->pr_usrreq)(so, PRU_ABORT, (struct mbuf *)0, |
(struct mbuf *)0, (struct mbuf *)0, (struct proc *)0); |
(struct mbuf *)0, (struct mbuf *)0, (struct lwp *)0); |
} |
} |
|
|
int |
int |
Line 501 soaccept(struct socket *so, struct mbuf |
|
Line 538 soaccept(struct socket *so, struct mbuf |
|
if ((so->so_state & SS_ISDISCONNECTED) == 0 || |
if ((so->so_state & SS_ISDISCONNECTED) == 0 || |
(so->so_proto->pr_flags & PR_ABRTACPTDIS) == 0) |
(so->so_proto->pr_flags & PR_ABRTACPTDIS) == 0) |
error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, |
error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, |
(struct mbuf *)0, nam, (struct mbuf *)0, (struct proc *)0); |
(struct mbuf *)0, nam, (struct mbuf *)0, (struct lwp *)0); |
else |
else |
error = ECONNABORTED; |
error = ECONNABORTED; |
|
|
Line 512 soaccept(struct socket *so, struct mbuf |
|
Line 549 soaccept(struct socket *so, struct mbuf |
|
int |
int |
soconnect(struct socket *so, struct mbuf *nam) |
soconnect(struct socket *so, struct mbuf *nam) |
{ |
{ |
struct proc *p; |
|
int s, error; |
int s, error; |
|
|
p = curproc; /* XXX */ |
|
if (so->so_options & SO_ACCEPTCONN) |
if (so->so_options & SO_ACCEPTCONN) |
return (EOPNOTSUPP); |
return (EOPNOTSUPP); |
s = splsoftnet(); |
s = splsoftnet(); |
Line 531 soconnect(struct socket *so, struct mbuf |
|
Line 566 soconnect(struct socket *so, struct mbuf |
|
error = EISCONN; |
error = EISCONN; |
else |
else |
error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT, |
error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT, |
(struct mbuf *)0, nam, (struct mbuf *)0, p); |
(struct mbuf *)0, nam, (struct mbuf *)0, curlwp); /* XXX */ |
splx(s); |
splx(s); |
return (error); |
return (error); |
} |
} |
Line 544 soconnect2(struct socket *so1, struct so |
|
Line 579 soconnect2(struct socket *so1, struct so |
|
s = splsoftnet(); |
s = splsoftnet(); |
error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, |
error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, |
(struct mbuf *)0, (struct mbuf *)so2, (struct mbuf *)0, |
(struct mbuf *)0, (struct mbuf *)so2, (struct mbuf *)0, |
(struct proc *)0); |
(struct lwp *)0); |
splx(s); |
splx(s); |
return (error); |
return (error); |
} |
} |
Line 565 sodisconnect(struct socket *so) |
|
Line 600 sodisconnect(struct socket *so) |
|
} |
} |
error = (*so->so_proto->pr_usrreq)(so, PRU_DISCONNECT, |
error = (*so->so_proto->pr_usrreq)(so, PRU_DISCONNECT, |
(struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, |
(struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, |
(struct proc *)0); |
(struct lwp *)0); |
bad: |
bad: |
splx(s); |
splx(s); |
sodopendfree(so); |
sodopendfree(so); |
Line 601 sosend(struct socket *so, struct mbuf *a |
|
Line 636 sosend(struct socket *so, struct mbuf *a |
|
|
|
sodopendfree(so); |
sodopendfree(so); |
|
|
p = curproc; /* XXX */ |
p = curproc; /* XXX */ |
clen = 0; |
clen = 0; |
atomic = sosendallatonce(so) || top; |
atomic = sosendallatonce(so) || top; |
if (uio) |
if (uio) |
Line 678 sosend(struct socket *so, struct mbuf *a |
|
Line 713 sosend(struct socket *so, struct mbuf *a |
|
top->m_flags |= M_EOR; |
top->m_flags |= M_EOR; |
} else do { |
} else do { |
if (top == 0) { |
if (top == 0) { |
MGETHDR(m, M_WAIT, MT_DATA); |
m = m_gethdr(M_WAIT, MT_DATA); |
mlen = MHLEN; |
mlen = MHLEN; |
m->m_pkthdr.len = 0; |
m->m_pkthdr.len = 0; |
m->m_pkthdr.rcvif = (struct ifnet *)0; |
m->m_pkthdr.rcvif = (struct ifnet *)0; |
} else { |
} else { |
MGET(m, M_WAIT, MT_DATA); |
m = m_get(M_WAIT, MT_DATA); |
mlen = MLEN; |
mlen = MLEN; |
} |
} |
|
MCLAIM(m, so->so_snd.sb_mowner); |
if (use_sosend_loan && |
if (use_sosend_loan && |
uio->uio_iov->iov_len >= SOCK_LOAN_THRESH && |
uio->uio_iov->iov_len >= SOCK_LOAN_THRESH && |
space >= SOCK_LOAN_THRESH && |
space >= SOCK_LOAN_THRESH && |
Line 697 sosend(struct socket *so, struct mbuf *a |
|
Line 733 sosend(struct socket *so, struct mbuf *a |
|
} |
} |
if (resid >= MINCLSIZE && space >= MCLBYTES) { |
if (resid >= MINCLSIZE && space >= MCLBYTES) { |
SOSEND_COUNTER_INCR(&sosend_copy_big); |
SOSEND_COUNTER_INCR(&sosend_copy_big); |
MCLGET(m, M_WAIT); |
m_clget(m, M_WAIT); |
if ((m->m_flags & M_EXT) == 0) |
if ((m->m_flags & M_EXT) == 0) |
goto nopages; |
goto nopages; |
mlen = MCLBYTES; |
mlen = MCLBYTES; |
Line 748 sosend(struct socket *so, struct mbuf *a |
|
Line 784 sosend(struct socket *so, struct mbuf *a |
|
so->so_state |= SS_MORETOCOME; |
so->so_state |= SS_MORETOCOME; |
error = (*so->so_proto->pr_usrreq)(so, |
error = (*so->so_proto->pr_usrreq)(so, |
(flags & MSG_OOB) ? PRU_SENDOOB : PRU_SEND, |
(flags & MSG_OOB) ? PRU_SENDOOB : PRU_SEND, |
top, addr, control, p); |
top, addr, control, curlwp); /* XXX */ |
if (dontroute) |
if (dontroute) |
so->so_options &= ~SO_DONTROUTE; |
so->so_options &= ~SO_DONTROUTE; |
if (resid > 0) |
if (resid > 0) |
Line 820 soreceive(struct socket *so, struct mbuf |
|
Line 856 soreceive(struct socket *so, struct mbuf |
|
m = m_get(M_WAIT, MT_DATA); |
m = m_get(M_WAIT, MT_DATA); |
error = (*pr->pr_usrreq)(so, PRU_RCVOOB, m, |
error = (*pr->pr_usrreq)(so, PRU_RCVOOB, m, |
(struct mbuf *)(long)(flags & MSG_PEEK), (struct mbuf *)0, |
(struct mbuf *)(long)(flags & MSG_PEEK), (struct mbuf *)0, |
(struct proc *)0); |
(struct lwp *)0); |
if (error) |
if (error) |
goto bad; |
goto bad; |
do { |
do { |
Line 837 soreceive(struct socket *so, struct mbuf |
|
Line 873 soreceive(struct socket *so, struct mbuf |
|
*mp = (struct mbuf *)0; |
*mp = (struct mbuf *)0; |
if (so->so_state & SS_ISCONFIRMING && uio->uio_resid) |
if (so->so_state & SS_ISCONFIRMING && uio->uio_resid) |
(*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0, |
(*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0, |
(struct mbuf *)0, (struct mbuf *)0, (struct proc *)0); |
(struct mbuf *)0, (struct mbuf *)0, (struct lwp *)0); |
|
|
restart: |
restart: |
if ((error = sblock(&so->so_rcv, SBLOCKWAIT(flags))) != 0) |
if ((error = sblock(&so->so_rcv, SBLOCKWAIT(flags))) != 0) |
Line 911 soreceive(struct socket *so, struct mbuf |
|
Line 947 soreceive(struct socket *so, struct mbuf |
|
* info, we save a copy of m->m_nextpkt into nextrecord. |
* info, we save a copy of m->m_nextpkt into nextrecord. |
*/ |
*/ |
#ifdef notyet /* XXXX */ |
#ifdef notyet /* XXXX */ |
if (uio->uio_procp) |
if (uio->uio_lwp) |
uio->uio_procp->p_stats->p_ru.ru_msgrcv++; |
uio->uio_lwp->l_proc->p_stats->p_ru.ru_msgrcv++; |
#endif |
#endif |
KASSERT(m == so->so_rcv.sb_mb); |
KASSERT(m == so->so_rcv.sb_mb); |
SBLASTRECORDCHK(&so->so_rcv, "soreceive 1"); |
SBLASTRECORDCHK(&so->so_rcv, "soreceive 1"); |
Line 1141 soreceive(struct socket *so, struct mbuf |
|
Line 1177 soreceive(struct socket *so, struct mbuf |
|
(struct mbuf *)0, |
(struct mbuf *)0, |
(struct mbuf *)(long)flags, |
(struct mbuf *)(long)flags, |
(struct mbuf *)0, |
(struct mbuf *)0, |
(struct proc *)0); |
(struct lwp *)0); |
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 2"); |
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 2"); |
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 2"); |
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 2"); |
error = sbwait(&so->so_rcv); |
error = sbwait(&so->so_rcv); |
Line 1179 soreceive(struct socket *so, struct mbuf |
|
Line 1215 soreceive(struct socket *so, struct mbuf |
|
if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) |
if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) |
(*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0, |
(*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0, |
(struct mbuf *)(long)flags, (struct mbuf *)0, |
(struct mbuf *)(long)flags, (struct mbuf *)0, |
(struct proc *)0); |
(struct lwp *)0); |
} |
} |
if (orig_resid == uio->uio_resid && orig_resid && |
if (orig_resid == uio->uio_resid && orig_resid && |
(flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { |
(flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { |
Line 1209 soshutdown(struct socket *so, int how) |
|
Line 1245 soshutdown(struct socket *so, int how) |
|
sorflush(so); |
sorflush(so); |
if (how == SHUT_WR || how == SHUT_RDWR) |
if (how == SHUT_WR || how == SHUT_RDWR) |
return (*pr->pr_usrreq)(so, PRU_SHUTDOWN, (struct mbuf *)0, |
return (*pr->pr_usrreq)(so, PRU_SHUTDOWN, (struct mbuf *)0, |
(struct mbuf *)0, (struct mbuf *)0, (struct proc *)0); |
(struct mbuf *)0, (struct mbuf *)0, (struct lwp *)0); |
return (0); |
return (0); |
} |
} |
|
|
Line 1341 sosetopt(struct socket *so, int level, i |
|
Line 1377 sosetopt(struct socket *so, int level, i |
|
goto bad; |
goto bad; |
} |
} |
tv = mtod(m, struct timeval *); |
tv = mtod(m, struct timeval *); |
if (tv->tv_sec * hz + tv->tv_usec / tick > SHRT_MAX) { |
if (tv->tv_sec > (SHRT_MAX - tv->tv_usec / tick) / hz) { |
error = EDOM; |
error = EDOM; |
goto bad; |
goto bad; |
} |
} |