Sweep-fix man page section order to match mdoc(7), part 1/5.
[dragonfly.git] / sbin / sysctl / sysctl.8
1 .\" Copyright (c) 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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.
19 .\"
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
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     From: @(#)sysctl.8      8.1 (Berkeley) 6/6/93
33 .\" $FreeBSD: src/sbin/sysctl/sysctl.8,v 1.23.2.17 2003/05/19 07:49:34 brueffer Exp $
34 .\" $DragonFly: src/sbin/sysctl/sysctl.8,v 1.4 2006/02/17 19:33:33 swildner Exp $
35 .\"
36 .Dd March 10, 2002
37 .Dt SYSCTL 8
38 .Os
39 .Sh NAME
40 .Nm sysctl
41 .Nd get or set kernel state
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl bdeNnox
45 .Ar name Ns Op = Ns Ar value
46 .Ar ...
47 .Nm
48 .Op Fl bdeNnox
49 .Fl a
50 .Sh DESCRIPTION
51 The
52 .Nm
53 utility retrieves kernel state and allows processes with appropriate
54 privilege to set kernel state.
55 The state to be retrieved or set is described using a
56 .Dq Management Information Base
57 .Pq Dq MIB
58 style name, described as a dotted set of
59 components.
60 .Pp
61 The following options are available:
62 .Bl -tag -width indent
63 .It Fl A
64 Equivalent to
65 .Fl o a
66 (for compatibility).
67 .It Fl a
68 List all the currently available non-opaque values.
69 This option is ignored if one or more variable names are specified on
70 the command line.
71 .It Fl b
72 Force the value of the variable(s) to be output in raw, binary format.
73 No names are printed and no terminating newlines are output.
74 This is mostly useful with a single variable.
75 .It Fl d
76 Print the description of the variable instead of its value.
77 .It Fl e
78 Separate the name and the value of the variable(s) with
79 .Ql = .
80 This is useful for producing output which can be fed back to the
81 .Nm
82 utility.
83 This option is ignored if either
84 .Fl N
85 or
86 .Fl n
87 is specified, or a variable is being set.
88 .It Fl N
89 Show only variable names, not their values.
90 This is particularly useful with shells that offer programmable
91 completion.
92 To enable completion of variable names in
93 .Nm zsh ,
94 use the following code:
95 .Bd -literal -offset indent
96 listsysctls () { set -A reply $(sysctl -AN ${1%.*}) }
97 compctl -K listsysctls sysctl
98 .Ed
99 .It Fl n
100 Show only variable values, not their names.
101 This option is useful for setting shell variables.
102 For instance, to save the pagesize in variable
103 .Va psize ,
104 use:
105 .Pp
106 .Dl "set psize=`sysctl -n hw.pagesize`"
107 .It Fl o
108 Show opaque variables (which are normally suppressed).
109 The format and length are printed, as well as a hex dump of the first
110 sixteen bytes of the value.
111 .It Fl X
112 Equivalent to
113 .Fl x a
114 (for compatibility).
115 .It Fl x
116 As
117 .Fl o ,
118 but prints a hex dump of the entire value instead of just the first
119 few bytes.
120 .El
121 .Pp
122 The information available from
123 .Nm
124 consists of integers, strings, devices
125 .Pq Vt dev_t ,
126 and opaque types.
127 The
128 .Nm
129 utility
130 only knows about a couple of opaque types, and will resort to hexdumps
131 for the rest.
132 The opaque information is much more useful if retrieved by special
133 purpose programs such as
134 .Nm ps ,
135 .Nm systat
136 and
137 .Nm netstat .
138 .Pp
139 Some of the variables which cannot be modified during normal system
140 operation can be initialized via
141 .Xr loader 8
142 tunables.
143 This can for example be done by setting them in
144 .Xr loader.conf 5 .
145 Please refer to
146 .Xr loader.conf 5
147 for more information on which tunables are available and how to set them.
148 .Pp
149 The string and integer information is summarized below.
150 For a detailed description of these variable see
151 .Xr sysctl 3 .
152 .Pp
153 The changeable column indicates whether a process with appropriate
154 privilege can change the value.
155 String, integer, and devices values can be set using
156 .Nm .
157 For device values,
158 .Cm value
159 can be specified as a character device special file name.
160 Special values
161 .Cm off
162 and
163 .Ar none
164 denote
165 .Dq no device .
166 .Bl -column net.inet.ip.forwardingxxxxxx integerxxx
167 .It Sy "Name    Type    Changeable
168 .It "kern.ostype        string  no
169 .It "kern.osrelease     string  no
170 .It "kern.osrevision    integer no
171 .It "kern.version       string  no
172 .It "kern.maxvnodes     integer yes
173 .It "kern.maxproc       integer no
174 .It "kern.maxprocperuid integer yes
175 .It "kern.maxfiles      integer yes
176 .It "kern.maxfilesperproc       integer yes
177 .It "kern.argmax        integer no
178 .It "kern.securelevel   integer raise only
179 .It "kern.hostname      string  yes
180 .It "kern.hostid        integer yes
181 .It "kern.clockrate     struct  no
182 .It "kern.posix1version integer no
183 .It "kern.ngroups       integer no
184 .It "kern.job_control   integer no
185 .It "kern.saved_ids     integer no
186 .It "kern.boottime      struct  no
187 .It "kern.domainname    string  yes
188 .It "kern.filedelay     integer yes
189 .It "kern.dirdelay      integer yes
190 .It "kern.metadelay     integer yes
191 .It "kern.osreldate     string  no
192 .It "kern.bootfile      string  yes
193 .It "kern.corefile      string  yes
194 .It "kern.dumpdev       dev_t   yes
195 .It "kern.logsigexit    integer yes
196 .It "vm.loadavg struct  no
197 .It "hw.machine string  no
198 .It "hw.model   string  no
199 .It "hw.ncpu    integer no
200 .It "hw.byteorder       integer no
201 .It "hw.physmem integer no
202 .It "hw.usermem integer no
203 .It "hw.pagesize        integer no
204 .It "hw.floatingpoint   integer no
205 .It "hw.machine_arch    string  no
206 .It "machdep.console_device     dev_t   no
207 .It "machdep.adjkerntz  integer yes
208 .It "machdep.disable_rtc_set    integer yes
209 .It "user.cs_path       string  no
210 .It "user.bc_base_max   integer no
211 .It "user.bc_dim_max    integer no
212 .It "user.bc_scale_max  integer no
213 .It "user.bc_string_max integer no
214 .It "user.coll_weights_max      integer no
215 .It "user.expr_nest_max integer no
216 .It "user.line_max      integer no
217 .It "user.re_dup_max    integer no
218 .It "user.posix2_version        integer no
219 .It "user.posix2_c_bind integer no
220 .It "user.posix2_c_dev  integer no
221 .It "user.posix2_char_term      integer no
222 .It "user.posix2_fort_dev       integer no
223 .It "user.posix2_fort_run       integer no
224 .It "user.posix2_localedef      integer no
225 .It "user.posix2_sw_dev integer no
226 .It "user.posix2_upe    integer no
227 .It "user.stream_max    integer no
228 .It "user.tzname_max    integer no
229 .El
230 .Sh FILES
231 .Bl -tag -width ".Aq Pa netinet/icmp_var.h" -compact
232 .It Aq Pa sys/sysctl.h
233 definitions for top level identifiers, second level kernel and hardware
234 identifiers, and user level identifiers
235 .It Aq Pa sys/socket.h
236 definitions for second level network identifiers
237 .It Aq Pa sys/gmon.h
238 definitions for third level profiling identifiers
239 .It Aq Pa vm/vm_param.h
240 definitions for second level virtual memory identifiers
241 .It Aq Pa netinet/in.h
242 definitions for third level Internet identifiers and
243 fourth level IP identifiers
244 .It Aq Pa netinet/icmp_var.h
245 definitions for fourth level ICMP identifiers
246 .It Aq Pa netinet/udp_var.h
247 definitions for fourth level UDP identifiers
248 .El
249 .Sh EXAMPLES
250 For example, to retrieve the maximum number of processes allowed
251 in the system, one would use the following request:
252 .Pp
253 .Dl "sysctl kern.maxproc"
254 .Pp
255 To set the maximum number of processes allowed
256 per uid to 1000, one would use the following request:
257 .Pp
258 .Dl "sysctl kern.maxprocperuid=1000"
259 .Pp
260 The device used for crash dumps can be specified using:
261 .Pp
262 .Dl "sysctl kern.dumpdev=/dev/somedev"
263 .Pp
264 which is equivalent to
265 .Pp
266 .Dl "dumpon /dev/somedev"
267 .Pp
268 Information about the system clock rate may be obtained with:
269 .Pp
270 .Dl "sysctl kern.clockrate"
271 .Pp
272 Information about the load average history may be obtained with:
273 .Pp
274 .Dl "sysctl vm.loadavg"
275 .Pp
276 More variables than these exist, and the best and likely only place
277 to search for their deeper meaning is undoubtedly the source where
278 they are defined.
279 .Sh COMPATIBILITY
280 The
281 .Fl w
282 option has been deprecated and is silently ignored.
283 .Sh SEE ALSO
284 .Xr sysctl 3 ,
285 .Xr loader.conf 5 ,
286 .Xr sysctl.conf 5 ,
287 .Xr loader 8
288 .Sh HISTORY
289 A
290 .Nm
291 utility first appeared in
292 .Bx 4.4 .
293 .Pp
294 In
295 .Fx 2.2 ,
296 .Nm
297 was significantly remodeled.
298 .Sh BUGS
299 The
300 .Nm
301 utility presently exploits an undocumented interface to the kernel
302 sysctl facility to traverse the sysctl tree and to retrieve format
303 and name information.
304 This correct interface is being thought about for the time being.