1.\" Copyright (c) 1993 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.roff% 5.\" 6.\" @(#)sysctl.8 5.1 (Berkeley) 03/31/93 7.\" 8.Dd "" 9.Dt SYSCTL 8 10.Os 11.Sh NAME 12.Nm sysctl 13.Nd get or set kernel state 14.Sh SYNOPSIS 15.Nm sysctl 16.Ar name ... 17.Nm sysctl 18.Op Fl w 19.Ar name=value ... 20.Nm sysctl 21.Fl aA 22.Sh DESCRIPTION 23The 24.Nm sysctl 25utility retrieves kernel state and allows processes with 26appropriate privilege to set kernel state. 27The state to be retrieved or set is described using a 28``Management Information Base'' (``MIB'') style name, 29described as a dotted set of components. 30The 31.Fl a 32flag can be used to list all the currently available string or integer values. 33The 34.Fl A 35flag will list all the known MIB names including tables. 36Those with string or integer values will be printed as with the 37.Fl a 38flag; for the table values, 39the name of the utility to retrieve them is given. 40.Pp 41If just a MIB style name is given, 42the corresponding value is retrieved. 43If a value is to be set, the 44.Fl w 45flag must be specified and the MIB name followed 46by an equal sign and the new value to be used. 47.Pp 48The information available from 49.Nm sysctl 50consists of integers, strings, and tables. 51The tabular information can only be retrieved by special 52purpose programs such as 53.Nm ps , 54.Nm systat , 55and 56.Nm netstat . 57The string and integer information is detailed below. 58The changeable column indicates whether a process with appropriate 59privilege can change the value. 60.Bl -column kern.posix1versionxx "integerxx" 61.It Sy "Name " " Type " " Changeable" 62.It Pa kern.ostype No " string" No " no" 63.It Pa kern.osrelease No " string" No " no" 64.It Pa kern.version No " string" No " no" 65.It Pa kern.osrevision No " integer" No " no" 66.It Pa kern.posix1version No " integer" No " no" 67.It Pa kern.maxproc No " integer" No " yes" 68.It Pa kern.maxfiles No " integer" No " yes" 69.It Pa kern.argmax No " integer" No " no" 70.It Pa kern.securelevel No " integer" No " raise only" 71.It Pa kern.hostname No " string" No " yes" 72.It Pa kern.hostid No " integer" No " yes" 73.It Pa kern.clockrate No " struct" No " no" 74.It Pa vm.loadavg No " struct" No " no" 75.It Pa hw.machine No " string" No " no" 76.It Pa hw.model No " string" No " no" 77.It Pa hw.ncpu No " integer" No " no" 78.It Pa hw.cpuspeed No " integer" No " no" 79.It Pa hw.physmem No " integer" No " no" 80.It Pa integer.usermem No " integer" No " no" 81.It Pa hw.pagesize No " integer" No " no" 82.El 83.Sh EXAMPLES 84.Pp 85For example, to retrieve the maximum number of processes allowed 86in the system, one would use the follow request: 87.Bd -literal -offset indent -compact 88sysctl kern.maxproc 89.Ed 90.Pp 91To set the maximum number of processes allowed 92in the system to 1000, one would use the follow request: 93.Bd -literal -offset indent -compact 94sysctl -w kern.maxproc=1000 95.Ed 96.Pp 97Information about the system clock rate may be obtained with: 98.Bd -literal -offset indent -compact 99sysctl kern.clockrate 100.Ed 101.Pp 102Information about the load average history may be obtained with 103.Bd -literal -offset indent -compact 104sysctl vm.loadavg 105.Ed 106.Sh FILES 107.Bl -tag -width <vm/vm_param.h> -compact 108.It Pa <sys/sysctl.h> 109definitions for top level identifiers and second level kernel 110and hardware identifiers 111.It Pa <sys/socket.h> 112definitions for second level network identifiers 113.It Pa <vm/vm_param.h> 114definitions for second level virtual memory identifiers 115.El 116.Sh SEE ALSO 117.Xr sysctl 2 118.Sh HISTORY 119.Nm sysctl 120first appeared in 4.4BSD. 121