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