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.6 (Berkeley) 05/26/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.Op Fl n 17.Ar name ... 18.Nm sysctl 19.Op Fl n 20.Fl w 21.Ar name=value ... 22.Nm sysctl 23.Op Fl n 24.Fl aA 25.Sh DESCRIPTION 26The 27.Nm sysctl 28utility retrieves kernel state and allows processes with 29appropriate privilege to set kernel state. 30The state to be retrieved or set is described using a 31``Management Information Base'' (``MIB'') style name, 32described as a dotted set of components. 33The 34.Fl a 35flag can be used to list all the currently available string or integer values. 36The 37.Fl A 38flag will list all the known MIB names including tables. 39Those with string or integer values will be printed as with the 40.Fl a 41flag; for the table values, 42the name of the utility to retrieve them is given. 43.Pp 44The 45.Fl n 46flag specifies that the printing of the field name should be 47suppressed and that only its value should be output. 48This flag is useful for setting shell variables. 49For example, to save the pagesize in variable psize, use: 50.Bd -literal -offset indent -compact 51set psize=`sysctl -n hw.pagesize` 52.Ed 53.Pp 54If just a MIB style name is given, 55the corresponding value is retrieved. 56If a value is to be set, the 57.Fl w 58flag must be specified and the MIB name followed 59by an equal sign and the new value to be used. 60.Pp 61The information available from 62.Nm sysctl 63consists of integers, strings, and tables. 64The tabular information can only be retrieved by special 65purpose programs such as 66.Nm ps , 67.Nm systat , 68and 69.Nm netstat . 70The string and integer information is summaried below. 71For a detailed description of these variable see 72.Xr sysctl 3 . 73The changeable column indicates whether a process with appropriate 74privilege can change the value. 75.Bl -column net.inet.ip.forwardingxxxxxx integerxxx 76.It Sy Name Type Changeable 77.It kern.ostype string no 78.It kern.osrelease string no 79.It kern.osrevision integer no 80.It kern.version string no 81.It kern.maxvnodes integer yes 82.It kern.maxproc integer yes 83.It kern.maxfiles integer yes 84.It kern.argmax integer no 85.It kern.securelevel integer raise only 86.It kern.hostname string yes 87.It kern.hostid integer yes 88.It kern.clockrate struct no 89.It kern.posix1version integer no 90.It kern.ngroups integer no 91.It kern.job_control integer no 92.It kern.saved_ids integer no 93.It kern.link_max integer no 94.It kern.max_canon integer no 95.It kern.max_input integer no 96.It kern.name_max integer no 97.It kern.path_max integer no 98.It kern.pipe_buf integer no 99.It kern.chown_restricted integer no 100.It kern.no_trunc integer no 101.It kern.vdisable integer no 102.It kern.boottime struct no 103.It vm.loadavg struct no 104.It machdep.console_device dev_t no 105.It net.inet.ip.forwarding integer yes 106.It net.inet.ip.redirect integer yes 107.It net.inet.ip.ttl integer yes 108.It net.inet.icmp.maskrepl integer yes 109.It net.inet.udp.checksum integer yes 110.It hw.machine string no 111.It hw.model string no 112.It hw.ncpu integer no 113.It hw.byteorder integer no 114.It hw.physmem integer no 115.It hw.usermem integer no 116.It hw.pagesize integer no 117.It user.cs_path string no 118.It user.bc_base_max integer no 119.It user.bc_dim_max integer no 120.It user.bc_scale_max integer no 121.It user.bc_string_max integer no 122.It user.coll_weights_max integer no 123.It user.expr_nest_max integer no 124.It user.line_max integer no 125.It user.re_dup_max integer no 126.It user.posix2_version integer no 127.It user.posix2_c_bind integer no 128.It user.posix2_c_dev integer no 129.It user.posix2_char_term integer no 130.It user.posix2_fort_dev integer no 131.It user.posix2_fort_run integer no 132.It user.posix2_localedef integer no 133.It user.posix2_sw_dev integer no 134.It user.posix2_upe integer no 135.El 136.Sh EXAMPLES 137.Pp 138For example, to retrieve the maximum number of processes allowed 139in the system, one would use the follow request: 140.Bd -literal -offset indent -compact 141sysctl kern.maxproc 142.Ed 143.Pp 144To set the maximum number of processes allowed 145in the system to 1000, one would use the follow request: 146.Bd -literal -offset indent -compact 147sysctl -w kern.maxproc=1000 148.Ed 149.Pp 150Information about the system clock rate may be obtained with: 151.Bd -literal -offset indent -compact 152sysctl kern.clockrate 153.Ed 154.Pp 155Information about the load average history may be obtained with 156.Bd -literal -offset indent -compact 157sysctl vm.loadavg 158.Ed 159.Sh FILES 160.Bl -tag -width <netinet/icmpXvar.h> -compact 161.It Pa <sys/sysctl.h> 162definitions for top level identifiers, second level kernel and hardware 163identifiers, and user level identifiers 164.It Pa <sys/socket.h> 165definitions for second level network identifiers 166.It Pa <sys/gmon.h> 167definitions for third level profiling identifiers 168.It Pa <vm/vm_param.h> 169definitions for second level virtual memory identifiers 170.It Pa <netinet/in.h> 171definitions for third level Internet identifiers and 172fourth level IP identifiers 173.It Pa <netinet/icmp_var.h> 174definitions for fourth level ICMP identifiers 175.It Pa <netinet/udp_var.h> 176definitions for fourth level UDP identifiers 177.El 178.Sh SEE ALSO 179.Xr sysctl 3 180.Sh HISTORY 181.Nm sysctl 182first appeared in 4.4BSD. 183