Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/uipc_socket.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/kern/uipc_socket.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.54 retrieving revision 1.54.2.7 diff -u -p -r1.54 -r1.54.2.7 --- src/sys/kern/uipc_socket.c 2001/02/27 05:19:13 1.54 +++ src/sys/kern/uipc_socket.c 2002/01/11 23:39:39 1.54.2.7 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.54 2001/02/27 05:19:13 lukem Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.54.2.7 2002/01/11 23:39:39 nathanw Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1990, 1993 @@ -35,10 +35,12 @@ * @(#)uipc_socket.c 8.6 (Berkeley) 5/2/95 */ -#include "opt_compat_sunos.h" +#include +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.54.2.7 2002/01/11 23:39:39 nathanw Exp $"); #include #include +#include #include #include #include @@ -81,7 +83,7 @@ socreate(int dom, struct socket **aso, i struct socket *so; int error, s; - p = curproc; /* XXX */ + p = curproc->l_proc; /* XXX */ if (proto) prp = pffindproto(dom, proto, type); else @@ -109,13 +111,6 @@ socreate(int dom, struct socket **aso, i splx(s); return (error); } -#ifdef COMPAT_SUNOS - { - extern struct emul emul_sunos; - if (p->p_emul == &emul_sunos && type == SOCK_DGRAM) - so->so_options |= SO_BROADCAST; - } -#endif splx(s); *aso = so; return (0); @@ -256,7 +251,8 @@ soaccept(struct socket *so, struct mbuf if ((so->so_state & SS_NOFDREF) == 0) panic("soaccept: !NOFDREF"); so->so_state &= ~SS_NOFDREF; - if ((so->so_state & SS_ISDISCONNECTED) == 0) + if ((so->so_state & SS_ISDISCONNECTED) == 0 || + (so->so_proto->pr_flags & PR_ABRTACPTDIS) == 0) error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, (struct mbuf *)0, nam, (struct mbuf *)0, (struct proc *)0); else @@ -272,7 +268,7 @@ soconnect(struct socket *so, struct mbuf struct proc *p; int s, error; - p = curproc; /* XXX */ + p = curproc->l_proc; /* XXX */ if (so->so_options & SO_ACCEPTCONN) return (EOPNOTSUPP); s = splsoftnet(); @@ -352,10 +348,10 @@ sosend(struct socket *so, struct mbuf *a { struct proc *p; struct mbuf **mp, *m; - long space, len, resid; - int clen, error, s, dontroute, mlen, atomic; + long space, len, resid, clen, mlen; + int error, s, dontroute, atomic; - p = curproc; /* XXX */ + p = curproc->l_proc; /* XXX */ clen = 0; atomic = sosendallatonce(so) || top; if (uio) @@ -446,19 +442,19 @@ sosend(struct socket *so, struct mbuf *a goto nopages; mlen = MCLBYTES; #ifdef MAPPED_MBUFS - len = min(MCLBYTES, resid); + len = lmin(MCLBYTES, resid); #else if (atomic && top == 0) { - len = min(MCLBYTES - max_hdr, + len = lmin(MCLBYTES - max_hdr, resid); m->m_data += max_hdr; } else - len = min(MCLBYTES, resid); + len = lmin(MCLBYTES, resid); #endif space -= len; } else { nopages: - len = min(min(mlen, resid), space); + len = lmin(lmin(mlen, resid), space); space -= len; /* * For datagram protocols, leave room @@ -735,6 +731,8 @@ soreceive(struct socket *so, struct mbuf splx(s); error = uiomove(mtod(m, caddr_t) + moff, (int)len, uio); s = splsoftnet(); + if (error) + goto release; } else uio->uio_resid -= len; if (len == m->m_len - moff) { @@ -862,7 +860,7 @@ sorflush(struct socket *so) pr = so->so_proto; sb->sb_flags |= SB_NOINTR; (void) sblock(sb, M_WAITOK); - s = splimp(); + s = splnet(); socantrcvmore(so); sbunlock(sb); asb = *sb;