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 33d9b1bc77SPhilippe Charnier.\" $Id: sysctl.8,v 1.13 1997/08/30 02:28:00 kato 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 54d9b1bc77SPhilippe Charnier.Nm 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 61d9b1bc77SPhilippe CharnierThe following options are available: 62d9b1bc77SPhilippe Charnier.Bl -tag -width indent 63d9b1bc77SPhilippe Charnier.It Fl a 64d9b1bc77SPhilippe CharnierList all the currently available string or integer values. 65d9b1bc77SPhilippe Charnier.It Fl A 66d9b1bc77SPhilippe CharnierList all the known MIB names including opaques. 67dea673e9SRodney W. GrimesThose with string or integer values will be printed as with the 68dea673e9SRodney W. Grimes.Fl a 691d86b91cSPoul-Henning Kampflag; for the opaque values, 701d86b91cSPoul-Henning Kampinformation about the format and the length is printed in addition the first 711d86b91cSPoul-Henning Kampfew bytes is dumped in hex. 72d9b1bc77SPhilippe Charnier.It Fl X 73d9b1bc77SPhilippe CharnierSame as 741d86b91cSPoul-Henning Kamp.Fl A 751d86b91cSPoul-Henning Kampexcept the entire value of opaque variables is hexdumped. 76d9b1bc77SPhilippe Charnier.It Fl n 77d9b1bc77SPhilippe CharnierSpecify that the printing of the field name should be 78dea673e9SRodney W. Grimessuppressed and that only its value should be output. 79dea673e9SRodney W. GrimesThis flag is useful for setting shell variables. 80dea673e9SRodney W. GrimesFor example, to save the pagesize in variable psize, use: 81dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 82dea673e9SRodney W. Grimesset psize=`sysctl -n hw.pagesize` 83dea673e9SRodney W. Grimes.Ed 84d9b1bc77SPhilippe Charnier.It Fl b 85d9b1bc77SPhilippe CharnierForce the value of the variable(s) to be output in raw, binary 861d86b91cSPoul-Henning Kampformat. No names are printed and no terminating newlines are output. 871d86b91cSPoul-Henning KampThis is mostly useful with a single variable. 88d9b1bc77SPhilippe Charnier.It Fl w Ar name=value ... 89d9b1bc77SPhilippe CharnierSet the MIB 90d9b1bc77SPhilippe Charnier.Ar name 91d9b1bc77SPhilippe Charnierto the new 92d9b1bc77SPhilippe Charnier.Ar value . 93d9b1bc77SPhilippe CharnierIf just a MIB style 94d9b1bc77SPhilippe Charnier.Ar name 95d9b1bc77SPhilippe Charnieris given, 96dea673e9SRodney W. Grimesthe corresponding value is retrieved. 97d9b1bc77SPhilippe Charnier.El 98dea673e9SRodney W. Grimes.Pp 99dea673e9SRodney W. GrimesThe information available from 100d9b1bc77SPhilippe Charnier.Nm 1011d86b91cSPoul-Henning Kampconsists of integers, strings, and opaques. 102d9b1bc77SPhilippe Charnier.Nm Sysctl 1031d86b91cSPoul-Henning Kamponly knows about a couple of opaque types, and will resort to hexdumps 1041d86b91cSPoul-Henning Kampfor the rest. 1051d86b91cSPoul-Henning KampThe opaque information is much more useful if retrieved by special 106dea673e9SRodney W. Grimespurpose programs such as 107dea673e9SRodney W. Grimes.Nm ps , 108dea673e9SRodney W. Grimes.Nm systat , 109dea673e9SRodney W. Grimesand 110dea673e9SRodney W. Grimes.Nm netstat . 1111d86b91cSPoul-Henning Kamp.Pp 1124a8d0283SMike PritchardThe string and integer information is summarized below. 113dea673e9SRodney W. GrimesFor a detailed description of these variable see 114dea673e9SRodney W. Grimes.Xr sysctl 3 . 1151d86b91cSPoul-Henning Kamp.Pp 116dea673e9SRodney W. GrimesThe changeable column indicates whether a process with appropriate 117dea673e9SRodney W. Grimesprivilege can change the value. 118dea673e9SRodney W. Grimes.Bl -column net.inet.ip.forwardingxxxxxx integerxxx 119dea673e9SRodney W. Grimes.It Sy Name Type Changeable 120dea673e9SRodney W. Grimes.It kern.ostype string no 121dea673e9SRodney W. Grimes.It kern.osrelease string no 122dea673e9SRodney W. Grimes.It kern.osrevision integer no 123dea673e9SRodney W. Grimes.It kern.version string no 124dea673e9SRodney W. Grimes.It kern.maxvnodes integer yes 125dea673e9SRodney W. Grimes.It kern.maxproc integer yes 126e6373c9eSGuido van Rooij.It kern.maxprocperuid integer yes 127dea673e9SRodney W. Grimes.It kern.maxfiles integer yes 128e6373c9eSGuido van Rooij.It kern.maxfilesperproc integer yes 129dea673e9SRodney W. Grimes.It kern.argmax integer no 130dea673e9SRodney W. Grimes.It kern.securelevel integer raise only 131dea673e9SRodney W. Grimes.It kern.hostname string yes 132dea673e9SRodney W. Grimes.It kern.hostid integer yes 133dea673e9SRodney W. Grimes.It kern.clockrate struct no 134dea673e9SRodney W. Grimes.It kern.posix1version integer no 135dea673e9SRodney W. Grimes.It kern.ngroups integer no 136dea673e9SRodney W. Grimes.It kern.job_control integer no 137dea673e9SRodney W. Grimes.It kern.saved_ids integer no 138dea673e9SRodney W. Grimes.It kern.boottime struct no 1398e3847b2SGarrett Wollman.It kern.domainname string yes 1408e3847b2SGarrett Wollman.It kern.update integer yes 1418e3847b2SGarrett Wollman.It kern.osreldate string no 1428e3847b2SGarrett Wollman.It kern.bootfile string yes 143dea673e9SRodney W. Grimes.It vm.loadavg struct no 144dea673e9SRodney W. Grimes.It hw.machine string no 145dea673e9SRodney W. Grimes.It hw.model string no 146dea673e9SRodney W. Grimes.It hw.ncpu integer no 147dea673e9SRodney W. Grimes.It hw.byteorder integer no 148dea673e9SRodney W. Grimes.It hw.physmem integer no 149dea673e9SRodney W. Grimes.It hw.usermem integer no 150dea673e9SRodney W. Grimes.It hw.pagesize integer no 1518e3847b2SGarrett Wollman.It hw.floatingpoint integer no 152d1d9bf7eSKATO Takenori.It hw.machine_arch string no 1535a663072SAndrey A. Chernov.It machdep.console_device dev_t no 1545a663072SAndrey A. Chernov.It machdep.adjkerntz integer yes 1555a663072SAndrey A. Chernov.It machdep.disable_rtc_set integer yes 156dea673e9SRodney W. Grimes.It user.cs_path string no 157dea673e9SRodney W. Grimes.It user.bc_base_max integer no 158dea673e9SRodney W. Grimes.It user.bc_dim_max integer no 159dea673e9SRodney W. Grimes.It user.bc_scale_max integer no 160dea673e9SRodney W. Grimes.It user.bc_string_max integer no 161dea673e9SRodney W. Grimes.It user.coll_weights_max integer no 162dea673e9SRodney W. Grimes.It user.expr_nest_max integer no 163dea673e9SRodney W. Grimes.It user.line_max integer no 164dea673e9SRodney W. Grimes.It user.re_dup_max integer no 165dea673e9SRodney W. Grimes.It user.posix2_version integer no 166dea673e9SRodney W. Grimes.It user.posix2_c_bind integer no 167dea673e9SRodney W. Grimes.It user.posix2_c_dev integer no 168dea673e9SRodney W. Grimes.It user.posix2_char_term integer no 169dea673e9SRodney W. Grimes.It user.posix2_fort_dev integer no 170dea673e9SRodney W. Grimes.It user.posix2_fort_run integer no 171dea673e9SRodney W. Grimes.It user.posix2_localedef integer no 172dea673e9SRodney W. Grimes.It user.posix2_sw_dev integer no 173dea673e9SRodney W. Grimes.It user.posix2_upe integer no 174750f8dc9SBruce Evans.It user.stream_max integer no 175750f8dc9SBruce Evans.It user.tzname_max integer no 176dea673e9SRodney W. Grimes.El 177dea673e9SRodney W. Grimes.Sh EXAMPLES 178dea673e9SRodney W. GrimesFor example, to retrieve the maximum number of processes allowed 179dea673e9SRodney W. Grimesin the system, one would use the follow request: 180dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 181dea673e9SRodney W. Grimessysctl kern.maxproc 182dea673e9SRodney W. Grimes.Ed 183dea673e9SRodney W. Grimes.Pp 184dea673e9SRodney W. GrimesTo set the maximum number of processes allowed 185dea673e9SRodney W. Grimesin the system to 1000, one would use the follow request: 186dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 187dea673e9SRodney W. Grimessysctl -w kern.maxproc=1000 188dea673e9SRodney W. Grimes.Ed 189dea673e9SRodney W. Grimes.Pp 190dea673e9SRodney W. GrimesInformation about the system clock rate may be obtained with: 191dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 192dea673e9SRodney W. Grimessysctl kern.clockrate 193dea673e9SRodney W. Grimes.Ed 194dea673e9SRodney W. Grimes.Pp 195d9b1bc77SPhilippe CharnierInformation about the load average history may be obtained with: 196dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact 197dea673e9SRodney W. Grimessysctl vm.loadavg 198dea673e9SRodney W. Grimes.Ed 1991d86b91cSPoul-Henning Kamp.Pp 2001d86b91cSPoul-Henning KampMore variables than these exist, and the best and likely only place 2011d86b91cSPoul-Henning Kampto search for their deeper meaning is undoubtedly the source where 2021d86b91cSPoul-Henning Kampthey are defined. 203dea673e9SRodney W. Grimes.Sh FILES 204dea673e9SRodney W. Grimes.Bl -tag -width <netinet/icmpXvar.h> -compact 205dea673e9SRodney W. Grimes.It Pa <sys/sysctl.h> 206dea673e9SRodney W. Grimesdefinitions for top level identifiers, second level kernel and hardware 207dea673e9SRodney W. Grimesidentifiers, and user level identifiers 208dea673e9SRodney W. Grimes.It Pa <sys/socket.h> 209dea673e9SRodney W. Grimesdefinitions for second level network identifiers 210dea673e9SRodney W. Grimes.It Pa <sys/gmon.h> 211dea673e9SRodney W. Grimesdefinitions for third level profiling identifiers 212dea673e9SRodney W. Grimes.It Pa <vm/vm_param.h> 213dea673e9SRodney W. Grimesdefinitions for second level virtual memory identifiers 214dea673e9SRodney W. Grimes.It Pa <netinet/in.h> 215dea673e9SRodney W. Grimesdefinitions for third level Internet identifiers and 216dea673e9SRodney W. Grimesfourth level IP identifiers 217dea673e9SRodney W. Grimes.It Pa <netinet/icmp_var.h> 218dea673e9SRodney W. Grimesdefinitions for fourth level ICMP identifiers 219dea673e9SRodney W. Grimes.It Pa <netinet/udp_var.h> 220dea673e9SRodney W. Grimesdefinitions for fourth level UDP identifiers 221dea673e9SRodney W. Grimes.El 222dea673e9SRodney W. Grimes.Sh SEE ALSO 223dea673e9SRodney W. Grimes.Xr sysctl 3 2241d86b91cSPoul-Henning Kamp.Sh BUGS 225d9b1bc77SPhilippe Charnier.Nm Sysctl 2261d86b91cSPoul-Henning Kamppresently exploits an undocumented interface to the kernel 2274a8d0283SMike Pritchardsysctl facility to traverse the sysctl tree and to retrieve format 2281d86b91cSPoul-Henning Kampand name information. 2291d86b91cSPoul-Henning KampThis correct interface is being thought about for the time being. 230dea673e9SRodney W. Grimes.Sh HISTORY 231d9b1bc77SPhilippe Charnier.Nm Sysctl 23285cf659aSMike Pritchardfirst appeared in 23385cf659aSMike Pritchard.Bx 4.4 . 2341d86b91cSPoul-Henning Kamp.Pp 23585cf659aSMike PritchardIn 236d9b1bc77SPhilippe Charnier.Fx 2.2 , 237d9b1bc77SPhilippe Charnier.Nm 23885cf659aSMike Pritchardwas significantly remodeled. 239