158f0484fSRodney W. Grimes.\" Copyright (c) 1993 258f0484fSRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 358f0484fSRodney W. Grimes.\" 458f0484fSRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 558f0484fSRodney W. Grimes.\" modification, are permitted provided that the following conditions 658f0484fSRodney W. Grimes.\" are met: 758f0484fSRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 858f0484fSRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 958f0484fSRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 1058f0484fSRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 1158f0484fSRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 1258f0484fSRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software 1358f0484fSRodney W. Grimes.\" must display the following acknowledgement: 1458f0484fSRodney W. Grimes.\" This product includes software developed by the University of 1558f0484fSRodney W. Grimes.\" California, Berkeley and its contributors. 1658f0484fSRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 1758f0484fSRodney W. Grimes.\" may be used to endorse or promote products derived from this software 1858f0484fSRodney W. Grimes.\" without specific prior written permission. 1958f0484fSRodney W. Grimes.\" 2058f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2158f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2258f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2358f0484fSRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2458f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2558f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2658f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2758f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2858f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2958f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3058f0484fSRodney W. Grimes.\" SUCH DAMAGE. 3158f0484fSRodney W. Grimes.\" 3258f0484fSRodney W. Grimes.\" @(#)sysctl.3 8.1 (Berkeley) 6/4/93 3358f0484fSRodney W. Grimes.\" 3458f0484fSRodney W. Grimes.Dd "June 4, 1993" 3558f0484fSRodney W. Grimes.Dt SYSCTL 3 3658f0484fSRodney W. Grimes.Os 3758f0484fSRodney W. Grimes.Sh NAME 3858f0484fSRodney W. Grimes.Nm sysctl 3958f0484fSRodney W. Grimes.Nd get or set system information 4058f0484fSRodney W. Grimes.Sh SYNOPSIS 4149f94c2dSPoul-Henning Kamp.Fd #include <sys/types.h> 4258f0484fSRodney W. Grimes.Fd #include <sys/sysctl.h> 4358f0484fSRodney W. Grimes.Ft int 4458f0484fSRodney W. Grimes.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" 4558f0484fSRodney W. Grimes.Sh DESCRIPTION 4658f0484fSRodney W. GrimesThe 47bf5a138eSMike Pritchard.Fn sysctl 4858f0484fSRodney W. Grimesfunction retrieves system information and allows processes with 4958f0484fSRodney W. Grimesappropriate privileges to set system information. 5058f0484fSRodney W. GrimesThe information available from 51bf5a138eSMike Pritchard.Fn sysctl 5258f0484fSRodney W. Grimesconsists of integers, strings, and tables. 5358f0484fSRodney W. GrimesInformation may be retrieved and set from the command interface 5458f0484fSRodney W. Grimesusing the 55e1f4e80cSMike Pritchard.Xr sysctl 8 5658f0484fSRodney W. Grimesutility. 5758f0484fSRodney W. Grimes.Pp 5858f0484fSRodney W. GrimesUnless explicitly noted below, 59bf5a138eSMike Pritchard.Fn sysctl 6058f0484fSRodney W. Grimesreturns a consistent snapshot of the data requested. 6158f0484fSRodney W. GrimesConsistency is obtained by locking the destination 6258f0484fSRodney W. Grimesbuffer into memory so that the data may be copied out without blocking. 6358f0484fSRodney W. GrimesCalls to 64bf5a138eSMike Pritchard.Fn sysctl 6558f0484fSRodney W. Grimesare serialized to avoid deadlock. 6658f0484fSRodney W. Grimes.Pp 6758f0484fSRodney W. GrimesThe state is described using a ``Management Information Base'' (MIB) 6858f0484fSRodney W. Grimesstyle name, listed in 6958f0484fSRodney W. Grimes.Fa name , 7058f0484fSRodney W. Grimeswhich is a 7158f0484fSRodney W. Grimes.Fa namelen 7258f0484fSRodney W. Grimeslength array of integers. 7358f0484fSRodney W. Grimes.Pp 7458f0484fSRodney W. GrimesThe information is copied into the buffer specified by 7558f0484fSRodney W. Grimes.Fa oldp . 7658f0484fSRodney W. GrimesThe size of the buffer is given by the location specified by 7758f0484fSRodney W. Grimes.Fa oldlenp 7858f0484fSRodney W. Grimesbefore the call, 7958f0484fSRodney W. Grimesand that location gives the amount of data copied after a successful call. 8058f0484fSRodney W. GrimesIf the amount of data available is greater 8158f0484fSRodney W. Grimesthan the size of the buffer supplied, 8258f0484fSRodney W. Grimesthe call supplies as much data as fits in the buffer provided 8358f0484fSRodney W. Grimesand returns with the error code ENOMEM. 8458f0484fSRodney W. GrimesIf the old value is not desired, 8558f0484fSRodney W. Grimes.Fa oldp 8658f0484fSRodney W. Grimesand 8758f0484fSRodney W. Grimes.Fa oldlenp 8858f0484fSRodney W. Grimesshould be set to NULL. 8958f0484fSRodney W. Grimes.Pp 9058f0484fSRodney W. GrimesThe size of the available data can be determined by calling 91bf5a138eSMike Pritchard.Fn sysctl 9258f0484fSRodney W. Grimeswith a NULL parameter for 9358f0484fSRodney W. Grimes.Fa oldp . 9458f0484fSRodney W. GrimesThe size of the available data will be returned in the location pointed to by 9558f0484fSRodney W. Grimes.Fa oldlenp . 9658f0484fSRodney W. GrimesFor some operations, the amount of space may change often. 9758f0484fSRodney W. GrimesFor these operations, 9858f0484fSRodney W. Grimesthe system attempts to round up so that the returned size is 9958f0484fSRodney W. Grimeslarge enough for a call to return the data shortly thereafter. 10058f0484fSRodney W. Grimes.Pp 10158f0484fSRodney W. GrimesTo set a new value, 10258f0484fSRodney W. Grimes.Fa newp 10358f0484fSRodney W. Grimesis set to point to a buffer of length 10458f0484fSRodney W. Grimes.Fa newlen 10558f0484fSRodney W. Grimesfrom which the requested value is to be taken. 10658f0484fSRodney W. GrimesIf a new value is not to be set, 10758f0484fSRodney W. Grimes.Fa newp 10858f0484fSRodney W. Grimesshould be set to NULL and 10958f0484fSRodney W. Grimes.Fa newlen 11058f0484fSRodney W. Grimesset to 0. 11158f0484fSRodney W. Grimes.Pp 11258f0484fSRodney W. GrimesThe top level names are defined with a CTL_ prefix in 11358f0484fSRodney W. Grimes.Pa <sys/sysctl.h> , 11458f0484fSRodney W. Grimesand are as follows. 11558f0484fSRodney W. GrimesThe next and subsequent levels down are found in the include files 11658f0484fSRodney W. Grimeslisted here, and described in separate sections below. 11758f0484fSRodney W. Grimes.Pp 11858f0484fSRodney W. Grimes.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent 11958f0484fSRodney W. Grimes.It Sy Pa Name Next level names Description 12058f0484fSRodney W. Grimes.It CTL\_DEBUG sys/sysctl.h Debugging 121782ff9b2SJeffrey Hsu.It CTL\_VFS sys/sysctl.h File system 12258f0484fSRodney W. Grimes.It CTL\_HW sys/sysctl.h Generic CPU, I/O 12358f0484fSRodney W. Grimes.It CTL\_KERN sys/sysctl.h High kernel limits 12458f0484fSRodney W. Grimes.It CTL\_MACHDEP sys/sysctl.h Machine dependent 12558f0484fSRodney W. Grimes.It CTL\_NET sys/socket.h Networking 12658f0484fSRodney W. Grimes.It CTL\_USER sys/sysctl.h User-level 12758f0484fSRodney W. Grimes.It CTL\_VM vm/vm_param.h Virtual memory 12858f0484fSRodney W. Grimes.El 12958f0484fSRodney W. Grimes.Pp 13058f0484fSRodney W. GrimesFor example, the following retrieves the maximum number of processes allowed 13158f0484fSRodney W. Grimesin the system: 13258f0484fSRodney W. Grimes.Bd -literal -offset indent -compact 13358f0484fSRodney W. Grimesint mib[2], maxproc; 13458f0484fSRodney W. Grimessize_t len; 13558f0484fSRodney W. Grimes.sp 13658f0484fSRodney W. Grimesmib[0] = CTL_KERN; 13758f0484fSRodney W. Grimesmib[1] = KERN_MAXPROC; 13858f0484fSRodney W. Grimeslen = sizeof(maxproc); 13958f0484fSRodney W. Grimessysctl(mib, 2, &maxproc, &len, NULL, 0); 14058f0484fSRodney W. Grimes.Ed 14158f0484fSRodney W. Grimes.sp 14258f0484fSRodney W. GrimesTo retrieve the standard search path for the system utilities: 14358f0484fSRodney W. Grimes.Bd -literal -offset indent -compact 14458f0484fSRodney W. Grimesint mib[2]; 14558f0484fSRodney W. Grimessize_t len; 14658f0484fSRodney W. Grimeschar *p; 14758f0484fSRodney W. Grimes.sp 14858f0484fSRodney W. Grimesmib[0] = CTL_USER; 14958f0484fSRodney W. Grimesmib[1] = USER_CS_PATH; 15058f0484fSRodney W. Grimessysctl(mib, 2, NULL, &len, NULL, 0); 15158f0484fSRodney W. Grimesp = malloc(len); 15258f0484fSRodney W. Grimessysctl(mib, 2, p, &len, NULL, 0); 15358f0484fSRodney W. Grimes.Ed 15458f0484fSRodney W. Grimes.Sh CTL_DEBUG 15558f0484fSRodney W. GrimesThe debugging variables vary from system to system. 15658f0484fSRodney W. GrimesA debugging variable may be added or deleted without need to recompile 157bf5a138eSMike Pritchard.Fn sysctl 15858f0484fSRodney W. Grimesto know about it. 15958f0484fSRodney W. GrimesEach time it runs, 160bf5a138eSMike Pritchard.Fn sysctl 16158f0484fSRodney W. Grimesgets the list of debugging variables from the kernel and 16258f0484fSRodney W. Grimesdisplays their current values. 16358f0484fSRodney W. GrimesThe system defines twenty 16458f0484fSRodney W. Grimes.Ns ( Va struct ctldebug ) 16558f0484fSRodney W. Grimesvariables named 16658f0484fSRodney W. Grimes.Nm debug0 16758f0484fSRodney W. Grimesthrough 16858f0484fSRodney W. Grimes.Nm debug19 . 16958f0484fSRodney W. GrimesThey are declared as separate variables so that they can be 17058f0484fSRodney W. Grimesindividually initialized at the location of their associated variable. 17158f0484fSRodney W. GrimesThe loader prevents multiple use of the same variable by issuing errors 17258f0484fSRodney W. Grimesif a variable is initialized in more than one place. 17358f0484fSRodney W. GrimesFor example, to export the variable 17458f0484fSRodney W. Grimes.Nm dospecialcheck 17558f0484fSRodney W. Grimesas a debugging variable, the following declaration would be used: 17658f0484fSRodney W. Grimes.Bd -literal -offset indent -compact 17758f0484fSRodney W. Grimesint dospecialcheck = 1; 17858f0484fSRodney W. Grimesstruct ctldebug debug5 = { "dospecialcheck", &dospecialcheck }; 17958f0484fSRodney W. Grimes.Ed 1804b10cdbcSJeffrey Hsu.Sh CTL_VFS 18158f0484fSRodney W. GrimesThere are currently no second level names for the file system. 18258f0484fSRodney W. Grimes.Sh CTL_HW 18358f0484fSRodney W. GrimesThe string and integer information available for the CTL_HW level 18458f0484fSRodney W. Grimesis detailed below. 18558f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate 18658f0484fSRodney W. Grimesprivilege may change the value. 18758f0484fSRodney W. Grimes.Bl -column "Second level nameXXXXXX" integerXXX -offset indent 18858f0484fSRodney W. Grimes.It Sy Pa Second level name Type Changeable 18958f0484fSRodney W. Grimes.It HW\_MACHINE string no 19058f0484fSRodney W. Grimes.It HW\_MODEL string no 19158f0484fSRodney W. Grimes.It HW\_NCPU integer no 19258f0484fSRodney W. Grimes.It HW\_BYTEORDER integer no 19358f0484fSRodney W. Grimes.It HW\_PHYSMEM integer no 19458f0484fSRodney W. Grimes.It HW\_USERMEM integer no 19558f0484fSRodney W. Grimes.It HW\_PAGESIZE integer no 19658f0484fSRodney W. Grimes.\".It HW\_DISKNAMES integer no 19758f0484fSRodney W. Grimes.\".It HW\_DISKSTATS integer no 19858f0484fSRodney W. Grimes.El 19958f0484fSRodney W. Grimes.Pp 20058f0484fSRodney W. Grimes.Bl -tag -width "123456" 20158f0484fSRodney W. Grimes.It Li HW_MACHINE 20258f0484fSRodney W. GrimesThe machine class. 20358f0484fSRodney W. Grimes.It Li HW_MODEL 20458f0484fSRodney W. GrimesThe machine model 20558f0484fSRodney W. Grimes.It Li HW_NCPU 20658f0484fSRodney W. GrimesThe number of cpus. 20758f0484fSRodney W. Grimes.It Li HW_BYTEORDER 20858f0484fSRodney W. GrimesThe byteorder (4,321, or 1,234). 20958f0484fSRodney W. Grimes.It Li HW_PHYSMEM 21058f0484fSRodney W. GrimesThe bytes of physical memory. 21158f0484fSRodney W. Grimes.It Li HW_USERMEM 21258f0484fSRodney W. GrimesThe bytes of non-kernel memory. 21358f0484fSRodney W. Grimes.It Li HW_PAGESIZE 21458f0484fSRodney W. GrimesThe software page size. 21558f0484fSRodney W. Grimes.\".It Fa HW_DISKNAMES 21658f0484fSRodney W. Grimes.\".It Fa HW_DISKSTATS 21758f0484fSRodney W. Grimes.El 21858f0484fSRodney W. Grimes.Sh CTL_KERN 21958f0484fSRodney W. GrimesThe string and integer information available for the CTL_KERN level 22058f0484fSRodney W. Grimesis detailed below. 22158f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate 22258f0484fSRodney W. Grimesprivilege may change the value. 22358f0484fSRodney W. GrimesThe types of data currently available are process information, 22458f0484fSRodney W. Grimessystem vnodes, the open file entries, routing table entries, 22558f0484fSRodney W. Grimesvirtual memory statistics, load average history, and clock rate 22658f0484fSRodney W. Grimesinformation. 22758f0484fSRodney W. Grimes.Bl -column "KERNXCHOWNXRESTRICTEDXXX" "struct clockrateXXX" -offset indent 22858f0484fSRodney W. Grimes.It Sy Pa Second level name Type Changeable 22958f0484fSRodney W. Grimes.It KERN\_ARGMAX integer no 23058f0484fSRodney W. Grimes.It KERN\_BOOTTIME struct timeval no 23158f0484fSRodney W. Grimes.It KERN\_CHOWN\_RESTRICTED integer no 23258f0484fSRodney W. Grimes.It KERN\_CLOCKRATE struct clockinfo no 23358f0484fSRodney W. Grimes.It KERN\_FILE struct file no 23458f0484fSRodney W. Grimes.It KERN\_HOSTID integer yes 23558f0484fSRodney W. Grimes.It KERN\_HOSTNAME string yes 23658f0484fSRodney W. Grimes.It KERN\_JOB\_CONTROL integer no 23758f0484fSRodney W. Grimes.It KERN\_LINK\_MAX integer no 23858f0484fSRodney W. Grimes.It KERN\_MAXFILES integer yes 23958f0484fSRodney W. Grimes.It KERN\_MAXPROC integer yes 24058f0484fSRodney W. Grimes.It KERN\_MAXVNODES integer yes 24158f0484fSRodney W. Grimes.It KERN\_MAX\_CANON integer no 24258f0484fSRodney W. Grimes.It KERN\_MAX\_INPUT integer no 24358f0484fSRodney W. Grimes.It KERN\_NAME\_MAX integer no 24458f0484fSRodney W. Grimes.It KERN\_NGROUPS integer no 24558f0484fSRodney W. Grimes.It KERN\_NO\_TRUNC integer no 24658f0484fSRodney W. Grimes.It KERN\_OSRELEASE string no 24758f0484fSRodney W. Grimes.It KERN\_OSREV integer no 24858f0484fSRodney W. Grimes.It KERN\_OSTYPE string no 24958f0484fSRodney W. Grimes.It KERN\_PATH\_MAX integer no 25058f0484fSRodney W. Grimes.It KERN\_PIPE\_BUF integer no 25158f0484fSRodney W. Grimes.It KERN\_POSIX1 integer no 25258f0484fSRodney W. Grimes.It KERN\_PROC struct proc no 25358f0484fSRodney W. Grimes.It KERN\_PROF node not applicable 25458f0484fSRodney W. Grimes.It KERN\_SAVED\_IDS integer no 25558f0484fSRodney W. Grimes.It KERN\_SECURELVL integer raise only 25658f0484fSRodney W. Grimes.It KERN\_VDISABLE integer no 25758f0484fSRodney W. Grimes.It KERN\_VERSION string no 25858f0484fSRodney W. Grimes.It KERN\_VNODE struct vnode no 25958f0484fSRodney W. Grimes.El 26058f0484fSRodney W. Grimes.Pp 26158f0484fSRodney W. Grimes.Bl -tag -width "123456" 26258f0484fSRodney W. Grimes.It Li KERN_ARGMAX 26358f0484fSRodney W. GrimesThe maximum bytes of argument to 264e1f4e80cSMike Pritchard.Xr execve 2 . 26558f0484fSRodney W. Grimes.It Li KERN_BOOTTIME 26658f0484fSRodney W. GrimesA 26758f0484fSRodney W. Grimes.Va struct timeval 26858f0484fSRodney W. Grimesstructure is returned. 26958f0484fSRodney W. GrimesThis structure contains the time that the system was booted. 27058f0484fSRodney W. Grimes.It Li KERN_CHOWN_RESTRICTED 27158f0484fSRodney W. GrimesReturn 1 if appropriate privileges are required for the 27258f0484fSRodney W. Grimes.Xr chown 2 27358f0484fSRodney W. Grimessystem call, otherwise 0. 27458f0484fSRodney W. Grimes.It Li KERN_CLOCKRATE 27558f0484fSRodney W. GrimesA 27658f0484fSRodney W. Grimes.Va struct clockinfo 27758f0484fSRodney W. Grimesstructure is returned. 27858f0484fSRodney W. GrimesThis structure contains the clock, statistics clock and profiling clock 27958f0484fSRodney W. Grimesfrequencies, and the number of micro-seconds per hz tick. 28058f0484fSRodney W. Grimes.It Li KERN_FILE 28158f0484fSRodney W. GrimesReturn the entire file table. 28258f0484fSRodney W. GrimesThe returned data consists of a single 28358f0484fSRodney W. Grimes.Va struct filehead 28458f0484fSRodney W. Grimesfollowed by an array of 28558f0484fSRodney W. Grimes.Va struct file , 28658f0484fSRodney W. Grimeswhose size depends on the current number of such objects in the system. 28758f0484fSRodney W. Grimes.It Li KERN_HOSTID 28858f0484fSRodney W. GrimesGet or set the host id. 28958f0484fSRodney W. Grimes.It Li KERN_HOSTNAME 29058f0484fSRodney W. GrimesGet or set the hostname. 29158f0484fSRodney W. Grimes.It Li KERN_JOB_CONTROL 29258f0484fSRodney W. GrimesReturn 1 if job control is available on this system, otherwise 0. 29358f0484fSRodney W. Grimes.It Li KERN_LINK_MAX 29458f0484fSRodney W. GrimesThe maximum file link count. 29558f0484fSRodney W. Grimes.It Li KERN_MAXFILES 29658f0484fSRodney W. GrimesThe maximum number of open files that may be open in the system. 29758f0484fSRodney W. Grimes.It Li KERN_MAXPROC 29858f0484fSRodney W. GrimesThe maximum number of simultaneous processes the system will allow. 29958f0484fSRodney W. Grimes.It Li KERN_MAXVNODES 30058f0484fSRodney W. GrimesThe maximum number of vnodes available on the system. 30158f0484fSRodney W. Grimes.It Li KERN_MAX_CANON 30258f0484fSRodney W. GrimesThe maximum number of bytes in terminal canonical input line. 30358f0484fSRodney W. Grimes.It Li KERN_MAX_INPUT 30458f0484fSRodney W. GrimesThe minimum maximum number of bytes for which space is available in 30558f0484fSRodney W. Grimesa terminal input queue. 30658f0484fSRodney W. Grimes.It Li KERN_NAME_MAX 30758f0484fSRodney W. GrimesThe maximum number of bytes in a file name. 30858f0484fSRodney W. Grimes.It Li KERN_NGROUPS 30958f0484fSRodney W. GrimesThe maximum number of supplemental groups. 31058f0484fSRodney W. Grimes.It Li KERN_NO_TRUNC 31158f0484fSRodney W. GrimesReturn 1 if file names longer than KERN_NAME_MAX are truncated. 31258f0484fSRodney W. Grimes.It Li KERN_OSRELEASE 31358f0484fSRodney W. GrimesThe system release string. 31458f0484fSRodney W. Grimes.It Li KERN_OSREV 31558f0484fSRodney W. GrimesThe system revision string. 31658f0484fSRodney W. Grimes.It Li KERN_OSTYPE 31758f0484fSRodney W. GrimesThe system type string. 31858f0484fSRodney W. Grimes.It Li KERN_PATH_MAX 31958f0484fSRodney W. GrimesThe maximum number of bytes in a pathname. 32058f0484fSRodney W. Grimes.It Li KERN_PIPE_BUF 32158f0484fSRodney W. GrimesThe maximum number of bytes which will be written atomically to a pipe. 32258f0484fSRodney W. Grimes.It Li KERN_POSIX1 32358f0484fSRodney W. GrimesThe version of ISO/IEC 9945 (POSIX 1003.1) with which the system 32458f0484fSRodney W. Grimesattempts to comply. 32558f0484fSRodney W. Grimes.It Li KERN_PROC 32658f0484fSRodney W. GrimesReturn the entire process table, or a subset of it. 32758f0484fSRodney W. GrimesAn array of 32858f0484fSRodney W. Grimes.Va struct kinfo_proc 32958f0484fSRodney W. Grimesstructures is returned, 33058f0484fSRodney W. Grimeswhose size depends on the current number of such objects in the system. 33158f0484fSRodney W. GrimesThe third and fourth level names are as follows: 33258f0484fSRodney W. Grimes.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent 33358f0484fSRodney W. Grimes.It Pa Third level name Fourth level is: 33458f0484fSRodney W. Grimes.It KERN\_PROC\_ALL None 33558f0484fSRodney W. Grimes.It KERN\_PROC\_PID A process ID 33658f0484fSRodney W. Grimes.It KERN\_PROC\_PGRP A process group 33758f0484fSRodney W. Grimes.It KERN\_PROC\_TTY A tty device 33858f0484fSRodney W. Grimes.It KERN\_PROC\_UID A user ID 33958f0484fSRodney W. Grimes.It KERN\_PROC\_RUID A real user ID 34058f0484fSRodney W. Grimes.El 34158f0484fSRodney W. Grimes.It Li KERN_PROF 34258f0484fSRodney W. GrimesReturn profiling information about the kernel. 34358f0484fSRodney W. GrimesIf the kernel is not compiled for profiling, 34458f0484fSRodney W. Grimesattempts to retrieve any of the KERN_PROF values will 34558f0484fSRodney W. Grimesfail with EOPNOTSUPP. 34658f0484fSRodney W. GrimesThe third level names for the string and integer profiling information 34758f0484fSRodney W. Grimesis detailed below. 34858f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate 34958f0484fSRodney W. Grimesprivilege may change the value. 35058f0484fSRodney W. Grimes.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent 35158f0484fSRodney W. Grimes.It Sy Pa Third level name Type Changeable 35258f0484fSRodney W. Grimes.It GPROF\_STATE integer yes 35358f0484fSRodney W. Grimes.It GPROF\_COUNT u_short[\|] yes 35458f0484fSRodney W. Grimes.It GPROF\_FROMS u_short[\|] yes 35558f0484fSRodney W. Grimes.It GPROF\_TOS struct tostruct yes 35658f0484fSRodney W. Grimes.It GPROF\_GMONPARAM struct gmonparam no 35758f0484fSRodney W. Grimes.El 35858f0484fSRodney W. Grimes.Pp 35958f0484fSRodney W. GrimesThe variables are as follows: 36058f0484fSRodney W. Grimes.Bl -tag -width "123456" 36158f0484fSRodney W. Grimes.It Li GPROF_STATE 36258f0484fSRodney W. GrimesReturns GMON_PROF_ON or GMON_PROF_OFF to show that profiling 36358f0484fSRodney W. Grimesis running or stopped. 36458f0484fSRodney W. Grimes.It Li GPROF_COUNT 36558f0484fSRodney W. GrimesArray of statistical program counter counts. 36658f0484fSRodney W. Grimes.It Li GPROF_FROMS 36758f0484fSRodney W. GrimesArray indexed by program counter of call-from points. 36858f0484fSRodney W. Grimes.It Li GPROF_TOS 36958f0484fSRodney W. GrimesArray of 37058f0484fSRodney W. Grimes.Va struct tostruct 37158f0484fSRodney W. Grimesdescribing destination of calls and their counts. 37258f0484fSRodney W. Grimes.It Li GPROF_GMONPARAM 37358f0484fSRodney W. GrimesStructure giving the sizes of the above arrays. 37458f0484fSRodney W. Grimes.El 37558f0484fSRodney W. Grimes.It Li KERN_SAVED_IDS 37658f0484fSRodney W. GrimesReturns 1 if saved set-group and saved set-user ID is available. 37758f0484fSRodney W. Grimes.It Li KERN_SECURELVL 37858f0484fSRodney W. GrimesThe system security level. 37958f0484fSRodney W. GrimesThis level may be raised by processes with appropriate privilege. 38058f0484fSRodney W. GrimesIt may only be lowered by process 1. 38158f0484fSRodney W. Grimes.It Li KERN_VDISABLE 38258f0484fSRodney W. GrimesReturns the terminal character disabling value. 38358f0484fSRodney W. Grimes.It Li KERN_VERSION 38458f0484fSRodney W. GrimesThe system version string. 38558f0484fSRodney W. Grimes.It Li KERN_VNODE 38658f0484fSRodney W. GrimesReturn the entire vnode table. 38758f0484fSRodney W. GrimesNote, the vnode table is not necessarily a consistent snapshot of 38858f0484fSRodney W. Grimesthe system. 38958f0484fSRodney W. GrimesThe returned data consists of an array whose size depends on the 39058f0484fSRodney W. Grimescurrent number of such objects in the system. 39158f0484fSRodney W. GrimesEach element of the array contains the kernel address of a vnode 39258f0484fSRodney W. Grimes.Va struct vnode * 39358f0484fSRodney W. Grimesfollowed by the vnode itself 39458f0484fSRodney W. Grimes.Va struct vnode . 39558f0484fSRodney W. Grimes.El 39658f0484fSRodney W. Grimes.Sh CTL_MACHDEP 39758f0484fSRodney W. GrimesThe set of variables defined is architecture dependent. 39858f0484fSRodney W. GrimesMost architectures define at least the following variables. 39958f0484fSRodney W. Grimes.Bl -column "CONSOLE_DEVICEXXX" "integerXXX" -offset indent 40058f0484fSRodney W. Grimes.It Sy Pa Second level name Type Changeable 40158f0484fSRodney W. Grimes.It Li CPU_CONSDEV dev_t no 402fb46136eSAndrey A. Chernov.It Li CPU_ADJKERNTZ int yes 403fb46136eSAndrey A. Chernov.It Li CPU_DISRTCSET int yes 40458f0484fSRodney W. Grimes.El 40558f0484fSRodney W. Grimes.Sh CTL_NET 40658f0484fSRodney W. GrimesThe string and integer information available for the CTL_NET level 40758f0484fSRodney W. Grimesis detailed below. 40858f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate 40958f0484fSRodney W. Grimesprivilege may change the value. 41058f0484fSRodney W. Grimes.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent 41158f0484fSRodney W. Grimes.It Sy Pa Second level name Type Changeable 41258f0484fSRodney W. Grimes.It PF\_ROUTE routing messages no 41358f0484fSRodney W. Grimes.It PF\_INET internet values yes 41458f0484fSRodney W. Grimes.El 41558f0484fSRodney W. Grimes.Pp 41658f0484fSRodney W. Grimes.Bl -tag -width "123456" 41758f0484fSRodney W. Grimes.It Li PF_ROUTE 41858f0484fSRodney W. GrimesReturn the entire routing table or a subset of it. 41958f0484fSRodney W. GrimesThe data is returned as a sequence of routing messages (see 42058f0484fSRodney W. Grimes.Xr route 4 42158f0484fSRodney W. Grimesfor the header file, format and meaning). 42258f0484fSRodney W. GrimesThe length of each message is contained in the message header. 42358f0484fSRodney W. Grimes.Pp 42458f0484fSRodney W. GrimesThe third level name is a protocol number, which is currently always 0. 42558f0484fSRodney W. GrimesThe fourth level name is an address family, which may be set to 0 to 42658f0484fSRodney W. Grimesselect all address families. 42758f0484fSRodney W. GrimesThe fifth and sixth level names are as follows: 42858f0484fSRodney W. Grimes.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent 42958f0484fSRodney W. Grimes.It Pa Fifth level name Sixth level is: 43058f0484fSRodney W. Grimes.It NET\_RT\_FLAGS rtflags 43158f0484fSRodney W. Grimes.It NET\_RT\_DUMP None 43258f0484fSRodney W. Grimes.It NET\_RT\_IFLIST None 43358f0484fSRodney W. Grimes.El 43458f0484fSRodney W. Grimes.It Li PF_INET 43558f0484fSRodney W. GrimesGet or set various global information about the internet protocols. 43658f0484fSRodney W. GrimesThe third level name is the protocol. 43758f0484fSRodney W. GrimesThe fourth level name is the variable name. 43858f0484fSRodney W. GrimesThe currently defined protocols and names are: 43958f0484fSRodney W. Grimes.Bl -column "Protocol nameXXXXXX" "Variable nameXXX" "integerXXX" -offset indent 44058f0484fSRodney W. Grimes.It Pa Protocol name Variable name Type Changeable 44158f0484fSRodney W. Grimes.It ip forwarding integer yes 44258f0484fSRodney W. Grimes.It ip redirect integer yes 44358f0484fSRodney W. Grimes.It ip ttl integer yes 44458f0484fSRodney W. Grimes.It icmp maskrepl integer yes 44558f0484fSRodney W. Grimes.It udp checksum integer yes 44658f0484fSRodney W. Grimes.El 44758f0484fSRodney W. Grimes.Pp 44858f0484fSRodney W. GrimesThe variables are as follows: 44958f0484fSRodney W. Grimes.Bl -tag -width "123456" 45058f0484fSRodney W. Grimes.It Li ip.forwarding 45158f0484fSRodney W. GrimesReturns 1 when IP forwarding is enabled for the host, 45258f0484fSRodney W. Grimesmeaning that the host is acting as a router. 45358f0484fSRodney W. Grimes.It Li ip.redirect 45458f0484fSRodney W. GrimesReturns 1 when ICMP redirects may be sent by the host. 45558f0484fSRodney W. GrimesThis option is ignored unless the host is routing IP packets, 45658f0484fSRodney W. Grimesand should normally be enabled on all systems. 45758f0484fSRodney W. Grimes.It Li ip.ttl 45858f0484fSRodney W. GrimesThe maximum time-to-live (hop count) value for an IP packet sourced by 45958f0484fSRodney W. Grimesthe system. 46058f0484fSRodney W. GrimesThis value applies to normal transport protocols, not to ICMP. 46158f0484fSRodney W. Grimes.It Li icmp.maskrepl 46258f0484fSRodney W. GrimesReturns 1 if ICMP network mask requests are to be answered. 46358f0484fSRodney W. Grimes.It Li udp.checksum 46458f0484fSRodney W. GrimesReturns 1 when UDP checksums are being computed and checked. 46558f0484fSRodney W. GrimesDisabling UDP checksums is strongly discouraged. 46658f0484fSRodney W. Grimes.El 46758f0484fSRodney W. Grimes.Sh CTL_USER 46858f0484fSRodney W. GrimesThe string and integer information available for the CTL_USER level 46958f0484fSRodney W. Grimesis detailed below. 47058f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate 47158f0484fSRodney W. Grimesprivilege may change the value. 47258f0484fSRodney W. Grimes.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent 47358f0484fSRodney W. Grimes.It Sy Pa Second level name Type Changeable 47458f0484fSRodney W. Grimes.It USER\_BC\_BASE\_MAX integer no 47558f0484fSRodney W. Grimes.It USER\_BC\_DIM\_MAX integer no 47658f0484fSRodney W. Grimes.It USER\_BC\_SCALE\_MAX integer no 47758f0484fSRodney W. Grimes.It USER\_BC\_STRING\_MAX integer no 47858f0484fSRodney W. Grimes.It USER\_COLL\_WEIGHTS\_MAX integer no 47958f0484fSRodney W. Grimes.It USER\_CS\_PATH string no 48058f0484fSRodney W. Grimes.It USER\_EXPR\_NEST\_MAX integer no 48158f0484fSRodney W. Grimes.It USER\_LINE\_MAX integer no 48258f0484fSRodney W. Grimes.It USER\_POSIX2\_CHAR\_TERM integer no 48358f0484fSRodney W. Grimes.It USER\_POSIX2\_C\_BIND integer no 48458f0484fSRodney W. Grimes.It USER\_POSIX2\_C\_DEV integer no 48558f0484fSRodney W. Grimes.It USER\_POSIX2\_FORT\_DEV integer no 48658f0484fSRodney W. Grimes.It USER\_POSIX2\_FORT\_RUN integer no 48758f0484fSRodney W. Grimes.It USER\_POSIX2\_LOCALEDEF integer no 48858f0484fSRodney W. Grimes.It USER\_POSIX2\_SW\_DEV integer no 48958f0484fSRodney W. Grimes.It USER\_POSIX2\_UPE integer no 49058f0484fSRodney W. Grimes.It USER\_POSIX2\_VERSION integer no 49158f0484fSRodney W. Grimes.It USER\_RE\_DUP\_MAX integer no 49258f0484fSRodney W. Grimes.It USER\_STREAM\_MAX integer no 49358f0484fSRodney W. Grimes.It USER\_TZNAME\_MAX integer no 49458f0484fSRodney W. Grimes.El 49558f0484fSRodney W. Grimes.Bl -tag -width "123456" 49658f0484fSRodney W. Grimes.Pp 49758f0484fSRodney W. Grimes.It Li USER_BC_BASE_MAX 49858f0484fSRodney W. GrimesThe maximum ibase/obase values in the 49958f0484fSRodney W. Grimes.Xr bc 1 50058f0484fSRodney W. Grimesutility. 50158f0484fSRodney W. Grimes.It Li USER_BC_DIM_MAX 50258f0484fSRodney W. GrimesThe maximum array size in the 50358f0484fSRodney W. Grimes.Xr bc 1 50458f0484fSRodney W. Grimesutility. 50558f0484fSRodney W. Grimes.It Li USER_BC_SCALE_MAX 50658f0484fSRodney W. GrimesThe maximum scale value in the 50758f0484fSRodney W. Grimes.Xr bc 1 50858f0484fSRodney W. Grimesutility. 50958f0484fSRodney W. Grimes.It Li USER_BC_STRING_MAX 51058f0484fSRodney W. GrimesThe maximum string length in the 51158f0484fSRodney W. Grimes.Xr bc 1 51258f0484fSRodney W. Grimesutility. 51358f0484fSRodney W. Grimes.It Li USER_COLL_WEIGHTS_MAX 51458f0484fSRodney W. GrimesThe maximum number of weights that can be assigned to any entry of 51558f0484fSRodney W. Grimesthe LC_COLLATE order keyword in the locale definition file. 51658f0484fSRodney W. Grimes.It Li USER_CS_PATH 51758f0484fSRodney W. GrimesReturn a value for the 51858f0484fSRodney W. Grimes.Ev PATH 51958f0484fSRodney W. Grimesenvironment variable that finds all the standard utilities. 52058f0484fSRodney W. Grimes.It Li USER_EXPR_NEST_MAX 52158f0484fSRodney W. GrimesThe maximum number of expressions that can be nested within 52258f0484fSRodney W. Grimesparenthesis by the 52358f0484fSRodney W. Grimes.Xr expr 1 52458f0484fSRodney W. Grimesutility. 52558f0484fSRodney W. Grimes.It Li USER_LINE_MAX 52658f0484fSRodney W. GrimesThe maximum length in bytes of a text-processing utility's input 52758f0484fSRodney W. Grimesline. 52858f0484fSRodney W. Grimes.It Li USER_POSIX2_CHAR_TERM 52958f0484fSRodney W. GrimesReturn 1 if the system supports at least one terminal type capable of 53058f0484fSRodney W. Grimesall operations described in POSIX 1003.2, otherwise 0. 53158f0484fSRodney W. Grimes.It Li USER_POSIX2_C_BIND 53258f0484fSRodney W. GrimesReturn 1 if the system's C-language development facilities support the 53358f0484fSRodney W. GrimesC-Language Bindings Option, otherwise 0. 53458f0484fSRodney W. Grimes.It Li USER_POSIX2_C_DEV 53558f0484fSRodney W. GrimesReturn 1 if the system supports the C-Language Development Utilities Option, 53658f0484fSRodney W. Grimesotherwise 0. 53758f0484fSRodney W. Grimes.It Li USER_POSIX2_FORT_DEV 53858f0484fSRodney W. GrimesReturn 1 if the system supports the FORTRAN Development Utilities Option, 53958f0484fSRodney W. Grimesotherwise 0. 54058f0484fSRodney W. Grimes.It Li USER_POSIX2_FORT_RUN 54158f0484fSRodney W. GrimesReturn 1 if the system supports the FORTRAN Runtime Utilities Option, 54258f0484fSRodney W. Grimesotherwise 0. 54358f0484fSRodney W. Grimes.It Li USER_POSIX2_LOCALEDEF 54458f0484fSRodney W. GrimesReturn 1 if the system supports the creation of locales, otherwise 0. 54558f0484fSRodney W. Grimes.It Li USER_POSIX2_SW_DEV 54658f0484fSRodney W. GrimesReturn 1 if the system supports the Software Development Utilities Option, 54758f0484fSRodney W. Grimesotherwise 0. 54858f0484fSRodney W. Grimes.It Li USER_POSIX2_UPE 54958f0484fSRodney W. GrimesReturn 1 if the system supports the User Portability Utilities Option, 55058f0484fSRodney W. Grimesotherwise 0. 55158f0484fSRodney W. Grimes.It Li USER_POSIX2_VERSION 55258f0484fSRodney W. GrimesThe version of POSIX 1003.2 with which the system attempts to comply. 55358f0484fSRodney W. Grimes.It Li USER_RE_DUP_MAX 55458f0484fSRodney W. GrimesThe maximum number of repeated occurrences of a regular expression 55558f0484fSRodney W. Grimespermitted when using interval notation. 55658f0484fSRodney W. Grimes.It Li USER_STREAM_MAX 55758f0484fSRodney W. GrimesThe minimum maximum number of streams that a process may have open 55858f0484fSRodney W. Grimesat any one time. 55958f0484fSRodney W. Grimes.It Li USER_TZNAME_MAX 56058f0484fSRodney W. GrimesThe minimum maximum number of types supported for the name of a 56158f0484fSRodney W. Grimestimezone. 56258f0484fSRodney W. Grimes.El 56358f0484fSRodney W. Grimes.Sh CTL_VM 56458f0484fSRodney W. GrimesThe string and integer information available for the CTL_VM level 56558f0484fSRodney W. Grimesis detailed below. 56658f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate 56758f0484fSRodney W. Grimesprivilege may change the value. 56858f0484fSRodney W. Grimes.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent 56958f0484fSRodney W. Grimes.It Sy Pa Second level name Type Changeable 57058f0484fSRodney W. Grimes.It VM\_LOADAVG struct loadavg no 57158f0484fSRodney W. Grimes.It VM\_METER struct vmtotal no 57258f0484fSRodney W. Grimes.El 57358f0484fSRodney W. Grimes.Pp 57458f0484fSRodney W. Grimes.Bl -tag -width "123456" 57558f0484fSRodney W. Grimes.It Li VM_LOADAVG 57658f0484fSRodney W. GrimesReturn the load average history. 57758f0484fSRodney W. GrimesThe returned data consists of a 57858f0484fSRodney W. Grimes.Va struct loadavg . 57958f0484fSRodney W. Grimes.It Li VM_METER 58058f0484fSRodney W. GrimesReturn the system wide virtual memory statistics. 58158f0484fSRodney W. GrimesThe returned data consists of a 58258f0484fSRodney W. Grimes.Va struct vmtotal . 58358f0484fSRodney W. Grimes.El 58458f0484fSRodney W. Grimes.Sh RETURN VALUES 58558f0484fSRodney W. GrimesIf the call to 586bf5a138eSMike Pritchard.Fn sysctl 58758f0484fSRodney W. Grimesis successful, 0 is returned. 58858f0484fSRodney W. GrimesOtherwise \-1 is returned and 58958f0484fSRodney W. Grimes.Va errno 59058f0484fSRodney W. Grimesis set appropriately. 59158f0484fSRodney W. Grimes.Sh ERRORS 59258f0484fSRodney W. GrimesThe following errors may be reported: 59358f0484fSRodney W. Grimes.Bl -tag -width Er 59458f0484fSRodney W. Grimes.It Bq Er EFAULT 59558f0484fSRodney W. GrimesThe buffer 59658f0484fSRodney W. Grimes.Fa name , 59758f0484fSRodney W. Grimes.Fa oldp , 59858f0484fSRodney W. Grimes.Fa newp , 59958f0484fSRodney W. Grimesor length pointer 60058f0484fSRodney W. Grimes.Fa oldlenp 60158f0484fSRodney W. Grimescontains an invalid address. 60258f0484fSRodney W. Grimes.It Bq Er EINVAL 60358f0484fSRodney W. GrimesThe 60458f0484fSRodney W. Grimes.Fa name 60558f0484fSRodney W. Grimesarray is less than two or greater than CTL_MAXNAME. 60658f0484fSRodney W. Grimes.It Bq Er EINVAL 60758f0484fSRodney W. GrimesA non-null 60858f0484fSRodney W. Grimes.Fa newp 60958f0484fSRodney W. Grimesis given and its specified length in 61058f0484fSRodney W. Grimes.Fa newlen 61158f0484fSRodney W. Grimesis too large or too small. 61258f0484fSRodney W. Grimes.It Bq Er ENOMEM 61358f0484fSRodney W. GrimesThe length pointed to by 61458f0484fSRodney W. Grimes.Fa oldlenp 61558f0484fSRodney W. Grimesis too short to hold the requested value. 61658f0484fSRodney W. Grimes.It Bq Er ENOTDIR 61758f0484fSRodney W. GrimesThe 61858f0484fSRodney W. Grimes.Fa name 61958f0484fSRodney W. Grimesarray specifies an intermediate rather than terminal name. 62058f0484fSRodney W. Grimes.It Bq Er EOPNOTSUPP 62158f0484fSRodney W. GrimesThe 62258f0484fSRodney W. Grimes.Fa name 62358f0484fSRodney W. Grimesarray specifies a value that is unknown. 62458f0484fSRodney W. Grimes.It Bq Er EPERM 62558f0484fSRodney W. GrimesAn attempt is made to set a read-only value. 62658f0484fSRodney W. Grimes.It Bq Er EPERM 62758f0484fSRodney W. GrimesA process without appropriate privilege attempts to set a value. 62858f0484fSRodney W. Grimes.El 62958f0484fSRodney W. Grimes.Sh FILES 63058f0484fSRodney W. Grimes.Bl -tag -width <netinet/icmpXvar.h> -compact 63158f0484fSRodney W. Grimes.It Pa <sys/sysctl.h> 63258f0484fSRodney W. Grimesdefinitions for top level identifiers, second level kernel and hardware 63358f0484fSRodney W. Grimesidentifiers, and user level identifiers 63458f0484fSRodney W. Grimes.It Pa <sys/socket.h> 63558f0484fSRodney W. Grimesdefinitions for second level network identifiers 63658f0484fSRodney W. Grimes.It Pa <sys/gmon.h> 63758f0484fSRodney W. Grimesdefinitions for third level profiling identifiers 63858f0484fSRodney W. Grimes.It Pa <vm/vm_param.h> 63958f0484fSRodney W. Grimesdefinitions for second level virtual memory identifiers 64058f0484fSRodney W. Grimes.It Pa <netinet/in.h> 64158f0484fSRodney W. Grimesdefinitions for third level Internet identifiers and 64258f0484fSRodney W. Grimesfourth level IP identifiers 64358f0484fSRodney W. Grimes.It Pa <netinet/icmp_var.h> 64458f0484fSRodney W. Grimesdefinitions for fourth level ICMP identifiers 64558f0484fSRodney W. Grimes.It Pa <netinet/udp_var.h> 64658f0484fSRodney W. Grimesdefinitions for fourth level UDP identifiers 64758f0484fSRodney W. Grimes.El 64858f0484fSRodney W. Grimes.Sh SEE ALSO 64958f0484fSRodney W. Grimes.Xr sysctl 8 65058f0484fSRodney W. Grimes.Sh HISTORY 65158f0484fSRodney W. GrimesThe 652bf5a138eSMike Pritchard.Fn sysctl 6537bdf80e5SMike Pritchardfunction first appeared in 6547bdf80e5SMike Pritchard.Bx 4.4 . 655