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 retrieving revision 1.159.2.3 retrieving revision 1.160 diff -u -p -r1.159.2.3 -r1.160 --- src/sys/kern/uipc_socket.c 2008/06/06 20:18:19 1.159.2.3 +++ src/sys/kern/uipc_socket.c 2008/04/24 11:38:36 1.160 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.159.2.3 2008/06/06 20:18:19 christos Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.160 2008/04/24 11:38:36 ad Exp $ */ /*- * Copyright (c) 2002, 2007, 2008 The NetBSD Foundation, Inc. @@ -15,6 +15,13 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -63,13 +70,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.159.2.3 2008/06/06 20:18:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.160 2008/04/24 11:38:36 ad Exp $"); #include "opt_sock_counters.h" #include "opt_sosend_loan.h" #include "opt_mbuftrace.h" #include "opt_somaxkva.h" -#include "opt_multiprocessor.h" /* XXX */ #include #include @@ -128,7 +134,7 @@ EVCNT_ATTACH_STATIC(sosend_kvalimit); static struct callback_entry sokva_reclaimerentry; -#if defined(SOSEND_NO_LOAN) || defined(MULTIPROCESSOR) +#ifdef SOSEND_NO_LOAN int sock_loan_thresh = -1; #else int sock_loan_thresh = 4096; @@ -436,7 +442,6 @@ soinit(void) mutex_init(&so_pendfree_lock, MUTEX_DEFAULT, IPL_VM); softnet_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE); cv_init(&socurkva_cv, "sokva"); - soinit2(); /* Set the initial adjusted socket buffer size. */ if (sb_max_set(sb_max)) @@ -500,8 +505,6 @@ socreate(int dom, struct socket **aso, i #endif uid = kauth_cred_geteuid(l->l_cred); so->so_uidinfo = uid_find(uid); - so->so_egid = kauth_cred_getegid(l->l_cred); - so->so_cpid = l->l_proc->p_pid; if (lockso != NULL) { /* Caller wants us to share a lock. */ lock = lockso->so_lock; @@ -571,10 +574,8 @@ solisten(struct socket *so, int backlog, solock(so); if ((so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING | - SS_ISDISCONNECTING)) != 0) { - sounlock(so); + SS_ISDISCONNECTING)) != 0) return (EOPNOTSUPP); - } error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL, NULL, NULL, l); if (error != 0) { @@ -593,7 +594,6 @@ solisten(struct socket *so, int backlog, void sofree(struct socket *so) { - u_int refs; KASSERT(solocked(so)); @@ -623,10 +623,8 @@ sofree(struct socket *so) KASSERT(!cv_has_waiters(&so->so_rcv.sb_cv)); KASSERT(!cv_has_waiters(&so->so_snd.sb_cv)); sorflush(so); - refs = so->so_aborting; /* XXX */ sounlock(so); - if (refs == 0) /* XXX */ - soput(so); + soput(so); } /* @@ -702,17 +700,14 @@ soclose(struct socket *so) int soabort(struct socket *so) { - u_int refs; int error; KASSERT(solocked(so)); KASSERT(so->so_head == NULL); - so->so_aborting++; /* XXX */ error = (*so->so_proto->pr_usrreq)(so, PRU_ABORT, NULL, NULL, NULL, NULL); - refs = --so->so_aborting; /* XXX */ - if (error || (refs == 0)) { + if (error) { sofree(so); } else { sounlock(so); @@ -854,7 +849,8 @@ sosend(struct socket *so, struct mbuf *a dontroute = (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 && (so->so_proto->pr_flags & PR_ATOMIC); - l->l_ru.ru_msgsnd++; + if (l) + l->l_ru.ru_msgsnd++; if (control) clen = control->m_len; restart: