williamr@2: /*- williamr@2: * Copyright (c) 1989, 1993 williamr@2: * The Regents of the University of California. All rights reserved. williamr@2: * williamr@2: * This code is derived from software contributed to Berkeley by williamr@2: * Mike Karels at Berkeley Software Design, Inc. williamr@2: * williamr@2: * Redistribution and use in source and binary forms, with or without williamr@2: * modification, are permitted provided that the following conditions williamr@2: * are met: williamr@2: * 1. Redistributions of source code must retain the above copyright williamr@2: * notice, this list of conditions and the following disclaimer. williamr@2: * 2. Redistributions in binary form must reproduce the above copyright williamr@2: * notice, this list of conditions and the following disclaimer in the williamr@2: * documentation and/or other materials provided with the distribution. williamr@2: * 4. Neither the name of the University nor the names of its contributors williamr@2: * may be used to endorse or promote products derived from this software williamr@2: * without specific prior written permission. williamr@2: * williamr@2: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND williamr@2: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE williamr@2: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE williamr@2: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE williamr@2: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL williamr@2: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS williamr@2: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) williamr@2: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT williamr@2: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY williamr@2: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF williamr@2: * SUCH DAMAGE. williamr@2: * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved. williamr@2: * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 williamr@2: * $FreeBSD: src/sys/sys/sysctl.h,v 1.138 2005/04/18 02:10:37 das Exp $ williamr@2: */ williamr@2: williamr@2: #ifndef _SYS_SYSCTL_H_ williamr@2: #define _SYS_SYSCTL_H_ williamr@2: williamr@2: #include williamr@2: williamr@2: struct thread; williamr@2: /* williamr@2: * Definitions for sysctl call. The sysctl call uses a hierarchical name williamr@2: * for objects that can be examined or modified. The name is expressed as williamr@2: * a sequence of integers. Like a file path name, the meaning of each williamr@2: * component depends on its place in the hierarchy. The top-level and kern williamr@2: * identifiers are defined here, and other identifiers are defined in the williamr@2: * respective subsystem header files. williamr@2: */ williamr@2: williamr@2: #define CTL_MAXNAME 24 /* largest number of components supported */ williamr@2: williamr@2: /* williamr@2: * Each subsystem defined by sysctl defines a list of variables williamr@2: * for that subsystem. Each name is either a node with further williamr@2: * levels defined below it, or it is a leaf of some particular williamr@2: * type given below. Each sysctl level defines a set of name/type williamr@2: * pairs to be used by sysctl(8) in manipulating the subsystem. williamr@2: */ williamr@2: struct ctlname { williamr@2: char *ctl_name; /* subsystem name */ williamr@2: int ctl_type; /* type of name */ williamr@2: }; williamr@2: williamr@2: #define CTLTYPE 0xf /* Mask for the type */ williamr@2: #define CTLTYPE_NODE 1 /* name is a node */ williamr@2: #define CTLTYPE_INT 2 /* name describes an integer */ williamr@2: #define CTLTYPE_STRING 3 /* name describes a string */ williamr@2: #define CTLTYPE_QUAD 4 /* name describes a 64-bit number */ williamr@2: #define CTLTYPE_OPAQUE 5 /* name describes a structure */ williamr@2: #define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */ williamr@2: #define CTLTYPE_UINT 6 /* name describes an unsigned integer */ williamr@2: #define CTLTYPE_LONG 7 /* name describes a long */ williamr@2: #define CTLTYPE_ULONG 8 /* name describes an unsigned long */ williamr@2: williamr@2: #define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ williamr@2: #define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ williamr@2: #define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) williamr@2: #define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */ williamr@2: #define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ williamr@2: #define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ williamr@2: #define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */ williamr@2: #define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */ williamr@2: #define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */ williamr@2: #define CTLMASK_SECURE 0x00F00000 /* Secure level */ williamr@2: #define CTLFLAG_TUN 0x00080000 /* Tunable variable */ williamr@2: #define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN) williamr@2: williamr@2: /* williamr@2: * Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1. williamr@2: * williamr@2: * Secure when the securelevel is raised to at least N. williamr@2: */ williamr@2: #define CTLSHIFT_SECURE 20 williamr@2: #define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE)) williamr@2: #define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE)) williamr@2: #define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE)) williamr@2: williamr@2: /* williamr@2: * USE THIS instead of a hardwired number from the categories below williamr@2: * to get dynamically assigned sysctl entries using the linker-set williamr@2: * technology. This is the way nearly all new sysctl variables should williamr@2: * be implemented. williamr@2: * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, ""); williamr@2: */ williamr@2: #define OID_AUTO (-1) williamr@2: williamr@2: /* williamr@2: * The starting number for dynamically-assigned entries. WARNING! williamr@2: * ALL static sysctl entries should have numbers LESS than this! williamr@2: */ williamr@2: #define CTL_AUTO_START 0x100 williamr@2: williamr@2: #ifdef _KERNEL williamr@2: #define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \ williamr@2: struct sysctl_req *req williamr@2: williamr@2: /* definitions for sysctl_req 'lock' member */ williamr@2: #define REQ_UNLOCKED 0 /* not locked and not wired */ williamr@2: #define REQ_LOCKED 1 /* locked and not wired */ williamr@2: #define REQ_WIRED 2 /* locked and wired */ williamr@2: williamr@2: /* definitions for sysctl_req 'flags' member */ williamr@2: #if defined(__amd64__) || defined(__ia64__) williamr@2: #define SCTL_MASK32 1 /* 32 bit emulation */ williamr@2: #endif williamr@2: williamr@2: /* williamr@2: * This describes the access space for a sysctl request. This is needed williamr@2: * so that we can use the interface from the kernel or from user-space. williamr@2: */ williamr@2: struct sysctl_req { williamr@2: struct thread *td; /* used for access checking */ williamr@2: int lock; /* locking/wiring state */ williamr@2: void *oldptr; williamr@2: size_t oldlen; williamr@2: size_t oldidx; williamr@2: int (*oldfunc)(struct sysctl_req *, const void *, size_t); williamr@2: void *newptr; williamr@2: size_t newlen; williamr@2: size_t newidx; williamr@2: int (*newfunc)(struct sysctl_req *, void *, size_t); williamr@2: size_t validlen; williamr@2: int flags; williamr@2: }; williamr@2: williamr@2: /* williamr@2: * This describes one "oid" in the MIB tree. Potentially more nodes can williamr@2: * be hidden behind it, expanded by the handler. williamr@2: */ williamr@2: struct sysctl_oid { williamr@2: struct sysctl_oid_list *oid_parent; williamr@2: SLIST_ENTRY(sysctl_oid) oid_link; williamr@2: int oid_number; williamr@2: u_int oid_kind; williamr@2: void *oid_arg1; williamr@2: int oid_arg2; williamr@2: const char *oid_name; williamr@2: int (*oid_handler)(SYSCTL_HANDLER_ARGS); williamr@2: const char *oid_fmt; williamr@2: int oid_refcnt; williamr@2: const char *oid_descr; williamr@2: }; williamr@2: williamr@2: #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) williamr@2: #define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) williamr@2: williamr@2: /* Declare a static oid to allow child oids to be added to it. */ williamr@2: #define SYSCTL_DECL(name) \ williamr@2: extern struct sysctl_oid_list sysctl_##name##_children williamr@2: williamr@2: /* Hide these in macros */ williamr@2: #define SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \ williamr@2: (oid_ptr)->oid_arg1 williamr@2: #define SYSCTL_CHILDREN_SET(oid_ptr, val) \ williamr@2: (oid_ptr)->oid_arg1 = (val); williamr@2: #define SYSCTL_STATIC_CHILDREN(oid_name) \ williamr@2: (&sysctl_##oid_name##_children) williamr@2: williamr@2: /* === Structs and macros related to context handling === */ williamr@2: williamr@2: /* All dynamically created sysctls can be tracked in a context list. */ williamr@2: struct sysctl_ctx_entry { williamr@2: struct sysctl_oid *entry; williamr@2: TAILQ_ENTRY(sysctl_ctx_entry) link; williamr@2: }; williamr@2: williamr@2: #define SYSCTL_NODE_CHILDREN(parent, name) \ williamr@2: sysctl_##parent##_##name##_children williamr@2: williamr@2: /* This constructs a "raw" MIB oid. */ williamr@2: #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ williamr@2: static struct sysctl_oid sysctl__##parent##_##name = { \ williamr@2: &sysctl_##parent##_children, { 0 }, \ williamr@2: nbr, kind, a1, a2, #name, handler, fmt, 0, descr }; \ williamr@2: DATA_SET(sysctl_set, sysctl__##parent##_##name) williamr@2: williamr@2: #define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) williamr@2: williamr@2: /* This constructs a node from which other oids can hang. */ williamr@2: #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ williamr@2: struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name); \ williamr@2: SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access), \ williamr@2: (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, \ williamr@2: "N", descr) williamr@2: williamr@2: #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ williamr@2: 0, 0, handler, "N", descr) williamr@2: williamr@2: /* Oid for a string. len can be 0 to indicate '\0' termination. */ williamr@2: #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ williamr@2: SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \ williamr@2: arg, len, sysctl_handle_string, "A", descr) williamr@2: williamr@2: #define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \ williamr@2: arg, len, sysctl_handle_string, "A", descr) williamr@2: williamr@2: /* Oid for an int. If ptr is NULL, val is returned. */ williamr@2: #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ williamr@2: SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|(access), \ williamr@2: ptr, val, sysctl_handle_int, "I", descr) williamr@2: williamr@2: #define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_INT|(access), \ williamr@2: ptr, val, sysctl_handle_int, "I", descr) williamr@2: williamr@2: /* Oid for an unsigned int. If ptr is NULL, val is returned. */ williamr@2: #define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \ williamr@2: SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|(access), \ williamr@2: ptr, val, sysctl_handle_int, "IU", descr) williamr@2: williamr@2: #define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|(access), \ williamr@2: ptr, val, sysctl_handle_int, "IU", descr) williamr@2: williamr@2: /* Oid for a long. The pointer must be non NULL. */ williamr@2: #define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \ williamr@2: SYSCTL_OID(parent, nbr, name, CTLTYPE_LONG|(access), \ williamr@2: ptr, val, sysctl_handle_long, "L", descr) williamr@2: williamr@2: #define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|(access), \ williamr@2: ptr, 0, sysctl_handle_long, "L", descr) williamr@2: williamr@2: /* Oid for an unsigned long. The pointer must be non NULL. */ williamr@2: #define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \ williamr@2: SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|(access), \ williamr@2: ptr, val, sysctl_handle_long, "LU", descr) williamr@2: williamr@2: #define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|(access), \ williamr@2: ptr, 0, sysctl_handle_long, "LU", descr) williamr@2: williamr@2: /* Oid for an opaque object. Specified by a pointer and a length. */ williamr@2: #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ williamr@2: SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ williamr@2: ptr, len, sysctl_handle_opaque, fmt, descr) williamr@2: williamr@2: #define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ williamr@2: ptr, len, sysctl_handle_opaque, fmt, descr) williamr@2: williamr@2: /* Oid for a struct. Specified by a pointer and a type. */ williamr@2: #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ williamr@2: SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ williamr@2: ptr, sizeof(struct type), sysctl_handle_opaque, \ williamr@2: "S," #type, descr) williamr@2: williamr@2: #define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ williamr@2: ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, descr) williamr@2: williamr@2: /* Oid for a procedure. Specified by a pointer and an arg. */ williamr@2: #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ williamr@2: SYSCTL_OID(parent, nbr, name, (access), \ williamr@2: ptr, arg, handler, fmt, descr) williamr@2: williamr@2: #define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \ williamr@2: sysctl_add_oid(ctx, parent, nbr, name, (access), \ williamr@2: ptr, arg, handler, fmt, descr) williamr@2: williamr@2: #endif /* _KERNEL */ williamr@2: williamr@2: /* williamr@2: * Top-level identifiers williamr@2: */ williamr@2: #define CTL_UNSPEC 0 /* unused */ williamr@2: #define CTL_KERN 1 /* "high kernel": proc, limits */ williamr@2: #define CTL_VM 2 /* virtual memory */ williamr@2: #define CTL_VFS 3 /* filesystem, mount type is next */ williamr@2: #define CTL_NET 4 /* network, see socket.h */ williamr@2: #define CTL_DEBUG 5 /* debugging parameters */ williamr@2: #define CTL_HW 6 /* generic cpu/io */ williamr@2: #define CTL_MACHDEP 7 /* machine dependent */ williamr@2: #define CTL_USER 8 /* user-level */ williamr@2: #define CTL_P1003_1B 9 /* POSIX 1003.1B */ williamr@2: #define CTL_MAXID 10 /* number of valid top-level ids */ williamr@2: williamr@2: #define CTL_NAMES { \ williamr@2: { 0, 0 }, \ williamr@2: { "kern", CTLTYPE_NODE }, \ williamr@2: { "vm", CTLTYPE_NODE }, \ williamr@2: { "vfs", CTLTYPE_NODE }, \ williamr@2: { "net", CTLTYPE_NODE }, \ williamr@2: { "debug", CTLTYPE_NODE }, \ williamr@2: { "hw", CTLTYPE_NODE }, \ williamr@2: { "machdep", CTLTYPE_NODE }, \ williamr@2: { "user", CTLTYPE_NODE }, \ williamr@2: { "p1003_1b", CTLTYPE_NODE }, \ williamr@2: } williamr@2: williamr@2: /* williamr@2: * CTL_KERN identifiers williamr@2: */ williamr@2: #define KERN_OSTYPE 1 /* string: system version */ williamr@2: #define KERN_OSRELEASE 2 /* string: system release */ williamr@2: #define KERN_OSREV 3 /* int: system revision */ williamr@2: #define KERN_VERSION 4 /* string: compile time info */ williamr@2: #define KERN_MAXVNODES 5 /* int: max vnodes */ williamr@2: #define KERN_MAXPROC 6 /* int: max processes */ williamr@2: #define KERN_MAXFILES 7 /* int: max open files */ williamr@2: #define KERN_ARGMAX 8 /* int: max arguments to exec */ williamr@2: #define KERN_SECURELVL 9 /* int: system security level */ williamr@2: #define KERN_HOSTNAME 10 /* string: hostname */ williamr@2: #define KERN_HOSTID 11 /* int: host identifier */ williamr@2: #define KERN_CLOCKRATE 12 /* struct: struct clockrate */ williamr@2: #define KERN_VNODE 13 /* struct: vnode structures */ williamr@2: #define KERN_PROC 14 /* struct: process entries */ williamr@2: #define KERN_FILE 15 /* struct: file entries */ williamr@2: #define KERN_PROF 16 /* node: kernel profiling info */ williamr@2: #define KERN_POSIX1 17 /* int: POSIX.1 version */ williamr@2: #define KERN_NGROUPS 18 /* int: # of supplemental group ids */ williamr@2: #define KERN_JOB_CONTROL 19 /* int: is job control available */ williamr@2: #define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ williamr@2: #define KERN_BOOTTIME 21 /* struct: time kernel was booted */ williamr@2: #define KERN_NISDOMAINNAME 22 /* string: YP domain name */ williamr@2: #define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */ williamr@2: #define KERN_OSRELDATE 24 /* int: kernel release date */ williamr@2: #define KERN_NTP_PLL 25 /* node: NTP PLL control */ williamr@2: #define KERN_BOOTFILE 26 /* string: name of booted kernel */ williamr@2: #define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */ williamr@2: #define KERN_MAXPROCPERUID 28 /* int: max processes per uid */ williamr@2: #define KERN_DUMPDEV 29 /* struct cdev *: device to dump on */ williamr@2: #define KERN_IPC 30 /* node: anything related to IPC */ williamr@2: #define KERN_DUMMY 31 /* unused */ williamr@2: #define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */ williamr@2: #define KERN_USRSTACK 33 /* int: address of USRSTACK */ williamr@2: #define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */ williamr@2: #define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */ williamr@2: #define KERN_MAXID 36 /* number of valid kern ids */ williamr@2: williamr@2: #define CTL_KERN_NAMES { \ williamr@2: { 0, 0 }, \ williamr@2: { "ostype", CTLTYPE_STRING }, \ williamr@2: { "osrelease", CTLTYPE_STRING }, \ williamr@2: { "osrevision", CTLTYPE_INT }, \ williamr@2: { "version", CTLTYPE_STRING }, \ williamr@2: { "maxvnodes", CTLTYPE_INT }, \ williamr@2: { "maxproc", CTLTYPE_INT }, \ williamr@2: { "maxfiles", CTLTYPE_INT }, \ williamr@2: { "argmax", CTLTYPE_INT }, \ williamr@2: { "securelevel", CTLTYPE_INT }, \ williamr@2: { "hostname", CTLTYPE_STRING }, \ williamr@2: { "hostid", CTLTYPE_UINT }, \ williamr@2: { "clockrate", CTLTYPE_STRUCT }, \ williamr@2: { "vnode", CTLTYPE_STRUCT }, \ williamr@2: { "proc", CTLTYPE_STRUCT }, \ williamr@2: { "file", CTLTYPE_STRUCT }, \ williamr@2: { "profiling", CTLTYPE_NODE }, \ williamr@2: { "posix1version", CTLTYPE_INT }, \ williamr@2: { "ngroups", CTLTYPE_INT }, \ williamr@2: { "job_control", CTLTYPE_INT }, \ williamr@2: { "saved_ids", CTLTYPE_INT }, \ williamr@2: { "boottime", CTLTYPE_STRUCT }, \ williamr@2: { "nisdomainname", CTLTYPE_STRING }, \ williamr@2: { "update", CTLTYPE_INT }, \ williamr@2: { "osreldate", CTLTYPE_INT }, \ williamr@2: { "ntp_pll", CTLTYPE_NODE }, \ williamr@2: { "bootfile", CTLTYPE_STRING }, \ williamr@2: { "maxfilesperproc", CTLTYPE_INT }, \ williamr@2: { "maxprocperuid", CTLTYPE_INT }, \ williamr@2: { "ipc", CTLTYPE_NODE }, \ williamr@2: { "dummy", CTLTYPE_INT }, \ williamr@2: { "ps_strings", CTLTYPE_INT }, \ williamr@2: { "usrstack", CTLTYPE_INT }, \ williamr@2: { "logsigexit", CTLTYPE_INT }, \ williamr@2: { "iov_max", CTLTYPE_INT }, \ williamr@2: } williamr@2: williamr@2: /* williamr@2: * CTL_VFS identifiers williamr@2: */ williamr@2: #define CTL_VFS_NAMES { \ williamr@2: { "vfsconf", CTLTYPE_STRUCT }, \ williamr@2: } williamr@2: williamr@2: /* williamr@2: * KERN_PROC subtypes williamr@2: */ williamr@2: #define KERN_PROC_ALL 0 /* everything */ williamr@2: #define KERN_PROC_PID 1 /* by process id */ williamr@2: #define KERN_PROC_PGRP 2 /* by process group id */ williamr@2: #define KERN_PROC_SESSION 3 /* by session of pid */ williamr@2: #define KERN_PROC_TTY 4 /* by controlling tty */ williamr@2: #define KERN_PROC_UID 5 /* by effective uid */ williamr@2: #define KERN_PROC_RUID 6 /* by real uid */ williamr@2: #define KERN_PROC_ARGS 7 /* get/set arguments/proctitle */ williamr@2: #define KERN_PROC_PROC 8 /* only return procs */ williamr@2: #define KERN_PROC_SV_NAME 9 /* get syscall vector name */ williamr@2: #define KERN_PROC_RGID 10 /* by real group id */ williamr@2: #define KERN_PROC_GID 11 /* by effective group id */ williamr@2: #define KERN_PROC_PATHNAME 12 /* path to executable */ williamr@2: #define KERN_PROC_INC_THREAD 0x10 /* williamr@2: * modifier for pid, pgrp, tty, williamr@2: * uid, ruid, gid, rgid and proc williamr@2: */ williamr@2: williamr@2: /* williamr@2: * KERN_IPC identifiers williamr@2: */ williamr@2: #define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */ williamr@2: #define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */ williamr@2: #define KIPC_SOMAXCONN 3 /* int: max length of connection q */ williamr@2: #define KIPC_MAX_LINKHDR 4 /* int: max length of link header */ williamr@2: #define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */ williamr@2: #define KIPC_MAX_HDR 6 /* int: max total length of headers */ williamr@2: #define KIPC_MAX_DATALEN 7 /* int: max length of data? */ williamr@2: williamr@2: /* williamr@2: * CTL_HW identifiers williamr@2: */ williamr@2: #define HW_MACHINE 1 /* string: machine class */ williamr@2: #define HW_MODEL 2 /* string: specific machine model */ williamr@2: #define HW_NCPU 3 /* int: number of cpus */ williamr@2: #define HW_BYTEORDER 4 /* int: machine byte order */ williamr@2: #define HW_PHYSMEM 5 /* int: total memory */ williamr@2: #define HW_USERMEM 6 /* int: non-kernel memory */ williamr@2: #define HW_PAGESIZE 7 /* int: software page size */ williamr@2: #define HW_DISKNAMES 8 /* strings: disk drive names */ williamr@2: #define HW_DISKSTATS 9 /* struct: diskstats[] */ williamr@2: #define HW_FLOATINGPT 10 /* int: has HW floating point? */ williamr@2: #define HW_MACHINE_ARCH 11 /* string: machine architecture */ williamr@2: #define HW_REALMEM 12 /* int: 'real' memory */ williamr@2: #define HW_MAXID 13 /* number of valid hw ids */ williamr@2: williamr@2: #define CTL_HW_NAMES { \ williamr@2: { 0, 0 }, \ williamr@2: { "machine", CTLTYPE_STRING }, \ williamr@2: { "model", CTLTYPE_STRING }, \ williamr@2: { "ncpu", CTLTYPE_INT }, \ williamr@2: { "byteorder", CTLTYPE_INT }, \ williamr@2: { "physmem", CTLTYPE_ULONG }, \ williamr@2: { "usermem", CTLTYPE_ULONG }, \ williamr@2: { "pagesize", CTLTYPE_INT }, \ williamr@2: { "disknames", CTLTYPE_STRUCT }, \ williamr@2: { "diskstats", CTLTYPE_STRUCT }, \ williamr@2: { "floatingpoint", CTLTYPE_INT }, \ williamr@2: { "realmem", CTLTYPE_ULONG }, \ williamr@2: } williamr@2: williamr@2: /* williamr@2: * CTL_USER definitions williamr@2: */ williamr@2: #define USER_CS_PATH 1 /* string: _CS_PATH */ williamr@2: #define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */ williamr@2: #define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */ williamr@2: #define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */ williamr@2: #define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */ williamr@2: #define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */ williamr@2: #define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */ williamr@2: #define USER_LINE_MAX 8 /* int: LINE_MAX */ williamr@2: #define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */ williamr@2: #define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */ williamr@2: #define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */ williamr@2: #define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */ williamr@2: #define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */ williamr@2: #define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */ williamr@2: #define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */ williamr@2: #define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */ williamr@2: #define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */ williamr@2: #define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */ williamr@2: #define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */ williamr@2: #define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */ williamr@2: #define USER_MAXID 21 /* number of valid user ids */ williamr@2: williamr@2: #define CTL_USER_NAMES { \ williamr@2: { 0, 0 }, \ williamr@2: { "cs_path", CTLTYPE_STRING }, \ williamr@2: { "bc_base_max", CTLTYPE_INT }, \ williamr@2: { "bc_dim_max", CTLTYPE_INT }, \ williamr@2: { "bc_scale_max", CTLTYPE_INT }, \ williamr@2: { "bc_string_max", CTLTYPE_INT }, \ williamr@2: { "coll_weights_max", CTLTYPE_INT }, \ williamr@2: { "expr_nest_max", CTLTYPE_INT }, \ williamr@2: { "line_max", CTLTYPE_INT }, \ williamr@2: { "re_dup_max", CTLTYPE_INT }, \ williamr@2: { "posix2_version", CTLTYPE_INT }, \ williamr@2: { "posix2_c_bind", CTLTYPE_INT }, \ williamr@2: { "posix2_c_dev", CTLTYPE_INT }, \ williamr@2: { "posix2_char_term", CTLTYPE_INT }, \ williamr@2: { "posix2_fort_dev", CTLTYPE_INT }, \ williamr@2: { "posix2_fort_run", CTLTYPE_INT }, \ williamr@2: { "posix2_localedef", CTLTYPE_INT }, \ williamr@2: { "posix2_sw_dev", CTLTYPE_INT }, \ williamr@2: { "posix2_upe", CTLTYPE_INT }, \ williamr@2: { "stream_max", CTLTYPE_INT }, \ williamr@2: { "tzname_max", CTLTYPE_INT }, \ williamr@2: } williamr@2: williamr@2: #define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */ williamr@2: #define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */ williamr@2: #define CTL_P1003_1B_MEMLOCK 3 /* boolean */ williamr@2: #define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */ williamr@2: #define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */ williamr@2: #define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */ williamr@2: #define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */ williamr@2: #define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */ williamr@2: #define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */ williamr@2: #define CTL_P1003_1B_SEMAPHORES 10 /* boolean */ williamr@2: #define CTL_P1003_1B_FSYNC 11 /* boolean */ williamr@2: #define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */ williamr@2: #define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */ williamr@2: #define CTL_P1003_1B_TIMERS 14 /* boolean */ williamr@2: #define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */ williamr@2: #define CTL_P1003_1B_AIO_MAX 16 /* int */ williamr@2: #define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */ williamr@2: #define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */ williamr@2: #define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */ williamr@2: #define CTL_P1003_1B_PAGESIZE 20 /* int */ williamr@2: #define CTL_P1003_1B_RTSIG_MAX 21 /* int */ williamr@2: #define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */ williamr@2: #define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */ williamr@2: #define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */ williamr@2: #define CTL_P1003_1B_TIMER_MAX 25 /* int */ williamr@2: williamr@2: #define CTL_P1003_1B_MAXID 26 williamr@2: williamr@2: #define CTL_P1003_1B_NAMES { \ williamr@2: { 0, 0 }, \ williamr@2: { "asynchronous_io", CTLTYPE_INT }, \ williamr@2: { "mapped_files", CTLTYPE_INT }, \ williamr@2: { "memlock", CTLTYPE_INT }, \ williamr@2: { "memlock_range", CTLTYPE_INT }, \ williamr@2: { "memory_protection", CTLTYPE_INT }, \ williamr@2: { "message_passing", CTLTYPE_INT }, \ williamr@2: { "prioritized_io", CTLTYPE_INT }, \ williamr@2: { "priority_scheduling", CTLTYPE_INT }, \ williamr@2: { "realtime_signals", CTLTYPE_INT }, \ williamr@2: { "semaphores", CTLTYPE_INT }, \ williamr@2: { "fsync", CTLTYPE_INT }, \ williamr@2: { "shared_memory_objects", CTLTYPE_INT }, \ williamr@2: { "synchronized_io", CTLTYPE_INT }, \ williamr@2: { "timers", CTLTYPE_INT }, \ williamr@2: { "aio_listio_max", CTLTYPE_INT }, \ williamr@2: { "aio_max", CTLTYPE_INT }, \ williamr@2: { "aio_prio_delta_max", CTLTYPE_INT }, \ williamr@2: { "delaytimer_max", CTLTYPE_INT }, \ williamr@2: { "mq_open_max", CTLTYPE_INT }, \ williamr@2: { "pagesize", CTLTYPE_INT }, \ williamr@2: { "rtsig_max", CTLTYPE_INT }, \ williamr@2: { "nsems_max", CTLTYPE_INT }, \ williamr@2: { "sem_value_max", CTLTYPE_INT }, \ williamr@2: { "sigqueue_max", CTLTYPE_INT }, \ williamr@2: { "timer_max", CTLTYPE_INT }, \ williamr@2: } williamr@2: williamr@2: #ifdef _KERNEL williamr@2: williamr@2: /* williamr@2: * Declare some common oids. williamr@2: */ williamr@2: extern struct sysctl_oid_list sysctl__children; williamr@2: williamr@2: extern char machine[]; williamr@2: extern char osrelease[]; williamr@2: extern char ostype[]; williamr@2: extern char kern_ident[]; williamr@2: williamr@2: williamr@2: #endif /* _KERNEL */ williamr@2: williamr@2: #endif /* !_SYS_SYSCTL_H_ */