summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.h
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1998-05-15 20:11:40 +0000
committerwollman <wollman@FreeBSD.org>1998-05-15 20:11:40 +0000
commitbbc4497adab2d7702eab9a609897b2e5f672289e (patch)
tree10594c024ae545493609ccaa7de3d90faf27616a /sys/netinet/in_pcb.h
parentbe2e5ffcfc349cb4483b536bd57048eca466e0c9 (diff)
downloadFreeBSD-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/netinet/in_pcb.h')
-rw-r--r--sys/netinet/in_pcb.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 467a5b2..aa2d0be 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
- * $Id: in_pcb.h,v 1.24 1998/03/24 18:06:11 wollman Exp $
+ * $Id: in_pcb.h,v 1.25 1998/03/28 10:18:22 bde Exp $
*/
#ifndef _NETINET_IN_PCB_H_
@@ -48,6 +48,7 @@
*/
LIST_HEAD(inpcbhead, inpcb);
LIST_HEAD(inpcbporthead, inpcbport);
+typedef u_quad_t inp_gen_t;
/*
* NB: the zone allocator is type-stable EXCEPT FOR THE FIRST TWO LONGS
@@ -75,7 +76,7 @@ struct inpcb {
struct ip_moptions *inp_moptions; /* IP multicast options */
LIST_ENTRY(inpcb) inp_portlist; /* list for this PCB's local port */
struct inpcbport *inp_phd; /* head of this list */
- u_quad_t inp_gencnt; /* generation count of this instance */
+ inp_gen_t inp_gencnt; /* generation count of this instance */
};
/*
* The range of the generation count, as used in this implementation,
@@ -84,6 +85,26 @@ struct inpcb {
* unlikely that we simply don't concern ourselves with that possibility.
*/
+/*
+ * Interface exported to userland by various protocols which use
+ * inpcbs. Hack alert -- only define if struct xsocket is in scope.
+ */
+#ifdef _SYS_SOCKETVAR_H_
+struct xinpcb {
+ size_t xi_len; /* length of this structure */
+ struct inpcb xi_inp;
+ struct xsocket xi_socket;
+ u_quad_t xi_alignment_hack;
+};
+
+struct xinpgen {
+ size_t xig_len; /* length of this structure */
+ u_int xig_count; /* number of PCBs at this time */
+ inp_gen_t xig_gen; /* generation count at this time */
+ so_gen_t xig_sogen; /* socket generation count at this time */
+};
+#endif /* _SYS_SOCKETVAR_H_ */
+
struct inpcbport {
LIST_ENTRY(inpcbport) phd_hash;
struct inpcbhead phd_pcblist;
OpenPOWER on IntegriCloud