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