1.\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $ 2.\" 3.\" Copyright (c) 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by the University of 17.\" California, Berkeley and its contributors. 18.\" 4. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)sysctl.8 8.1 (Berkeley) 6/6/93 35.\" 36.Dd "June 6, 1993" 37.Dt SYSCTL 8 38.Os 39.Sh NAME 40.Nm sysctl 41.Nd get or set kernel state 42.Sh SYNOPSIS 43.Nm sysctl 44.Op Fl n 45.Ar name ... 46.Nm sysctl 47.Op Fl n 48.Fl w 49.Ar name=value ... 50.Nm sysctl 51.Op Fl n 52.Fl aA 53.Sh DESCRIPTION 54The 55.Nm sysctl 56utility retrieves kernel state and allows processes with 57appropriate privilege to set kernel state. 58The state to be retrieved or set is described using a 59``Management Information Base'' (``MIB'') style name, 60described as a dotted set of components. 61The 62.Fl a 63flag can be used to list all the currently available string or integer values. 64The 65.Fl A 66flag will list all the known MIB names including tables. 67Those with string or integer values will be printed as with the 68.Fl a 69flag; for the table values, 70the name of the utility to retrieve them is given. 71.Pp 72The 73.Fl n 74flag specifies that the printing of the field name should be 75suppressed and that only its value should be output. 76This flag is useful for setting shell variables. 77For example, to save the pagesize in variable psize, use: 78.Bd -literal -offset indent -compact 79set psize=`sysctl -n hw.pagesize` 80.Ed 81.Pp 82If just a MIB style name is given, 83the corresponding value is retrieved. 84If a value is to be set, the 85.Fl w 86flag must be specified and the MIB name followed 87by an equal sign and the new value to be used. 88.Pp 89The information available from 90.Nm sysctl 91consists of integers, strings, and tables. 92The tabular information can only be retrieved by special 93purpose programs such as 94.Nm ps , 95.Nm systat , 96and 97.Nm netstat . 98The string and integer information is summaried below. 99For a detailed description of these variable see 100.Xr sysctl 3 . 101The changeable column indicates whether a process with appropriate 102privilege can change the value. 103.Bl -column net.inet.ip.forwardingxxxxxx integerxxx 104.It Sy Name Type Changeable 105.It kern.ostype string no 106.It kern.osrelease string no 107.It kern.osrevision integer no 108.It kern.version string no 109.It kern.maxvnodes integer yes 110.It kern.maxproc integer yes 111.It kern.maxfiles integer yes 112.It kern.maxpartitions integer no 113.It kern.rawpartition integer no 114.It kern.argmax integer no 115.It kern.securelevel integer raise only 116.It kern.hostname string yes 117.It kern.hostid integer yes 118.It kern.clockrate struct no 119.It kern.posix1version integer no 120.It kern.ngroups integer no 121.It kern.job_control integer no 122.It kern.saved_ids integer no 123.It kern.link_max integer no 124.It kern.max_canon integer no 125.It kern.max_input integer no 126.It kern.name_max integer no 127.It kern.path_max integer no 128.It kern.pipe_buf integer no 129.It kern.chown_restricted integer no 130.It kern.no_trunc integer no 131.It kern.vdisable integer no 132.It kern.boottime struct no 133.It vm.loadavg struct no 134.It machdep.console_device dev_t no 135.It net.inet.ip.forwarding integer yes 136.It net.inet.ip.redirect integer yes 137.It net.inet.ip.ttl integer yes 138.It net.inet.icmp.maskrepl integer yes 139.It net.inet.tcp.rfc1323 integer yes 140.It net.inet.udp.checksum integer yes 141.It hw.machine string no 142.It hw.model string no 143.It hw.ncpu integer no 144.It hw.byteorder integer no 145.It hw.physmem integer no 146.It hw.usermem integer no 147.It hw.pagesize integer no 148.It user.cs_path string no 149.It user.bc_base_max integer no 150.It user.bc_dim_max integer no 151.It user.bc_scale_max integer no 152.It user.bc_string_max integer no 153.It user.coll_weights_max integer no 154.It user.expr_nest_max integer no 155.It user.line_max integer no 156.It user.re_dup_max integer no 157.It user.posix2_version integer no 158.It user.posix2_c_bind integer no 159.It user.posix2_c_dev integer no 160.It user.posix2_char_term integer no 161.It user.posix2_fort_dev integer no 162.It user.posix2_fort_run integer no 163.It user.posix2_localedef integer no 164.It user.posix2_sw_dev integer no 165.It user.posix2_upe integer no 166.El 167.Sh EXAMPLES 168.Pp 169For example, to retrieve the maximum number of processes allowed 170in the system, one would use the follow request: 171.Bd -literal -offset indent -compact 172sysctl kern.maxproc 173.Ed 174.Pp 175To set the maximum number of processes allowed 176in the system to 1000, one would use the follow request: 177.Bd -literal -offset indent -compact 178sysctl -w kern.maxproc=1000 179.Ed 180.Pp 181Information about the system clock rate may be obtained with: 182.Bd -literal -offset indent -compact 183sysctl kern.clockrate 184.Ed 185.Pp 186Information about the load average history may be obtained with 187.Bd -literal -offset indent -compact 188sysctl vm.loadavg 189.Ed 190.Sh FILES 191.Bl -tag -width <netinet/icmpXvar.h> -compact 192.It Pa <sys/sysctl.h> 193definitions for top level identifiers, second level kernel and hardware 194identifiers, and user level identifiers 195.It Pa <sys/socket.h> 196definitions for second level network identifiers 197.It Pa <sys/gmon.h> 198definitions for third level profiling identifiers 199.It Pa <vm/vm_param.h> 200definitions for second level virtual memory identifiers 201.It Pa <netinet/in.h> 202definitions for third level Internet identifiers and 203fourth level IP identifiers 204.It Pa <netinet/icmp_var.h> 205definitions for fourth level ICMP identifiers 206.It Pa <netinet/udp_var.h> 207definitions for fourth level UDP identifiers 208.El 209.Sh SEE ALSO 210.Xr sysctl 3 211.Sh HISTORY 212.Nm sysctl 213first appeared in 4.4BSD. 214