161111Sbostic.\" Copyright (c) 1993 261111Sbostic.\" The Regents of the University of California. All rights reserved. 358401Smckusick.\" 458401Smckusick.\" %sccs.include.redist.roff% 558401Smckusick.\" 6*69185Smckusick.\" @(#)sysctl.3 8.3 (Berkeley) 05/03/95 758401Smckusick.\" 858401Smckusick.Dd "" 959868Sbostic.Dt SYSCTL 3 1058401Smckusick.Os 1158401Smckusick.Sh NAME 1258401Smckusick.Nm sysctl 1359868Sbostic.Nd get or set system information 1458401Smckusick.Sh SYNOPSIS 1558401Smckusick.Fd #include <sys/sysctl.h> 1658401Smckusick.Ft int 1759868Sbostic.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" 1858401Smckusick.Sh DESCRIPTION 1958401SmckusickThe 2059868Sbostic.Nm sysctl 2159868Sbosticfunction retrieves system information and allows processes with 2259868Sbosticappropriate privileges to set system information. 2359868SbosticThe information available from 2459868Sbostic.Nm sysctl 2559868Sbosticconsists of integers, strings, and tables. 2659868SbosticInformation may be retrieved and set from the command interface 2759868Sbosticusing the 2859868Sbostic.Xr sysctl 1 2959868Sbosticutility. 3059868Sbostic.Pp 3159978SmckusickUnless explicitly noted below, 3259978Smckusick.Nm sysctl 3359978Smckusickreturns a consistent snapshot of the data requested. 3459978SmckusickConsistency is obtained by locking the destination 3559978Smckusickbuffer into memory so that the data may be copied out without blocking. 3659978SmckusickCalls to 3759978Smckusick.Nm sysctl 3859978Smckusickare serialized to avoid deadlock. 3959978Smckusick.Pp 4059868SbosticThe state is described using a ``Management Information Base'' (MIB) 4159868Sbosticstyle name, listed in 4259868Sbostic.Fa name , 4359868Sbosticwhich is a 4458401Smckusick.Fa namelen 4559868Sbosticlength array of integers. 4658401Smckusick.Pp 4758507SmckusickThe information is copied into the buffer specified by 4859868Sbostic.Fa oldp . 4958507SmckusickThe size of the buffer is given by the location specified by 5058507Smckusick.Fa oldlenp 5158507Smckusickbefore the call, 5258507Smckusickand that location gives the amount of data copied after a successful call. 5358507SmckusickIf the amount of data available is greater 5458507Smckusickthan the size of the buffer supplied, 5558507Smckusickthe call supplies as much data as fits in the buffer provided 5659978Smckusickand returns with the error code ENOMEM. 5758401SmckusickIf the old value is not desired, 5859868Sbostic.Fa oldp 5958401Smckusickand 6058401Smckusick.Fa oldlenp 6159868Sbosticshould be set to NULL. 6258401Smckusick.Pp 6358507SmckusickThe size of the available data can be determined by calling 6459868Sbostic.Nm sysctl 6558507Smckusickwith a NULL parameter for 6659868Sbostic.Fa oldp . 6759978SmckusickThe size of the available data will be returned in the location pointed to by 6858507Smckusick.Fa oldlenp . 6959978SmckusickFor some operations, the amount of space may change often. 7059978SmckusickFor these operations, 7158507Smckusickthe system attempts to round up so that the returned size is 7258507Smckusicklarge enough for a call to return the data shortly thereafter. 7358507Smckusick.Pp 7458401SmckusickTo set a new value, 7559868Sbostic.Fa newp 7658401Smckusickis set to point to a buffer of length 7758401Smckusick.Fa newlen 7858401Smckusickfrom which the requested value is to be taken. 7958507SmckusickIf a new value is not to be set, 8059868Sbostic.Fa newp 8158401Smckusickshould be set to NULL and 8258401Smckusick.Fa newlen 8358401Smckusickset to 0. 8458401Smckusick.Pp 8559868SbosticThe top level names are defined with a CTL_ prefix in 8659868Sbostic.Pa <sys/sysctl.h> , 8759868Sbosticand are as follows. 8859868SbosticThe next and subsequent levels down are found in the include files 8959868Sbosticlisted here, and described in separate sections below. 9059868Sbostic.Pp 9159978Smckusick.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent 9259868Sbostic.It Sy Pa Name Next level names Description 9359868Sbostic.It CTL\_DEBUG sys/sysctl.h Debugging 9459868Sbostic.It CTL\_FS sys/sysctl.h File system 9559868Sbostic.It CTL\_HW sys/sysctl.h Generic CPU, I/O 9660429Smckusick.It CTL\_KERN sys/sysctl.h High kernel limits 9759868Sbostic.It CTL\_MACHDEP sys/sysctl.h Machine dependent 9859868Sbostic.It CTL\_NET sys/socket.h Networking 9959868Sbostic.It CTL\_USER sys/sysctl.h User-level 10059868Sbostic.It CTL\_VM vm/vm_param.h Virtual memory 10158507Smckusick.El 10258507Smckusick.Pp 10358507SmckusickFor example, the following retrieves the maximum number of processes allowed 10458507Smckusickin the system: 10558401Smckusick.Bd -literal -offset indent -compact 10659868Sbosticint mib[2], maxproc; 10758462Sbosticsize_t len; 10858507Smckusick.sp 10959868Sbosticmib[0] = CTL_KERN; 11059868Sbosticmib[1] = KERN_MAXPROC; 11158462Sbosticlen = sizeof(maxproc); 11259868Sbosticsysctl(mib, 2, &maxproc, &len, NULL, 0); 11358401Smckusick.Ed 11459868Sbostic.sp 11559868SbosticTo retrieve the standard search path for the system utilities: 11659868Sbostic.Bd -literal -offset indent -compact 11759868Sbosticint mib[2]; 11859868Sbosticsize_t len; 11959868Sbosticchar *p; 12059868Sbostic.sp 12159868Sbosticmib[0] = CTL_USER; 12259868Sbosticmib[1] = USER_CS_PATH; 12359868Sbosticsysctl(mib, 2, NULL, &len, NULL, 0); 12459868Sbosticp = malloc(len); 12559868Sbosticsysctl(mib, 2, p, &len, NULL, 0); 12659868Sbostic.Ed 12759978Smckusick.Sh CTL_DEBUG 12859978SmckusickThe debugging variables vary from system to system. 12959978SmckusickA debugging variable may be added or deleted without need to recompile 13059868Sbostic.Nm sysctl 13159978Smckusickto know about it. 13259978SmckusickEach time it runs, 13359978Smckusick.Nm sysctl 13459978Smckusickgets the list of debugging variables from the kernel and 13559978Smckusickdisplays their current values. 13659978SmckusickThe system defines twenty 13759978Smckusick.Ns ( Va struct ctldebug ) 13859978Smckusickvariables named 13959978Smckusick.Nm debug0 14059978Smckusickthrough 14159978Smckusick.Nm debug19 . 14259978SmckusickThey are declared as separate variables so that they can be 14359978Smckusickindividually initialized at the location of their associated variable. 14459978SmckusickThe loader prevents multiple use of the same variable by issuing errors 14559978Smckusickif a variable is initialized in more than one place. 14659978SmckusickFor example, to export the variable 14759978Smckusick.Nm dospecialcheck 14859978Smckusickas a debugging variable, the following declaration would be used: 14959978Smckusick.Bd -literal -offset indent -compact 15059978Smckusickint dospecialcheck = 1; 15159978Smckusickstruct ctldebug debug5 = { "dospecialcheck", &dospecialcheck }; 15259978Smckusick.Ed 15359868Sbostic.Sh CTL_FS 15459868SbosticThere are currently no second level names for the file system. 15559868Sbostic.Sh CTL_HW 15659978SmckusickThe string and integer information available for the CTL_HW level 15759868Sbosticis detailed below. 15859868SbosticThe changeable column shows whether a process with appropriate 15959868Sbosticprivilege may change the value. 16059978Smckusick.Bl -column "Second level nameXXXXXX" integerXXX -offset indent 16159868Sbostic.It Sy Pa Second level name Type Changeable 16259868Sbostic.It HW\_MACHINE string no 16359868Sbostic.It HW\_MODEL string no 16459868Sbostic.It HW\_NCPU integer no 16559868Sbostic.It HW\_BYTEORDER integer no 16659868Sbostic.It HW\_PHYSMEM integer no 16759868Sbostic.It HW\_USERMEM integer no 16859868Sbostic.It HW\_PAGESIZE integer no 16959868Sbostic.\".It HW\_DISKNAMES integer no 17059868Sbostic.\".It HW\_DISKSTATS integer no 17159868Sbostic.El 17258507Smckusick.Pp 17359868Sbostic.Bl -tag -width "123456" 17459868Sbostic.It Li HW_MACHINE 17559978SmckusickThe machine class. 17659868Sbostic.It Li HW_MODEL 17759978SmckusickThe machine model 17859868Sbostic.It Li HW_NCPU 17959978SmckusickThe number of cpus. 18067357Sah.ne 1i 18159868Sbostic.It Li HW_BYTEORDER 18259978SmckusickThe byteorder (4,321, or 1,234). 18359868Sbostic.It Li HW_PHYSMEM 18459978SmckusickThe bytes of physical memory. 18559868Sbostic.It Li HW_USERMEM 18659978SmckusickThe bytes of non-kernel memory. 18759868Sbostic.It Li HW_PAGESIZE 18859978SmckusickThe software page size. 18959868Sbostic.\".It Fa HW_DISKNAMES 19059868Sbostic.\".It Fa HW_DISKSTATS 19159868Sbostic.El 19259868Sbostic.Sh CTL_KERN 19359868SbosticThe string and integer information available for the CTL_KERN level 19459868Sbosticis detailed below. 19559868SbosticThe changeable column shows whether a process with appropriate 19659868Sbosticprivilege may change the value. 19758507SmckusickThe types of data currently available are process information, 19858507Smckusicksystem vnodes, the open file entries, routing table entries, 19959868Sbosticvirtual memory statistics, load average history, and clock rate 20059868Sbosticinformation. 20159868Sbostic.Bl -column "KERNXCHOWNXRESTRICTEDXXX" "struct clockrateXXX" -offset indent 20259868Sbostic.It Sy Pa Second level name Type Changeable 20359868Sbostic.It KERN\_ARGMAX integer no 20460166Smckusick.It KERN\_BOOTTIME struct timeval no 20559868Sbostic.It KERN\_CHOWN\_RESTRICTED integer no 20659978Smckusick.It KERN\_CLOCKRATE struct clockinfo no 20759978Smckusick.It KERN\_FILE struct file no 20859868Sbostic.It KERN\_HOSTID integer yes 20959868Sbostic.It KERN\_HOSTNAME string yes 21059868Sbostic.It KERN\_JOB\_CONTROL integer no 21159868Sbostic.It KERN\_LINK\_MAX integer no 21259868Sbostic.It KERN\_MAXFILES integer yes 21359868Sbostic.It KERN\_MAXPROC integer yes 21459978Smckusick.It KERN\_MAXVNODES integer yes 21559868Sbostic.It KERN\_MAX\_CANON integer no 21659868Sbostic.It KERN\_MAX\_INPUT integer no 21759868Sbostic.It KERN\_NAME\_MAX integer no 21859868Sbostic.It KERN\_NGROUPS integer no 21959868Sbostic.It KERN\_NO\_TRUNC integer no 22059868Sbostic.It KERN\_OSRELEASE string no 22159868Sbostic.It KERN\_OSREV integer no 22259868Sbostic.It KERN\_OSTYPE string no 22359868Sbostic.It KERN\_PATH\_MAX integer no 22459868Sbostic.It KERN\_PIPE\_BUF integer no 22559868Sbostic.It KERN\_POSIX1 integer no 22659978Smckusick.It KERN\_PROC struct proc no 22759978Smckusick.It KERN\_PROF node not applicable 22859868Sbostic.It KERN\_SAVED\_IDS integer no 22959868Sbostic.It KERN\_SECURELVL integer raise only 23059868Sbostic.It KERN\_VDISABLE integer no 23159868Sbostic.It KERN\_VERSION string no 23259978Smckusick.It KERN\_VNODE struct vnode no 23359868Sbostic.El 23467357Sah.ne 1i 23558507Smckusick.Pp 23659868Sbostic.Bl -tag -width "123456" 23759868Sbostic.It Li KERN_ARGMAX 23860274SbosticThe maximum bytes of argument to 23960274Sbostic.Xr exec 2 . 24060166Smckusick.It Li KERN_BOOTTIME 24160166SmckusickA 24260166Smckusick.Va struct timeval 24360166Smckusickstructure is returned. 24460166SmckusickThis structure contains the time that the system was booted. 24559868Sbostic.It Li KERN_CHOWN_RESTRICTED 24659868SbosticReturn 1 if appropriate privileges are required for the 24759868Sbostic.Xr chown 2 24859868Sbosticsystem call, otherwise 0. 24959868Sbostic.It Li KERN_CLOCKRATE 25059868SbosticA 25159978Smckusick.Va struct clockinfo 25259868Sbosticstructure is returned. 25359868SbosticThis structure contains the clock, statistics clock and profiling clock 25459868Sbosticfrequencies, and the number of micro-seconds per hz tick. 25559868Sbostic.It Li KERN_FILE 25659868SbosticReturn the entire file table. 25759868SbosticThe returned data consists of a single 25859978Smckusick.Va struct filehead 25959868Sbosticfollowed by an array of 26059978Smckusick.Va struct file , 26159868Sbosticwhose size depends on the current number of such objects in the system. 26259868Sbostic.It Li KERN_HOSTID 26359978SmckusickGet or set the host id. 26459868Sbostic.It Li KERN_HOSTNAME 26559978SmckusickGet or set the hostname. 26659868Sbostic.It Li KERN_JOB_CONTROL 26759868SbosticReturn 1 if job control is available on this system, otherwise 0. 26859868Sbostic.It Li KERN_LINK_MAX 26959978SmckusickThe maximum file link count. 27059868Sbostic.It Li KERN_MAXFILES 27159978SmckusickThe maximum number of open files that may be open in the system. 27259868Sbostic.It Li KERN_MAXPROC 27359978SmckusickThe maximum number of simultaneous processes the system will allow. 27459868Sbostic.It Li KERN_MAXVNODES 27559978SmckusickThe maximum number of vnodes available on the system. 27659868Sbostic.It Li KERN_MAX_CANON 27759978SmckusickThe maximum number of bytes in terminal canonical input line. 27859868Sbostic.It Li KERN_MAX_INPUT 27960278SbosticThe minimum maximum number of bytes for which space is available in 28059868Sbostica terminal input queue. 28159868Sbostic.It Li KERN_NAME_MAX 28259978SmckusickThe maximum number of bytes in a file name. 28359868Sbostic.It Li KERN_NGROUPS 28459978SmckusickThe maximum number of supplemental groups. 28559868Sbostic.It Li KERN_NO_TRUNC 28659978SmckusickReturn 1 if file names longer than KERN_NAME_MAX are truncated. 28759868Sbostic.It Li KERN_OSRELEASE 28859978SmckusickThe system release string. 28959868Sbostic.It Li KERN_OSREV 29059978SmckusickThe system revision string. 29159868Sbostic.It Li KERN_OSTYPE 29259978SmckusickThe system type string. 29359868Sbostic.It Li KERN_PATH_MAX 29459978SmckusickThe maximum number of bytes in a pathname. 29559868Sbostic.It Li KERN_PIPE_BUF 29659978SmckusickThe maximum number of bytes which will be written atomically to a pipe. 29759868Sbostic.It Li KERN_POSIX1 29860274SbosticThe version of ISO/IEC 9945 (POSIX 1003.1) with which the system 29960274Sbosticattempts to comply. 30059868Sbostic.It Li KERN_PROC 30159868SbosticReturn the entire process table, or a subset of it. 30258507SmckusickAn array of 30359978Smckusick.Va struct kinfo_proc 30458507Smckusickstructures is returned, 30558507Smckusickwhose size depends on the current number of such objects in the system. 30659868SbosticThe third and fourth level names are as follows: 30759978Smckusick.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent 30859868Sbostic.It Pa Third level name Fourth level is: 30959868Sbostic.It KERN\_PROC\_ALL None 31059868Sbostic.It KERN\_PROC\_PID A process ID 31159868Sbostic.It KERN\_PROC\_PGRP A process group 31259868Sbostic.It KERN\_PROC\_TTY A tty device 31359868Sbostic.It KERN\_PROC\_UID A user ID 31459868Sbostic.It KERN\_PROC\_RUID A real user ID 31558507Smckusick.El 31659868Sbostic.It Li KERN_PROF 31759978SmckusickReturn profiling information about the kernel. 31859978SmckusickIf the kernel is not compiled for profiling, 31959978Smckusickattempts to retrieve any of the KERN_PROF values will 32059978Smckusickfail with EOPNOTSUPP. 32159978SmckusickThe third level names for the string and integer profiling information 32259978Smckusickis detailed below. 32359978SmckusickThe changeable column shows whether a process with appropriate 32459978Smckusickprivilege may change the value. 32559978Smckusick.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent 32659978Smckusick.It Sy Pa Third level name Type Changeable 32759978Smckusick.It GPROF\_STATE integer yes 32859978Smckusick.It GPROF\_COUNT u_short[\|] yes 32959978Smckusick.It GPROF\_FROMS u_short[\|] yes 33059978Smckusick.It GPROF\_TOS struct tostruct yes 33159978Smckusick.It GPROF\_GMONPARAM struct gmonparam no 33259978Smckusick.El 33359978Smckusick.Pp 33459978SmckusickThe variables are as follows: 33559978Smckusick.Bl -tag -width "123456" 33659978Smckusick.It Li GPROF_STATE 33759978SmckusickReturns GMON_PROF_ON or GMON_PROF_OFF to show that profiling 33859978Smckusickis running or stopped. 33959978Smckusick.It Li GPROF_COUNT 34059978SmckusickArray of statistical program counter counts. 34159978Smckusick.It Li GPROF_FROMS 34259978SmckusickArray indexed by program counter of call-from points. 34359978Smckusick.It Li GPROF_TOS 34459978SmckusickArray of 34559978Smckusick.Va struct tostruct 34659978Smckusickdescribing destination of calls and their counts. 34759978Smckusick.It Li GPROF_GMONPARAM 34859978SmckusickStructure giving the sizes of the above arrays. 34959978Smckusick.El 35067357Sah.ne 1i 35159868Sbostic.It Li KERN_SAVED_IDS 35259868SbosticReturns 1 if saved set-group and saved set-user ID is available. 35359868Sbostic.It Li KERN_SECURELVL 35459978SmckusickThe system security level. 35559868SbosticThis level may be raised by processes with appropriate privilege. 35659978SmckusickIt may only be lowered by process 1. 35759868Sbostic.It Li KERN_VDISABLE 35859868SbosticReturns the terminal character disabling value. 35959868Sbostic.It Li KERN_VERSION 36059978SmckusickThe system version string. 36159868Sbostic.It Li KERN_VNODE 36259868SbosticReturn the entire vnode table. 36359978SmckusickNote, the vnode table is not necessarily a consistent snapshot of 36459978Smckusickthe system. 36559868SbosticThe returned data consists of an array whose size depends on the 36659868Sbosticcurrent number of such objects in the system. 36758507SmckusickEach element of the array contains the kernel address of a vnode 36859978Smckusick.Va struct vnode * 36958507Smckusickfollowed by the vnode itself 37059978Smckusick.Va struct vnode . 37159868Sbostic.El 37259868Sbostic.Sh CTL_MACHDEP 37360429SmckusickThe set of variables defined is architecture dependent. 37460429SmckusickMost architectures define at least the following variables. 37560429Smckusick.Bl -column "CONSOLE_DEVICEXXX" "integerXXX" -offset indent 37660429Smckusick.It Sy Pa Second level name Type Changeable 37760429Smckusick.It Li CPU_CONSDEV dev_t no 37860429Smckusick.El 37959868Sbostic.Sh CTL_NET 38059868SbosticThe string and integer information available for the CTL_NET level 38159868Sbosticis detailed below. 38259868SbosticThe changeable column shows whether a process with appropriate 38359868Sbosticprivilege may change the value. 38459978Smckusick.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent 38559868Sbostic.It Sy Pa Second level name Type Changeable 38659978Smckusick.It PF\_ROUTE routing messages no 38759978Smckusick.It PF\_INET internet values yes 38859868Sbostic.El 38958507Smckusick.Pp 39059868Sbostic.Bl -tag -width "123456" 39159868Sbostic.It Li PF_ROUTE 39259868SbosticReturn the entire routing table or a subset of it. 39359868SbosticThe data is returned as a sequence of routing messages (see 39459868Sbostic.Xr route 4 39559868Sbosticfor the header file, format and meaning). 39659868SbosticThe length of each message is contained in the message header. 39758507Smckusick.Pp 39859868SbosticThe third level name is a protocol number, which is currently always 0. 39959868SbosticThe fourth level name is an address family, which may be set to 0 to 40059868Sbosticselect all address families. 40159868SbosticThe fifth and sixth level names are as follows: 40259978Smckusick.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent 40359868Sbostic.It Pa Fifth level name Sixth level is: 40459868Sbostic.It NET\_RT\_FLAGS rtflags 40559868Sbostic.It NET\_RT\_DUMP None 40659868Sbostic.It NET\_RT\_IFLIST None 40759868Sbostic.El 40859978Smckusick.It Li PF_INET 40959978SmckusickGet or set various global information about the internet protocols. 41059978SmckusickThe third level name is the protocol. 41159978SmckusickThe fourth level name is the variable name. 41259978SmckusickThe currently defined protocols and names are: 41367357Sah.ne 1i 41459978Smckusick.Bl -column "Protocol nameXXXXXX" "Variable nameXXX" "integerXXX" -offset indent 41559978Smckusick.It Pa Protocol name Variable name Type Changeable 41659978Smckusick.It ip forwarding integer yes 41759978Smckusick.It ip redirect integer yes 41859978Smckusick.It ip ttl integer yes 41959978Smckusick.It icmp maskrepl integer yes 42059978Smckusick.It udp checksum integer yes 42159978Smckusick.El 42259978Smckusick.Pp 42359978SmckusickThe variables are as follows: 42459978Smckusick.Bl -tag -width "123456" 42559978Smckusick.It Li ip.forwarding 42660011SmckusickReturns 1 when IP forwarding is enabled for the host, 42760011Smckusickmeaning that the host is acting as a router. 42859978Smckusick.It Li ip.redirect 42960011SmckusickReturns 1 when ICMP redirects may be sent by the host. 43060011SmckusickThis option is ignored unless the host is routing IP packets, 43160011Smckusickand should normally be enabled on all systems. 43259978Smckusick.It Li ip.ttl 43360011SmckusickThe maximum time-to-live (hop count) value for an IP packet sourced by 43460011Smckusickthe system. 43560011SmckusickThis value applies to normal transport protocols, not to ICMP. 43659978Smckusick.It Li icmp.maskrepl 43760011SmckusickReturns 1 if ICMP network mask requests are to be answered. 43859978Smckusick.It Li udp.checksum 43960011SmckusickReturns 1 when UDP checksums are being computed and checked. 44060011SmckusickDisabling UDP checksums is strongly discouraged. 44159978Smckusick.El 44259868Sbostic.Sh CTL_USER 44359868SbosticThe string and integer information available for the CTL_USER level 44459868Sbosticis detailed below. 44559868SbosticThe changeable column shows whether a process with appropriate 44659868Sbosticprivilege may change the value. 44759978Smckusick.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent 44859868Sbostic.It Sy Pa Second level name Type Changeable 44959868Sbostic.It USER\_BC\_BASE\_MAX integer no 45059868Sbostic.It USER\_BC\_DIM\_MAX integer no 45159868Sbostic.It USER\_BC\_SCALE\_MAX integer no 45259868Sbostic.It USER\_BC\_STRING\_MAX integer no 45359868Sbostic.It USER\_COLL\_WEIGHTS\_MAX integer no 45459868Sbostic.It USER\_CS\_PATH string no 45559868Sbostic.It USER\_EXPR\_NEST\_MAX integer no 45659868Sbostic.It USER\_LINE\_MAX integer no 45759868Sbostic.It USER\_POSIX2\_CHAR\_TERM integer no 45859868Sbostic.It USER\_POSIX2\_C\_BIND integer no 45959868Sbostic.It USER\_POSIX2\_C\_DEV integer no 46059868Sbostic.It USER\_POSIX2\_FORT\_DEV integer no 46159868Sbostic.It USER\_POSIX2\_FORT\_RUN integer no 46259868Sbostic.It USER\_POSIX2\_LOCALEDEF integer no 46359868Sbostic.It USER\_POSIX2\_SW\_DEV integer no 46459868Sbostic.It USER\_POSIX2\_UPE integer no 46559868Sbostic.It USER\_POSIX2\_VERSION integer no 46659868Sbostic.It USER\_RE\_DUP\_MAX integer no 46760274Sbostic.It USER\_STREAM\_MAX integer no 46860274Sbostic.It USER\_TZNAME\_MAX integer no 46959868Sbostic.El 47059868Sbostic.Bl -tag -width "123456" 47158507Smckusick.Pp 47259868Sbostic.It Li USER_BC_BASE_MAX 47359978SmckusickThe maximum ibase/obase values in the 47459868Sbostic.Xr bc 1 47560274Sbosticutility. 47659868Sbostic.It Li USER_BC_DIM_MAX 47759978SmckusickThe maximum array size in the 47859868Sbostic.Xr bc 1 47959868Sbosticutility. 48059868Sbostic.It Li USER_BC_SCALE_MAX 48159978SmckusickThe maximum scale value in the 48259868Sbostic.Xr bc 1 48359868Sbosticutility. 48459868Sbostic.It Li USER_BC_STRING_MAX 48559978SmckusickThe maximum string length in the 48659868Sbostic.Xr bc 1 48759868Sbosticutility. 48859868Sbostic.It Li USER_COLL_WEIGHTS_MAX 48959978SmckusickThe maximum number of weights that can be assigned to any entry of 49059868Sbosticthe LC_COLLATE order keyword in the locale definition file. 49159868Sbostic.It Li USER_CS_PATH 49259868SbosticReturn a value for the 49359868Sbostic.Ev PATH 49459978Smckusickenvironment variable that finds all the standard utilities. 49559868Sbostic.It Li USER_EXPR_NEST_MAX 49659978SmckusickThe maximum number of expressions that can be nested within 49759868Sbosticparenthesis by the 49859868Sbostic.Xr expr 1 49959868Sbosticutility. 50059868Sbostic.It Li USER_LINE_MAX 50159978SmckusickThe maximum length in bytes of a text-processing utility's input 50259868Sbosticline. 50359868Sbostic.It Li USER_POSIX2_CHAR_TERM 50459868SbosticReturn 1 if the system supports at least one terminal type capable of 50559868Sbosticall operations described in POSIX 1003.2, otherwise 0. 50659868Sbostic.It Li USER_POSIX2_C_BIND 50759868SbosticReturn 1 if the system's C-language development facilities support the 50859868SbosticC-Language Bindings Option, otherwise 0. 50959868Sbostic.It Li USER_POSIX2_C_DEV 51059868SbosticReturn 1 if the system supports the C-Language Development Utilities Option, 51159868Sbosticotherwise 0. 51259868Sbostic.It Li USER_POSIX2_FORT_DEV 51359868SbosticReturn 1 if the system supports the FORTRAN Development Utilities Option, 51459868Sbosticotherwise 0. 51559868Sbostic.It Li USER_POSIX2_FORT_RUN 51659868SbosticReturn 1 if the system supports the FORTRAN Runtime Utilities Option, 51759868Sbosticotherwise 0. 51859868Sbostic.It Li USER_POSIX2_LOCALEDEF 51959868SbosticReturn 1 if the system supports the creation of locales, otherwise 0. 52059868Sbostic.It Li USER_POSIX2_SW_DEV 52159868SbosticReturn 1 if the system supports the Software Development Utilities Option, 52259868Sbosticotherwise 0. 52359868Sbostic.It Li USER_POSIX2_UPE 52459868SbosticReturn 1 if the system supports the User Portability Utilities Option, 52559868Sbosticotherwise 0. 52659868Sbostic.It Li USER_POSIX2_VERSION 52760274SbosticThe version of POSIX 1003.2 with which the system attempts to comply. 52859868Sbostic.It Li USER_RE_DUP_MAX 52959978SmckusickThe maximum number of repeated occurrences of a regular expression 53059868Sbosticpermitted when using interval notation. 53167357Sah.ne 1i 53260274Sbostic.It Li USER_STREAM_MAX 53360274SbosticThe minimum maximum number of streams that a process may have open 53460274Sbosticat any one time. 53560274Sbostic.It Li USER_TZNAME_MAX 53660274SbosticThe minimum maximum number of types supported for the name of a 53760274Sbostictimezone. 53859868Sbostic.El 53959868Sbostic.Sh CTL_VM 54059868SbosticThe string and integer information available for the CTL_VM level 54159868Sbosticis detailed below. 54259868SbosticThe changeable column shows whether a process with appropriate 54359868Sbosticprivilege may change the value. 54459978Smckusick.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent 54559868Sbostic.It Sy Pa Second level name Type Changeable 54659868Sbostic.It VM\_LOADAVG struct loadavg no 54759868Sbostic.It VM\_METER struct vmtotal no 54859868Sbostic.El 54958507Smckusick.Pp 55059868Sbostic.Bl -tag -width "123456" 55159868Sbostic.It Li VM_LOADAVG 55259868SbosticReturn the load average history. 55358507SmckusickThe returned data consists of a 55459978Smckusick.Va struct loadavg . 55559868Sbostic.It Li VM_METER 55659868SbosticReturn the system wide virtual memory statistics. 55759868SbosticThe returned data consists of a 55859978Smckusick.Va struct vmtotal . 55958507Smckusick.El 56059978Smckusick.Sh RETURN VALUES 56159978SmckusickIf the call to 56259978Smckusick.Nm sysctl 563*69185Smckusickis successful, the number of bytes copied out is returned. 56459978SmckusickOtherwise \-1 is returned and 56559978Smckusick.Va errno 56659978Smckusickis set appropriately. 56758401Smckusick.Sh ERRORS 56859868SbosticThe following errors may be reported: 56958401Smckusick.Bl -tag -width Er 57058401Smckusick.It Bq Er EFAULT 57158401SmckusickThe buffer 57258401Smckusick.Fa name , 57359868Sbostic.Fa oldp , 57459868Sbostic.Fa newp , 57558401Smckusickor length pointer 57658401Smckusick.Fa oldlenp 57758401Smckusickcontains an invalid address. 57858401Smckusick.It Bq Er EINVAL 57958401SmckusickThe 58058401Smckusick.Fa name 58158401Smckusickarray is less than two or greater than CTL_MAXNAME. 58258401Smckusick.It Bq Er EINVAL 58358401SmckusickA non-null 58459868Sbostic.Fa newp 58558401Smckusickis given and its specified length in 58658401Smckusick.Fa newlen 58758401Smckusickis too large or too small. 58858401Smckusick.It Bq Er ENOMEM 58958401SmckusickThe length pointed to by 59058401Smckusick.Fa oldlenp 59158401Smckusickis too short to hold the requested value. 59258401Smckusick.It Bq Er ENOTDIR 59358401SmckusickThe 59458401Smckusick.Fa name 59558401Smckusickarray specifies an intermediate rather than terminal name. 59658401Smckusick.It Bq Er EOPNOTSUPP 59758401SmckusickThe 59858401Smckusick.Fa name 59958401Smckusickarray specifies a value that is unknown. 60058401Smckusick.It Bq Er EPERM 60158401SmckusickAn attempt is made to set a read-only value. 60258401Smckusick.It Bq Er EPERM 60358401SmckusickA process without appropriate privilege attempts to set a value. 60458401Smckusick.El 60558401Smckusick.Sh FILES 60659978Smckusick.Bl -tag -width <netinet/icmpXvar.h> -compact 60758401Smckusick.It Pa <sys/sysctl.h> 60859868Sbosticdefinitions for top level identifiers, second level kernel and hardware 60959978Smckusickidentifiers, and user level identifiers 61058401Smckusick.It Pa <sys/socket.h> 61158401Smckusickdefinitions for second level network identifiers 61259978Smckusick.It Pa <sys/gmon.h> 61359978Smckusickdefinitions for third level profiling identifiers 61458401Smckusick.It Pa <vm/vm_param.h> 61558401Smckusickdefinitions for second level virtual memory identifiers 61659978Smckusick.It Pa <netinet/in.h> 61759978Smckusickdefinitions for third level Internet identifiers and 61859978Smckusickfourth level IP identifiers 61959978Smckusick.It Pa <netinet/icmp_var.h> 62059978Smckusickdefinitions for fourth level ICMP identifiers 62159978Smckusick.It Pa <netinet/udp_var.h> 62259978Smckusickdefinitions for fourth level UDP identifiers 62358401Smckusick.El 62458401Smckusick.Sh SEE ALSO 62558401Smckusick.Xr sysctl 8 62658401Smckusick.Sh HISTORY 62758507SmckusickThe 62859868Sbostic.Nm sysctl 62958507Smckusickfunction first appeared in 4.4BSD. 630