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.63 diff -u -p -r1.54 -r1.63 --- src/sys/kern/uipc_socket.c 2001/02/27 05:19:13 1.54 +++ src/sys/kern/uipc_socket.c 2002/04/06 08:04:17 1.63 @@ -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.63 2002/04/06 08:04:17 matt Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1990, 1993 @@ -35,7 +35,8 @@ * @(#)uipc_socket.c 8.6 (Berkeley) 5/2/95 */ -#include "opt_compat_sunos.h" +#include +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.63 2002/04/06 08:04:17 matt Exp $"); #include #include @@ -62,7 +63,7 @@ soinit(void) { pool_init(&socket_pool, sizeof(struct socket), 0, 0, 0, - "sockpl", 0, NULL, NULL, M_SOCKET); + "sockpl", NULL); } /* @@ -109,13 +110,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); @@ -145,7 +139,7 @@ solisten(struct socket *so, int backlog) splx(s); return (error); } - if (so->so_q.tqh_first == NULL) + if (TAILQ_EMPTY(&so->so_q)) so->so_options |= SO_ACCEPTCONN; if (backlog < 0) backlog = 0; @@ -188,11 +182,11 @@ soclose(struct socket *so) error = 0; s = splsoftnet(); /* conservative */ if (so->so_options & SO_ACCEPTCONN) { - while ((so2 = so->so_q0.tqh_first) != 0) { + while ((so2 = TAILQ_FIRST(&so->so_q0)) != 0) { (void) soqremque(so2, 0); (void) soabort(so2); } - while ((so2 = so->so_q.tqh_first) != 0) { + while ((so2 = TAILQ_FIRST(&so->so_q)) != 0) { (void) soqremque(so2, 1); (void) soabort(so2); } @@ -256,7 +250,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 @@ -352,8 +347,8 @@ 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 */ clen = 0; @@ -446,19 +441,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 +730,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 +859,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;