inet6: require RTF_ANNOUNCE to proxy NS
[dragonfly.git] / sbin / sysctl / sysctl.8
blobb91b5a1f3bbc967a70a2aac7a0f53d9ec8981754
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. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     From: @(#)sysctl.8      8.1 (Berkeley) 6/6/93
29 .\" $FreeBSD: src/sbin/sysctl/sysctl.8,v 1.23.2.17 2003/05/19 07:49:34 brueffer Exp $
30 .\"
31 .Dd May 25, 2021
32 .Dt SYSCTL 8
33 .Os
34 .Sh NAME
35 .Nm sysctl
36 .Nd get or set kernel state
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl AbdeiNnoqwxX
40 .Ar name Ns Op = Ns Ar value
41 .Ar ...
42 .Nm
43 .Op Fl bdeiNnoqwxX
44 .Fl a
45 .Sh DESCRIPTION
46 The
47 .Nm
48 utility retrieves kernel state and allows processes with appropriate
49 privilege to set kernel state.
50 The state to be retrieved or set is described using a
51 .Dq Management Information Base
52 .Pq Dq MIB
53 style name, described as a dotted set of
54 components.
55 .Pp
56 The following options are available:
57 .Bl -tag -width indent
58 .It Fl A
59 Equivalent to
60 .Fl o a
61 (for compatibility).
62 .It Fl a
63 List all the currently available non-opaque values.
64 This option is ignored if one or more variable names are specified on
65 the command line.
66 .It Fl b
67 Force the value of the variable(s) to be output in raw, binary format.
68 No names are printed and no terminating newlines are output.
69 This is mostly useful with a single variable.
70 .It Fl d
71 Print the description of the variable instead of its value.
72 .It Fl e
73 Separate the name and the value of the variable(s) with
74 .Ql = .
75 This is useful for producing output which can be fed back to the
76 .Nm
77 utility.
78 This option is ignored if either
79 .Fl N
81 .Fl n
82 is specified, or a variable is being set.
83 .It Fl i
84 Exit cleanly (exit code 0) with no output if the sysctl does not exist.
85 .It Fl N
86 Show only variable names, not their values.
87 This is particularly useful with shells that offer programmable
88 completion.
89 To enable completion of variable names in
90 .Nm zsh ,
91 use the following code:
92 .Bd -literal -offset indent
93 listsysctls () { set -A reply $(sysctl -AN ${1%.*}) }
94 compctl -K listsysctls sysctl
95 .Ed
96 .It Fl n
97 Show only variable values, not their names.
98 This option is useful for setting shell variables.
99 For instance, to save the pagesize in variable
100 .Va psize ,
101 use:
103 .Dl "set psize=`sysctl -n hw.pagesize`"
104 .It Fl o
105 Show opaque variables (which are normally suppressed).
106 The format and length are printed, as well as a hex dump of the first
107 sixteen bytes of the value.
108 .It Fl q
109 Exit (exit code N) with no output if the sysctl does not exist.  Each
110 failed mib on the command line increments N.
111 .It Fl w
112 Ignored (for compatibility).
113 .It Fl X
114 Equivalent to
115 .Fl x a
116 (for compatibility).
117 .It Fl x
119 .Fl o ,
120 but prints a hex dump of the entire value instead of just the first
121 few bytes.
124 The information available from
126 consists of integers, strings, devices
127 .Pq Vt dev_t ,
128 and opaque types.
131 utility
132 only knows about a couple of opaque types, and will resort to hexdumps
133 for the rest.
134 The opaque information is much more useful if retrieved by special
135 purpose programs such as
136 .Nm ps ,
137 .Nm systat
139 .Nm netstat .
141 Some of the variables which cannot be modified during normal system
142 operation can be initialized via
143 .Xr loader 8
144 tunables.
145 This can for example be done by setting them in
146 .Xr loader.conf 5 .
147 Please refer to
148 .Xr loader.conf 5
149 for more information on which tunables are available and how to set them.
151 The string and integer information is summarized below.
152 For a detailed description of these variable see
153 .Xr sysctl 3 .
155 The changeable column indicates whether a process with appropriate
156 privilege can change the value.
157 String, integer, and devices values can be set using
158 .Nm .
159 For device values,
160 .Cm value
161 can be specified as a character device special file name.
162 Special values
163 .Cm off
165 .Ar none
166 denote
167 .Dq no device .
168 .Bl -column net.inet.ip.forwardingxxxxxx integerxxx
169 .It Sy "Name    Type    Changeable"
170 .It "kern.ostype        string  no"
171 .It "kern.osrelease     string  no"
172 .It "kern.osrevision    integer no"
173 .It "kern.version       string  no"
174 .It "kern.maxvnodes     integer yes"
175 .It "kern.maxproc       integer no"
176 .It "kern.maxprocperuid integer yes"
177 .It "kern.maxfiles      integer yes"
178 .It "kern.maxfilesperproc       integer yes"
179 .It "kern.argmax        integer no"
180 .It "kern.securelevel   integer raise only"
181 .It "kern.hostname      string  yes"
182 .It "kern.hostid        integer yes"
183 .It "kern.clockrate     struct  no"
184 .It "kern.posix1version integer no"
185 .It "kern.ngroups       integer no"
186 .It "kern.job_control   integer no"
187 .It "kern.saved_ids     integer no"
188 .It "kern.boottime      struct  no"
189 .It "kern.domainname    string  yes"
190 .It "kern.filedelay     integer yes"
191 .It "kern.dirdelay      integer yes"
192 .It "kern.metadelay     integer yes"
193 .It "kern.osreldate     integer no"
194 .It "kern.bootfile      string  yes"
195 .It "kern.corefile      string  yes"
196 .It "kern.dumpdev       dev_t   yes"
197 .It "kern.logsigexit    integer yes"
198 .It "vm.loadavg struct  no"
199 .It "hw.machine string  no"
200 .It "hw.model   string  no"
201 .It "hw.ncpu    integer no"
202 .It "hw.byteorder       integer no"
203 .It "hw.physmem integer no"
204 .It "hw.usermem integer no"
205 .It "hw.pagesize        integer no"
206 .It "hw.floatingpoint   integer no"
207 .It "hw.machine_arch    string  no"
208 .It "hw.sensors.<xname>.<type><numt>    struct  no"
209 .It "machdep.console_device     dev_t   no"
210 .It "machdep.adjkerntz  integer yes"
211 .It "machdep.disable_rtc_set    integer yes"
212 .It "user.cs_path       string  no"
213 .It "user.bc_base_max   integer no"
214 .It "user.bc_dim_max    integer no"
215 .It "user.bc_scale_max  integer no"
216 .It "user.bc_string_max integer no"
217 .It "user.coll_weights_max      integer no"
218 .It "user.expr_nest_max integer no"
219 .It "user.line_max      integer no"
220 .It "user.re_dup_max    integer no"
221 .It "user.posix2_version        integer no"
222 .It "user.posix2_c_bind integer no"
223 .It "user.posix2_c_dev  integer no"
224 .It "user.posix2_char_term      integer no"
225 .It "user.posix2_fort_dev       integer no"
226 .It "user.posix2_fort_run       integer no"
227 .It "user.posix2_localedef      integer no"
228 .It "user.posix2_sw_dev integer no"
229 .It "user.posix2_upe    integer no"
230 .It "user.stream_max    integer no"
231 .It "user.tzname_max    integer no"
233 .Sh FILES
234 .Bl -tag -width ".In netinet/icmp_var.h" -compact
235 .It In sys/sysctl.h
236 definitions for top level identifiers, second level kernel and hardware
237 identifiers, and user level identifiers
238 .It In sys/socket.h
239 definitions for second level network identifiers
240 .It In sys/gmon.h
241 definitions for third level profiling identifiers
242 .It In vm/vm_param.h
243 definitions for second level virtual memory identifiers
244 .It In netinet/in.h
245 definitions for third level Internet identifiers and
246 fourth level IP identifiers
247 .It In netinet/icmp_var.h
248 definitions for fourth level ICMP identifiers
249 .It In netinet/udp_var.h
250 definitions for fourth level UDP identifiers
252 .Sh EXAMPLES
253 For example, to retrieve the maximum number of processes allowed
254 in the system, one would use the following request:
256 .Dl "sysctl kern.maxproc"
258 To set the maximum number of processes allowed
259 per uid to 1000, one would use the following request:
261 .Dl "sysctl kern.maxprocperuid=1000"
263 The device used for crash dumps can be specified using:
265 .Dl "sysctl kern.dumpdev=/dev/somedev"
267 which is equivalent to
269 .Dl "dumpon /dev/somedev"
271 Information about the system clock rate may be obtained with:
273 .Dl "sysctl kern.clockrate"
275 Information about the load average history may be obtained with:
277 .Dl "sysctl vm.loadavg"
279 More variables than these exist, and the best and likely only place
280 to search for their deeper meaning is undoubtedly the source where
281 they are defined.
282 .Sh COMPATIBILITY
284 .Fl w
285 option has been deprecated and is silently ignored.
286 .Sh SEE ALSO
287 .Xr sysctl 3 ,
288 .Xr loader.conf 5 ,
289 .Xr sysctl.conf 5 ,
290 .Xr loader 8
291 .Sh HISTORY
294 utility first appeared in
295 .Bx 4.4 .
298 .Fx 2.2 ,
300 was significantly remodeled.
301 .Sh BUGS
304 utility presently exploits an undocumented interface to the kernel
305 sysctl facility to traverse the sysctl tree and to retrieve format
306 and name information.
307 This correct interface is being thought about for the time being.