sysctl.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 1989, 1993
00003  *      The Regents of the University of California.  All rights reserved.
00004  *
00005  * This code is derived from software contributed to Berkeley by
00006  * Mike Karels at Berkeley Software Design, Inc.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 4. Neither the name of the University nor the names of its contributors
00017  *    may be used to endorse or promote products derived from this software
00018  *    without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00023  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00024  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00025  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00026  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00027  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00028  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00029  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
00032  *      @(#)sysctl.h    8.1 (Berkeley) 6/2/93
00033  * $FreeBSD: src/sys/sys/sysctl.h,v 1.138 2005/04/18 02:10:37 das Exp $
00034  */
00035 
00036 #ifndef _SYS_SYSCTL_H_
00037 #define _SYS_SYSCTL_H_
00038 
00039 #include <sys/queue.h>
00040 
00041 struct thread;
00042 /*
00043  * Definitions for sysctl call.  The sysctl call uses a hierarchical name
00044  * for objects that can be examined or modified.  The name is expressed as
00045  * a sequence of integers.  Like a file path name, the meaning of each
00046  * component depends on its place in the hierarchy.  The top-level and kern
00047  * identifiers are defined here, and other identifiers are defined in the
00048  * respective subsystem header files.
00049  */
00050 
00051 #define CTL_MAXNAME     24      /* largest number of components supported */
00052 
00053 /*
00054  * Each subsystem defined by sysctl defines a list of variables
00055  * for that subsystem. Each name is either a node with further
00056  * levels defined below it, or it is a leaf of some particular
00057  * type given below. Each sysctl level defines a set of name/type
00058  * pairs to be used by sysctl(8) in manipulating the subsystem.
00059  */
00060 struct ctlname {
00061         char    *ctl_name;      /* subsystem name */
00062         int     ctl_type;       /* type of name */
00063 };
00064 
00065 #define CTLTYPE         0xf     /* Mask for the type */
00066 #define CTLTYPE_NODE    1       /* name is a node */
00067 #define CTLTYPE_INT     2       /* name describes an integer */
00068 #define CTLTYPE_STRING  3       /* name describes a string */
00069 #define CTLTYPE_QUAD    4       /* name describes a 64-bit number */
00070 #define CTLTYPE_OPAQUE  5       /* name describes a structure */
00071 #define CTLTYPE_STRUCT  CTLTYPE_OPAQUE  /* name describes a structure */
00072 #define CTLTYPE_UINT    6       /* name describes an unsigned integer */
00073 #define CTLTYPE_LONG    7       /* name describes a long */
00074 #define CTLTYPE_ULONG   8       /* name describes an unsigned long */
00075 
00076 #define CTLFLAG_RD      0x80000000      /* Allow reads of variable */
00077 #define CTLFLAG_WR      0x40000000      /* Allow writes to the variable */
00078 #define CTLFLAG_RW      (CTLFLAG_RD|CTLFLAG_WR)
00079 #define CTLFLAG_NOLOCK  0x20000000      /* XXX Don't Lock */
00080 #define CTLFLAG_ANYBODY 0x10000000      /* All users can set this var */
00081 #define CTLFLAG_SECURE  0x08000000      /* Permit set only if securelevel<=0 */
00082 #define CTLFLAG_PRISON  0x04000000      /* Prisoned roots can fiddle */
00083 #define CTLFLAG_DYN     0x02000000      /* Dynamic oid - can be freed */
00084 #define CTLFLAG_SKIP    0x01000000      /* Skip this sysctl when listing */
00085 #define CTLMASK_SECURE  0x00F00000      /* Secure level */
00086 #define CTLFLAG_TUN     0x00080000      /* Tunable variable */
00087 #define CTLFLAG_RDTUN   (CTLFLAG_RD|CTLFLAG_TUN)
00088 
00089 /*
00090  * Secure level.   Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.  
00091  *
00092  * Secure when the securelevel is raised to at least N.
00093  */
00094 #define CTLSHIFT_SECURE 20
00095 #define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))
00096 #define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))
00097 #define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))
00098 
00099 /*
00100  * USE THIS instead of a hardwired number from the categories below
00101  * to get dynamically assigned sysctl entries using the linker-set
00102  * technology. This is the way nearly all new sysctl variables should
00103  * be implemented.
00104  * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
00105  */ 
00106 #define OID_AUTO        (-1)
00107 
00108 /*
00109  * The starting number for dynamically-assigned entries.  WARNING!
00110  * ALL static sysctl entries should have numbers LESS than this!
00111  */
00112 #define CTL_AUTO_START  0x100
00113 
00114 #ifdef _KERNEL
00115 #define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
00116         struct sysctl_req *req
00117 
00118 /* definitions for sysctl_req 'lock' member */
00119 #define REQ_UNLOCKED    0       /* not locked and not wired */
00120 #define REQ_LOCKED      1       /* locked and not wired */
00121 #define REQ_WIRED       2       /* locked and wired */
00122 
00123 /* definitions for sysctl_req 'flags' member */
00124 #if defined(__amd64__) || defined(__ia64__)
00125 #define SCTL_MASK32     1       /* 32 bit emulation */
00126 #endif
00127 
00128 /*
00129  * This describes the access space for a sysctl request.  This is needed
00130  * so that we can use the interface from the kernel or from user-space.
00131  */
00132 struct sysctl_req {
00133         struct thread   *td;            /* used for access checking */
00134         int             lock;           /* locking/wiring state */
00135         void            *oldptr;
00136         size_t          oldlen;
00137         size_t          oldidx;
00138         int             (*oldfunc)(struct sysctl_req *, const void *, size_t);
00139         void            *newptr;
00140         size_t          newlen;
00141         size_t          newidx;
00142         int             (*newfunc)(struct sysctl_req *, void *, size_t);
00143         size_t          validlen;
00144         int             flags;
00145 };
00146 
00147 /*
00148  * This describes one "oid" in the MIB tree.  Potentially more nodes can
00149  * be hidden behind it, expanded by the handler.
00150  */
00151 struct sysctl_oid {
00152         struct sysctl_oid_list *oid_parent;
00153         SLIST_ENTRY(sysctl_oid) oid_link;
00154         int             oid_number;
00155         u_int           oid_kind;
00156         void            *oid_arg1;
00157         int             oid_arg2;
00158         const char      *oid_name;
00159         int             (*oid_handler)(SYSCTL_HANDLER_ARGS);
00160         const char      *oid_fmt;
00161         int             oid_refcnt;
00162         const char      *oid_descr;
00163 };
00164 
00165 #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
00166 #define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
00167 
00168 /* Declare a static oid to allow child oids to be added to it. */
00169 #define SYSCTL_DECL(name)                                       \
00170         extern struct sysctl_oid_list sysctl_##name##_children
00171 
00172 /* Hide these in macros */
00173 #define SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \
00174         (oid_ptr)->oid_arg1
00175 #define SYSCTL_CHILDREN_SET(oid_ptr, val) \
00176         (oid_ptr)->oid_arg1 = (val);
00177 #define SYSCTL_STATIC_CHILDREN(oid_name) \
00178         (&sysctl_##oid_name##_children)
00179 
00180 /* === Structs and macros related to context handling === */
00181 
00182 /* All dynamically created sysctls can be tracked in a context list. */
00183 struct sysctl_ctx_entry {
00184         struct sysctl_oid *entry;
00185         TAILQ_ENTRY(sysctl_ctx_entry) link;
00186 };
00187 
00188 #define SYSCTL_NODE_CHILDREN(parent, name) \
00189         sysctl_##parent##_##name##_children
00190 
00191 /* This constructs a "raw" MIB oid. */
00192 #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
00193         static struct sysctl_oid sysctl__##parent##_##name = {           \
00194                 &sysctl_##parent##_children, { 0 },                      \
00195                 nbr, kind, a1, a2, #name, handler, fmt, 0, descr };      \
00196         DATA_SET(sysctl_set, sysctl__##parent##_##name)
00197 
00198 #define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
00199         sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr)
00200 
00201 /* This constructs a node from which other oids can hang. */
00202 #define SYSCTL_NODE(parent, nbr, name, access, handler, descr)              \
00203         struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name);          \
00204         SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access),                \
00205                    (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, \
00206                    "N", descr)
00207 
00208 #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr)     \
00209         sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access),       \
00210         0, 0, handler, "N", descr)
00211 
00212 /* Oid for a string.  len can be 0 to indicate '\0' termination. */
00213 #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
00214         SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \
00215                 arg, len, sysctl_handle_string, "A", descr)
00216 
00217 #define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr)  \
00218         sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access),     \
00219         arg, len, sysctl_handle_string, "A", descr)
00220 
00221 /* Oid for an int.  If ptr is NULL, val is returned. */
00222 #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
00223         SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|(access), \
00224                 ptr, val, sysctl_handle_int, "I", descr)
00225 
00226 #define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr)     \
00227         sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_INT|(access),        \
00228         ptr, val, sysctl_handle_int, "I", descr)
00229 
00230 /* Oid for an unsigned int.  If ptr is NULL, val is returned. */
00231 #define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \
00232         SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|(access), \
00233                 ptr, val, sysctl_handle_int, "IU", descr)
00234 
00235 #define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr)    \
00236         sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|(access),       \
00237         ptr, val, sysctl_handle_int, "IU", descr)
00238 
00239 /* Oid for a long.  The pointer must be non NULL. */
00240 #define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \
00241         SYSCTL_OID(parent, nbr, name, CTLTYPE_LONG|(access), \
00242                 ptr, val, sysctl_handle_long, "L", descr)
00243 
00244 #define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr)         \
00245         sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|(access),       \
00246         ptr, 0, sysctl_handle_long, "L", descr)
00247 
00248 /* Oid for an unsigned long.  The pointer must be non NULL. */
00249 #define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \
00250         SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|(access), \
00251                 ptr, val, sysctl_handle_long, "LU", descr)
00252 
00253 #define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr)        \
00254         sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|(access),      \
00255         ptr, 0, sysctl_handle_long, "LU", descr)
00256 
00257 /* Oid for an opaque object.  Specified by a pointer and a length. */
00258 #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
00259         SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
00260                 ptr, len, sysctl_handle_opaque, fmt, descr)
00261 
00262 #define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\
00263         sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),     \
00264         ptr, len, sysctl_handle_opaque, fmt, descr)
00265 
00266 /* Oid for a struct.  Specified by a pointer and a type. */
00267 #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
00268         SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
00269                 ptr, sizeof(struct type), sysctl_handle_opaque, \
00270                 "S," #type, descr)
00271 
00272 #define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
00273         sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),     \
00274         ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, descr)
00275 
00276 /* Oid for a procedure.  Specified by a pointer and an arg. */
00277 #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
00278         SYSCTL_OID(parent, nbr, name, (access), \
00279                 ptr, arg, handler, fmt, descr)
00280 
00281 #define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
00282         sysctl_add_oid(ctx, parent, nbr, name, (access),                            \
00283         ptr, arg, handler, fmt, descr)
00284 
00285 #endif /* _KERNEL */
00286 
00287 /*
00288  * Top-level identifiers
00289  */
00290 #define CTL_UNSPEC      0               /* unused */
00291 #define CTL_KERN        1               /* "high kernel": proc, limits */
00292 #define CTL_VM          2               /* virtual memory */
00293 #define CTL_VFS         3               /* filesystem, mount type is next */
00294 #define CTL_NET         4               /* network, see socket.h */
00295 #define CTL_DEBUG       5               /* debugging parameters */
00296 #define CTL_HW          6               /* generic cpu/io */
00297 #define CTL_MACHDEP     7               /* machine dependent */
00298 #define CTL_USER        8               /* user-level */
00299 #define CTL_P1003_1B    9               /* POSIX 1003.1B */
00300 #define CTL_MAXID       10              /* number of valid top-level ids */
00301 
00302 #define CTL_NAMES { \
00303         { 0, 0 }, \
00304         { "kern", CTLTYPE_NODE }, \
00305         { "vm", CTLTYPE_NODE }, \
00306         { "vfs", CTLTYPE_NODE }, \
00307         { "net", CTLTYPE_NODE }, \
00308         { "debug", CTLTYPE_NODE }, \
00309         { "hw", CTLTYPE_NODE }, \
00310         { "machdep", CTLTYPE_NODE }, \
00311         { "user", CTLTYPE_NODE }, \
00312         { "p1003_1b", CTLTYPE_NODE }, \
00313 }
00314 
00315 /*
00316  * CTL_KERN identifiers
00317  */
00318 #define KERN_OSTYPE              1      /* string: system version */
00319 #define KERN_OSRELEASE           2      /* string: system release */
00320 #define KERN_OSREV               3      /* int: system revision */
00321 #define KERN_VERSION             4      /* string: compile time info */
00322 #define KERN_MAXVNODES           5      /* int: max vnodes */
00323 #define KERN_MAXPROC             6      /* int: max processes */
00324 #define KERN_MAXFILES            7      /* int: max open files */
00325 #define KERN_ARGMAX              8      /* int: max arguments to exec */
00326 #define KERN_SECURELVL           9      /* int: system security level */
00327 #define KERN_HOSTNAME           10      /* string: hostname */
00328 #define KERN_HOSTID             11      /* int: host identifier */
00329 #define KERN_CLOCKRATE          12      /* struct: struct clockrate */
00330 #define KERN_VNODE              13      /* struct: vnode structures */
00331 #define KERN_PROC               14      /* struct: process entries */
00332 #define KERN_FILE               15      /* struct: file entries */
00333 #define KERN_PROF               16      /* node: kernel profiling info */
00334 #define KERN_POSIX1             17      /* int: POSIX.1 version */
00335 #define KERN_NGROUPS            18      /* int: # of supplemental group ids */
00336 #define KERN_JOB_CONTROL        19      /* int: is job control available */
00337 #define KERN_SAVED_IDS          20      /* int: saved set-user/group-ID */
00338 #define KERN_BOOTTIME           21      /* struct: time kernel was booted */
00339 #define KERN_NISDOMAINNAME      22      /* string: YP domain name */
00340 #define KERN_UPDATEINTERVAL     23      /* int: update process sleep time */
00341 #define KERN_OSRELDATE          24      /* int: kernel release date */
00342 #define KERN_NTP_PLL            25      /* node: NTP PLL control */
00343 #define KERN_BOOTFILE           26      /* string: name of booted kernel */
00344 #define KERN_MAXFILESPERPROC    27      /* int: max open files per proc */
00345 #define KERN_MAXPROCPERUID      28      /* int: max processes per uid */
00346 #define KERN_DUMPDEV            29      /* struct cdev *: device to dump on */
00347 #define KERN_IPC                30      /* node: anything related to IPC */
00348 #define KERN_DUMMY              31      /* unused */
00349 #define KERN_PS_STRINGS         32      /* int: address of PS_STRINGS */
00350 #define KERN_USRSTACK           33      /* int: address of USRSTACK */
00351 #define KERN_LOGSIGEXIT         34      /* int: do we log sigexit procs? */
00352 #define KERN_IOV_MAX            35      /* int: value of UIO_MAXIOV */
00353 #define KERN_MAXID              36      /* number of valid kern ids */
00354 
00355 #define CTL_KERN_NAMES { \
00356         { 0, 0 }, \
00357         { "ostype", CTLTYPE_STRING }, \
00358         { "osrelease", CTLTYPE_STRING }, \
00359         { "osrevision", CTLTYPE_INT }, \
00360         { "version", CTLTYPE_STRING }, \
00361         { "maxvnodes", CTLTYPE_INT }, \
00362         { "maxproc", CTLTYPE_INT }, \
00363         { "maxfiles", CTLTYPE_INT }, \
00364         { "argmax", CTLTYPE_INT }, \
00365         { "securelevel", CTLTYPE_INT }, \
00366         { "hostname", CTLTYPE_STRING }, \
00367         { "hostid", CTLTYPE_UINT }, \
00368         { "clockrate", CTLTYPE_STRUCT }, \
00369         { "vnode", CTLTYPE_STRUCT }, \
00370         { "proc", CTLTYPE_STRUCT }, \
00371         { "file", CTLTYPE_STRUCT }, \
00372         { "profiling", CTLTYPE_NODE }, \
00373         { "posix1version", CTLTYPE_INT }, \
00374         { "ngroups", CTLTYPE_INT }, \
00375         { "job_control", CTLTYPE_INT }, \
00376         { "saved_ids", CTLTYPE_INT }, \
00377         { "boottime", CTLTYPE_STRUCT }, \
00378         { "nisdomainname", CTLTYPE_STRING }, \
00379         { "update", CTLTYPE_INT }, \
00380         { "osreldate", CTLTYPE_INT }, \
00381         { "ntp_pll", CTLTYPE_NODE }, \
00382         { "bootfile", CTLTYPE_STRING }, \
00383         { "maxfilesperproc", CTLTYPE_INT }, \
00384         { "maxprocperuid", CTLTYPE_INT }, \
00385         { "ipc", CTLTYPE_NODE }, \
00386         { "dummy", CTLTYPE_INT }, \
00387         { "ps_strings", CTLTYPE_INT }, \
00388         { "usrstack", CTLTYPE_INT }, \
00389         { "logsigexit", CTLTYPE_INT }, \
00390         { "iov_max", CTLTYPE_INT }, \
00391 }
00392 
00393 /*
00394  * CTL_VFS identifiers
00395  */
00396 #define CTL_VFS_NAMES { \
00397         { "vfsconf", CTLTYPE_STRUCT }, \
00398 }
00399 
00400 /*
00401  * KERN_PROC subtypes
00402  */
00403 #define KERN_PROC_ALL           0       /* everything */
00404 #define KERN_PROC_PID           1       /* by process id */
00405 #define KERN_PROC_PGRP          2       /* by process group id */
00406 #define KERN_PROC_SESSION       3       /* by session of pid */
00407 #define KERN_PROC_TTY           4       /* by controlling tty */
00408 #define KERN_PROC_UID           5       /* by effective uid */
00409 #define KERN_PROC_RUID          6       /* by real uid */
00410 #define KERN_PROC_ARGS          7       /* get/set arguments/proctitle */
00411 #define KERN_PROC_PROC          8       /* only return procs */
00412 #define KERN_PROC_SV_NAME       9       /* get syscall vector name */
00413 #define KERN_PROC_RGID          10      /* by real group id */
00414 #define KERN_PROC_GID           11      /* by effective group id */
00415 #define KERN_PROC_PATHNAME      12      /* path to executable */
00416 #define KERN_PROC_INC_THREAD    0x10    /*
00417                                          * modifier for pid, pgrp, tty,
00418                                          * uid, ruid, gid, rgid and proc
00419                                          */
00420 
00421 /*
00422  * KERN_IPC identifiers
00423  */
00424 #define KIPC_MAXSOCKBUF         1       /* int: max size of a socket buffer */
00425 #define KIPC_SOCKBUF_WASTE      2       /* int: wastage factor in sockbuf */
00426 #define KIPC_SOMAXCONN          3       /* int: max length of connection q */
00427 #define KIPC_MAX_LINKHDR        4       /* int: max length of link header */
00428 #define KIPC_MAX_PROTOHDR       5       /* int: max length of network header */
00429 #define KIPC_MAX_HDR            6       /* int: max total length of headers */
00430 #define KIPC_MAX_DATALEN        7       /* int: max length of data? */
00431 
00432 /*
00433  * CTL_HW identifiers
00434  */
00435 #define HW_MACHINE       1              /* string: machine class */
00436 #define HW_MODEL         2              /* string: specific machine model */
00437 #define HW_NCPU          3              /* int: number of cpus */
00438 #define HW_BYTEORDER     4              /* int: machine byte order */
00439 #define HW_PHYSMEM       5              /* int: total memory */
00440 #define HW_USERMEM       6              /* int: non-kernel memory */
00441 #define HW_PAGESIZE      7              /* int: software page size */
00442 #define HW_DISKNAMES     8              /* strings: disk drive names */
00443 #define HW_DISKSTATS     9              /* struct: diskstats[] */
00444 #define HW_FLOATINGPT   10              /* int: has HW floating point? */
00445 #define HW_MACHINE_ARCH 11              /* string: machine architecture */
00446 #define HW_REALMEM      12              /* int: 'real' memory */
00447 #define HW_MAXID        13              /* number of valid hw ids */
00448 
00449 #define CTL_HW_NAMES { \
00450         { 0, 0 }, \
00451         { "machine", CTLTYPE_STRING }, \
00452         { "model", CTLTYPE_STRING }, \
00453         { "ncpu", CTLTYPE_INT }, \
00454         { "byteorder", CTLTYPE_INT }, \
00455         { "physmem", CTLTYPE_ULONG }, \
00456         { "usermem", CTLTYPE_ULONG }, \
00457         { "pagesize", CTLTYPE_INT }, \
00458         { "disknames", CTLTYPE_STRUCT }, \
00459         { "diskstats", CTLTYPE_STRUCT }, \
00460         { "floatingpoint", CTLTYPE_INT }, \
00461         { "realmem", CTLTYPE_ULONG }, \
00462 }
00463 
00464 /*
00465  * CTL_USER definitions
00466  */
00467 #define USER_CS_PATH             1      /* string: _CS_PATH */
00468 #define USER_BC_BASE_MAX         2      /* int: BC_BASE_MAX */
00469 #define USER_BC_DIM_MAX          3      /* int: BC_DIM_MAX */
00470 #define USER_BC_SCALE_MAX        4      /* int: BC_SCALE_MAX */
00471 #define USER_BC_STRING_MAX       5      /* int: BC_STRING_MAX */
00472 #define USER_COLL_WEIGHTS_MAX    6      /* int: COLL_WEIGHTS_MAX */
00473 #define USER_EXPR_NEST_MAX       7      /* int: EXPR_NEST_MAX */
00474 #define USER_LINE_MAX            8      /* int: LINE_MAX */
00475 #define USER_RE_DUP_MAX          9      /* int: RE_DUP_MAX */
00476 #define USER_POSIX2_VERSION     10      /* int: POSIX2_VERSION */
00477 #define USER_POSIX2_C_BIND      11      /* int: POSIX2_C_BIND */
00478 #define USER_POSIX2_C_DEV       12      /* int: POSIX2_C_DEV */
00479 #define USER_POSIX2_CHAR_TERM   13      /* int: POSIX2_CHAR_TERM */
00480 #define USER_POSIX2_FORT_DEV    14      /* int: POSIX2_FORT_DEV */
00481 #define USER_POSIX2_FORT_RUN    15      /* int: POSIX2_FORT_RUN */
00482 #define USER_POSIX2_LOCALEDEF   16      /* int: POSIX2_LOCALEDEF */
00483 #define USER_POSIX2_SW_DEV      17      /* int: POSIX2_SW_DEV */
00484 #define USER_POSIX2_UPE         18      /* int: POSIX2_UPE */
00485 #define USER_STREAM_MAX         19      /* int: POSIX2_STREAM_MAX */
00486 #define USER_TZNAME_MAX         20      /* int: POSIX2_TZNAME_MAX */
00487 #define USER_MAXID              21      /* number of valid user ids */
00488 
00489 #define CTL_USER_NAMES { \
00490         { 0, 0 }, \
00491         { "cs_path", CTLTYPE_STRING }, \
00492         { "bc_base_max", CTLTYPE_INT }, \
00493         { "bc_dim_max", CTLTYPE_INT }, \
00494         { "bc_scale_max", CTLTYPE_INT }, \
00495         { "bc_string_max", CTLTYPE_INT }, \
00496         { "coll_weights_max", CTLTYPE_INT }, \
00497         { "expr_nest_max", CTLTYPE_INT }, \
00498         { "line_max", CTLTYPE_INT }, \
00499         { "re_dup_max", CTLTYPE_INT }, \
00500         { "posix2_version", CTLTYPE_INT }, \
00501         { "posix2_c_bind", CTLTYPE_INT }, \
00502         { "posix2_c_dev", CTLTYPE_INT }, \
00503         { "posix2_char_term", CTLTYPE_INT }, \
00504         { "posix2_fort_dev", CTLTYPE_INT }, \
00505         { "posix2_fort_run", CTLTYPE_INT }, \
00506         { "posix2_localedef", CTLTYPE_INT }, \
00507         { "posix2_sw_dev", CTLTYPE_INT }, \
00508         { "posix2_upe", CTLTYPE_INT }, \
00509         { "stream_max", CTLTYPE_INT }, \
00510         { "tzname_max", CTLTYPE_INT }, \
00511 }
00512 
00513 #define CTL_P1003_1B_ASYNCHRONOUS_IO            1       /* boolean */
00514 #define CTL_P1003_1B_MAPPED_FILES               2       /* boolean */
00515 #define CTL_P1003_1B_MEMLOCK                    3       /* boolean */
00516 #define CTL_P1003_1B_MEMLOCK_RANGE              4       /* boolean */
00517 #define CTL_P1003_1B_MEMORY_PROTECTION          5       /* boolean */
00518 #define CTL_P1003_1B_MESSAGE_PASSING            6       /* boolean */
00519 #define CTL_P1003_1B_PRIORITIZED_IO             7       /* boolean */
00520 #define CTL_P1003_1B_PRIORITY_SCHEDULING        8       /* boolean */
00521 #define CTL_P1003_1B_REALTIME_SIGNALS           9       /* boolean */
00522 #define CTL_P1003_1B_SEMAPHORES                 10      /* boolean */
00523 #define CTL_P1003_1B_FSYNC                      11      /* boolean */
00524 #define CTL_P1003_1B_SHARED_MEMORY_OBJECTS      12      /* boolean */
00525 #define CTL_P1003_1B_SYNCHRONIZED_IO            13      /* boolean */
00526 #define CTL_P1003_1B_TIMERS                     14      /* boolean */
00527 #define CTL_P1003_1B_AIO_LISTIO_MAX             15      /* int */
00528 #define CTL_P1003_1B_AIO_MAX                    16      /* int */
00529 #define CTL_P1003_1B_AIO_PRIO_DELTA_MAX         17      /* int */
00530 #define CTL_P1003_1B_DELAYTIMER_MAX             18      /* int */
00531 #define CTL_P1003_1B_MQ_OPEN_MAX                19      /* int */
00532 #define CTL_P1003_1B_PAGESIZE                   20      /* int */
00533 #define CTL_P1003_1B_RTSIG_MAX                  21      /* int */
00534 #define CTL_P1003_1B_SEM_NSEMS_MAX              22      /* int */
00535 #define CTL_P1003_1B_SEM_VALUE_MAX              23      /* int */
00536 #define CTL_P1003_1B_SIGQUEUE_MAX               24      /* int */
00537 #define CTL_P1003_1B_TIMER_MAX                  25      /* int */
00538 
00539 #define CTL_P1003_1B_MAXID              26
00540 
00541 #define CTL_P1003_1B_NAMES { \
00542         { 0, 0 }, \
00543         { "asynchronous_io", CTLTYPE_INT }, \
00544         { "mapped_files", CTLTYPE_INT }, \
00545         { "memlock", CTLTYPE_INT }, \
00546         { "memlock_range", CTLTYPE_INT }, \
00547         { "memory_protection", CTLTYPE_INT }, \
00548         { "message_passing", CTLTYPE_INT }, \
00549         { "prioritized_io", CTLTYPE_INT }, \
00550         { "priority_scheduling", CTLTYPE_INT }, \
00551         { "realtime_signals", CTLTYPE_INT }, \
00552         { "semaphores", CTLTYPE_INT }, \
00553         { "fsync", CTLTYPE_INT }, \
00554         { "shared_memory_objects", CTLTYPE_INT }, \
00555         { "synchronized_io", CTLTYPE_INT }, \
00556         { "timers", CTLTYPE_INT }, \
00557         { "aio_listio_max", CTLTYPE_INT }, \
00558         { "aio_max", CTLTYPE_INT }, \
00559         { "aio_prio_delta_max", CTLTYPE_INT }, \
00560         { "delaytimer_max", CTLTYPE_INT }, \
00561         { "mq_open_max", CTLTYPE_INT }, \
00562         { "pagesize", CTLTYPE_INT }, \
00563         { "rtsig_max", CTLTYPE_INT }, \
00564         { "nsems_max", CTLTYPE_INT }, \
00565         { "sem_value_max", CTLTYPE_INT }, \
00566         { "sigqueue_max", CTLTYPE_INT }, \
00567         { "timer_max", CTLTYPE_INT }, \
00568 }
00569 
00570 #ifdef _KERNEL
00571 
00572 /*
00573  * Declare some common oids.
00574  */
00575 extern struct sysctl_oid_list sysctl__children;
00576 
00577 extern char     machine[];
00578 extern char     osrelease[];
00579 extern char     ostype[];
00580 extern char     kern_ident[];
00581 
00582 
00583 #endif  /* _KERNEL */
00584 
00585 #endif  /* !_SYS_SYSCTL_H_ */

Copyright © Nokia Corporation 2001-2008
Back to top