1: /*
   2:  * Copyright (c) 1989, 1993
   3:  *	The Regents of the University of California.  All rights reserved.
   4:  *
   5:  * This code is derived from software contributed to Berkeley by
   6:  * Mike Karels at Berkeley Software Design, Inc.
   7:  *
   8:  * Redistribution and use in source and binary forms, with or without
   9:  * modification, are permitted provided that the following conditions
  10:  * are met:
  11:  * 1. Redistributions of source code must retain the above copyright
  12:  *    notice, this list of conditions and the following disclaimer.
  13:  * 2. Redistributions in binary form must reproduce the above copyright
  14:  *    notice, this list of conditions and the following disclaimer in the
  15:  *    documentation and/or other materials provided with the distribution.
  16:  * 3. All advertising materials mentioning features or use of this software
  17:  *    must display the following acknowledgement:
  18:  *	This product includes software developed by the University of
  19:  *	California, Berkeley and its contributors.
  20:  * 4. Neither the name of the University nor the names of its contributors
  21:  *    may be used to endorse or promote products derived from this software
  22:  *    without specific prior written permission.
  23:  *
  24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  34:  * SUCH DAMAGE.
  35:  *
  36:  *	@(#)sysctl.h	8.1.3 (2.11BSD) 1999/4/29
  37:  */
  38: 
  39: #ifndef _SYS_SYSCTL_H_
  40: #define _SYS_SYSCTL_H_
  41: 
  42: /*
  43:  * These are for the eproc, etext, einode, efile and map structures.
  44:  */
  45: #ifndef KERNEL
  46: #include <sys/time.h>
  47: #include <sys/resource.h>
  48: #include <sys/file.h>
  49: #include <sys/inode.h>
  50: #include <sys/text.h>
  51: #include <sys/proc.h>
  52: #include <sys/vm.h>
  53: #include <sys/map.h>
  54: #endif
  55: 
  56: /*
  57:  * Definitions for sysctl call.  The sysctl call uses a hierarchical name
  58:  * for objects that can be examined or modified.  The name is expressed as
  59:  * a sequence of integers.  Like a file path name, the meaning of each
  60:  * component depends on its place in the hierarchy.  The top-level and kern
  61:  * identifiers are defined here, and other identifiers are defined in the
  62:  * respective subsystem header files.
  63:  */
  64: 
  65: #define CTL_MAXNAME 12  /* largest number of components supported */
  66: 
  67: /*
  68:  * Each subsystem defined by sysctl defines a list of variables
  69:  * for that subsystem. Each name is either a node with further
  70:  * levels defined below it, or it is a leaf of some particular
  71:  * type given below. Each sysctl level defines a set of name/type
  72:  * pairs to be used by sysctl(1) in manipulating the subsystem.
  73:  */
  74: struct ctlname {
  75:     char    *ctl_name;  /* subsystem name */
  76:     int ctl_type;   /* type of name */
  77: };
  78: #define CTLTYPE_NODE    1   /* name is a node */
  79: #define CTLTYPE_INT 2   /* name describes a 16-bit integer */
  80: #define CTLTYPE_STRING  3   /* name describes a string */
  81: #define CTLTYPE_LONG    4   /* name describes a 32-bit number */
  82: #define CTLTYPE_STRUCT  5   /* name describes a structure */
  83: 
  84: /*
  85:  * Top-level identifiers
  86:  */
  87: #define CTL_UNSPEC  0       /* unused */
  88: #define CTL_KERN    1       /* "high kernel": proc, limits */
  89: #define CTL_VM      2       /* virtual memory */
  90: #define CTL_FS      3       /* file system, mount type is next */
  91: #define CTL_NET     4       /* network, see socket.h */
  92: #define CTL_DEBUG   5       /* debugging parameters */
  93: #define CTL_HW      6       /* generic cpu/io */
  94: #define CTL_MACHDEP 7       /* machine dependent */
  95: #define CTL_USER    8       /* user-level */
  96: #define CTL_MAXID   9       /* number of valid top-level ids */
  97: 
  98: #ifndef KERNEL
  99: #define CTL_NAMES { \
 100:     { 0, 0 }, \
 101:     { "kern", CTLTYPE_NODE }, \
 102:     { "vm", CTLTYPE_NODE }, \
 103:     { "fs", CTLTYPE_NODE }, \
 104:     { "net", CTLTYPE_NODE }, \
 105:     { "debug", CTLTYPE_NODE }, \
 106:     { "hw", CTLTYPE_NODE }, \
 107:     { "machdep", CTLTYPE_NODE }, \
 108:     { "user", CTLTYPE_NODE }, \
 109: }
 110: #endif
 111: 
 112: /*
 113:  * CTL_KERN identifiers
 114:  */
 115: #define KERN_OSTYPE      1  /* string: system version */
 116: #define KERN_OSRELEASE       2  /* string: system release */
 117: #define KERN_OSREV       3  /* int: system revision */
 118: #define KERN_VERSION         4  /* string: compile time info */
 119: #define KERN_MAXINODES       5  /* int: max inodes */
 120: #define KERN_MAXPROC         6  /* int: max processes */
 121: #define KERN_MAXFILES        7  /* int: max open files */
 122: #define KERN_ARGMAX      8  /* int: max arguments to exec */
 123: #define KERN_SECURELVL       9  /* int: system security level */
 124: #define KERN_HOSTNAME       10  /* string: hostname */
 125: #define KERN_HOSTID     11  /* int: host identifier */
 126: #define KERN_CLOCKRATE      12  /* struct: struct clockrate */
 127: #define KERN_INODE      13  /* struct: inode structures */
 128: #define KERN_PROC       14  /* struct: process entries */
 129: #define KERN_FILE       15  /* struct: file entries */
 130: #define KERN_PROF       16  /* node: kernel profiling info */
 131: #define KERN_POSIX1     17  /* int: POSIX.1 version */
 132: #define KERN_NGROUPS        18  /* int: # of supplemental group ids */
 133: #define KERN_JOB_CONTROL    19  /* int: is job control available */
 134: #define KERN_SAVED_IDS      20  /* int: saved set-user/group-ID */
 135: #define KERN_BOOTTIME       21  /* struct: time kernel was booted */
 136: #define KERN_MAXTEXTS       22  /* int: # of text entries */
 137: #define KERN_TEXT       23  /* struct: text entries */
 138: #define KERN_ACCTTHRESH     24  /* int: accounting daemon threshold */
 139: #define KERN_MAXID      25  /* number of valid kern ids */
 140: 
 141: #ifndef KERNEL
 142: #define CTL_KERN_NAMES { \
 143:     { 0, 0 }, \
 144:     { "ostype", CTLTYPE_STRING }, \
 145:     { "osrelease", CTLTYPE_STRING }, \
 146:     { "osrevision", CTLTYPE_LONG }, \
 147:     { "version", CTLTYPE_STRING }, \
 148:     { "maxinodes", CTLTYPE_INT }, \
 149:     { "maxproc", CTLTYPE_INT }, \
 150:     { "maxfiles", CTLTYPE_INT }, \
 151:     { "argmax", CTLTYPE_INT }, \
 152:     { "securelevel", CTLTYPE_INT }, \
 153:     { "hostname", CTLTYPE_STRING }, \
 154:     { "hostid", CTLTYPE_LONG }, \
 155:     { "clockrate", CTLTYPE_STRUCT }, \
 156:     { "inode", CTLTYPE_STRUCT }, \
 157:     { "proc", CTLTYPE_STRUCT }, \
 158:     { "file", CTLTYPE_STRUCT }, \
 159:     { "profiling", CTLTYPE_NODE }, \
 160:     { "posix1version", CTLTYPE_INT }, \
 161:     { "ngroups", CTLTYPE_INT }, \
 162:     { "job_control", CTLTYPE_INT }, \
 163:     { "saved_ids", CTLTYPE_INT }, \
 164:     { "boottime", CTLTYPE_STRUCT }, \
 165:     { "maxtexts", CTLTYPE_INT }, \
 166:     { "text", CTLTYPE_STRUCT }, \
 167:     { "acctthresh", CTLTYPE_INT }, \
 168: }
 169: #endif
 170: 
 171: /*
 172:  * KERN_PROC subtypes
 173:  */
 174: #define KERN_PROC_ALL       0   /* everything */
 175: #define KERN_PROC_PID       1   /* by process id */
 176: #define KERN_PROC_PGRP      2   /* by process group id */
 177: #define KERN_PROC_SESSION   3   /* by session of pid - NOT IN 2.11 */
 178: #define KERN_PROC_TTY       4   /* by controlling tty */
 179: #define KERN_PROC_UID       5   /* by effective uid */
 180: #define KERN_PROC_RUID      6   /* by real uid */
 181: 
 182: /*
 183:  * KERN_PROC subtype ops return arrays of augmented proc structures:
 184:  */
 185: struct kinfo_proc {
 186:     struct  proc kp_proc;           /* proc structure */
 187:     struct  eproc {
 188:         struct  proc *e_paddr;      /* address of proc */
 189:         dev_t   e_tdev;         /* controlling tty dev */
 190:         pid_t   e_tpgid;        /* tty process group id */
 191:         uid_t   e_ruid;         /* real uid */
 192:     } kp_eproc;
 193: };
 194: 
 195: /*
 196:  * KERN_TEXT op returns array of augmented text structures:
 197: */
 198: struct  kinfo_text {
 199:     struct  text *kp_textp;         /* address of text */
 200:     struct  text kp_text;           /* text structure */
 201: };
 202: 
 203: /*
 204:  * KERN_INODE returns an array of augmented inode structures:
 205: */
 206: struct  kinfo_inode {
 207:     struct  inode   *kp_inodep;     /* address of inode */
 208:     struct  inode   kp_inode;       /* inode structure */
 209: };
 210: 
 211: /*
 212:  * KERN_FILE returns an array of augmented file structures:
 213: */
 214: struct  kinfo_file {
 215:     struct  file    *kp_filep;      /* address of file */
 216:     struct  file    kp_file;        /* file structure */
 217: };
 218: 
 219: /*
 220:  * CTL_HW identifiers
 221:  */
 222: #define HW_MACHINE   1      /* string: machine class */
 223: #define HW_MODEL     2      /* string: specific machine model */
 224: #define HW_NCPU      3      /* int: number of cpus */
 225: #define HW_BYTEORDER     4      /* int: machine byte order */
 226: #define HW_PHYSMEM   5      /* int: total memory */
 227: #define HW_USERMEM   6      /* int: non-kernel memory */
 228: #define HW_PAGESIZE  7      /* int: software page size */
 229: #define HW_DISKNAMES     8      /* strings: disk drive names */
 230: #define HW_DISKSTATS     9      /* struct: diskstats[] */
 231: #define HW_MAXID    10      /* number of valid hw ids */
 232: 
 233: #ifndef KERNEL
 234: #define CTL_HW_NAMES { \
 235:     { 0, 0 }, \
 236:     { "machine", CTLTYPE_STRING }, \
 237:     { "model", CTLTYPE_STRING }, \
 238:     { "ncpu", CTLTYPE_INT }, \
 239:     { "byteorder", CTLTYPE_INT }, \
 240:     { "physmem", CTLTYPE_LONG }, \
 241:     { "usermem", CTLTYPE_LONG }, \
 242:     { "pagesize", CTLTYPE_INT }, \
 243:     { "disknames", CTLTYPE_STRUCT }, \
 244:     { "diskstats", CTLTYPE_STRUCT }, \
 245: }
 246: #endif
 247: 
 248: #ifndef KERNEL
 249: /*
 250:  * CTL_USER definitions
 251:  */
 252: #define USER_CS_PATH         1  /* string: _CS_PATH */
 253: #define USER_BC_BASE_MAX     2  /* int: BC_BASE_MAX */
 254: #define USER_BC_DIM_MAX      3  /* int: BC_DIM_MAX */
 255: #define USER_BC_SCALE_MAX    4  /* int: BC_SCALE_MAX */
 256: #define USER_BC_STRING_MAX   5  /* int: BC_STRING_MAX */
 257: #define USER_COLL_WEIGHTS_MAX    6  /* int: COLL_WEIGHTS_MAX */
 258: #define USER_EXPR_NEST_MAX   7  /* int: EXPR_NEST_MAX */
 259: #define USER_LINE_MAX        8  /* int: LINE_MAX */
 260: #define USER_RE_DUP_MAX      9  /* int: RE_DUP_MAX */
 261: #define USER_POSIX2_VERSION 10  /* int: POSIX2_VERSION */
 262: #define USER_POSIX2_C_BIND  11  /* int: POSIX2_C_BIND */
 263: #define USER_POSIX2_C_DEV   12  /* int: POSIX2_C_DEV */
 264: #define USER_POSIX2_CHAR_TERM   13  /* int: POSIX2_CHAR_TERM */
 265: #define USER_POSIX2_FORT_DEV    14  /* int: POSIX2_FORT_DEV */
 266: #define USER_POSIX2_FORT_RUN    15  /* int: POSIX2_FORT_RUN */
 267: #define USER_POSIX2_LOCALEDEF   16  /* int: POSIX2_LOCALEDEF */
 268: #define USER_POSIX2_SW_DEV  17  /* int: POSIX2_SW_DEV */
 269: #define USER_POSIX2_UPE     18  /* int: POSIX2_UPE */
 270: #define USER_STREAM_MAX     19  /* int: POSIX2_STREAM_MAX */
 271: #define USER_TZNAME_MAX     20  /* int: POSIX2_TZNAME_MAX */
 272: #define USER_MAXID      21  /* number of valid user ids */
 273: 
 274: #define CTL_USER_NAMES { \
 275:     { 0, 0 }, \
 276:     { "cs_path", CTLTYPE_STRING }, \
 277:     { "bc_base_max", CTLTYPE_INT }, \
 278:     { "bc_dim_max", CTLTYPE_INT }, \
 279:     { "bc_scale_max", CTLTYPE_INT }, \
 280:     { "bc_string_max", CTLTYPE_INT }, \
 281:     { "coll_weights_max", CTLTYPE_INT }, \
 282:     { "expr_nest_max", CTLTYPE_INT }, \
 283:     { "line_max", CTLTYPE_INT }, \
 284:     { "re_dup_max", CTLTYPE_INT }, \
 285:     { "posix2_version", CTLTYPE_INT }, \
 286:     { "posix2_c_bind", CTLTYPE_INT }, \
 287:     { "posix2_c_dev", CTLTYPE_INT }, \
 288:     { "posix2_char_term", CTLTYPE_INT }, \
 289:     { "posix2_fort_dev", CTLTYPE_INT }, \
 290:     { "posix2_fort_run", CTLTYPE_INT }, \
 291:     { "posix2_localedef", CTLTYPE_INT }, \
 292:     { "posix2_sw_dev", CTLTYPE_INT }, \
 293:     { "posix2_upe", CTLTYPE_INT }, \
 294:     { "stream_max", CTLTYPE_INT }, \
 295:     { "tzname_max", CTLTYPE_INT }, \
 296: }
 297: #endif
 298: 
 299: /*
 300:  * CTL_DEBUG definitions
 301:  *
 302:  * Second level identifier specifies which debug variable.
 303:  * Third level identifier specifies which stucture component.
 304:  */
 305: #define CTL_DEBUG_NAME      0   /* string: variable name */
 306: #define CTL_DEBUG_VALUE     1   /* int: variable value */
 307: #define CTL_DEBUG_MAXID     20
 308: 
 309: #ifdef  KERNEL
 310: #ifdef  DEBUG
 311: /*
 312:  * CTL_DEBUG variables.
 313:  *
 314:  * These are declared as separate variables so that they can be
 315:  * individually initialized at the location of their associated
 316:  * variable. The loader prevents multiple use by issuing errors
 317:  * if a variable is initialized in more than one place. They are
 318:  * aggregated into an array in debug_sysctl(), so that it can
 319:  * conveniently locate them when querried. If more debugging
 320:  * variables are added, they must also be declared here and also
 321:  * entered into the array.
 322:  */
 323: struct ctldebug {
 324:     char    *debugname; /* name of debugging variable */
 325:     int *debugvar;  /* pointer to debugging variable */
 326: };
 327: extern struct ctldebug debug0, debug1, debug2, debug3, debug4;
 328: extern struct ctldebug debug5, debug6, debug7, debug8, debug9;
 329: extern struct ctldebug debug10, debug11, debug12, debug13, debug14;
 330: extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
 331: #endif	/* DEBUG */
 332: 
 333: /*
 334:  * Internal sysctl function calling convention:
 335:  *
 336:  *	(*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen);
 337:  *
 338:  * The name parameter points at the next component of the name to be
 339:  * interpreted.  The namelen parameter is the number of integers in
 340:  * the name.
 341:  */
 342: typedef int (sysctlfn)();
 343: 
 344: int sysctl_int();
 345: int sysctl_rdint();
 346: int sysctl_string();
 347: int sysctl_rdstring();
 348: int sysctl_rdstruct();
 349: void fill_eproc();
 350: 
 351: #else   /* !KERNEL */
 352: 
 353: int sysctl();
 354: #endif	/* KERNEL */
 355: #endif	/* !_SYS_SYSCTL_H_ */

Defined struct's

ctldebug defined in line 323; used 20 times
ctlname defined in line 74; used 30 times
eproc defined in line 187; used 4 times
kinfo_file defined in line 214; used 10 times
kinfo_inode defined in line 206; never used
kinfo_proc defined in line 185; used 30 times
kinfo_text defined in line 198; never used

Defined macros

CTLTYPE_INT defined in line 79; used 34 times
CTLTYPE_LONG defined in line 81; used 4 times
CTLTYPE_NODE defined in line 78; used 25 times
CTLTYPE_STRING defined in line 80; used 7 times
CTLTYPE_STRUCT defined in line 82; used 8 times
CTL_DEBUG defined in line 92; used 4 times
CTL_DEBUG_NAME defined in line 305; used 1 times
CTL_DEBUG_VALUE defined in line 306; used 1 times
CTL_FS defined in line 90; never used
CTL_HW_NAMES defined in line 234; used 1 times
CTL_KERN_NAMES defined in line 142; used 1 times
CTL_MACHDEP defined in line 94; never used
CTL_MAXID defined in line 96; used 2 times
CTL_MAXNAME defined in line 65; used 3 times
CTL_NAMES defined in line 99; used 1 times
CTL_NET defined in line 91; never used
CTL_UNSPEC defined in line 87; never used
CTL_USER defined in line 95; used 2 times
CTL_USER_NAMES defined in line 274; used 1 times
CTL_VM defined in line 89; used 1 times
HW_BYTEORDER defined in line 225; never used
HW_DISKNAMES defined in line 229; never used
HW_DISKSTATS defined in line 230; never used
HW_MAXID defined in line 231; used 1 times
HW_MODEL defined in line 223; used 1 times
HW_NCPU defined in line 224; never used
HW_PAGESIZE defined in line 228; used 1 times
HW_PHYSMEM defined in line 226; never used
HW_USERMEM defined in line 227; never used
KERN_ACCTTHRESH defined in line 138; never used
KERN_ARGMAX defined in line 122; never used
KERN_BOOTTIME defined in line 135; used 2 times
KERN_FILE defined in line 129; used 1 times
KERN_INODE defined in line 127; never used
KERN_JOB_CONTROL defined in line 133; never used
KERN_MAXFILES defined in line 121; never used
KERN_MAXID defined in line 139; used 1 times
KERN_MAXINODES defined in line 119; never used
KERN_MAXPROC defined in line 120; never used
KERN_MAXTEXTS defined in line 136; never used
KERN_NGROUPS defined in line 132; never used
KERN_OSREV defined in line 117; never used
KERN_POSIX1 defined in line 131; never used
KERN_PROC_PGRP defined in line 176; never used
KERN_PROC_PID defined in line 175; never used
KERN_PROC_RUID defined in line 180; never used
KERN_PROC_SESSION defined in line 177; never used
KERN_PROC_TTY defined in line 178; never used
KERN_PROC_UID defined in line 179; never used
KERN_PROF defined in line 130; used 1 times
KERN_SAVED_IDS defined in line 134; never used
KERN_SECURELVL defined in line 123; used 4 times
KERN_TEXT defined in line 137; never used
USER_BC_BASE_MAX defined in line 253; never used
USER_BC_DIM_MAX defined in line 254; never used
USER_BC_SCALE_MAX defined in line 255; never used
USER_BC_STRING_MAX defined in line 256; never used
USER_COLL_WEIGHTS_MAX defined in line 257; never used
USER_CS_PATH defined in line 252; used 1 times
USER_EXPR_NEST_MAX defined in line 258; never used
USER_LINE_MAX defined in line 259; never used
USER_MAXID defined in line 272; used 1 times
USER_POSIX2_CHAR_TERM defined in line 264; never used
USER_POSIX2_C_BIND defined in line 262; never used
USER_POSIX2_C_DEV defined in line 263; never used
USER_POSIX2_FORT_DEV defined in line 265; never used
USER_POSIX2_FORT_RUN defined in line 266; never used
USER_POSIX2_LOCALEDEF defined in line 267; never used
USER_POSIX2_SW_DEV defined in line 268; never used
USER_POSIX2_UPE defined in line 269; never used
USER_POSIX2_VERSION defined in line 261; never used
USER_RE_DUP_MAX defined in line 260; never used
USER_STREAM_MAX defined in line 270; never used
USER_TZNAME_MAX defined in line 271; never used
_SYS_SYSCTL_H_ defined in line 40; used 1 times
  • in line 39

Usage of this include

Last modified: 1999-04-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 4934
Valid CSS Valid XHTML 1.0 Strict