OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [bsd_tcpip/] [current/] [include/] [sys/] [sysctl.h] - Blame information for rev 856

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      include/sys/sysctl.h
4
//
5
//==========================================================================
6
// ####BSDCOPYRIGHTBEGIN####                                    
7
// -------------------------------------------                  
8
// This file is part of eCos, the Embedded Configurable Operating System.
9
//
10
// Portions of this software may have been derived from FreeBSD 
11
// or other sources, and if so are covered by the appropriate copyright
12
// and license included herein.                                 
13
//
14
// Portions created by the Free Software Foundation are         
15
// Copyright (C) 2002 Free Software Foundation, Inc.            
16
// -------------------------------------------                  
17
// ####BSDCOPYRIGHTEND####                                      
18
//==========================================================================
19
 
20
/*
21
 * Copyright (c) 1989, 1993
22
 *      The Regents of the University of California.  All rights reserved.
23
 *
24
 * This code is derived from software contributed to Berkeley by
25
 * Mike Karels at Berkeley Software Design, Inc.
26
 *
27
 * Redistribution and use in source and binary forms, with or without
28
 * modification, are permitted provided that the following conditions
29
 * are met:
30
 * 1. Redistributions of source code must retain the above copyright
31
 *    notice, this list of conditions and the following disclaimer.
32
 * 2. Redistributions in binary form must reproduce the above copyright
33
 *    notice, this list of conditions and the following disclaimer in the
34
 *    documentation and/or other materials provided with the distribution.
35
 * 3. All advertising materials mentioning features or use of this software
36
 *    must display the following acknowledgement:
37
 *      This product includes software developed by the University of
38
 *      California, Berkeley and its contributors.
39
 * 4. Neither the name of the University nor the names of its contributors
40
 *    may be used to endorse or promote products derived from this software
41
 *    without specific prior written permission.
42
 *
43
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53
 * SUCH DAMAGE.
54
 *
55
 *      @(#)sysctl.h    8.1 (Berkeley) 6/2/93
56
 * $FreeBSD: src/sys/sys/sysctl.h,v 1.81.2.7 2001/07/18 15:36:56 pirzyk Exp $
57
 */
58
 
59
#ifndef _SYS_SYSCTL_H_
60
#define _SYS_SYSCTL_H_
61
 
62
#include <sys/queue.h>
63
#include <cyg/hal/hal_tables.h>
64
 
65
/*
66
 * Definitions for sysctl call.  The sysctl call uses a hierarchical name
67
 * for objects that can be examined or modified.  The name is expressed as
68
 * a sequence of integers.  Like a file path name, the meaning of each
69
 * component depends on its place in the hierarchy.  The top-level and kern
70
 * identifiers are defined here, and other identifiers are defined in the
71
 * respective subsystem header files.
72
 */
73
 
74
#define CTL_MAXNAME     12      /* largest number of components supported */
75
 
76
/*
77
 * Each subsystem defined by sysctl defines a list of variables
78
 * for that subsystem. Each name is either a node with further
79
 * levels defined below it, or it is a leaf of some particular
80
 * type given below. Each sysctl level defines a set of name/type
81
 * pairs to be used by sysctl(1) in manipulating the subsystem.
82
 */
83
struct ctlname {
84
        char    *ctl_name;      /* subsystem name */
85
        int     ctl_type;       /* type of name */
86
};
87
 
88
#define CTLTYPE         0xf     /* Mask for the type */
89
#define CTLTYPE_NODE    1       /* name is a node */
90
#define CTLTYPE_INT     2       /* name describes an integer */
91
#define CTLTYPE_STRING  3       /* name describes a string */
92
#define CTLTYPE_QUAD    4       /* name describes a 64-bit number */
93
#define CTLTYPE_OPAQUE  5       /* name describes a structure */
94
#define CTLTYPE_STRUCT  CTLTYPE_OPAQUE  /* name describes a structure */
95
#define CTLTYPE_UINT    6       /* name describes an unsigned integer */
96
#define CTLTYPE_LONG    7       /* name describes a long */
97
#define CTLTYPE_ULONG   8       /* name describes an unsigned long */
98
 
99
#define CTLFLAG_RD      0x80000000      /* Allow reads of variable */
100
#define CTLFLAG_WR      0x40000000      /* Allow writes to the variable */
101
#define CTLFLAG_RW      (CTLFLAG_RD|CTLFLAG_WR)
102
#define CTLFLAG_NOLOCK  0x20000000      /* XXX Don't Lock */
103
#define CTLFLAG_ANYBODY 0x10000000      /* All users can set this var */
104
#define CTLFLAG_SECURE  0x08000000      /* Permit set only if securelevel<=0 */
105
#define CTLFLAG_PRISON  0x04000000      /* Prisoned roots can fiddle */
106
#define CTLFLAG_DYN     0x02000000      /* Dynamic oid - can be freed */
107
 
108
/*
109
 * USE THIS instead of a hardwired number from the categories below
110
 * to get dynamically assigned sysctl entries using the linker-set
111
 * technology. This is the way nearly all new sysctl variables should
112
 * be implemented.
113
 * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
114
 */
115
#define OID_AUTO        (-1)
116
 
117
#ifdef _KERNEL
118
#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
119
        struct sysctl_req *req
120
 
121
/*
122
 * This describes the access space for a sysctl request.  This is needed
123
 * so that we can use the interface from the kernel or from user-space.
124
 */
125
struct sysctl_req {
126
        struct proc     *p;
127
        int             lock;
128
        void            *oldptr;
129
        size_t          oldlen;
130
        size_t          oldidx;
131
        int             (*oldfunc)(struct sysctl_req *, const void *, size_t);
132
        void            *newptr;
133
        size_t          newlen;
134
        size_t          newidx;
135
        int             (*newfunc)(struct sysctl_req *, void *, size_t);
136
};
137
 
138
SLIST_HEAD(sysctl_oid_list, sysctl_oid);
139
 
140
/*
141
 * This describes one "oid" in the MIB tree.  Potentially more nodes can
142
 * be hidden behind it, expanded by the handler.
143
 */
144
struct sysctl_oid {
145
        struct sysctl_oid_list *oid_parent;
146
        SLIST_ENTRY(sysctl_oid) oid_link;
147
        int             oid_number;
148
        int             oid_kind;
149
        void            *oid_arg1;
150
        int             oid_arg2;
151
        const char      *oid_name;
152
        int             (*oid_handler)(SYSCTL_HANDLER_ARGS);
153
        const char      *oid_fmt;
154
        int             oid_refcnt;
155
} CYG_HAL_TABLE_TYPE;
156
 
157
#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
158
#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
159
 
160
int sysctl_handle_int(SYSCTL_HANDLER_ARGS);
161
int sysctl_handle_long(SYSCTL_HANDLER_ARGS);
162
int sysctl_handle_intptr(SYSCTL_HANDLER_ARGS);
163
int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
164
int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
165
 
166
/*
167
 * These functions are used to add/remove an oid from the mib.
168
 */
169
void sysctl_register_oid(struct sysctl_oid *oidp);
170
void sysctl_unregister_oid(struct sysctl_oid *oidp);
171
 
172
/* Declare a static oid to allow child oids to be added to it. */
173
#define SYSCTL_DECL(name)                                       \
174
        extern struct sysctl_oid_list sysctl_##name##_children
175
 
176
/* Hide these in macros */
177
#define SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \
178
        (oid_ptr)->oid_arg1
179
#define SYSCTL_STATIC_CHILDREN(oid_name) \
180
        (&sysctl_##oid_name##_children)
181
 
182
/* === Structs and macros related to context handling === */
183
 
184
/* All dynamically created sysctls can be tracked in a context list. */
185
struct sysctl_ctx_entry {
186
        struct sysctl_oid *entry;
187
        TAILQ_ENTRY(sysctl_ctx_entry) link;
188
};
189
 
190
TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
191
 
192
#ifdef CYGPKG_NET_FREEBSD_SYSCTL
193
/* This constructs a "raw" MIB oid. */
194
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
195
        struct sysctl_oid sysctl__##parent##_##name \
196
           CYG_HAL_TABLE_ENTRY(sysctl_set) = {           \
197
                &sysctl_##parent##_children, { 0 },                      \
198
                nbr, kind, a1, a2, #name, handler, fmt };       
199
#else
200
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) 
201
#endif
202
 
203
#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
204
        sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr);
205
 
206
/* This constructs a node from which other oids can hang. */
207
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr)              \
208
        struct sysctl_oid_list sysctl_##parent##_##name##_children;         \
209
        SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access,                  \
210
                   (void*)&sysctl_##parent##_##name##_children, 0, handler, \
211
                   "N", descr);
212
 
213
#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr)     \
214
        sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|access,         \
215
        0, 0, handler, "N", descr);
216
 
217
/* Oid for a string.  len can be 0 to indicate '\0' termination. */
218
#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
219
        SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \
220
                arg, len, sysctl_handle_string, "A", descr)
221
 
222
#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr)  \
223
        sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|access,       \
224
        arg, len, sysctl_handle_string, "A", descr);
225
 
226
/* Oid for an int.  If ptr is NULL, val is returned. */
227
#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
228
        SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
229
                ptr, val, sysctl_handle_int, "I", descr)
230
 
231
#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr)     \
232
        sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_INT|access,          \
233
        ptr, val, sysctl_handle_int, "I", descr);
234
 
235
/* Oid for an unsigned int.  If ptr is NULL, val is returned. */
236
#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \
237
        SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|access, \
238
                ptr, val, sysctl_handle_int, "IU", descr)
239
 
240
#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr)    \
241
        sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|access,         \
242
        ptr, val, sysctl_handle_int, "IU", descr);
243
 
244
/* Oid for a long.  The pointer must be non NULL. */
245
#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \
246
        SYSCTL_OID(parent, nbr, name, CTLTYPE_LONG|access, \
247
                ptr, val, sysctl_handle_long, "L", descr)
248
 
249
#define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr)         \
250
        sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|access,         \
251
        ptr, 0, sysctl_handle_long, "L", descr);
252
 
253
/* Oid for a long.  The pointer must be non NULL. */
254
#define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \
255
        SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|access, \
256
                ptr, val, sysctl_handle_long, "LU", descr)
257
 
258
#define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr)        \
259
        sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|access,        \
260
        ptr, 0, sysctl_handle_long, "LU", descr);
261
 
262
/* Oid for an opaque object.  Specified by a pointer and a length. */
263
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
264
        SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
265
                ptr, len, sysctl_handle_opaque, fmt, descr)
266
 
267
#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\
268
        sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|access,       \
269
        ptr, len, sysctl_handle_opaque, fmt, descr);
270
 
271
/* Oid for a struct.  Specified by a pointer and a type. */
272
#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
273
        SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
274
                ptr, sizeof(struct type), sysctl_handle_opaque, \
275
                "S," #type, descr)
276
 
277
#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
278
        sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|access,       \
279
        ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, descr);
280
 
281
/* Oid for a procedure.  Specified by a pointer and an arg. */
282
#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
283
        SYSCTL_OID(parent, nbr, name, access, \
284
                ptr, arg, handler, fmt, descr)
285
 
286
#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
287
        sysctl_add_oid(ctx, parent, nbr, name, access,                      \
288
        ptr, arg, handler, fmt, descr);
289
 
290
#endif /* _KERNEL */
291
 
292
/*
293
 * Top-level identifiers
294
 */
295
#define CTL_UNSPEC      0                /* unused */
296
#define CTL_KERN        1               /* "high kernel": proc, limits */
297
#define CTL_VM          2               /* virtual memory */
298
#define CTL_VFS         3               /* file system, mount type is next */
299
#define CTL_NET         4               /* network, see socket.h */
300
#define CTL_DEBUG       5               /* debugging parameters */
301
#define CTL_HW          6               /* generic cpu/io */
302
#define CTL_MACHDEP     7               /* machine dependent */
303
#define CTL_USER        8               /* user-level */
304
#define CTL_P1003_1B    9               /* POSIX 1003.1B */
305
#define CTL_MAXID       10              /* number of valid top-level ids */
306
 
307
#define CTL_NAMES { \
308
        { 0, 0 }, \
309
        { "kern", CTLTYPE_NODE }, \
310
        { "vm", CTLTYPE_NODE }, \
311
        { "vfs", CTLTYPE_NODE }, \
312
        { "net", CTLTYPE_NODE }, \
313
        { "debug", CTLTYPE_NODE }, \
314
        { "hw", CTLTYPE_NODE }, \
315
        { "machdep", CTLTYPE_NODE }, \
316
        { "user", CTLTYPE_NODE }, \
317
        { "p1003_1b", CTLTYPE_NODE }, \
318
}
319
 
320
/*
321
 * CTL_KERN identifiers
322
 */
323
#define KERN_OSTYPE              1      /* string: system version */
324
#define KERN_OSRELEASE           2      /* string: system release */
325
#define KERN_OSREV               3      /* int: system revision */
326
#define KERN_VERSION             4      /* string: compile time info */
327
#define KERN_MAXVNODES           5      /* int: max vnodes */
328
#define KERN_MAXPROC             6      /* int: max processes */
329
#define KERN_MAXFILES            7      /* int: max open files */
330
#define KERN_ARGMAX              8      /* int: max arguments to exec */
331
#define KERN_SECURELVL           9      /* int: system security level */
332
#define KERN_HOSTNAME           10      /* string: hostname */
333
#define KERN_HOSTID             11      /* int: host identifier */
334
#define KERN_CLOCKRATE          12      /* struct: struct clockrate */
335
#define KERN_VNODE              13      /* struct: vnode structures */
336
#define KERN_PROC               14      /* struct: process entries */
337
#define KERN_FILE               15      /* struct: file entries */
338
#define KERN_PROF               16      /* node: kernel profiling info */
339
#define KERN_POSIX1             17      /* int: POSIX.1 version */
340
#define KERN_NGROUPS            18      /* int: # of supplemental group ids */
341
#define KERN_JOB_CONTROL        19      /* int: is job control available */
342
#define KERN_SAVED_IDS          20      /* int: saved set-user/group-ID */
343
#define KERN_BOOTTIME           21      /* struct: time kernel was booted */
344
#define KERN_NISDOMAINNAME      22      /* string: YP domain name */
345
#define KERN_UPDATEINTERVAL     23      /* int: update process sleep time */
346
#define KERN_OSRELDATE          24      /* int: OS release date */
347
#define KERN_NTP_PLL            25      /* node: NTP PLL control */
348
#define KERN_BOOTFILE           26      /* string: name of booted kernel */
349
#define KERN_MAXFILESPERPROC    27      /* int: max open files per proc */
350
#define KERN_MAXPROCPERUID      28      /* int: max processes per uid */
351
#define KERN_DUMPDEV            29      /* dev_t: device to dump on */
352
#define KERN_IPC                30      /* node: anything related to IPC */
353
#define KERN_DUMMY              31      /* unused */
354
#define KERN_PS_STRINGS         32      /* int: address of PS_STRINGS */
355
#define KERN_USRSTACK           33      /* int: address of USRSTACK */
356
#define KERN_LOGSIGEXIT         34      /* int: do we log sigexit procs? */
357
#define KERN_MAXID              35      /* number of valid kern ids */
358
 
359
#define CTL_KERN_NAMES { \
360
        { 0, 0 }, \
361
        { "ostype", CTLTYPE_STRING }, \
362
        { "osrelease", CTLTYPE_STRING }, \
363
        { "osrevision", CTLTYPE_INT }, \
364
        { "version", CTLTYPE_STRING }, \
365
        { "maxvnodes", CTLTYPE_INT }, \
366
        { "maxproc", CTLTYPE_INT }, \
367
        { "maxfiles", CTLTYPE_INT }, \
368
        { "argmax", CTLTYPE_INT }, \
369
        { "securelevel", CTLTYPE_INT }, \
370
        { "hostname", CTLTYPE_STRING }, \
371
        { "hostid", CTLTYPE_UINT }, \
372
        { "clockrate", CTLTYPE_STRUCT }, \
373
        { "vnode", CTLTYPE_STRUCT }, \
374
        { "proc", CTLTYPE_STRUCT }, \
375
        { "file", CTLTYPE_STRUCT }, \
376
        { "profiling", CTLTYPE_NODE }, \
377
        { "posix1version", CTLTYPE_INT }, \
378
        { "ngroups", CTLTYPE_INT }, \
379
        { "job_control", CTLTYPE_INT }, \
380
        { "saved_ids", CTLTYPE_INT }, \
381
        { "boottime", CTLTYPE_STRUCT }, \
382
        { "nisdomainname", CTLTYPE_STRING }, \
383
        { "update", CTLTYPE_INT }, \
384
        { "osreldate", CTLTYPE_INT }, \
385
        { "ntp_pll", CTLTYPE_NODE }, \
386
        { "bootfile", CTLTYPE_STRING }, \
387
        { "maxfilesperproc", CTLTYPE_INT }, \
388
        { "maxprocperuid", CTLTYPE_INT }, \
389
        { "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
390
        { "ipc", CTLTYPE_NODE }, \
391
        { "dummy", CTLTYPE_INT }, \
392
        { "ps_strings", CTLTYPE_INT }, \
393
        { "usrstack", CTLTYPE_INT }, \
394
        { "logsigexit", CTLTYPE_INT }, \
395
}
396
 
397
/*
398
 * CTL_VFS identifiers
399
 */
400
#define CTL_VFS_NAMES { \
401
        { "vfsconf", CTLTYPE_STRUCT }, \
402
}
403
 
404
/*
405
 * KERN_PROC subtypes
406
 */
407
#define KERN_PROC_ALL           0        /* everything */
408
#define KERN_PROC_PID           1       /* by process id */
409
#define KERN_PROC_PGRP          2       /* by process group id */
410
#define KERN_PROC_SESSION       3       /* by session of pid */
411
#define KERN_PROC_TTY           4       /* by controlling tty */
412
#define KERN_PROC_UID           5       /* by effective uid */
413
#define KERN_PROC_RUID          6       /* by real uid */
414
#define KERN_PROC_ARGS          7       /* get/set arguments/proctitle */
415
 
416
/*
417
 * KERN_IPC identifiers
418
 */
419
#define KIPC_MAXSOCKBUF         1       /* int: max size of a socket buffer */
420
#define KIPC_SOCKBUF_WASTE      2       /* int: wastage factor in sockbuf */
421
#define KIPC_SOMAXCONN          3       /* int: max length of connection q */
422
#define KIPC_MAX_LINKHDR        4       /* int: max length of link header */
423
#define KIPC_MAX_PROTOHDR       5       /* int: max length of network header */
424
#define KIPC_MAX_HDR            6       /* int: max total length of headers */
425
#define KIPC_MAX_DATALEN        7       /* int: max length of data? */
426
#define KIPC_MBSTAT             8       /* struct: mbuf usage statistics */
427
#define KIPC_NMBCLUSTERS        9       /* int: maximum mbuf clusters */
428
 
429
/*
430
 * CTL_HW identifiers
431
 */
432
#define HW_MACHINE       1              /* string: machine class */
433
#define HW_MODEL         2              /* string: specific machine model */
434
#define HW_NCPU          3              /* int: number of cpus */
435
#define HW_BYTEORDER     4              /* int: machine byte order */
436
#define HW_PHYSMEM       5              /* int: total memory */
437
#define HW_USERMEM       6              /* int: non-kernel memory */
438
#define HW_PAGESIZE      7              /* int: software page size */
439
#define HW_DISKNAMES     8              /* strings: disk drive names */
440
#define HW_DISKSTATS     9              /* struct: diskstats[] */
441
#define HW_FLOATINGPT   10              /* int: has HW floating point? */
442
#define HW_MACHINE_ARCH 11              /* string: machine architecture */
443
#define HW_MAXID        12              /* number of valid hw ids */
444
 
445
#define CTL_HW_NAMES { \
446
        { 0, 0 }, \
447
        { "machine", CTLTYPE_STRING }, \
448
        { "model", CTLTYPE_STRING }, \
449
        { "ncpu", CTLTYPE_INT }, \
450
        { "byteorder", CTLTYPE_INT }, \
451
        { "physmem", CTLTYPE_UINT }, \
452
        { "usermem", CTLTYPE_UINT }, \
453
        { "pagesize", CTLTYPE_INT }, \
454
        { "disknames", CTLTYPE_STRUCT }, \
455
        { "diskstats", CTLTYPE_STRUCT }, \
456
        { "floatingpoint", CTLTYPE_INT }, \
457
}
458
 
459
/*
460
 * CTL_USER definitions
461
 */
462
#define USER_CS_PATH             1      /* string: _CS_PATH */
463
#define USER_BC_BASE_MAX         2      /* int: BC_BASE_MAX */
464
#define USER_BC_DIM_MAX          3      /* int: BC_DIM_MAX */
465
#define USER_BC_SCALE_MAX        4      /* int: BC_SCALE_MAX */
466
#define USER_BC_STRING_MAX       5      /* int: BC_STRING_MAX */
467
#define USER_COLL_WEIGHTS_MAX    6      /* int: COLL_WEIGHTS_MAX */
468
#define USER_EXPR_NEST_MAX       7      /* int: EXPR_NEST_MAX */
469
#define USER_LINE_MAX            8      /* int: LINE_MAX */
470
#define USER_RE_DUP_MAX          9      /* int: RE_DUP_MAX */
471
#define USER_POSIX2_VERSION     10      /* int: POSIX2_VERSION */
472
#define USER_POSIX2_C_BIND      11      /* int: POSIX2_C_BIND */
473
#define USER_POSIX2_C_DEV       12      /* int: POSIX2_C_DEV */
474
#define USER_POSIX2_CHAR_TERM   13      /* int: POSIX2_CHAR_TERM */
475
#define USER_POSIX2_FORT_DEV    14      /* int: POSIX2_FORT_DEV */
476
#define USER_POSIX2_FORT_RUN    15      /* int: POSIX2_FORT_RUN */
477
#define USER_POSIX2_LOCALEDEF   16      /* int: POSIX2_LOCALEDEF */
478
#define USER_POSIX2_SW_DEV      17      /* int: POSIX2_SW_DEV */
479
#define USER_POSIX2_UPE         18      /* int: POSIX2_UPE */
480
#define USER_STREAM_MAX         19      /* int: POSIX2_STREAM_MAX */
481
#define USER_TZNAME_MAX         20      /* int: POSIX2_TZNAME_MAX */
482
#define USER_MAXID              21      /* number of valid user ids */
483
 
484
#define CTL_USER_NAMES { \
485
        { 0, 0 }, \
486
        { "cs_path", CTLTYPE_STRING }, \
487
        { "bc_base_max", CTLTYPE_INT }, \
488
        { "bc_dim_max", CTLTYPE_INT }, \
489
        { "bc_scale_max", CTLTYPE_INT }, \
490
        { "bc_string_max", CTLTYPE_INT }, \
491
        { "coll_weights_max", CTLTYPE_INT }, \
492
        { "expr_nest_max", CTLTYPE_INT }, \
493
        { "line_max", CTLTYPE_INT }, \
494
        { "re_dup_max", CTLTYPE_INT }, \
495
        { "posix2_version", CTLTYPE_INT }, \
496
        { "posix2_c_bind", CTLTYPE_INT }, \
497
        { "posix2_c_dev", CTLTYPE_INT }, \
498
        { "posix2_char_term", CTLTYPE_INT }, \
499
        { "posix2_fort_dev", CTLTYPE_INT }, \
500
        { "posix2_fort_run", CTLTYPE_INT }, \
501
        { "posix2_localedef", CTLTYPE_INT }, \
502
        { "posix2_sw_dev", CTLTYPE_INT }, \
503
        { "posix2_upe", CTLTYPE_INT }, \
504
        { "stream_max", CTLTYPE_INT }, \
505
        { "tzname_max", CTLTYPE_INT }, \
506
}
507
 
508
#define CTL_P1003_1B_ASYNCHRONOUS_IO            1       /* boolean */
509
#define CTL_P1003_1B_MAPPED_FILES               2       /* boolean */
510
#define CTL_P1003_1B_MEMLOCK                    3       /* boolean */
511
#define CTL_P1003_1B_MEMLOCK_RANGE              4       /* boolean */
512
#define CTL_P1003_1B_MEMORY_PROTECTION          5       /* boolean */
513
#define CTL_P1003_1B_MESSAGE_PASSING            6       /* boolean */
514
#define CTL_P1003_1B_PRIORITIZED_IO             7       /* boolean */
515
#define CTL_P1003_1B_PRIORITY_SCHEDULING        8       /* boolean */
516
#define CTL_P1003_1B_REALTIME_SIGNALS           9       /* boolean */
517
#define CTL_P1003_1B_SEMAPHORES                 10      /* boolean */
518
#define CTL_P1003_1B_FSYNC                      11      /* boolean */
519
#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS      12      /* boolean */
520
#define CTL_P1003_1B_SYNCHRONIZED_IO            13      /* boolean */
521
#define CTL_P1003_1B_TIMERS                     14      /* boolean */
522
#define CTL_P1003_1B_AIO_LISTIO_MAX             15      /* int */
523
#define CTL_P1003_1B_AIO_MAX                    16      /* int */
524
#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX         17      /* int */
525
#define CTL_P1003_1B_DELAYTIMER_MAX             18      /* int */
526
#define CTL_P1003_1B_MQ_OPEN_MAX                19      /* int */
527
#define CTL_P1003_1B_PAGESIZE                   20      /* int */
528
#define CTL_P1003_1B_RTSIG_MAX                  21      /* int */
529
#define CTL_P1003_1B_SEM_NSEMS_MAX              22      /* int */
530
#define CTL_P1003_1B_SEM_VALUE_MAX              23      /* int */
531
#define CTL_P1003_1B_SIGQUEUE_MAX               24      /* int */
532
#define CTL_P1003_1B_TIMER_MAX                  25      /* int */
533
 
534
#define CTL_P1003_1B_MAXID              26
535
 
536
#define CTL_P1003_1B_NAMES { \
537
        { 0, 0 }, \
538
        { "asynchronous_io", CTLTYPE_INT }, \
539
        { "mapped_files", CTLTYPE_INT }, \
540
        { "memlock", CTLTYPE_INT }, \
541
        { "memlock_range", CTLTYPE_INT }, \
542
        { "memory_protection", CTLTYPE_INT }, \
543
        { "message_passing", CTLTYPE_INT }, \
544
        { "prioritized_io", CTLTYPE_INT }, \
545
        { "priority_scheduling", CTLTYPE_INT }, \
546
        { "realtime_signals", CTLTYPE_INT }, \
547
        { "semaphores", CTLTYPE_INT }, \
548
        { "fsync", CTLTYPE_INT }, \
549
        { "shared_memory_objects", CTLTYPE_INT }, \
550
        { "synchronized_io", CTLTYPE_INT }, \
551
        { "timers", CTLTYPE_INT }, \
552
        { "aio_listio_max", CTLTYPE_INT }, \
553
        { "aio_max", CTLTYPE_INT }, \
554
        { "aio_prio_delta_max", CTLTYPE_INT }, \
555
        { "delaytimer_max", CTLTYPE_INT }, \
556
        { "mq_open_max", CTLTYPE_INT }, \
557
        { "pagesize", CTLTYPE_INT }, \
558
        { "rtsig_max", CTLTYPE_INT }, \
559
        { "nsems_max", CTLTYPE_INT }, \
560
        { "sem_value_max", CTLTYPE_INT }, \
561
        { "sigqueue_max", CTLTYPE_INT }, \
562
        { "timer_max", CTLTYPE_INT }, \
563
}
564
 
565
#ifdef _KERNEL
566
 
567
/*
568
 * Declare some common oids.
569
 */
570
extern struct sysctl_oid_list sysctl__children;
571
SYSCTL_DECL(_kern);
572
SYSCTL_DECL(_sysctl);
573
SYSCTL_DECL(_vm);
574
SYSCTL_DECL(_vfs);
575
SYSCTL_DECL(_net);
576
SYSCTL_DECL(_debug);
577
SYSCTL_DECL(_hw);
578
SYSCTL_DECL(_machdep);
579
SYSCTL_DECL(_user);
580
SYSCTL_DECL(_compat);
581
 
582
extern char     machine[];
583
extern char     osrelease[];
584
extern char     ostype[];
585
 
586
struct linker_set;
587
 
588
/* Dynamic oid handling */
589
struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,
590
                struct sysctl_oid_list *parent, int nbr, const char *name,
591
                int kind, void *arg1, int arg2,
592
                int (*handler) (SYSCTL_HANDLER_ARGS),
593
                const char *fmt, const char *descr);
594
int     sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse);
595
int     sysctl_ctx_init(struct sysctl_ctx_list *clist);
596
int     sysctl_ctx_free(struct sysctl_ctx_list *clist);
597
struct  sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist,
598
                struct sysctl_oid *oidp);
599
struct  sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist,
600
                struct sysctl_oid *oidp);
601
int     sysctl_ctx_entry_del(struct sysctl_ctx_list *clist,
602
                struct sysctl_oid *oidp);
603
 
604
/* Linker set based oid handling */
605
void    sysctl_register_set(struct linker_set *lsp);
606
void    sysctl_unregister_set(struct linker_set *lsp);
607
 
608
int     kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old,
609
                      size_t *oldlenp, void *new, size_t newlen,
610
                      size_t *retval);
611
int     userland_sysctl(struct proc *p, int *name, u_int namelen, void *old,
612
                        size_t *oldlenp, int inkernel, void *new, size_t newlen,
613
                        size_t *retval);
614
int     sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
615
                        int *nindx, struct sysctl_req *req);
616
 
617
#else   /* !_KERNEL */
618
#include <sys/cdefs.h>
619
 
620
__BEGIN_DECLS
621
int     sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
622
int     sysctlbyname __P((const char *, void *, size_t *, void *, size_t));
623
int     sysctlnametomib __P((const char *, int *, size_t *));
624
__END_DECLS
625
#endif  /* _KERNEL */
626
 
627
#endif  /* !_SYS_SYSCTL_H_ */
628
 
629
 
630
 
631
 
632
 
633
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.