SYSCTL(3) BSD Programmer's Manual SYSCTL(3)NAME
sysctl - get or set system information
SYNOPSIS
#include <sys/param.h>
#include <sys/sysctl.h>
int
sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
const void *newp, size_t newlen);
DESCRIPTION
The sysctl function retrieves system information and allows processes
with appropriate privileges to set system information. The information
available from sysctl consists of integers, strings, and tables. Infor-
mation may be retrieved and set from the command interface using the
sysctl(8) utility.
Unless explicitly noted below, sysctl returns a consistent snapshot of
the data requested. Consistency is obtained by locking the destination
buffer into memory so that the data may be copied out without blocking.
Calls to sysctl are serialized to avoid deadlock.
The state is described using a ``Management Information Base'' (MIB)
style name, listed in name, which is a namelen length array of integers.
The information is copied into the buffer specified by oldp. The size of
the buffer is given by the location specified by oldlenp before the call,
and that location gives the amount of data copied after a successful
call. (The data copied for strings includes a trailing null byte.) If
the amount of data available is greater than the size of the buffer sup-
plied, the call supplies as much data as will fit in the buffer provided
and returns with the error code ENOMEM. If the old value is not desired,
oldp and oldlenp should be set to NULL.
To determine the size of the available data, call sysctl with a NULL pa-
rameter for oldp. The size of the available data will then be returned in
the location pointed to by oldlenp. For some operations, the amount of
space may change from one call to the next. For these operations, the
system attempts to round up so that the returned size is large enough for
a subsequent call (where the data size may be larger).
To set a new value, newp is set to point to a buffer of length newlen
from which the requested value is to be taken. If a new value is not to
be set, newp should be set to NULL and newlen set to 0.
The top level names are defined with a CTL_ prefix in
/usr/include/sys/sysctl.h, and are found below. The next and subsequent
levels down are found in the include files listed here, and described in
separate sections as follows:
Name Next level names Description
CTL_DEBUG sys/sysctl.h Debugging
CTL_VFS sys/mount.h Filesystem
CTL_HW sys/sysctl.h Generic CPU, I/O
CTL_KERN sys/sysctl.h High kernel limits
CTL_MACHDEP sys/sysctl.h Machine dependent
CTL_NET sys/socket.h Networking
CTL_USER sys/sysctl.h User-level
CTL_VM vm/vm_param.h Virtual memory
For example, the following retrieves the maximum number of processes al-
lowed in the system:
int mib[2], maxproc;
size_t len;
mib[0] = CTL_KERN;
mib[1] = KERN_MAXPROC;
len = sizeof(maxproc);
sysctl(mib, 2, &maxproc, &len, NULL, 0);
To retrieve the standard search path for the system utilities:
int mib[2];
size_t len;
char *p;
mib[0] = CTL_USER;
mib[1] = USER_CS_PATH;
sysctl(mib, 2, NULL, &len, NULL, 0);
p = malloc(len);
sysctl(mib, 2, p, &len, NULL, 0);
CTL_DEBUG
The debugging variables vary from system to system. A debugging variable
may be added or deleted without need to recompile sysctl to know about
it. Each time it runs, sysctl gets the list of debugging variables and
their names from the kernel and displays their current values.
In the kernel programming environment twenty (struct ctldebug) variables
named debug0 through debug19 are defined. They are declared as separate
variables so that they can be individually initialized at the location of
their associated variable. The loader prevents multiple use of the same
variable by issuing errors if a variable is initialized in more than one
place. For example, to export the variable dospecialcheck as a debugging
variable, the following declaration would be used:
int dospecialcheck = 1;
struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck };
CTL_VFS
The second level name is either the distinguished value VFS_GENERIC for
generic information about filesystem types, or a valid filesystem type
identifier as returned by getvfsbyname(3) or statfs(2). Third level
names for specific valid filesystem types (if any) are described in
filesystem-type-specific documentation.
The remaining third level identifiers for VFS_GENERIC are detailed below.
The changeable column shows whether a process with appropriate privilege
may change the value.
Third level name Type Changeable
VFS_MAXTYPENUM integer no
VFS_CONF node not applicable
VFS_SYNCDELAY integer yes
VFS_MAXSYNCDELAY integer no
VFS_MAXTYPENUM
Returns the maximum valid filesystem type number as an integer.
VFS_CONF
Returns the configuration information (struct vfsconf as
described in getvfsbyname(3)) for the filesystem type number pro-
vided as the fourth level name.
VFS_SYNCDELAY
Specifies the maximum interval at which volatile cached filesys-
tem data is written to disk (see update(4) for more info).
VFS_MAXSYNCDELAY
Specifies the maximum value to which VFS_MAXSYNCDELAY may be set.
To learn all of the valid filesystem type numbers, issue a VFS_CONF
sysctl(3) for all type numbers from one to the maximum type number re-
turned by VFS_MAXTYPENUM, ignoring type numbers for which sysctl(3) re-
turns EOPNOTSUPP.
CTL_HW
The string and integer information available for the CTL_HW level is de-
tailed below. The changeable column shows whether a process with appro-
priate privilege may change the value.
Second level name Type Changeable
HW_BYTEORDER integer no
HW_DISKNAMES strings no
HW_DISKSTATS struct diskstats no
HW_MACHINE string no
HW_MODEL string no
HW_NCPU integer no
HW_PAGESIZE integer no
HW_PHYSMEM integer no
HW_USERMEM integer no
HW_TTYNAMES_TMP struct ttydevice_tmp no
HW_TTYSTATS_TMP struct tty no
HW_BYTEORDER
The byte order (4321 or 1234).
HW_DISKNAMES
Returns a concatenated set of null-terminated strings consisting
of the name and unit numbers of all disk devices recognized by
the kernel.
HW_DISKSTATS
Returns statistics on all the disk devices recognized by the sys-
tem. An array of struct diskstats structures is returned. There
is a one-to-one correspondence with the strings returned by
HW_DISKNAMES. The struct diskstats structure is defined in
/usr/include/sys/diskstats.h.
HW_MACHINE
The machine class.
HW_MODEL
The machine model.
HW_NCPU
The number of CPUs.
HW_PAGESIZE
The software page size.
HW_PHYSMEM
The bytes of physical memory.
HW_TTYNAMES_TMP
Returns a table of all tty devices or multiplexors recognized by
the system, including pseudo-devices such as those described in
pty(4). An array of struct ttydevice_tmp structures is returned.
The struct ttydevice_tmp is defined in
/usr/include/sys/ttystats.h.
HW_TTYSTATS_TMP
Returns a table of state and statistics for all tty devices in
the system. An array of struct tty structures is returned.
There is a correspondence between the structures returned by
HW_TTYSTATS_TMP and the structures returned by HW_TTYNAMES_TMP,
but note that a multiplexor entry listed in the array returned by
HW_TTYNAMES_TMP may define more than one struct tty structure.
The struct tty structure is defined in /usr/include/sys/tty.h.
HW_USERMEM
The bytes of non-kernel memory.
CTL_KERN
The string and integer information available for the CTL_KERN level is
detailed below. The changeable column shows whether a process with ap-
propriate privilege may change the value. The types of data currently
available are process information, system vnodes, the open file entries
virtual memory statistics, load average history, and clock rate informa-
tion.
Second level name Type Changeable
KERN_ARGMAX integer no
KERN_BOOTTIME struct timeval no
KERN_CLOCKRATE struct clockinfo no
KERN_CORESFOLLOWLINKS integer yes
KERN_CPUSTATS struct cpustats no
KERN_MP_CPUSTATS struct cpustats * no
KERN_MPCPUSTATS struct mpcpustats * no
KERN_DEADMANTIMER integer yes
KERN_FILES struct file no
KERN_HOSTID integer yes
KERN_HOSTNAME string yes
KERN_JOB_CONTROL integer no
KERN_KMEMBUCKETS struct kmembuckets no
KERN_KMEMSTATS struct kmemstats no
KERN_LICENSE string yes
KERN_LICENSE_FLAGS integer no
KERN_LICENSE_USERS integer no
KERN_MAXFILES integer yes
KERN_MAXPROC integer yes
KERN_MAXSYMLINKS integer yes
KERN_MAXVNODES integer yes
KERN_NCHSTATS struct nchstats no
KERN_NGROUPS integer no
KERN_NISDOMAINNAME string yes
KERN_OSRELEASE string no
KERN_OSREV integer no
KERN_OSTYPE string no
KERN_POSIX1 integer no
KERN_PROC struct proc no
KERN_PROF node not applicable
KERN_SAVED_IDS integer no
KERN_SECURELVL integer raise only
KERN_SYSVIPC node not applicable
KERN_TTYTOTALS struct ttytotals no
KERN_VERSION string no
KERN_VNODE struct vnode no
KERN_AUTONICETIME integer yes
KERN_ARGMAX
The maximum bytes of argument to exec(2).
KERN_BOOTTIME
A struct timeval structure is returned. This structure contains
the time that the system was booted and is defined in
/usr/include/sys/time.h.
KERN_CLOCKRATE
A struct clockinfo structure is returned. This structure con-
tains the clock, statistics clock and profiling clock frequen-
cies, and the number of micro-seconds per Hz tick. The struct
clockinfo structure is defined in /usr/include/sys/time.h.
KERN_CORESFOLLOWLINKS
For security reasons setuid or setgid programs will not generate
a memory image if the last element of the path name is a symbolic
link unless this integer is non-zero.
KERN_CPUSTATS
A struct cpustats structure is returned. This structure contains
statistics on how much time (in clock ticks) that the processor
spends in various states. The struct cpustats structure is de-
fined in /usr/include/sys/cpustats.h. On multiprocessor systems
running in SMP mode, KERN_CPUSTATS returns a summation of the
statistics across all active processors.
KERN_MP_CPUSTATS
This interface is deprecated, use KERN_MPCPUSTATS.
KERN_MPCPUSTATS
A linked list of a struct mpcpustats structures is returned.
Each structure within the array contains per-processor statistics
on how much time (in clock ticks) that the processor spends in
various stats. The struct mpcpustats structure is defined in
/usr/include/sys/cpustats.h.
KERN_DEADMANTIMER
Return the value of the kernel deadman timer. When the timer is
active the value returned will be the number of system clock
ticks remaining before the system panics and reboots. This vari-
able is normally used by periodically resetting it to a large
value; if the system hangs it will automatically reboot. Setting
this value to zero will disable the deadman timer. Setting this
value to a nonzero value will cause a system panic unless ar-
rangements are made to cancel the timer or to increase its value
before it expires.
KERN_FILES
Return the entire file table. The returned data consists of an
array of struct file structures representing each open file in
the system, with each structure's f_filef field replaced with its
own address rather than that of the next file. The struct file
structure is defined in /usr/include/sys/file.h.
KERN_HOSTID
Get or set the host id.
KERN_HOSTNAME
Get or set the host name.
KERN_JOB_CONTROL
Return 1 if job control is available on this system, otherwise 0.
KERN_KMEMBUCKETS
An array of struct kmembuckets structures is returned providing
statistics on the usage of the various sizes of kernel memory.
The struct kmembuckets structure is defined in
/usr/include/sys/malloc.h.
KERN_KMEMSTATS
An array of struct kmemstats structures is returned providing
statistics on the usage of kernel memory by various kernel sub-
systems. The struct kmemstats structure is defined in
/usr/include/sys/malloc.h.
KERN_LICENSE
An array of 9 u_chars which represent the encoded value of the
license. A license contains the host id (viewable through
KERN_HOSTID), the maximum number of users (viewable and settable
through KERN_LICENSE_USERS), and the license flags (viewable
through KERN_LICENSE_FLAGS ).
KERN_LICENSE_FLAGS
A set of flags describing this license, as defined in
/usr/include/sys/license.h.
KERN_LICENSE_USERS
The maximum number of licensed users for this machine. A value
of 0 implies this machine has an unlimited user license.
KERN_MAXFILES
The maximum number of files that may be open in the system.
KERN_MAXPROC
The maximum number of simultaneous processes the system will al-
low.
KERN_MAXSYMLINKS
The maximum number of symbolic links that will be followed before
an error is generated.
KERN_MAXVNODES
The maximum number of vnodes available on the system.
KERN_NCHSTATS
A struct nchstats structure is returned containing statistics on
the system pathname to inode translation cache. The struct
nchstats structure is defined in /usr/include/sys/namei.h.
KERN_NGROUPS
The maximum number of supplemental groups.
KERN_NISDOMAINNAME
Get or set the NIS domain name.
KERN_OSRELEASE
The system release string.
KERN_OSREV
The system revision string.
KERN_OSTYPE
The system type string.
KERN_POSIX1
The version of IEEE Std1003.1 (``POSIX'') with which the system
attempts to comply.
KERN_PROC
Return the entire process table, or a subset of it. An array of
struct kinfo_proc structures is returned, whose size depends on
the current number of such objects in the system. The third and
fourth level names are as follows:
Third level name: Fourth level is:
KERN_PROC_ALL None
KERN_PROC_PID A process ID
KERN_PROC_PGRP A process group
KERN_PROC_TTY A tty device
KERN_PROC_UID A user ID
KERN_PROC_RUID A real user ID
KERN_PROF
Return profiling information about the kernel. If the kernel is
not compiled for profiling, attempts to retrieve any of the
KERN_PROF values will fail with EOPNOTSUPP. The third level names
for the string and integer profiling information is detailed be-
low. The changeable column shows whether a process with appro-
priate privilege may change the value.
Third level name Type Changeable
GPROF_COUNT u_short[] yes
GPROF_FROMS u_short[] yes
GPROF_GMONPARAM struct gmonparam no
GPROF_STATE integer yes
GPROF_TOS struct tostruct yes
The variables are as follows:
GPROF_COUNT
Array of statistical program counter counts.
GPROF_FROMS
Array indexed by program counter of call-from points.
GPROF_GMONPARAM
Structure giving the sizes of the above arrays.
GPROF_STATE
Returns GMON_PROF_ON or GMON_PROF_OFF to show that pro-
filing is running or stopped.
GPROF_TOS
Array of struct tostruct structures describing destina-
tion of calls and their counts.
The struct gmonparam and struct tostruct structures are defined
in /usr/include/sys/gmon.h.
KERN_SAVED_IDS
Returns 1 if saved set-group and saved set-user ID is available.
KERN_SECURELVL
The system security level. This level may be raised by processes
with appropriate privileges. It may only be lowered by process
1.
KERN_SYSVIPC
Return information about the SYSV IPC compatibility shared memo-
ry, message queue and semaphore subsystems in the kernel. The
preferred method for retrieving this information is by using
ipcs(1). The third level names for the data structures returned
are detailed below. The changeable column shows whether a pro-
cess with appropriate privilege may change the value.
Third level name Type Changeable
SYSVIPC_MSGINFO struct msginfo no
SYSVIPC_MSQIDS struct msqids[] no
SYSVIPC_SEMINFO struct seminfo no
SYSVIPC_SEMIDS struct sema[] no
SYSVIPC_SHMINFO struct shminfo no
SYSVIPC_SHMSEGS struct shmsegs[] no
The variables are as follows:
SYSVIPC_MSGINFO
Structure defining the limits and sizes with which the
SYSV message queue subsystem has been configured. This
structure is defined in /usr/include/sys/msg.h.
SYSVIPC_MSQIDS
An array of struct msqids describing the current state of
the message queue identifiers configured into the system.
This structure is defined in /usr/include/sys/msg.h.
SYSVIPC_SEMINFO
Structure defining the limits and sizes with which the
SYSV semaphore subsystem has been configured. This
structure is defined in /usr/include/sys/sem.h.
SYSVIPC_SEMIDS
An array of struct sema describing the current state of
the semaphores configured into the system. This struc-
ture is defined in /usr/include/sys/sem.h.
SYSVIPC_SHMINFO
Structure defining the limits and sizes with which the
SYSV shared memory subsystem has been configured. This
structure is defined in /usr/include/sys/shm.h.
SYSVIPC_SHMSEGS
An array of struct shmsegs describing the current state
of the shared memory segments configured into the system.
This structure is defined in /usr/include/sys/shm.h.
KERN_TTYTOTALS
A struct ttytotals structure is returned. This structure con-
tains global statistics on characters sent and received on tty
devices. The struct ttytotals structure is defined in
/usr/include/sys/ttystats.h.
KERN_VERSION
The system version string.
KERN_VNODE
Returns the entire vnode table. Note, the vnode table is not
necessarily a consistent snapshot of the system. The returned
data consists of an array whose size depends on the current num-
ber of such objects in the system. Each element of the array
contains the kernel address of a vnode struct vnode * followed by
the vnode itself struct vnode. The struct vnode structure is de-
fined in /usr/include/sys/vnode.h.
KERN_AUTONICETIME
The number of seconds after which a process which is still run-
ning will begin to have its nice value automatically adjusted up-
ward resulting in a decrease in priority with respect to other
processes. A value of zero disables this feature. See also
setpriority(2).
CTL_MACHDEP
The set of variables defined is architecture dependent. Most architec-
tures define at least the following variables.
Second level name Type Changeable
CPU_CONSDEV dev_t no
The following variables are available on one or more architectures.
Second level name Type Changeable
CPU_BIOS node no
CPU_CNTLALTDEL integer yes
CPU_CNTLALTDELCORE integer yes
CPU_PARITYERRORPANIC integer yes
The variables are as follows:
CPU_BIOS
A set of variables specific to the system BIOS. The following
third-level variables are currently defined.
Third level name Type Changeable
BIOS_DISKGEOM struct biosgeom no
The variables are as follows:
BIOS_DISKGEOM
Returns BIOS disk geometry information as an array of
struct biosgeom structures as defined in
/usr/include/machine/cpu.h.
CPU_CNTLALTDEL
If non-zero, it enables the CNTL-ALT-DEL keyboard sequence to
cause a system reboot after requesting confirmation. If zero,
the CNTL-ALT-DEL sequence will be treated as normal input.
CPU_CNTLALTDELCORE
If non-zero, it causes the system to prompt on the console about
generating a core dump when being rebooted by the CNTL-ALT-DEL
sequence. If zero, no core dump will be taken.
CPU_CONSDEV
The returned data consists of a dev_t identifying the device be-
ing used as the system console.
CPU_PARITYERRORPANIC
When non-zero, a hardware parity error or I/O channel error in-
terrupt will cause the system to panic and reboot after logging a
descriptive message. When zero, a message will be logged, but
the system will not panic. This value should be set to a non-ze-
ro value on systems with parity memory unless spurious errors
cause crashes. If the value is zero, memory errors are logged,
but can cause unpredictable behavior by the system and user pro-
grams.
CTL_NET
The string and integer information available for the CTL_NET level is de-
tailed below. The changeable column shows whether a process with appro-
priate privilege may change the value.
Second level name Type Changeable
PF_INET internet values yes
PF_ROUTE packet forwarding yes
PF_LINK link layer interfaces yes
PF_UNSPEC socket layer values yes
PF_ROUTE
Get or set information about the packet forwarding layer. The
changeable column shows whether a process with appropriate privi-
lege may change the value.
Third level name Type Changeable
NET_ROUTE_ARP node no
NET_ROUTE_IDLE integer yes
NET_ROUTE_NETCLONE integer yes
NET_ROUTE_STATS struct not
NET_ROUTE_TABLE node no
NET_ROUTE_ARP
The variables supporting the ARP protocol are documented
in arp(4).
NET_ROUTE_IDLE
Returns the number of seconds before an ``idle'' cloned
route is deleted.
NET_ROUTE_NETCLONE
Returns one if networks are cloned to host routes when
referenced locally.
NET_ROUTE_STATS
Returns the struct rtstat which contains statistics re-
lating to the forwarding table.
NET_ROUTE_TABLE
Return the entire routing table or a subset of it. The
data is returned as a sequence of routing messages (see
route(4) for the header file, format and meaning). The
length of each message is contained in the message head-
er.
The fourth-level name is an address family, which may be
set to 0 to select all address families. The fifth- and
sixth-level names are as follows:
Fifth level Sixth level Table
NET_RT_DUMP None Routing
NET_RT_FLAGS rtflags Routing (by flags)
NET_RT_IFLIST None Interface list
PF_LINK
Get or set information about the link-layer interfaces. If the
second-level parameter is 0, the information described is global
to a specific type of interface, according to the type named in
the third-level parameter. Interface types are defined in the
header file /usr/include/net/if_types.h. Currently, the interface
types IFT_PPP (ppp(4)) and IFT_PROPMUX (pif(4)) each support a
single option to set the number of interfaces for that type. The
fourth parameter is zero, and the value is an integer. The value
may be increased, but cannot be decreased.
If the second-level parameter is non-zero, it is an interface in-
dex number as used in a sockaddr_dl structure. The third-level
parameter specifies one of the following:
Third level name Type
CTL_LINK_GENERIC Generic link operations
CTL_LINK_LINKTYPE Link-type specific operations
CTL_LINK_HWTYPE Hardware specific operations
CTL_LINK_PROTOTYPE Protocol specific operations
CTL_LINK_GENERIC
Specifies generic link operations. Fourth-level names
available are as follows:
Fourth level name Type Changeable
LINK_GENERIC_DATA struct if_data no
LINK_GENERIC_DATA
Returns the if_data structure which contains
statistics and generic configuration information
about the specified interface.
CTL_LINK_LINKTYPE
Specifies operations dependent on the interface type, as
enumerated in /usr/include/net/if_types.h. The fourth-
level name is the defined value of the interface type
(i.e. IFT_ETHER) although an interface type of 0 (zero)
may be used to specify the current type of the specified
interface. Operations specific to an interface type (if
any) are documented in the man page describing the spe-
cific interface. For example, ether(4), fddi(4) and
tokenring(4).
CTL_LINK_HWTYPE
Specifies operations dependent on the hardware type (i.e.
device driver). Operations specific to a device driver
are documented in the man page for that device driver
(i.e. cisco_hdlc(4)).
CTL_LINK_PROTOTYPE
Specifies operations specific to a protocol family run-
ning on the specified interface. The protocol family is
specified as the fourth-level name.
PF_INET
Get or set various Internet specific interface
parameters. These variables are described in
ip(4).
PF_UNSPEC
Get or set various bits of global information about the socket
layer. The string and integer information available for the
PF_UNSPEC level is detailed below. The changeable column shows
whether a process with appropriate privilege may change the val-
ue.
Second level name Type Changeable
SOCTL_MAXCONN integer yes
SOCTL_NMBCLUSTERS integer yes
SOCTL_SBMAX integer yes
SOCTL_MAXCONN
Specifies the maximum allowable backlog of pending con-
nections on a socket that is accepting connections via
listen(2).
SOCTL_NMBCLUSTERS
Specifies the maximum number of mbuf clusters (the larger
of two types of network buffers) that can be created by
the network subsystem. This value can be increased to a
value not larger than an internal system limit (either
pre-configured for the kernel, or a default value depend-
ing on memory size). See the -m option to netstat(8) for
information about printing the current usage and limit.
The default size of mbuf clusters is given by the macro
MCLBYTES in the header file /usr/include/machine/param.h.
SOCTL_SBMAX
Specifies the maximum queue limit that may be requested
for any socket send or receive buffer. See the SO_SNDBUF
and SO_RCVBUF parameters to setsockopt(2) for more infor-
mation.
PF_INET
Get or set various bits of global information about the internet
protocols. The third-level name is the protocol:
IPPROTO_IP
The variables at the IP layer are described in ip(4).
IPPROTO_ICMP
The variables at the ICMP layer are described in icmp(4).
IPPROTO_IGMP
The variables at the IGMP layer are described in igmp(4).
IPPROTO_TCP
The variables at the TCMP layer are described in tcp(4).
IPPROTO_UDP
The variables at the UDP layer are described in udp(4).
CTL_USER
The string and integer information available for the CTL_USER level is
detailed below. The changeable column shows whether a process with ap-
propriate privilege may change the value.
Second level name Type Changeable
USER_BC_BASE_MAX integer no
USER_BC_DIM_MAX integer no
USER_BC_SCALE_MAX integer no
USER_BC_STRING_MAX integer no
USER_COLL_WEIGHTS_MAX integer no
USER_CS_PATH string no
USER_EXPR_NEST_MAX integer no
USER_LINE_MAX integer no
USER_POSIX2_CHAR_TERM integer no
USER_POSIX2_C_BIND integer no
USER_POSIX2_C_DEV integer no
USER_POSIX2_FORT_DEV integer no
USER_POSIX2_FORT_RUN integer no
USER_POSIX2_LOCALEDEF integer no
USER_POSIX2_SW_DEV integer no
USER_POSIX2_UPE integer no
USER_POSIX2_VERSION integer no
USER_RE_DUP_MAX integer no
USER_STREAM_MAX integer no
USER_TZNAME_MAX integer no
USER_BC_BASE_MAX
The maximum ibase/obase values in the bc(1) utility.
USER_BC_DIM_MAX
The maximum array size in the bc(1) utility.
USER_BC_SCALE_MAX
The maximum scale value in the bc(1) utility.
USER_BC_STRING_MAX
The maximum string length in the bc(1) utility.
USER_COLL_WEIGHTS_MAX
The maximum number of weights that can be assigned to any entry
of the LC_COLLATE order keyword in the locale definition file.
USER_CS_PATH
Return a value for the PATH environment variable that finds all
the standard utilities.
USER_EXPR_NEST_MAX
The maximum number of expressions that can be nested within
parenthesis by the expr(1) utility.
USER_LINE_MAX
The maximum length in bytes of a text-processing utility's input
line.
USER_POSIX2_CHAR_TERM
Return 1 if the system supports at least one terminal type capa-
ble of all operations described in IEEE Std1003.2 (``POSIX''),
otherwise 0.
USER_POSIX2_C_BIND
Return 1 if the system's C-language development facilities sup-
port the C-Language Bindings Option, otherwise 0.
USER_POSIX2_C_DEV
Return 1 if the system supports the C-Language Development Utili-
ties Option, otherwise 0.
USER_POSIX2_FORT_DEV
Return 1 if the system supports the FORTRAN Development Utilities
Option, otherwise 0.
USER_POSIX2_FORT_RUN
Return 1 if the system supports the FORTRAN Runtime Utilities Op-
tion, otherwise 0.
USER_POSIX2_LOCALEDEF
Return 1 if the system supports the creation of locales, other-
wise 0.
USER_POSIX2_SW_DEV
Return 1 if the system supports the Software Development Utili-
ties Option, otherwise 0.
USER_POSIX2_UPE
Return 1 if the system supports the User Portability Utilities
Option, otherwise 0.
USER_POSIX2_VERSION
The version of IEEE Std1003.2 (``POSIX'') with which the system
attempts to comply.
USER_RE_DUP_MAX
The maximum number of repeated occurrences of a regular expres-
sion permitted when using interval notation.
USER_STREAM_MAX
The maximum number of streams that a process may have open at any
one time.
USER_TZNAME_MAX
The maximum length (in characters) supported for the name of a
time zone.
CTL_VM
The string and integer information available for the CTL_VM level is de-
tailed below. The changeable column shows whether a process with appro-
priate privilege may change the value.
Second level name Type Changeable
VM_CNT struct vmmeter no
VM_LOADAVG struct loadavg no
VM_MAXDSIZE integer yes
VM_MAXMAPENTRIES integer yes
VM_MAXSSIZE integer yes
VM_TOTAL struct vmtotal no
VM_SWAPRESERVE integer yes
VM_SWAPSTATS struct swapstats no
VM_CNT Return various event counters and pages in various states. The
returned data consists of a struct vmmeter structure as defined
in /usr/include/sys/vmmeter.h.
VM_LOADAVG
Return the load average history. The returned data consists of a
struct loadavg structure as defined in
/usr/include/sys/resource.h.
VM_MAXDSIZE
Returns the hard limit for the maximum size (in bytes) of the da-
ta segment for a process. See the RLIMIT_DATA resource parameter
to getrlimit(2).
VM_MAXMAPENTRIES
Returns the map entry threshold. The segments of the address
space of a process are described by map entry structures, which
the kernel allocates from a common pool. If a non-root process
requires so many map entries that it reaches the map entry
threshold, the system prevents the process from using mmap(2),
mprotect(2) or munmap(2) in ways that would cause it to allocate
more map entries to the process, until the process falls below
the threshold again. The system calls fail with errno set to
ENOMEM in this situation. This limit is designed to prevent pro-
cesses from acquiring all of a common resource and starving other
processes.
VM_MAXSSIZE
Returns the hard limit for the maximum size (in bytes) of the
stack segment for a process. See the RLIMIT_STACK resource pa-
rameter to getrlimit(2).
VM_TOTAL
Return system statistics of processes in various states, and
physical and virtual memory usage in pages. The returned data
consists of a struct vmtotal structure as defined in
/usr/include/sys/vmmeter.h.
VM_SWAPRESERVE
Indicates the amount of swap space (in units of 512-byte blocks)
to be reserved for programs that are already running. When less
than this amount of swap space remains, the system will not
promise additional virtual memory by allowing programs to fork or
to allocate additional memory.
VM_SWAPSTATS
Return the system wide statistics on swap usage. The returned
data consists of a struct swapstats structure as defined in
/usr/include/vm/swap_pager.h.
RETURN VALUES
If the call to sysctl is successful, sysctl returns 0; otherwise it re-
turns -1 and sets errno appropriately.
ERRORS
The following errors may be reported:
[EFAULT] The buffer name, oldp, newp, or length pointer oldlenp con-
tains an invalid address.
[EINVAL] The name array is less than two or greater than CTL_MAX-
NAME.
[EINVAL] A non-null newp is given and its specified length in newlen
is too large or too small.
[ENOMEM] The length pointed to by oldlenp is too short to hold the
requested value.
[ENOTDIR] The name array specifies an intermediate rather than termi-
nal name.
[EOPNOTSUPP] The name array specifies a value that is unknown.
[EPERM] An attempt is made to set a read-only value.
[EPERM] A process without appropriate privilege attempts to set a
value.
FILES
<sys/sysctl.h> definitions for top level identifiers, second level
kernel and hardware identifiers, and user level
identifiers
<sys/socket.h> definitions for second level network identifiers
<sys/gmon.h> definitions for third level profiling identifiers
<vm/vm_param.h> definitions for second level virtual memory identi-
fiers
<netinet/in.h> definitions for third level Internet identifiers
and fourth level IP identifiers
<netinet/icmp_var.h> definitions for fourth level ICMP identifiers
<netinet/igmp_var.h> definitions for forth level IGMP identifiers
<netinet/tcp.h> definitions for fourth level TCP identifiers
<netinet/udp_var.h> definitions for fourth level UDP identifiers
<netinet/tcp.h> definitions for fourth level TCP identifiers
SEE ALSOarp(4), ether(4), fddi(4), icmp(4), igmp(4), ip(4), tcp(4),
udp(4), token(4), sysctl(8)HISTORY
The sysctl function first appeared in 4.4BSD.
KERN_MP_CPUSTATS was a hack added by Jeff Kellem <composer@Be-
yond.Dreams.ORG> to obtain per-processor statistics.
BSDI BSD/OS November 29, 1997 15