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
60 utility retrieves kernel state and allows processes with
61 appropriate privilege to set kernel state.
62 The state to be retrieved or set is described using a
63 ``Management Information Base'' (``MIB'') style name,
64 described as a dotted set of components.
66 The following options are available:
67 .Bl -tag -width indent
70 List all MIB variables including opaque variables (which are normally suppressed).
71 The format and length are printed, as well as a hex dump of the first sixteen bytes of the value.
74 List all the currently available non-opaque values.
75 This option is ignored if one or more variable names are specified on
79 Force the value of the variable(s) to be output in raw, binary format.
80 No names are printed and no terminating newlines are output.
81 This is mostly useful with a single variable.
84 Show only variable values, not their names.
85 This option is useful for setting shell variables.
86 For instance, to save the pagesize in variable
90 .Dl "set psize=`sysctl -n hw.pagesize`"
92 .It Fl w Ar name=value
93 Used to set values. The MIB name (
95 ) followed by an equal sign and the new value (
102 but prints a hex dump of the entire value
103 instead of just the first few bytes.
106 If just a MIB style name is given,
107 the corresponding value is retrieved.
109 The information available from
111 consists of integers, strings, and tables.
112 The tabular information can only be retrieved by special
113 purpose programs such as
118 The string and integer information is summarized below.
119 For a detailed description of these variable see
121 The changeable column indicates whether a process with appropriate
122 privilege can change the value.
123 .Bl -column net.inet.ip.forwardingxxxxxx integerxxx
124 .It Sy Name Type Changeable
125 .It kern.ostype string no
126 .It kern.osrelease string no
127 .It kern.osrevision integer no
128 .It kern.version string no
129 .It kern.maxvnodes integer yes
130 .It kern.maxproc integer yes
131 .It kern.maxfiles integer yes
132 .It kern.argmax integer no
133 .It kern.securelevel integer raise only
134 .It kern.hostname string yes
135 .It kern.hostid integer yes
136 .It kern.clockrate struct no
137 .It kern.posix1version integer no
138 .It kern.ngroups integer no
139 .It kern.job_control integer no
140 .It kern.saved_ids integer no
141 .It kern.link_max integer no
142 .It kern.max_canon integer no
143 .It kern.max_input integer no
144 .It kern.name_max integer no
145 .It kern.path_max integer no
146 .It kern.pipe_buf integer no
147 .It kern.chown_restricted integer no
148 .It kern.no_trunc integer no
149 .It kern.vdisable integer no
150 .It kern.boottime struct no
151 .It vm.loadavg struct no
152 .It vm.swapusage struct no
153 .It machdep.console_device dev_t no
154 .It net.inet.ip.forwarding integer yes
155 .It net.inet.ip.redirect integer yes
156 .It net.inet.ip.ttl integer yes
157 .It net.inet.icmp.maskrepl integer yes
158 .It net.inet.udp.checksum integer yes
159 .It hw.machine string no
160 .It hw.model string no
161 .It hw.ncpu integer no
162 .It hw.byteorder integer no
163 .It hw.physmem integer no
164 .It hw.usermem integer no
165 .It hw.memsize integer no
166 .It hw.pagesize integer no
167 .It user.cs_path string no
168 .It user.bc_base_max integer no
169 .It user.bc_dim_max integer no
170 .It user.bc_scale_max integer no
171 .It user.bc_string_max integer no
172 .It user.coll_weights_max integer no
173 .It user.expr_nest_max integer no
174 .It user.line_max integer no
175 .It user.re_dup_max integer no
176 .It user.posix2_version integer no
177 .It user.posix2_c_bind integer no
178 .It user.posix2_c_dev integer no
179 .It user.posix2_char_term integer no
180 .It user.posix2_fort_dev integer no
181 .It user.posix2_fort_run integer no
182 .It user.posix2_localedef integer no
183 .It user.posix2_sw_dev integer no
184 .It user.posix2_upe integer no
189 program can get or set debugging variables
190 that have been identified for its display.
191 This information can be obtained by using the command:
192 .Bd -literal -offset indent
198 can extract information about the filesystems that have been compiled
199 into the running system.
200 This information can be obtained by using the command:
201 .Bd -literal -offset indent
205 By default, only filesystems that are actively being used are listed.
208 flag lists all the filesystems compiled into the running kernel.
211 For example, to retrieve the maximum number of processes allowed
212 in the system, one would use the request:
213 .Bd -literal -offset indent
217 To set the maximum number of processes allowed
218 in the system to 1000, one would use the request:
219 .Bd -literal -offset inden
220 sysctl -w kern.maxproc=1000
223 Information about the system clock rate may be obtained with:
224 .Bd -literal -offset indent
225 sysctl kern.clockrate
228 Information about the load average history may be obtained with:
229 .Bd -literal -offset indent
233 Information about the system's swap space usage may be obtained with:
234 .Bd -literal -offset indent
238 .Bl -tag -width <netinet/icmpXvar.h> -compact
239 .It Pa <sys/sysctl.h>
240 definitions for top level identifiers, second level kernel and hardware
241 identifiers, and user level identifiers
242 .It Pa <sys/socket.h>
243 definitions for second level network identifiers
245 definitions for third level profiling identifiers
246 .It Pa <vm/vm_param.h>
247 definitions for second level virtual memory identifiers
248 .It Pa <netinet/in.h>
249 definitions for third level Internet identifiers and
250 fourth level IP identifiers
251 .It Pa <netinet/icmp_var.h>
252 definitions for fourth level ICMP identifiers
253 .It Pa <netinet/udp_var.h>
254 definitions for fourth level UDP identifiers
260 first appeared in 4.4BSD.