2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)sysctl.8 8.2 (Berkeley) 5/9/95
39 .Nd get or set kernel state
54 utility retrieves kernel state and allows processes with
55 appropriate privilege to set kernel state.
56 The state to be retrieved or set is described using a
57 ``Management Information Base'' (``MIB'') style name,
58 described as a dotted set of components.
61 flag can be used to list all the currently available string or integer values.
64 flag will list all the known MIB names including tables.
65 Those with string or integer values will be printed as with the
67 flag; for the table values,
68 the name of the utility to retrieve them is given.
72 flag specifies that the printing of the field name should be
73 suppressed and that only its value should be output.
74 This flag is useful for setting shell variables.
75 For example, to save the pagesize in variable psize, use:
76 .Bd -literal -offset indent -compact
77 set psize=`sysctl -n hw.pagesize`
80 If just a MIB style name is given,
81 the corresponding value is retrieved.
82 If a value is to be set, the
84 flag must be specified and the MIB name followed
85 by an equal sign and the new value to be used.
87 The information available from
89 consists of integers, strings, and tables.
90 The tabular information can only be retrieved by special
91 purpose programs such as
96 The string and integer information is summarized below.
97 For a detailed description of these variable see
99 The changeable column indicates whether a process with appropriate
100 privilege can change the value.
101 .Bl -column net.inet.ip.forwardingxxxxxx integerxxx
102 .It Sy Name Type Changeable
103 .It kern.ostype string no
104 .It kern.osrelease string no
105 .It kern.osrevision integer no
106 .It kern.version string no
107 .It kern.maxvnodes integer yes
108 .It kern.maxproc integer yes
109 .It kern.maxfiles integer yes
110 .It kern.argmax integer no
111 .It kern.securelevel integer raise only
112 .It kern.hostname string yes
113 .It kern.hostid integer yes
114 .It kern.clockrate struct no
115 .It kern.posix1version integer no
116 .It kern.ngroups integer no
117 .It kern.job_control integer no
118 .It kern.saved_ids integer no
119 .It kern.link_max integer no
120 .It kern.max_canon integer no
121 .It kern.max_input integer no
122 .It kern.name_max integer no
123 .It kern.path_max integer no
124 .It kern.pipe_buf integer no
125 .It kern.chown_restricted integer no
126 .It kern.no_trunc integer no
127 .It kern.vdisable integer no
128 .It kern.boottime struct no
129 .It vm.loadavg struct no
130 .It machdep.console_device dev_t no
131 .It net.inet.ip.forwarding integer yes
132 .It net.inet.ip.redirect integer yes
133 .It net.inet.ip.ttl integer yes
134 .It net.inet.icmp.maskrepl integer yes
135 .It net.inet.udp.checksum integer yes
136 .It hw.machine string no
137 .It hw.model string no
138 .It hw.ncpu integer no
139 .It hw.byteorder integer no
140 .It hw.physmem integer no
141 .It hw.usermem integer no
142 .It hw.pagesize integer no
143 .It user.cs_path string no
144 .It user.bc_base_max integer no
145 .It user.bc_dim_max integer no
146 .It user.bc_scale_max integer no
147 .It user.bc_string_max integer no
148 .It user.coll_weights_max integer no
149 .It user.expr_nest_max integer no
150 .It user.line_max integer no
151 .It user.re_dup_max integer no
152 .It user.posix2_version integer no
153 .It user.posix2_c_bind integer no
154 .It user.posix2_c_dev integer no
155 .It user.posix2_char_term integer no
156 .It user.posix2_fort_dev integer no
157 .It user.posix2_fort_run integer no
158 .It user.posix2_localedef integer no
159 .It user.posix2_sw_dev integer no
160 .It user.posix2_upe integer no
165 program can get or set debugging variables
166 that have been identified for its display.
167 This information can be obtained by using the command:
168 .Bd -literal -offset indent
173 can extract information about the filesystems that have been compiled
174 into the running system.
175 This information can be obtained by using the command:
176 .Bd -literal -offset indent
179 By default, only filesystems that are actively being used are listed.
182 flag lists all the filesystems compiled into the running kernel.
185 For example, to retrieve the maximum number of processes allowed
186 in the system, one would use the follow request:
187 .Bd -literal -offset indent -compact
191 To set the maximum number of processes allowed
192 in the system to 1000, one would use the follow request:
193 .Bd -literal -offset indent -compact
194 sysctl -w kern.maxproc=1000
197 Information about the system clock rate may be obtained with:
198 .Bd -literal -offset indent -compact
199 sysctl kern.clockrate
202 Information about the load average history may be obtained with
203 .Bd -literal -offset indent -compact
207 .Bl -tag -width <netinet/icmpXvar.h> -compact
208 .It Pa <sys/sysctl.h>
209 definitions for top level identifiers, second level kernel and hardware
210 identifiers, and user level identifiers
211 .It Pa <sys/socket.h>
212 definitions for second level network identifiers
214 definitions for third level profiling identifiers
215 .It Pa <vm/vm_param.h>
216 definitions for second level virtual memory identifiers
217 .It Pa <netinet/in.h>
218 definitions for third level Internet identifiers and
219 fourth level IP identifiers
220 .It Pa <netinet/icmp_var.h>
221 definitions for fourth level ICMP identifiers
222 .It Pa <netinet/udp_var.h>
223 definitions for fourth level UDP identifiers
229 first appeared in 4.4BSD.