diff options
author | wollman <wollman@FreeBSD.org> | 1998-05-15 20:11:40 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1998-05-15 20:11:40 +0000 |
commit | bbc4497adab2d7702eab9a609897b2e5f672289e (patch) | |
tree | 10594c024ae545493609ccaa7de3d90faf27616a /sys/kern/uipc_domain.c | |
parent | be2e5ffcfc349cb4483b536bd57048eca466e0c9 (diff) | |
download | FreeBSD-src-bbc4497adab2d7702eab9a609897b2e5f672289e.zip FreeBSD-src-bbc4497adab2d7702eab9a609897b2e5f672289e.tar.gz |
Convert socket structures to be type-stable and add a version number.
Define a parameter which indicates the maximum number of sockets in a
system, and use this to size the zone allocators used for sockets and
for certain PCBs.
Convert PF_LOCAL PCB structures to be type-stable and add a version number.
Define an external format for infomation about socket structures and use
it in several places.
Define a mechanism to get all PF_LOCAL and PF_INET PCB lists through
sysctl(3) without blocking network interrupts for an unreasonable
length of time. This probably still has some bugs and/or race
conditions, but it seems to work well enough on my machines.
It is now possible for `netstat' to get almost all of its information
via the sysctl(3) interface rather than reading kmem (changes to follow).
Diffstat (limited to 'sys/kern/uipc_domain.c')
-rw-r--r-- | sys/kern/uipc_domain.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 69d6bf8..22078b1 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_domain.c 8.2 (Berkeley) 10/18/93 - * $Id: uipc_domain.c,v 1.17 1997/04/27 20:00:42 wollman Exp $ + * $Id: uipc_domain.c,v 1.18 1997/09/16 11:43:36 bde Exp $ */ #include <sys/param.h> @@ -40,7 +40,9 @@ #include <sys/domain.h> #include <sys/mbuf.h> #include <sys/kernel.h> +#include <sys/socketvar.h> #include <sys/systm.h> +#include <vm/vm_zone.h> /* * System initialization @@ -85,6 +87,21 @@ domaininit(dummy) register struct protosw *pr; /* + * Before we do any setup, make sure to initialize the + * zone allocator we get struct sockets from. The obvious + * maximum number of sockets is `maxfiles', but it is possible + * to have a socket without an open file (e.g., a connection waiting + * to be accept(2)ed). Rather than think up and define a + * better value, we just use nmbclusters, since that's what people + * are told to increase first when the network runs out of memory. + * Perhaps we should have two pools, one of unlimited size + * for use during socreate(), and one ZONE_INTERRUPT pool for + * use in sonewconn(). + */ + socket_zone = zinit("socket", sizeof(struct socket), maxsockets, + ZONE_INTERRUPT, 0); + + /* * NB - local domain is always present. */ ADDDOMAIN(local); @@ -94,26 +111,14 @@ domaininit(dummy) domains = *dpp; } -/* - not in our sources -#ifdef ISDN - ADDDOMAIN(isdn); -#endif -*/ - for (dp = domains; dp; dp = dp->dom_next) { if (dp->dom_init) (*dp->dom_init)(); for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++){ -#ifdef PRU_OLDSTYLE - /* See comments in uipc_socket2.c. */ - if (pr->pr_usrreqs == 0 && pr->pr_ousrreq) - pr->pr_usrreqs = &pru_oldstyle; -#else if (pr->pr_usrreqs == 0) panic("domaininit: %ssw[%d] has no usrreqs!", dp->dom_name, (int)(pr - dp->dom_protosw)); -#endif if (pr->pr_init) (*pr->pr_init)(); } @@ -151,7 +156,7 @@ kludge_splx(udata) { int *savesplp = udata; - splx( *savesplp); + splx(*savesplp); } |