uipc_socket.c (50477) | uipc_socket.c (51381) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 | 1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 |
34 * $FreeBSD: head/sys/kern/uipc_socket.c 50477 1999-08-28 01:08:13Z peter $ | 34 * $FreeBSD: head/sys/kern/uipc_socket.c 51381 1999-09-19 02:17:02Z green $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/fcntl.h> 40#include <sys/malloc.h> 41#include <sys/mbuf.h> 42#include <sys/domain.h> --- 77 unchanged lines hidden (view full) --- 120 return (EPROTOTYPE); 121 so = soalloc(p != 0); 122 if (so == 0) 123 return (ENOBUFS); 124 125 TAILQ_INIT(&so->so_incomp); 126 TAILQ_INIT(&so->so_comp); 127 so->so_type = type; | 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/fcntl.h> 40#include <sys/malloc.h> 41#include <sys/mbuf.h> 42#include <sys/domain.h> --- 77 unchanged lines hidden (view full) --- 120 return (EPROTOTYPE); 121 so = soalloc(p != 0); 122 if (so == 0) 123 return (ENOBUFS); 124 125 TAILQ_INIT(&so->so_incomp); 126 TAILQ_INIT(&so->so_comp); 127 so->so_type = type; |
128 if (p) { 129 so->so_cred = p->p_cred; 130 so->so_cred->p_refcnt++; 131 } else so->so_cred = NULL; | 128 so->so_cred = p->p_ucred; 129 crhold(so->so_cred); |
132 so->so_proto = prp; 133 error = (*prp->pr_usrreqs->pru_attach)(so, proto, p); 134 if (error) { 135 so->so_state |= SS_NOFDREF; 136 sofree(so); 137 return (error); 138 } 139 *aso = so; --- 13 unchanged lines hidden (view full) --- 153 splx(s); 154 return (error); 155} 156 157void 158sodealloc(so) 159 struct socket *so; 160{ | 130 so->so_proto = prp; 131 error = (*prp->pr_usrreqs->pru_attach)(so, proto, p); 132 if (error) { 133 so->so_state |= SS_NOFDREF; 134 sofree(so); 135 return (error); 136 } 137 *aso = so; --- 13 unchanged lines hidden (view full) --- 151 splx(s); 152 return (error); 153} 154 155void 156sodealloc(so) 157 struct socket *so; 158{ |
159 |
|
161 so->so_gencnt = ++so_gencnt; | 160 so->so_gencnt = ++so_gencnt; |
162 if (so->so_cred && --so->so_cred->p_refcnt == 0) { 163 crfree(so->so_cred->pc_ucred); 164 FREE(so->so_cred, M_SUBPROC); 165 } | 161 crfree(so->so_cred); |
166 zfreei(so->so_zone, so); 167} 168 169int 170solisten(so, backlog, p) 171 register struct socket *so; 172 int backlog; 173 struct proc *p; --- 1086 unchanged lines hidden --- | 162 zfreei(so->so_zone, so); 163} 164 165int 166solisten(so, backlog, p) 167 register struct socket *so; 168 int backlog; 169 struct proc *p; --- 1086 unchanged lines hidden --- |