uipc_domain.c (29506) | uipc_domain.c (36079) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 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_domain.c 8.2 (Berkeley) 10/18/93 | 1/* 2 * Copyright (c) 1982, 1986, 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_domain.c 8.2 (Berkeley) 10/18/93 |
34 * $Id: uipc_domain.c,v 1.17 1997/04/27 20:00:42 wollman Exp $ | 34 * $Id: uipc_domain.c,v 1.18 1997/09/16 11:43:36 bde Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/socket.h> 39#include <sys/protosw.h> 40#include <sys/domain.h> 41#include <sys/mbuf.h> 42#include <sys/kernel.h> | 35 */ 36 37#include <sys/param.h> 38#include <sys/socket.h> 39#include <sys/protosw.h> 40#include <sys/domain.h> 41#include <sys/mbuf.h> 42#include <sys/kernel.h> |
43#include <sys/socketvar.h> |
|
43#include <sys/systm.h> | 44#include <sys/systm.h> |
45#include <vm/vm_zone.h> |
|
44 45/* 46 * System initialization 47 * 48 * Note: domain initialization wants to take place on a per domain basis 49 * as a result of traversing a linker set. Most likely, each domain 50 * want to call a registration function rather than being handled here 51 * in domaininit(). Probably this will look like: --- 28 unchanged lines hidden (view full) --- 80static void 81domaininit(dummy) 82 void *dummy; 83{ 84 register struct domain *dp, **dpp; 85 register struct protosw *pr; 86 87 /* | 46 47/* 48 * System initialization 49 * 50 * Note: domain initialization wants to take place on a per domain basis 51 * as a result of traversing a linker set. Most likely, each domain 52 * want to call a registration function rather than being handled here 53 * in domaininit(). Probably this will look like: --- 28 unchanged lines hidden (view full) --- 82static void 83domaininit(dummy) 84 void *dummy; 85{ 86 register struct domain *dp, **dpp; 87 register struct protosw *pr; 88 89 /* |
90 * Before we do any setup, make sure to initialize the 91 * zone allocator we get struct sockets from. The obvious 92 * maximum number of sockets is `maxfiles', but it is possible 93 * to have a socket without an open file (e.g., a connection waiting 94 * to be accept(2)ed). Rather than think up and define a 95 * better value, we just use nmbclusters, since that's what people 96 * are told to increase first when the network runs out of memory. 97 * Perhaps we should have two pools, one of unlimited size 98 * for use during socreate(), and one ZONE_INTERRUPT pool for 99 * use in sonewconn(). 100 */ 101 socket_zone = zinit("socket", sizeof(struct socket), maxsockets, 102 ZONE_INTERRUPT, 0); 103 104 /* |
|
88 * NB - local domain is always present. 89 */ 90 ADDDOMAIN(local); 91 92 for (dpp = (struct domain **)domain_set.ls_items; *dpp; dpp++) { 93 (**dpp).dom_next = domains; 94 domains = *dpp; 95 } 96 | 105 * NB - local domain is always present. 106 */ 107 ADDDOMAIN(local); 108 109 for (dpp = (struct domain **)domain_set.ls_items; *dpp; dpp++) { 110 (**dpp).dom_next = domains; 111 domains = *dpp; 112 } 113 |
97/* - not in our sources 98#ifdef ISDN 99 ADDDOMAIN(isdn); 100#endif 101*/ 102 | |
103 for (dp = domains; dp; dp = dp->dom_next) { 104 if (dp->dom_init) 105 (*dp->dom_init)(); 106 for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++){ | 114 for (dp = domains; dp; dp = dp->dom_next) { 115 if (dp->dom_init) 116 (*dp->dom_init)(); 117 for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++){ |
107#ifdef PRU_OLDSTYLE 108 /* See comments in uipc_socket2.c. */ 109 if (pr->pr_usrreqs == 0 && pr->pr_ousrreq) 110 pr->pr_usrreqs = &pru_oldstyle; 111#else | |
112 if (pr->pr_usrreqs == 0) 113 panic("domaininit: %ssw[%d] has no usrreqs!", 114 dp->dom_name, 115 (int)(pr - dp->dom_protosw)); | 118 if (pr->pr_usrreqs == 0) 119 panic("domaininit: %ssw[%d] has no usrreqs!", 120 dp->dom_name, 121 (int)(pr - dp->dom_protosw)); |
116#endif | |
117 if (pr->pr_init) 118 (*pr->pr_init)(); 119 } 120 } 121 122 if (max_linkhdr < 16) /* XXX */ 123 max_linkhdr = 16; 124 max_hdr = max_linkhdr + max_protohdr; --- 21 unchanged lines hidden (view full) --- 146} 147 148static void 149kludge_splx(udata) 150 void *udata; 151{ 152 int *savesplp = udata; 153 | 122 if (pr->pr_init) 123 (*pr->pr_init)(); 124 } 125 } 126 127 if (max_linkhdr < 16) /* XXX */ 128 max_linkhdr = 16; 129 max_hdr = max_linkhdr + max_protohdr; --- 21 unchanged lines hidden (view full) --- 151} 152 153static void 154kludge_splx(udata) 155 void *udata; 156{ 157 int *savesplp = udata; 158 |
154 splx( *savesplp); | 159 splx(*savesplp); |
155} 156 157 158 159struct protosw * 160pffindtype(family, type) 161 int family; 162 int type; --- 84 unchanged lines hidden --- | 160} 161 162 163 164struct protosw * 165pffindtype(family, type) 166 int family; 167 int type; --- 84 unchanged lines hidden --- |