Annotation of XNU/bsd/sys/sysctl.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
                     23: /*
                     24:  * Copyright (c) 1989, 1993
                     25:  *     The Regents of the University of California.  All rights reserved.
                     26:  *
                     27:  * This code is derived from software contributed to Berkeley by
                     28:  * Mike Karels at Berkeley Software Design, Inc.
                     29:  *
                     30:  * Redistribution and use in source and binary forms, with or without
                     31:  * modification, are permitted provided that the following conditions
                     32:  * are met:
                     33:  * 1. Redistributions of source code must retain the above copyright
                     34:  *    notice, this list of conditions and the following disclaimer.
                     35:  * 2. Redistributions in binary form must reproduce the above copyright
                     36:  *    notice, this list of conditions and the following disclaimer in the
                     37:  *    documentation and/or other materials provided with the distribution.
                     38:  * 3. All advertising materials mentioning features or use of this software
                     39:  *    must display the following acknowledgement:
                     40:  *     This product includes software developed by the University of
                     41:  *     California, Berkeley and its contributors.
                     42:  * 4. Neither the name of the University nor the names of its contributors
                     43:  *    may be used to endorse or promote products derived from this software
                     44:  *    without specific prior written permission.
                     45:  *
                     46:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     47:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     48:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     49:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     50:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     51:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     52:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     53:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     54:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     55:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     56:  * SUCH DAMAGE.
                     57:  *
                     58:  *     @(#)sysctl.h    8.1 (Berkeley) 6/2/93
                     59:  */
                     60: 
                     61: #ifndef _SYS_SYSCTL_H_
                     62: #define        _SYS_SYSCTL_H_
                     63: 
                     64: /*
                     65:  * These are for the eproc structure defined below.
                     66:  */
                     67: #ifndef KERNEL
                     68: #include <sys/time.h>
                     69: #include <sys/ucred.h>
                     70: 
                     71: 
                     72: #endif
                     73: 
                     74: #include <sys/vm.h>
                     75: #include <sys/proc.h>
                     76: #include <sys/linker_set.h>
                     77: 
                     78: /*
                     79:  * Definitions for sysctl call.  The sysctl call uses a hierarchical name
                     80:  * for objects that can be examined or modified.  The name is expressed as
                     81:  * a sequence of integers.  Like a file path name, the meaning of each
                     82:  * component depends on its place in the hierarchy.  The top-level and kern
                     83:  * identifiers are defined here, and other identifiers are defined in the
                     84:  * respective subsystem header files.
                     85:  */
                     86: 
                     87: #define CTL_MAXNAME    12      /* largest number of components supported */
                     88: 
                     89: /*
                     90:  * Each subsystem defined by sysctl defines a list of variables
                     91:  * for that subsystem. Each name is either a node with further 
                     92:  * levels defined below it, or it is a leaf of some particular
                     93:  * type given below. Each sysctl level defines a set of name/type
                     94:  * pairs to be used by sysctl(1) in manipulating the subsystem.
                     95:  */
                     96: struct ctlname {
                     97:        char    *ctl_name;      /* subsystem name */
                     98:        int     ctl_type;       /* type of name */
                     99: };
                    100: 
                    101: #define CTLTYPE                0xf     /* Mask for the type */
                    102: #define        CTLTYPE_NODE    1       /* name is a node */
                    103: #define        CTLTYPE_INT     2       /* name describes an integer */
                    104: #define        CTLTYPE_STRING  3       /* name describes a string */
                    105: #define        CTLTYPE_QUAD    4       /* name describes a 64-bit number */
                    106: #define        CTLTYPE_OPAQUE  5       /* name describes a structure */
                    107: #define        CTLTYPE_STRUCT  CTLTYPE_OPAQUE  /* name describes a structure */
                    108: 
                    109: #define CTLFLAG_RD     0x80000000      /* Allow reads of variable */
                    110: #define CTLFLAG_WR     0x40000000      /* Allow writes to the variable */
                    111: #define CTLFLAG_RW     (CTLFLAG_RD|CTLFLAG_WR)
                    112: #define CTLFLAG_NOLOCK 0x20000000      /* XXX Don't Lock */
                    113: #define CTLFLAG_ANYBODY        0x10000000      /* All users can set this var */
                    114: #define CTLFLAG_SECURE 0x08000000      /* Permit set only if securelevel<=0 */
                    115: 
                    116: /*
                    117:  * USE THIS instead of a hardwired number from the categories below
                    118:  * to get dynamically assigned sysctl entries using the linker-set
                    119:  * technology. This is the way nearly all new sysctl variables should
                    120:  * be implemented.
                    121:  * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
                    122:  */ 
                    123: #define OID_AUTO       (-1)
                    124: 
                    125: #ifdef KERNEL
                    126: #define SYSCTL_HANDLER_ARGS (struct sysctl_oid *oidp, void *arg1, int arg2, \
                    127:        struct sysctl_req *req)
                    128: 
                    129: /*
                    130:  * This describes the access space for a sysctl request.  This is needed
                    131:  * so that we can use the interface from the kernel or from user-space.
                    132:  */
                    133: struct sysctl_req {
                    134:        struct proc     *p;
                    135:        int             lock;
                    136:        void            *oldptr;
                    137:        size_t          oldlen;
                    138:        size_t          oldidx;
                    139:        int             (*oldfunc)(struct sysctl_req *, const void *, size_t);
                    140:        void            *newptr;
                    141:        size_t          newlen;
                    142:        size_t          newidx;
                    143:        int             (*newfunc)(struct sysctl_req *, void *, size_t);
                    144: };
                    145: 
                    146: SLIST_HEAD(sysctl_oid_list, sysctl_oid);
                    147: 
                    148: /*
                    149:  * This describes one "oid" in the MIB tree.  Potentially more nodes can
                    150:  * be hidden behind it, expanded by the handler.
                    151:  */
                    152: struct sysctl_oid {
                    153:        struct sysctl_oid_list *oid_parent;
                    154:        SLIST_ENTRY(sysctl_oid) oid_link;
                    155:        int             oid_number;
                    156:        int             oid_kind;
                    157:        void            *oid_arg1;
                    158:        int             oid_arg2;
                    159:        const char      *oid_name;
                    160:        int             (*oid_handler) SYSCTL_HANDLER_ARGS;
                    161:        const char      *oid_fmt;
                    162: };
                    163: 
                    164: #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
                    165: #define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
                    166: 
                    167: int sysctl_handle_int SYSCTL_HANDLER_ARGS;
                    168: int sysctl_handle_long SYSCTL_HANDLER_ARGS;
                    169: int sysctl_handle_intptr SYSCTL_HANDLER_ARGS;
                    170: int sysctl_handle_string SYSCTL_HANDLER_ARGS;
                    171: int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
                    172: 
                    173: /*
                    174:  * These functions are used to add/remove an oid from the mib.
                    175:  */
                    176: void sysctl_register_oid(struct sysctl_oid *oidp);
                    177: void sysctl_unregister_oid(struct sysctl_oid *oidp);
                    178: 
                    179: /* Declare an oid to allow child oids to be added to it. */
                    180: #define SYSCTL_DECL(name)                                      \
                    181:        extern struct sysctl_oid_list sysctl_##name##_children
                    182: 
                    183: /* This constructs a "raw" MIB oid. */
                    184: #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
                    185:        struct sysctl_oid sysctl_##parent##_##name## = {                 \
                    186:                &sysctl_##parent##_children, { 0 },                      \
                    187:                nbr, kind, a1, a2, #name, handler, fmt };
                    188: 
                    189: 
                    190: /* This constructs a node from which other oids can hang. */
                    191: #define SYSCTL_NODE(parent, nbr, name, access, handler, descr)             \
                    192:        struct sysctl_oid_list sysctl_##parent##_##name##_children;         \
                    193:        SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access,                  \
                    194:                   (void*)&sysctl_##parent##_##name##_children, 0, handler, \
                    195:                   "N", descr);
                    196: 
                    197: /* Oid for a string.  len can be 0 to indicate '\0' termination. */
                    198: #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
                    199:        SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \
                    200:                arg, len, sysctl_handle_string, "A", descr)
                    201: 
                    202: /* Oid for an int.  If ptr is NULL, val is returned. */
                    203: #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
                    204:        SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
                    205:                ptr, val, sysctl_handle_int, "I", descr)
                    206: 
                    207: /* Oid for a long.  The pointer must be non NULL. */
                    208: #define SYSCTL_LONG(parent, nbr, name, access, ptr, descr) \
                    209:        SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
                    210:                ptr, 0, sysctl_handle_long, "L", descr)
                    211: 
                    212: /* Oid for an opaque object.  Specified by a pointer and a length. */
                    213: #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
                    214:        SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
                    215:                ptr, len, sysctl_handle_opaque, fmt, descr)
                    216: 
                    217: /* Oid for a struct.  Specified by a pointer and a type. */
                    218: #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
                    219:        SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
                    220:                ptr, sizeof(struct type), sysctl_handle_opaque, \
                    221:                "S," #type, descr)
                    222: 
                    223: /* Oid for a procedure.  Specified by a pointer and an arg. */
                    224: #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
                    225:        SYSCTL_OID(parent, nbr, name, access, \
                    226:                ptr, arg, handler, fmt, descr)
                    227: #endif /* KERNEL */
                    228: 
                    229: /*
                    230:  * Top-level identifiers
                    231:  */
                    232: #define        CTL_UNSPEC      0               /* unused */
                    233: #define        CTL_KERN        1               /* "high kernel": proc, limits */
                    234: #define        CTL_VM          2               /* virtual memory */
                    235: #define        CTL_VFS         3               /* file system, mount type is next */
                    236: #define        CTL_NET         4               /* network, see socket.h */
                    237: #define        CTL_DEBUG       5               /* debugging parameters */
                    238: #define        CTL_HW          6               /* generic cpu/io */
                    239: #define        CTL_MACHDEP     7               /* machine dependent */
                    240: #define        CTL_USER        8               /* user-level */
                    241: #define        CTL_P1003_1B    9               /* POSIX 1003.1B */
                    242: #define        CTL_MAXID       10              /* number of valid top-level ids */
                    243: 
                    244: #define CTL_NAMES { \
                    245:        { 0, 0 }, \
                    246:        { "kern", CTLTYPE_NODE }, \
                    247:        { "vm", CTLTYPE_NODE }, \
                    248:        { "vfs", CTLTYPE_NODE }, \
                    249:        { "net", CTLTYPE_NODE }, \
                    250:        { "debug", CTLTYPE_NODE }, \
                    251:        { "hw", CTLTYPE_NODE }, \
                    252:        { "machdep", CTLTYPE_NODE }, \
                    253:        { "user", CTLTYPE_NODE }, \
                    254:        { "p1003_1b", CTLTYPE_NODE }, \
                    255: }
                    256: 
                    257: /*
                    258:  * CTL_KERN identifiers
                    259:  */
                    260: #define        KERN_OSTYPE              1      /* string: system version */
                    261: #define        KERN_OSRELEASE           2      /* string: system release */
                    262: #define        KERN_OSREV               3      /* int: system revision */
                    263: #define        KERN_VERSION             4      /* string: compile time info */
                    264: #define        KERN_MAXVNODES           5      /* int: max vnodes */
                    265: #define        KERN_MAXPROC             6      /* int: max processes */
                    266: #define        KERN_MAXFILES            7      /* int: max open files */
                    267: #define        KERN_ARGMAX              8      /* int: max arguments to exec */
                    268: #define        KERN_SECURELVL           9      /* int: system security level */
                    269: #define        KERN_HOSTNAME           10      /* string: hostname */
                    270: #define        KERN_HOSTID             11      /* int: host identifier */
                    271: #define        KERN_CLOCKRATE          12      /* struct: struct clockrate */
                    272: #define        KERN_VNODE              13      /* struct: vnode structures */
                    273: #define        KERN_PROC               14      /* struct: process entries */
                    274: #define        KERN_FILE               15      /* struct: file entries */
                    275: #define        KERN_PROF               16      /* node: kernel profiling info */
                    276: #define        KERN_POSIX1             17      /* int: POSIX.1 version */
                    277: #define        KERN_NGROUPS            18      /* int: # of supplemental group ids */
                    278: #define        KERN_JOB_CONTROL        19      /* int: is job control available */
                    279: #define        KERN_SAVED_IDS          20      /* int: saved set-user/group-ID */
                    280: #define        KERN_BOOTTIME           21      /* struct: time kernel was booted */
                    281: #define KERN_NISDOMAINNAME     22      /* string: YP domain name */
                    282: #define KERN_DOMAINNAME                KERN_NISDOMAINNAME
                    283: #define        KERN_MAXPARTITIONS      23      /* int: number of partitions/disk */
                    284: #define        KERN_KDEBUG             24      /* int: kernel trace points */
                    285: #define KERN_UPDATEINTERVAL    25      /* int: update process sleep time */
                    286: #define KERN_OSRELDATE         26      /* int: OS release date */
                    287: #define KERN_NTP_PLL           27      /* node: NTP PLL control */
                    288: #define        KERN_BOOTFILE           28      /* string: name of booted kernel */
                    289: #define        KERN_MAXFILESPERPROC    29      /* int: max open files per proc */
                    290: #define        KERN_MAXPROCPERUID      30      /* int: max processes per uid */
                    291: #define KERN_DUMPDEV           31      /* dev_t: device to dump on */
                    292: #define        KERN_IPC                32      /* node: anything related to IPC */
                    293: #define        KERN_DUMMY              33      /* unused */
                    294: #define        KERN_PS_STRINGS         34      /* int: address of PS_STRINGS */
                    295: #define        KERN_USRSTACK           35      /* int: address of USRSTACK */
                    296: #define        KERN_LOGSIGEXIT         36      /* int: do we log sigexit procs? */
                    297: #define KERN_SYMFILE           37      /* string: kernel symbol filename */
                    298: #define KERN_PROCARGS          38
                    299: #define KERN_PCSAMPLES          39      /* int: pc sampling */
                    300: #define KERN_MAXID             40      /* number of valid kern ids */
                    301: 
                    302: 
                    303: /* KERN_KDEBUG types */
                    304: #define KERN_KDEFLAGS          1
                    305: #define KERN_KDDFLAGS          2
                    306: #define KERN_KDENABLE          3
                    307: #define KERN_KDSETBUF          4
                    308: #define KERN_KDGETBUF          5
                    309: #define KERN_KDSETUP           6
                    310: #define KERN_KDREMOVE          7
                    311: #define KERN_KDSETREG          8
                    312: #define KERN_KDGETREG          9
                    313: #define KERN_KDREADTR          10
                    314: #define KERN_KDPIDTR            11
                    315: #define KERN_KDTHRMAP           12
                    316: /* Don't use 13 as it is overloaded with KERN_VNODE */
                    317: #define KERN_KDPIDEX            14
                    318: #define KERN_KDSETRTCDEC        15
                    319: 
                    320: /* KERN_PCSAMPLES types */
                    321: #define KERN_PCENABLE          1
                    322: #define KERN_PCSETBUF          2
                    323: #define KERN_PCGETBUF          3
                    324: #define KERN_PCSETUP           4
                    325: #define KERN_PCREMOVE          5
                    326: #define KERN_PCREADBUF         6
                    327: #define KERN_PCSETREG           7
                    328: 
                    329: #define CTL_KERN_NAMES { \
                    330:        { 0, 0 }, \
                    331:        { "ostype", CTLTYPE_STRING }, \
                    332:        { "osrelease", CTLTYPE_STRING }, \
                    333:        { "osrevision", CTLTYPE_INT }, \
                    334:        { "version", CTLTYPE_STRING }, \
                    335:        { "maxvnodes", CTLTYPE_INT }, \
                    336:        { "maxproc", CTLTYPE_INT }, \
                    337:        { "maxfiles", CTLTYPE_INT }, \
                    338:        { "argmax", CTLTYPE_INT }, \
                    339:        { "securelevel", CTLTYPE_INT }, \
                    340:        { "hostname", CTLTYPE_STRING }, \
                    341:        { "hostid", CTLTYPE_INT }, \
                    342:        { "clockrate", CTLTYPE_STRUCT }, \
                    343:        { "vnode", CTLTYPE_STRUCT }, \
                    344:        { "proc", CTLTYPE_STRUCT }, \
                    345:        { "file", CTLTYPE_STRUCT }, \
                    346:        { "profiling", CTLTYPE_NODE }, \
                    347:        { "posix1version", CTLTYPE_INT }, \
                    348:        { "ngroups", CTLTYPE_INT }, \
                    349:        { "job_control", CTLTYPE_INT }, \
                    350:        { "saved_ids", CTLTYPE_INT }, \
                    351:        { "boottime", CTLTYPE_STRUCT }, \
                    352:        { "nisdomainname", CTLTYPE_STRING }, \
                    353:        { "maxpartitions", CTLTYPE_INT }, \
                    354:        { "kdebug", CTLTYPE_INT }, \
                    355:        { "update", CTLTYPE_INT }, \
                    356:        { "osreldate", CTLTYPE_INT }, \
                    357:         { "ntp_pll", CTLTYPE_NODE }, \
                    358:        { "bootfile", CTLTYPE_STRING }, \
                    359:        { "maxfilesperproc", CTLTYPE_INT }, \
                    360:        { "maxprocperuid", CTLTYPE_INT }, \
                    361:        { "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
                    362:        { "ipc", CTLTYPE_NODE }, \
                    363:        { "dummy", CTLTYPE_INT }, \
                    364:        { "ps_strings", CTLTYPE_INT }, \
                    365:        { "usrstack", CTLTYPE_INT }, \
                    366:        { "logsigexit", CTLTYPE_INT }, \
                    367:         { "symfile",CTLTYPE_STRING },\
                    368: }
                    369: 
                    370: /*
                    371:  * CTL_VFS identifiers
                    372:  */
                    373: #define CTL_VFS_NAMES { \
                    374:        { "vfsconf", CTLTYPE_STRUCT }, \
                    375: }
                    376: 
                    377: /* 
                    378:  * KERN_PROC subtypes
                    379:  */
                    380: #define KERN_PROC_ALL          0       /* everything */
                    381: #define        KERN_PROC_PID           1       /* by process id */
                    382: #define        KERN_PROC_PGRP          2       /* by process group id */
                    383: #define        KERN_PROC_SESSION       3       /* by session of pid */
                    384: #define        KERN_PROC_TTY           4       /* by controlling tty */
                    385: #define        KERN_PROC_UID           5       /* by effective uid */
                    386: #define        KERN_PROC_RUID          6       /* by real uid */
                    387: 
                    388: /* 
                    389:  * KERN_PROC subtype ops return arrays of augmented proc structures:
                    390:  */
                    391: struct kinfo_proc {
                    392:        struct  extern_proc kp_proc;                    /* proc structure */
                    393:        struct  eproc {
                    394:                struct  proc *e_paddr;          /* address of proc */
                    395:                struct  session *e_sess;        /* session pointer */
                    396:                struct  pcred e_pcred;          /* process credentials */
                    397:                struct  ucred e_ucred;          /* current credentials */
                    398: #ifdef sparc
                    399:                struct {
                    400:                        segsz_t vm_rssize;      /* resident set size */
                    401:                        segsz_t vm_tsize;       /* text size */
                    402:                        segsz_t vm_dsize;       /* data size */
                    403:                        segsz_t vm_ssize;       /* stack size */
                    404:                } e_vm;
                    405: #else
                    406:                struct  vmspace e_vm;           /* address space */
                    407: #endif
                    408:                pid_t   e_ppid;                 /* parent process id */
                    409:                pid_t   e_pgid;                 /* process group id */
                    410:                short   e_jobc;                 /* job control counter */
                    411:                dev_t   e_tdev;                 /* controlling tty dev */
                    412:                pid_t   e_tpgid;                /* tty process group id */
                    413:                struct  session *e_tsess;       /* tty session pointer */
                    414: #define        WMESGLEN        7
                    415:                char    e_wmesg[WMESGLEN+1];    /* wchan message */
                    416:                segsz_t e_xsize;                /* text size */
                    417:                short   e_xrssize;              /* text rss */
                    418:                short   e_xccount;              /* text references */
                    419:                short   e_xswrss;
                    420:                long    e_flag;
                    421: #define        EPROC_CTTY      0x01    /* controlling tty vnode active */
                    422: #define        EPROC_SLEADER   0x02    /* session leader */
                    423:                char    e_login[MAXLOGNAME];    /* setlogin() name */
                    424:                long    e_spare[4];
                    425:        } kp_eproc;
                    426: };
                    427: 
                    428: /*
                    429:  * CTL_VM identifiers
                    430:  */
                    431: #define KIPC_MAXSOCKBUF                1       /* int: max size of a socket buffer */
                    432: #define        KIPC_SOCKBUF_WASTE      2       /* int: wastage factor in sockbuf */
                    433: #define        KIPC_SOMAXCONN          3       /* int: max length of connection q */
                    434: #define        KIPC_MAX_LINKHDR        4       /* int: max length of link header */
                    435: #define        KIPC_MAX_PROTOHDR       5       /* int: max length of network header */
                    436: #define        KIPC_MAX_HDR            6       /* int: max total length of headers */
                    437: #define        KIPC_MAX_DATALEN        7       /* int: max length of data? */
                    438: #define        KIPC_MBSTAT             8       /* struct: mbuf usage statistics */
                    439: #define        KIPC_NMBCLUSTERS        9       /* int: maximum mbuf clusters */
                    440: 
                    441: #define        VM_METER        1               /* struct vmmeter */
                    442: #define        VM_LOADAVG      2               /* struct loadavg */
                    443: #define        VM_MAXID        3               /* number of valid vm ids */
                    444: #define        VM_MACHFACTOR   4               /* struct loadavg with mach factor*/
                    445: 
                    446: #define        CTL_VM_NAMES { \
                    447:        { 0, 0 }, \
                    448:        { "vmmeter", CTLTYPE_STRUCT }, \
                    449:        { "loadavg", CTLTYPE_STRUCT }, \
                    450: }
                    451: 
                    452: /*
                    453:  * CTL_HW identifiers
                    454:  */
                    455: #define        HW_MACHINE       1              /* string: machine class */
                    456: #define        HW_MODEL         2              /* string: specific machine model */
                    457: #define        HW_NCPU          3              /* int: number of cpus */
                    458: #define        HW_BYTEORDER     4              /* int: machine byte order */
                    459: #define        HW_PHYSMEM       5              /* int: total memory */
                    460: #define        HW_USERMEM       6              /* int: non-kernel memory */
                    461: #define        HW_PAGESIZE      7              /* int: software page size */
                    462: #define        HW_DISKNAMES     8              /* strings: disk drive names */
                    463: #define        HW_DISKSTATS     9              /* struct: diskstats[] */
                    464: #define        HW_EPOCH        10              /* int: 0 for Legacy, else NewWorld */
                    465: #define HW_FLOATINGPT  11              /* int: has HW floating point? */
                    466: #define HW_MACHINE_ARCH        12              /* string: machine architecture */
                    467: #define        HW_MAXID        12              /* number of valid hw ids */
                    468: 
                    469: #define CTL_HW_NAMES { \
                    470:        { 0, 0 }, \
                    471:        { "machine", CTLTYPE_STRING }, \
                    472:        { "model", CTLTYPE_STRING }, \
                    473:        { "ncpu", CTLTYPE_INT }, \
                    474:        { "byteorder", CTLTYPE_INT }, \
                    475:        { "physmem", CTLTYPE_INT }, \
                    476:        { "usermem", CTLTYPE_INT }, \
                    477:        { "pagesize", CTLTYPE_INT }, \
                    478:        { "disknames", CTLTYPE_STRUCT }, \
                    479:        { "diskstats", CTLTYPE_STRUCT }, \
                    480:        { "epoch", CTLTYPE_INT }, \
                    481:        { "floatingpoint", CTLTYPE_INT }, \
                    482:        { "machinearch", CTLTYPE_STRING }, \
                    483: }
                    484: 
                    485: /*
                    486:  * CTL_USER definitions
                    487:  */
                    488: #define        USER_CS_PATH             1      /* string: _CS_PATH */
                    489: #define        USER_BC_BASE_MAX         2      /* int: BC_BASE_MAX */
                    490: #define        USER_BC_DIM_MAX          3      /* int: BC_DIM_MAX */
                    491: #define        USER_BC_SCALE_MAX        4      /* int: BC_SCALE_MAX */
                    492: #define        USER_BC_STRING_MAX       5      /* int: BC_STRING_MAX */
                    493: #define        USER_COLL_WEIGHTS_MAX    6      /* int: COLL_WEIGHTS_MAX */
                    494: #define        USER_EXPR_NEST_MAX       7      /* int: EXPR_NEST_MAX */
                    495: #define        USER_LINE_MAX            8      /* int: LINE_MAX */
                    496: #define        USER_RE_DUP_MAX          9      /* int: RE_DUP_MAX */
                    497: #define        USER_POSIX2_VERSION     10      /* int: POSIX2_VERSION */
                    498: #define        USER_POSIX2_C_BIND      11      /* int: POSIX2_C_BIND */
                    499: #define        USER_POSIX2_C_DEV       12      /* int: POSIX2_C_DEV */
                    500: #define        USER_POSIX2_CHAR_TERM   13      /* int: POSIX2_CHAR_TERM */
                    501: #define        USER_POSIX2_FORT_DEV    14      /* int: POSIX2_FORT_DEV */
                    502: #define        USER_POSIX2_FORT_RUN    15      /* int: POSIX2_FORT_RUN */
                    503: #define        USER_POSIX2_LOCALEDEF   16      /* int: POSIX2_LOCALEDEF */
                    504: #define        USER_POSIX2_SW_DEV      17      /* int: POSIX2_SW_DEV */
                    505: #define        USER_POSIX2_UPE         18      /* int: POSIX2_UPE */
                    506: #define        USER_STREAM_MAX         19      /* int: POSIX2_STREAM_MAX */
                    507: #define        USER_TZNAME_MAX         20      /* int: POSIX2_TZNAME_MAX */
                    508: #define        USER_MAXID              21      /* number of valid user ids */
                    509: 
                    510: #define        CTL_USER_NAMES { \
                    511:        { 0, 0 }, \
                    512:        { "cs_path", CTLTYPE_STRING }, \
                    513:        { "bc_base_max", CTLTYPE_INT }, \
                    514:        { "bc_dim_max", CTLTYPE_INT }, \
                    515:        { "bc_scale_max", CTLTYPE_INT }, \
                    516:        { "bc_string_max", CTLTYPE_INT }, \
                    517:        { "coll_weights_max", CTLTYPE_INT }, \
                    518:        { "expr_nest_max", CTLTYPE_INT }, \
                    519:        { "line_max", CTLTYPE_INT }, \
                    520:        { "re_dup_max", CTLTYPE_INT }, \
                    521:        { "posix2_version", CTLTYPE_INT }, \
                    522:        { "posix2_c_bind", CTLTYPE_INT }, \
                    523:        { "posix2_c_dev", CTLTYPE_INT }, \
                    524:        { "posix2_char_term", CTLTYPE_INT }, \
                    525:        { "posix2_fort_dev", CTLTYPE_INT }, \
                    526:        { "posix2_fort_run", CTLTYPE_INT }, \
                    527:        { "posix2_localedef", CTLTYPE_INT }, \
                    528:        { "posix2_sw_dev", CTLTYPE_INT }, \
                    529:        { "posix2_upe", CTLTYPE_INT }, \
                    530:        { "stream_max", CTLTYPE_INT }, \
                    531:        { "tzname_max", CTLTYPE_INT }, \
                    532: }
                    533: 
                    534: #define CTL_P1003_1B_ASYNCHRONOUS_IO           1       /* boolean */
                    535: #define CTL_P1003_1B_MAPPED_FILES              2       /* boolean */
                    536: #define CTL_P1003_1B_MEMLOCK                   3       /* boolean */
                    537: #define CTL_P1003_1B_MEMLOCK_RANGE             4       /* boolean */
                    538: #define CTL_P1003_1B_MEMORY_PROTECTION         5       /* boolean */
                    539: #define CTL_P1003_1B_MESSAGE_PASSING           6       /* boolean */
                    540: #define CTL_P1003_1B_PRIORITIZED_IO            7       /* boolean */
                    541: #define CTL_P1003_1B_PRIORITY_SCHEDULING       8       /* boolean */
                    542: #define CTL_P1003_1B_REALTIME_SIGNALS          9       /* boolean */
                    543: #define CTL_P1003_1B_SEMAPHORES                        10      /* boolean */
                    544: #define CTL_P1003_1B_FSYNC                     11      /* boolean */
                    545: #define CTL_P1003_1B_SHARED_MEMORY_OBJECTS     12      /* boolean */
                    546: #define CTL_P1003_1B_SYNCHRONIZED_IO           13      /* boolean */
                    547: #define CTL_P1003_1B_TIMERS                    14      /* boolean */
                    548: #define CTL_P1003_1B_AIO_LISTIO_MAX            15      /* int */
                    549: #define CTL_P1003_1B_AIO_MAX                   16      /* int */
                    550: #define CTL_P1003_1B_AIO_PRIO_DELTA_MAX                17      /* int */
                    551: #define CTL_P1003_1B_DELAYTIMER_MAX            18      /* int */
                    552: #define CTL_P1003_1B_MQ_OPEN_MAX               19      /* int */
                    553: #define CTL_P1003_1B_PAGESIZE                  20      /* int */
                    554: #define CTL_P1003_1B_RTSIG_MAX                 21      /* int */
                    555: #define CTL_P1003_1B_SEM_NSEMS_MAX             22      /* int */
                    556: #define CTL_P1003_1B_SEM_VALUE_MAX             23      /* int */
                    557: #define CTL_P1003_1B_SIGQUEUE_MAX              24      /* int */
                    558: #define CTL_P1003_1B_TIMER_MAX                 25      /* int */
                    559: 
                    560: #define CTL_P1003_1B_MAXID             26
                    561: 
                    562: #define        CTL_P1003_1B_NAMES { \
                    563:        { 0, 0 }, \
                    564:        { "asynchronous_io", CTLTYPE_INT }, \
                    565:        { "mapped_files", CTLTYPE_INT }, \
                    566:        { "memlock", CTLTYPE_INT }, \
                    567:        { "memlock_range", CTLTYPE_INT }, \
                    568:        { "memory_protection", CTLTYPE_INT }, \
                    569:        { "message_passing", CTLTYPE_INT }, \
                    570:        { "prioritized_io", CTLTYPE_INT }, \
                    571:        { "priority_scheduling", CTLTYPE_INT }, \
                    572:        { "realtime_signals", CTLTYPE_INT }, \
                    573:        { "semaphores", CTLTYPE_INT }, \
                    574:        { "fsync", CTLTYPE_INT }, \
                    575:        { "shared_memory_objects", CTLTYPE_INT }, \
                    576:        { "synchronized_io", CTLTYPE_INT }, \
                    577:        { "timers", CTLTYPE_INT }, \
                    578:        { "aio_listio_max", CTLTYPE_INT }, \
                    579:        { "aio_max", CTLTYPE_INT }, \
                    580:        { "aio_prio_delta_max", CTLTYPE_INT }, \
                    581:        { "delaytimer_max", CTLTYPE_INT }, \
                    582:        { "mq_open_max", CTLTYPE_INT }, \
                    583:        { "pagesize", CTLTYPE_INT }, \
                    584:        { "rtsig_max", CTLTYPE_INT }, \
                    585:        { "nsems_max", CTLTYPE_INT }, \
                    586:        { "sem_value_max", CTLTYPE_INT }, \
                    587:        { "sigqueue_max", CTLTYPE_INT }, \
                    588:        { "timer_max", CTLTYPE_INT }, \
                    589: }
                    590: 
                    591: 
                    592: /*
                    593:  * CTL_DEBUG definitions
                    594:  *
                    595:  * Second level identifier specifies which debug variable.
                    596:  * Third level identifier specifies which stucture component.
                    597:  */
                    598: #define        CTL_DEBUG_NAME          0       /* string: variable name */
                    599: #define        CTL_DEBUG_VALUE         1       /* int: variable value */
                    600: #define        CTL_DEBUG_MAXID         20
                    601: 
                    602: #ifdef KERNEL
                    603: 
                    604: extern struct sysctl_oid_list sysctl__children;
                    605: SYSCTL_DECL(_kern);
                    606: SYSCTL_DECL(_sysctl);
                    607: SYSCTL_DECL(_vm);
                    608: SYSCTL_DECL(_vfs);
                    609: SYSCTL_DECL(_net);
                    610: SYSCTL_DECL(_debug);
                    611: SYSCTL_DECL(_hw);
                    612: SYSCTL_DECL(_machdep);
                    613: SYSCTL_DECL(_user);
                    614: 
                    615: 
                    616: #ifdef DEBUG
                    617: /*
                    618:  * CTL_DEBUG variables.
                    619:  *
                    620:  * These are declared as separate variables so that they can be
                    621:  * individually initialized at the location of their associated
                    622:  * variable. The loader prevents multiple use by issuing errors
                    623:  * if a variable is initialized in more than one place. They are
                    624:  * aggregated into an array in debug_sysctl(), so that it can
                    625:  * conveniently locate them when querried. If more debugging
                    626:  * variables are added, they must also be declared here and also
                    627:  * entered into the array.
                    628:  */
                    629: struct ctldebug {
                    630:        char    *debugname;     /* name of debugging variable */
                    631:        int     *debugvar;      /* pointer to debugging variable */
                    632: };
                    633: extern struct ctldebug debug0, debug1, debug2, debug3, debug4;
                    634: extern struct ctldebug debug5, debug6, debug7, debug8, debug9;
                    635: extern struct ctldebug debug10, debug11, debug12, debug13, debug14;
                    636: extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
                    637: #endif /* DEBUG */
                    638: 
                    639: extern char    machine[];
                    640: extern char    osrelease[];
                    641: extern char    ostype[];
                    642: 
                    643: struct linker_set;
                    644: 
                    645: void   sysctl_register_set(struct linker_set *lsp);
                    646: void   sysctl_unregister_set(struct linker_set *lsp);
                    647: int    kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old,
                    648:                      size_t *oldlenp, void *new, size_t newlen,
                    649:                      size_t *retval);
                    650: int    userland_sysctl(struct proc *p, int *name, u_int namelen, void *old,
                    651:                        size_t *oldlenp, int inkernel, void *new, size_t newlen,
                    652:                        size_t *retval);
                    653: /*
                    654:  * Internal sysctl function calling convention:
                    655:  *
                    656:  *     (*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen);
                    657:  *
                    658:  * The name parameter points at the next component of the name to be
                    659:  * interpreted.  The namelen parameter is the number of integers in
                    660:  * the name.
                    661:  */
                    662: typedef int (sysctlfn)
                    663:     __P((int *, u_int, void *, size_t *, void *, size_t, struct proc *));
                    664: 
                    665: int sysctl_int __P((void *, size_t *, void *, size_t, int *));
                    666: int sysctl_rdint __P((void *, size_t *, void *, int));
                    667: int sysctl_string __P((void *, size_t *, void *, size_t, char *, int));
                    668: int sysctl_rdstring __P((void *, size_t *, void *, char *));
                    669: int sysctl_rdstruct __P((void *, size_t *, void *, void *, int));
                    670: void fill_eproc __P((struct proc *, struct eproc *));
                    671: 
                    672: #else  /* !KERNEL */
                    673: #include <sys/cdefs.h>
                    674: 
                    675: __BEGIN_DECLS
                    676: int    sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
                    677: int    sysctlbyname __P((const char *, void *, size_t *, void *, size_t));
                    678: __END_DECLS
                    679: #endif /* KERNEL */
                    680: #endif /* !_SYS_SYSCTL_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.