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.5 (Berkeley) 05/20/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 net.inet.ip.forwarding integer yes 105.It net.inet.ip.redirect integer yes 106.It net.inet.ip.ttl integer yes 107.It net.inet.icmp.maskrepl integer yes 108.It net.inet.udp.checksum integer yes 109.It hw.machine string no 110.It hw.model string no 111.It hw.ncpu integer no 112.It hw.byteorder integer no 113.It hw.physmem integer no 114.It hw.usermem integer no 115.It hw.pagesize integer no 116.It user.cs_path string no 117.It user.bc_base_max integer no 118.It user.bc_dim_max integer no 119.It user.bc_scale_max integer no 120.It user.bc_string_max integer no 121.It user.coll_weights_max integer no 122.It user.expr_nest_max integer no 123.It user.line_max integer no 124.It user.re_dup_max integer no 125.It user.posix2_version integer no 126.It user.posix2_c_bind integer no 127.It user.posix2_c_dev integer no 128.It user.posix2_char_term integer no 129.It user.posix2_fort_dev integer no 130.It user.posix2_fort_run integer no 131.It user.posix2_localedef integer no 132.It user.posix2_sw_dev integer no 133.It user.posix2_upe integer no 134.El 135.Sh EXAMPLES 136.Pp 137For example, to retrieve the maximum number of processes allowed 138in the system, one would use the follow request: 139.Bd -literal -offset indent -compact 140sysctl kern.maxproc 141.Ed 142.Pp 143To set the maximum number of processes allowed 144in the system to 1000, one would use the follow request: 145.Bd -literal -offset indent -compact 146sysctl -w kern.maxproc=1000 147.Ed 148.Pp 149Information about the system clock rate may be obtained with: 150.Bd -literal -offset indent -compact 151sysctl kern.clockrate 152.Ed 153.Pp 154Information about the load average history may be obtained with 155.Bd -literal -offset indent -compact 156sysctl vm.loadavg 157.Ed 158.Sh FILES 159.Bl -tag -width <netinet/icmpXvar.h> -compact 160.It Pa <sys/sysctl.h> 161definitions for top level identifiers, second level kernel and hardware 162identifiers, and user level identifiers 163.It Pa <sys/socket.h> 164definitions for second level network identifiers 165.It Pa <sys/gmon.h> 166definitions for third level profiling identifiers 167.It Pa <vm/vm_param.h> 168definitions for second level virtual memory identifiers 169.It Pa <netinet/in.h> 170definitions for third level Internet identifiers and 171fourth level IP identifiers 172.It Pa <netinet/icmp_var.h> 173definitions for fourth level ICMP identifiers 174.It Pa <netinet/udp_var.h> 175definitions for fourth level UDP identifiers 176.El 177.Sh SEE ALSO 178.Xr sysctl 3 179.Sh HISTORY 180.Nm sysctl 181first appeared in 4.4BSD. 182