source: rtems/cpukit/libnetworking/sys/kernel.h @ b0c516b

Last change on this file since b0c516b was 36799d4, checked in by Joel Sherrill <joel.sherrill@…>, on 01/03/03 at 18:09:57

2002-11-26 Chris Johns <cjohns@…>

  • Makefile.am: Added sys/linker_set.h
  • kern/Makefile.am: Added kern_mib.c and kern_sysctl.c.
  • kern/uipc_socket.c: OID changed from KERN_SOMAXCONN to KIPC_SOMAXCONN.
  • kern/uipc_socket2.c: OID changed from KERN_MAXSOCKBUF to KIPC_MAXSOCKBUF.
  • net/if_ethersubr.c: FreeBSD 2.2.2 does not have a _net_link node while 5.0 does.
  • net/if_ppp.c: Removed the TEXT_SET define as these macros are now implemented.
  • net/rtsock.c: Enable sysctl support plus fix the bug with the lastest FreeBSD sysctl header file.
  • netinet/icmp_var.h: FreeBSD 2.2.2 does not have a _net_inet_icmp node while 5.0 does.
  • netinet/if_ether.c: FreeBSD 2.2.2 does not have a _net_link_ether node while 5.0 does.
  • netinet/igmp_var.h: FreeBSD 2.2.2 does not have a _net_inet_igmp node while 5.0 does.
  • netinet/in_pcb.c: Fixed the arguments to the sysctl call. Add inp_gencnt and ipi_count. These are used when listing connections.
  • netinet/in_pcb.h: Added counters to aid the listing of connections.
  • netinet/in_var.h: Provide the _net_inet_ip and _net_inet_raw nodes.
  • netinet/ip_fw.c: Disable the firewall sysctl calls.
  • netinet/tcp_subr.c: Merge tcp_pcblist from the lastest FreeBSD source.
  • netinet/tcp_var.h: Add structures needed by net-snmp to list connections.
  • netinet/udp_usrreq.c: Merged udp_pcblist from the lastest FreeBSD source.
  • netinet/udp_var.h: Added the sysctl id UDPCTL_PCBLIST. Used by net-snmp.
  • rtems_glue.c: Call sysctl_register_all when initialising the network stack to register all the sysctl calls. These are in the special sections and required an updated linker script.
  • rtems/rtems_syscall.c: Add the sysctl call.
  • sys/kernel.h: Use the lastest FreeBSD method of handling sysctl structures. This now held in the sys/linker_set.h file.
  • sys/queue.h: This is from the lastest FreeBSD code with the circular code merged back in as it is not used in the lastest FreeBSD kernel.
  • sys/sysctl.h: The lastest sysctl. This was needed to use with the new linker set method. The FreeBSD 2.2.2 version has asm hacks. The lastest version of the FreeBSD does not have these hacks. It uses gcc attribute directives.
  • Property mode set to 100644
File size: 9.3 KB
Line 
1/*-
2 * Copyright (c) 1995 Terrence R. Lambert
3 * All rights reserved.
4 *
5 * Copyright (c) 1990, 1993
6 *      The Regents of the University of California.  All rights reserved.
7 * (c) UNIX System Laboratories, Inc.
8 * All or some portions of this file are derived from material licensed
9 * to the University of California by American Telephone and Telegraph
10 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
11 * the permission of UNIX System Laboratories, Inc.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 *    notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 *    notice, this list of conditions and the following disclaimer in the
20 *    documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 *    must display the following acknowledgement:
23 *      This product includes software developed by the University of
24 *      California, Berkeley and its contributors.
25 * 4. Neither the name of the University nor the names of its contributors
26 *    may be used to endorse or promote products derived from this software
27 *    without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 *      @(#)kernel.h    8.3 (Berkeley) 1/21/94
42 * $Id$
43 */
44
45#ifndef _SYS_KERNEL_H_
46#define _SYS_KERNEL_H_
47
48/* Global variables for the kernel. */
49
50/* 1.1 */
51extern long hostid;
52extern char hostname[MAXHOSTNAMELEN];
53extern int hostnamelen;
54extern char domainname[MAXHOSTNAMELEN];
55extern int domainnamelen;
56extern char kernelname[MAXPATHLEN];
57
58/* 1.2 */
59extern volatile struct timeval mono_time;
60extern struct timeval boottime;
61extern struct timeval runtime;
62/* extern volatile struct timeval time; */
63extern struct timezone tz;                      /* XXX */
64
65extern int tick;                        /* usec per tick (1000000 / hz) */
66extern int hz;                          /* system clock's frequency */
67extern int psratio;                     /* ratio: prof / stat */
68extern int stathz;                      /* statistics clock's frequency */
69extern int profhz;                      /* profiling clock's frequency */
70extern int ticks;
71extern int lbolt;                       /* once a second sleep address */
72extern int tickdelta;
73extern long timedelta;
74
75#if FREEBSD_RELENG_2_2_2_BASE
76/*
77 * The following macros are used to declare global sets of objects, which
78 * are collected by the linker into a `struct linker_set' as defined below.
79 *
80 * NB: the constants defined below must match those defined in
81 * ld/ld.h.  Since their calculation requires arithmetic, we
82 * can't name them symbolically (e.g., 23 is N_SETT | N_EXT).
83 */
84#define MAKE_SET(set, sym, type)
85#define TEXT_SET(set, sym) MAKE_SET(set, sym, 23)
86#define DATA_SET(set, sym) MAKE_SET(set, sym, 25)
87#define BSS_SET(set, sym)  MAKE_SET(set, sym, 27)
88#define ABS_SET(set, sym)  MAKE_SET(set, sym, 21)
89
90#else
91
92/*
93 * RTEMS specific port using the updated sys/linker_set.h
94 * from the lastest FreeBSD (2002-Nov-15). This is a better
95 * way.
96 *
97 * Chris Johns (ccj@acm.org> 18 Nov 2002.
98 */
99#include <sys/linker_set.h>
100
101#endif
102
103/*
104 * Enumerated types for known system startup interfaces.
105 *
106 * Startup occurs in ascending numeric order; the list entries are
107 * sorted prior to attempting startup to guarantee order.  Items
108 * of the same level are arbitrated for order based on the 'order'
109 * element.
110 *
111 * These numbers are arbitrary and are chosen ONLY for ordering; the
112 * enumeration values are explicit rather than implicit to provide
113 * for binary compatibility with inserted elements.
114 *
115 * The SI_SUB_RUN_SCHEDULER value must have the highest lexical value.
116 *
117 * The SI_SUB_CONSOLE and SI_SUB_SWAP values represent values used by
118 * the BSD 4.4Lite but not by FreeBSD; they are maintained in dependent
119 * order to support porting.
120 *
121 * The SI_SUB_PROTO_BEGIN and SI_SUB_PROTO_END bracket a range of
122 * initializations to take place at splimp().  This is a historical
123 * wart that should be removed -- probably running everything at
124 * splimp() until the first init that doesn't want it is the correct
125 * fix.  They are currently present to ensure historical behavior.
126 */
127enum sysinit_sub_id {
128        SI_SUB_DUMMY            = 0x00000000,   /* not executed; for linker*/
129        SI_SUB_CONSOLE          = 0x08000000,   /* console*/
130        SI_SUB_COPYRIGHT        = 0x08000001,   /* first use of console*/
131        SI_SUB_VM               = 0x10000000,   /* virtual memory system init*/
132        SI_SUB_KMEM             = 0x18000000,   /* kernel memory*/
133        SI_SUB_CPU              = 0x20000000,   /* CPU resource(s)*/
134        SI_SUB_DEVFS            = 0x22000000,   /* get DEVFS ready */
135        SI_SUB_DRIVERS          = 0x23000000,   /* Let Drivers initialize */
136        SI_SUB_CONFIGURE        = 0x24000000,   /* Configure devices */
137        SI_SUB_INTRINSIC        = 0x28000000,   /* proc 0*/
138        SI_SUB_RUN_QUEUE        = 0x30000000,   /* the run queue*/
139        SI_SUB_VM_CONF          = 0x38000000,   /* config VM, set limits*/
140        SI_SUB_VFS              = 0x40000000,   /* virtual file system*/
141        SI_SUB_CLOCKS           = 0x48000000,   /* real time and stat clocks*/
142        SI_SUB_MBUF             = 0x50000000,   /* mbufs*/
143        SI_SUB_CLIST            = 0x58000000,   /* clists*/
144        SI_SUB_SYSV_SHM         = 0x64000000,   /* System V shared memory*/
145        SI_SUB_SYSV_SEM         = 0x68000000,   /* System V semaphores*/
146        SI_SUB_SYSV_MSG         = 0x6C000000,   /* System V message queues*/
147        SI_SUB_PSEUDO           = 0x70000000,   /* pseudo devices*/
148        SI_SUB_PROTO_BEGIN      = 0x80000000,   /* XXX: set splimp (kludge)*/
149        SI_SUB_PROTO_IF         = 0x84000000,   /* interfaces*/
150        SI_SUB_PROTO_DOMAIN     = 0x88000000,   /* domains (address families?)*/
151        SI_SUB_PROTO_END        = 0x8fffffff,   /* XXX: set splx (kludge)*/
152        SI_SUB_KPROF            = 0x90000000,   /* kernel profiling*/
153        SI_SUB_KICK_SCHEDULER   = 0xa0000000,   /* start the timeout events*/
154        SI_SUB_ROOT             = 0xb0000000,   /* root mount*/
155        SI_SUB_ROOT_FDTAB       = 0xb8000000,   /* root vnode in fd table...*/
156        SI_SUB_SWAP             = 0xc0000000,   /* swap*/
157        SI_SUB_INTRINSIC_POST   = 0xd0000000,   /* proc 0 cleanup*/
158        SI_SUB_KTHREAD_INIT     = 0xe0000000,   /* init process*/
159        SI_SUB_KTHREAD_PAGE     = 0xe4000000,   /* pageout daemon*/
160        SI_SUB_KTHREAD_VM       = 0xe8000000,   /* vm daemon*/
161        SI_SUB_KTHREAD_UPDATE   = 0xec000000,   /* update daemon*/
162        SI_SUB_RUN_SCHEDULER    = 0xffffffff    /* scheduler: no return*/
163};
164
165
166/*
167 * Some enumerated orders; "ANY" sorts last.
168 */
169enum sysinit_elem_order {
170        SI_ORDER_FIRST          = 0x00000000,   /* first*/
171        SI_ORDER_SECOND         = 0x00000001,   /* second*/
172        SI_ORDER_THIRD          = 0x00000002,   /* third*/
173        SI_ORDER_MIDDLE         = 0x10000000,   /* somewhere in the middle */
174        SI_ORDER_ANY            = 0xffffffff    /* last*/
175};
176
177
178/*
179 * System initialization call types; currently two are supported... one
180 * to do a simple function call and one to cause a process to be started
181 * by the kernel on the callers behalf.
182 */
183typedef enum sysinit_elem_type {
184        SI_TYPE_DEFAULT         = 0x00000000,   /* No special processing*/
185        SI_TYPE_KTHREAD         = 0x00000001    /* start kernel thread*/
186} si_elem_t;
187
188
189/*
190 * A system initialization call instance
191 *
192 * The subsystem
193 */
194struct sysinit {
195        unsigned int    subsystem;              /* subsystem identifier*/
196        unsigned int    order;                  /* init order within subsystem*/
197        void            (*func) __P((void *));  /* init function*/
198        void            *udata;                 /* multiplexer/argument */
199        si_elem_t       type;                   /* sysinit_elem_type*/
200};
201
202
203/*
204 * Default: no special processing
205 */
206#define SYSINIT(uniquifier, subsystem, order, func, ident)     
207
208/*
209 * Call 'fork()' before calling '(*func)(ident)';
210 * for making a kernel 'thread' (or builtin process.)
211 */
212#define SYSINIT_KT(uniquifier, subsystem, order, func, ident)
213
214
215/*
216 * A kernel process descriptor; used to start "internal" daemons
217 *
218 * Note: global_procpp may be NULL for no global save area
219 */
220struct kproc_desc {
221        char            *arg0;                  /* arg 0 (for 'ps' listing)*/
222        void            (*func) __P((void));    /* "main" for kernel process*/
223        struct proc     **global_procpp;        /* ptr to proc ptr save area*/
224};
225
226void    kproc_start __P((void *udata));
227
228#ifdef PSEUDO_LKM
229#include <sys/conf.h>
230#include <sys/exec.h>
231#include <sys/sysent.h>
232#include <sys/lkm.h>
233
234#define PSEUDO_SET(init, name) \
235        extern struct linker_set MODVNOPS; \
236        MOD_MISC(name); \
237        static int \
238        name ## _load(struct lkm_table *lkmtp, int cmd) \
239                { init((void *)NULL /* XXX unused (?) */); return 0; } \
240        static int \
241        name ## _unload(struct lkm_table *lkmtp, int cmd) \
242                { return EINVAL; } \
243        int \
244        name ## _mod(struct lkm_table *lkmtp, int cmd, int ver) { \
245                DISPATCH(lkmtp, cmd, ver, name ## _load, name ## _unload, \
246                         lkm_nullcmd); }
247#else /* PSEUDO_LKM */
248
249/*
250 * Compatibility.  To be deprecated after LKM is updated.
251 */
252#define PSEUDO_SET(sym, name)   SYSINIT(ps, SI_SUB_PSEUDO, SI_ORDER_ANY, sym, 0)
253
254#endif /* PSEUDO_LKM */
255
256struct linker_set {
257        int             ls_length;
258        const void      *ls_items[1];           /* really ls_length of them,
259                                                 * trailing NULL */
260};
261
262extern struct linker_set execsw_set;
263
264#endif /* !_SYS_KERNEL_H_*/
Note: See TracBrowser for help on using the repository browser.