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