1dea673e9SRodney W. Grimes.\" Copyright (c) 1993 2dea673e9SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 3dea673e9SRodney W. Grimes.\" 4dea673e9SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 5dea673e9SRodney W. Grimes.\" modification, are permitted provided that the following conditions 6dea673e9SRodney W. Grimes.\" are met: 7dea673e9SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 8dea673e9SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 9dea673e9SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 10dea673e9SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 11dea673e9SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 12dea673e9SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software 13dea673e9SRodney W. Grimes.\" must display the following acknowledgement: 14dea673e9SRodney W. Grimes.\" This product includes software developed by the University of 15dea673e9SRodney W. Grimes.\" California, Berkeley and its contributors. 16dea673e9SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 17dea673e9SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 18dea673e9SRodney W. Grimes.\" without specific prior written permission. 19dea673e9SRodney W. Grimes.\" 20dea673e9SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21dea673e9SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22dea673e9SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23dea673e9SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24dea673e9SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25dea673e9SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26dea673e9SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27dea673e9SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28dea673e9SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29dea673e9SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30dea673e9SRodney W. Grimes.\" SUCH DAMAGE. 31dea673e9SRodney W. Grimes.\" 328e3847b2SGarrett Wollman.\" From: @(#)sysctl.8 8.1 (Berkeley) 6/6/93 331d86b91cSPoul-Henning Kamp.\" $Id: sysctl.8,v 1.6 1995/02/20 19:42:42 guido Exp $ 34dea673e9SRodney W. Grimes.\" 358e3847b2SGarrett Wollman.Dd September 23, 1994 36dea673e9SRodney W. Grimes.Dt SYSCTL 8 37dea673e9SRodney W. Grimes.Os 38dea673e9SRodney W. Grimes.Sh NAME 39dea673e9SRodney W. Grimes.Nm sysctl 40dea673e9SRodney W. Grimes.Nd get or set kernel state 41dea673e9SRodney W. Grimes.Sh SYNOPSIS 42dea673e9SRodney W. Grimes.Nm sysctl 431d86b91cSPoul-Henning Kamp.Op Fl bn 44dea673e9SRodney W. Grimes.Ar name ... 45dea673e9SRodney W. Grimes.Nm sysctl 461d86b91cSPoul-Henning Kamp.Op Fl bn 47dea673e9SRodney W. Grimes.Fl w 48dea673e9SRodney W. Grimes.Ar name=value ... 49dea673e9SRodney W. Grimes.Nm sysctl 501d86b91cSPoul-Henning Kamp.Op Fl bn 511d86b91cSPoul-Henning Kamp.Fl aAX 52dea673e9SRodney W. Grimes.Sh DESCRIPTION 53dea673e9SRodney W. GrimesThe 54dea673e9SRodney W. Grimes.Nm sysctl 55dea673e9SRodney W. Grimesutility retrieves kernel state and allows processes with 56dea673e9SRodney W. Grimesappropriate privilege to set kernel state. 57dea673e9SRodney W. GrimesThe state to be retrieved or set is described using a 58dea673e9SRodney W. Grimes``Management Information Base'' (``MIB'') style name, 59dea673e9SRodney W. Grimesdescribed as a dotted set of components. 601d86b91cSPoul-Henning Kamp.Pp 61dea673e9SRodney W. GrimesThe 62dea673e9SRodney W. Grimes.Fl a 63dea673e9SRodney W. Grimesflag can be used to list all the currently available string or integer values. 641d86b91cSPoul-Henning Kamp.Pp 65dea673e9SRodney W. GrimesThe 66dea673e9SRodney W. Grimes.Fl A 671d86b91cSPoul-Henning Kampflag will list all the known MIB names including opaques. 68dea673e9SRodney W. GrimesThose with string or integer values will be printed as with the 69dea673e9SRodney W. Grimes.Fl a 701d86b91cSPoul-Henning Kampflag; for the opaque values, 711d86b91cSPoul-Henning Kampinformation about the format and the length is printed in addition the first 721d86b91cSPoul-Henning Kampfew bytes is dumped in hex. 731d86b91cSPoul-Henning Kamp.Pp 741d86b91cSPoul-Henning KampThe 751d86b91cSPoul-Henning Kamp.Fl X 761d86b91cSPoul-Henning Kampflag is the same as 771d86b91cSPoul-Henning Kamp.Fl A 781d86b91cSPoul-Henning Kampexcept the entire value of opaque variables is hexdumped. 79dea673e9SRodney W. Grimes.Pp 80dea673e9SRodney W. GrimesThe 81dea673e9SRodney W. Grimes.Fl n 82dea673e9SRodney W. Grimesflag specifies that the printing of the field name should be 83dea673e9SRodney W. Grimessuppressed and that only its value should be output. 84dea673e9SRodney W. GrimesThis flag is useful for setting shell variables. 85dea673e9SRodney W. GrimesFor example, to save the pagesize in variable psize, use: 86dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 87dea673e9SRodney W. Grimesset psize=`sysctl -n hw.pagesize` 88dea673e9SRodney W. Grimes.Ed 89dea673e9SRodney W. Grimes.Pp 901d86b91cSPoul-Henning KampThe 911d86b91cSPoul-Henning Kamp.Fl b 921d86b91cSPoul-Henning Kampflag forces the value of the variable(s) to be output in raw, binary 931d86b91cSPoul-Henning Kampformat. No names are printed and no terminating newlines are output. 941d86b91cSPoul-Henning KampThis is mostly useful with a single variable. 951d86b91cSPoul-Henning Kamp.Pp 96dea673e9SRodney W. GrimesIf just a MIB style name is given, 97dea673e9SRodney W. Grimesthe corresponding value is retrieved. 98dea673e9SRodney W. GrimesIf a value is to be set, the 99dea673e9SRodney W. Grimes.Fl w 100dea673e9SRodney W. Grimesflag must be specified and the MIB name followed 101dea673e9SRodney W. Grimesby an equal sign and the new value to be used. 102dea673e9SRodney W. Grimes.Pp 103dea673e9SRodney W. GrimesThe information available from 104dea673e9SRodney W. Grimes.Nm sysctl 1051d86b91cSPoul-Henning Kampconsists of integers, strings, and opaques. 1061d86b91cSPoul-Henning Kamp.Nm sysctl 1071d86b91cSPoul-Henning Kamponly knows about a couple of opaque types, and will resort to hexdumps 1081d86b91cSPoul-Henning Kampfor the rest. 1091d86b91cSPoul-Henning KampThe opaque information is much more useful if retrieved by special 110dea673e9SRodney W. Grimespurpose programs such as 111dea673e9SRodney W. Grimes.Nm ps , 112dea673e9SRodney W. Grimes.Nm systat , 113dea673e9SRodney W. Grimesand 114dea673e9SRodney W. Grimes.Nm netstat . 1151d86b91cSPoul-Henning Kamp.Pp 116dea673e9SRodney W. GrimesThe string and integer information is summaried below. 117dea673e9SRodney W. GrimesFor a detailed description of these variable see 118dea673e9SRodney W. Grimes.Xr sysctl 3 . 1191d86b91cSPoul-Henning Kamp.Pp 120dea673e9SRodney W. GrimesThe changeable column indicates whether a process with appropriate 121dea673e9SRodney W. Grimesprivilege can change the value. 122dea673e9SRodney W. Grimes.Bl -column net.inet.ip.forwardingxxxxxx integerxxx 123dea673e9SRodney W. Grimes.It Sy Name Type Changeable 124dea673e9SRodney W. Grimes.It kern.ostype string no 125dea673e9SRodney W. Grimes.It kern.osrelease string no 126dea673e9SRodney W. Grimes.It kern.osrevision integer no 127dea673e9SRodney W. Grimes.It kern.version string no 128dea673e9SRodney W. Grimes.It kern.maxvnodes integer yes 129dea673e9SRodney W. Grimes.It kern.maxproc integer yes 130e6373c9eSGuido van Rooij.It kern.maxprocperuid integer yes 131dea673e9SRodney W. Grimes.It kern.maxfiles integer yes 132e6373c9eSGuido van Rooij.It kern.maxfilesperproc integer yes 133dea673e9SRodney W. Grimes.It kern.argmax integer no 134dea673e9SRodney W. Grimes.It kern.securelevel integer raise only 135dea673e9SRodney W. Grimes.It kern.hostname string yes 136dea673e9SRodney W. Grimes.It kern.hostid integer yes 137dea673e9SRodney W. Grimes.It kern.clockrate struct no 138dea673e9SRodney W. Grimes.It kern.posix1version integer no 139dea673e9SRodney W. Grimes.It kern.ngroups integer no 140dea673e9SRodney W. Grimes.It kern.job_control integer no 141dea673e9SRodney W. Grimes.It kern.saved_ids integer no 142dea673e9SRodney W. Grimes.It kern.link_max integer no 143dea673e9SRodney W. Grimes.It kern.max_canon integer no 144dea673e9SRodney W. Grimes.It kern.max_input integer no 145dea673e9SRodney W. Grimes.It kern.name_max integer no 146dea673e9SRodney W. Grimes.It kern.path_max integer no 147dea673e9SRodney W. Grimes.It kern.pipe_buf integer no 148dea673e9SRodney W. Grimes.It kern.chown_restricted integer no 149dea673e9SRodney W. Grimes.It kern.no_trunc integer no 150dea673e9SRodney W. Grimes.It kern.vdisable integer no 151dea673e9SRodney W. Grimes.It kern.boottime struct no 1528e3847b2SGarrett Wollman.It kern.domainname string yes 1538e3847b2SGarrett Wollman.It kern.update integer yes 1548e3847b2SGarrett Wollman.It kern.osreldate string no 1558e3847b2SGarrett Wollman.It kern.bootfile string yes 156dea673e9SRodney W. Grimes.It vm.loadavg struct no 157dea673e9SRodney W. Grimes.It hw.machine string no 158dea673e9SRodney W. Grimes.It hw.model string no 159dea673e9SRodney W. Grimes.It hw.ncpu integer no 160dea673e9SRodney W. Grimes.It hw.byteorder integer no 161dea673e9SRodney W. Grimes.It hw.physmem integer no 162dea673e9SRodney W. Grimes.It hw.usermem integer no 163dea673e9SRodney W. Grimes.It hw.pagesize integer no 1648e3847b2SGarrett Wollman.It hw.floatingpoint integer no 1655a663072SAndrey A. Chernov.It machdep.console_device dev_t no 1665a663072SAndrey A. Chernov.It machdep.adjkerntz integer yes 1675a663072SAndrey A. Chernov.It machdep.disable_rtc_set integer yes 168dea673e9SRodney W. Grimes.It user.cs_path string no 169dea673e9SRodney W. Grimes.It user.bc_base_max integer no 170dea673e9SRodney W. Grimes.It user.bc_dim_max integer no 171dea673e9SRodney W. Grimes.It user.bc_scale_max integer no 172dea673e9SRodney W. Grimes.It user.bc_string_max integer no 173dea673e9SRodney W. Grimes.It user.coll_weights_max integer no 174dea673e9SRodney W. Grimes.It user.expr_nest_max integer no 175dea673e9SRodney W. Grimes.It user.line_max integer no 176dea673e9SRodney W. Grimes.It user.re_dup_max integer no 177dea673e9SRodney W. Grimes.It user.posix2_version integer no 178dea673e9SRodney W. Grimes.It user.posix2_c_bind integer no 179dea673e9SRodney W. Grimes.It user.posix2_c_dev integer no 180dea673e9SRodney W. Grimes.It user.posix2_char_term integer no 181dea673e9SRodney W. Grimes.It user.posix2_fort_dev integer no 182dea673e9SRodney W. Grimes.It user.posix2_fort_run integer no 183dea673e9SRodney W. Grimes.It user.posix2_localedef integer no 184dea673e9SRodney W. Grimes.It user.posix2_sw_dev integer no 185dea673e9SRodney W. Grimes.It user.posix2_upe integer no 186dea673e9SRodney W. Grimes.El 187dea673e9SRodney W. Grimes.Sh EXAMPLES 188dea673e9SRodney W. Grimes.Pp 189dea673e9SRodney W. GrimesFor example, to retrieve the maximum number of processes allowed 190dea673e9SRodney W. Grimesin the system, one would use the follow request: 191dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 192dea673e9SRodney W. Grimessysctl kern.maxproc 193dea673e9SRodney W. Grimes.Ed 194dea673e9SRodney W. Grimes.Pp 195dea673e9SRodney W. GrimesTo set the maximum number of processes allowed 196dea673e9SRodney W. Grimesin the system to 1000, one would use the follow request: 197dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 198dea673e9SRodney W. Grimessysctl -w kern.maxproc=1000 199dea673e9SRodney W. Grimes.Ed 200dea673e9SRodney W. Grimes.Pp 201dea673e9SRodney W. GrimesInformation about the system clock rate may be obtained with: 202dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 203dea673e9SRodney W. Grimessysctl kern.clockrate 204dea673e9SRodney W. Grimes.Ed 205dea673e9SRodney W. Grimes.Pp 206dea673e9SRodney W. GrimesInformation about the load average history may be obtained with 207dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 208dea673e9SRodney W. Grimessysctl vm.loadavg 209dea673e9SRodney W. Grimes.Ed 2101d86b91cSPoul-Henning Kamp.Pp 2111d86b91cSPoul-Henning KampMore variables than these exist, and the best and likely only place 2121d86b91cSPoul-Henning Kampto search for their deeper meaning is undoubtedly the source where 2131d86b91cSPoul-Henning Kampthey are defined. 214dea673e9SRodney W. Grimes.Sh FILES 215dea673e9SRodney W. Grimes.Bl -tag -width <netinet/icmpXvar.h> -compact 216dea673e9SRodney W. Grimes.It Pa <sys/sysctl.h> 217dea673e9SRodney W. Grimesdefinitions for top level identifiers, second level kernel and hardware 218dea673e9SRodney W. Grimesidentifiers, and user level identifiers 219dea673e9SRodney W. Grimes.It Pa <sys/socket.h> 220dea673e9SRodney W. Grimesdefinitions for second level network identifiers 221dea673e9SRodney W. Grimes.It Pa <sys/gmon.h> 222dea673e9SRodney W. Grimesdefinitions for third level profiling identifiers 223dea673e9SRodney W. Grimes.It Pa <vm/vm_param.h> 224dea673e9SRodney W. Grimesdefinitions for second level virtual memory identifiers 225dea673e9SRodney W. Grimes.It Pa <netinet/in.h> 226dea673e9SRodney W. Grimesdefinitions for third level Internet identifiers and 227dea673e9SRodney W. Grimesfourth level IP identifiers 228dea673e9SRodney W. Grimes.It Pa <netinet/icmp_var.h> 229dea673e9SRodney W. Grimesdefinitions for fourth level ICMP identifiers 230dea673e9SRodney W. Grimes.It Pa <netinet/udp_var.h> 231dea673e9SRodney W. Grimesdefinitions for fourth level UDP identifiers 232dea673e9SRodney W. Grimes.El 233dea673e9SRodney W. Grimes.Sh SEE ALSO 234dea673e9SRodney W. Grimes.Xr sysctl 3 2351d86b91cSPoul-Henning Kamp.Sh BUGS 2361d86b91cSPoul-Henning Kamp.Nm sysctl 2371d86b91cSPoul-Henning Kamppresently exploits an undocumented interface to the kernel 2381d86b91cSPoul-Henning Kampsysctl facility to traverse the sysctl tree and to retrive format 2391d86b91cSPoul-Henning Kampand name information. 2401d86b91cSPoul-Henning KampThis correct interface is being thought about for the time being. 241dea673e9SRodney W. Grimes.Sh HISTORY 242dea673e9SRodney W. Grimes.Nm sysctl 243dea673e9SRodney W. Grimesfirst appeared in 4.4BSD. 2441d86b91cSPoul-Henning Kamp.Pp 2451d86b91cSPoul-Henning KampIn FreeBSD 2.2 sysctl was significantly remodeled. 246