xref: /freebsd/sbin/sysctl/sysctl.8 (revision 97a00e767aac7370c77dc1bdb540d6a98d70c182)
1dea673e9SRodney W. Grimes.\" Copyright (c) 1993
2dea673e9SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3dea673e9SRodney W. Grimes.\"
4dea673e9SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5dea673e9SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6dea673e9SRodney W. Grimes.\" are met:
7dea673e9SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8dea673e9SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9dea673e9SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10dea673e9SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11dea673e9SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12dea673e9SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
13dea673e9SRodney W. Grimes.\"    must display the following acknowledgement:
14dea673e9SRodney W. Grimes.\"	This product includes software developed by the University of
15dea673e9SRodney W. Grimes.\"	California, Berkeley and its contributors.
16dea673e9SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
17dea673e9SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
18dea673e9SRodney W. Grimes.\"    without specific prior written permission.
19dea673e9SRodney W. Grimes.\"
20dea673e9SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21dea673e9SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22dea673e9SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23dea673e9SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24dea673e9SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25dea673e9SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26dea673e9SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27dea673e9SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28dea673e9SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29dea673e9SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30dea673e9SRodney W. Grimes.\" SUCH DAMAGE.
31dea673e9SRodney W. Grimes.\"
328e3847b2SGarrett Wollman.\"	From: @(#)sysctl.8	8.1 (Berkeley) 6/6/93
337f3dea24SPeter Wemm.\" $FreeBSD$
34dea673e9SRodney W. Grimes.\"
358e3847b2SGarrett Wollman.Dd September 23, 1994
36dea673e9SRodney W. Grimes.Dt SYSCTL 8
37dea673e9SRodney W. Grimes.Os
38dea673e9SRodney W. Grimes.Sh NAME
39dea673e9SRodney W. Grimes.Nm sysctl
40dea673e9SRodney W. Grimes.Nd get or set kernel state
41dea673e9SRodney W. Grimes.Sh SYNOPSIS
427c7fb079SRuslan Ermilov.Nm
432d730c26SDag-Erling Smørgrav.Op Fl bn
44dea673e9SRodney W. Grimes.Ar name ...
457c7fb079SRuslan Ermilov.Nm
461d86b91cSPoul-Henning Kamp.Op Fl bn
47dea673e9SRodney W. Grimes.Fl w
48dea673e9SRodney W. Grimes.Ar name=value ...
497c7fb079SRuslan Ermilov.Nm
502d730c26SDag-Erling Smørgrav.Op Fl bn
511d86b91cSPoul-Henning Kamp.Fl aAX
52dea673e9SRodney W. Grimes.Sh DESCRIPTION
53dea673e9SRodney W. GrimesThe
54d9b1bc77SPhilippe Charnier.Nm
55dea673e9SRodney W. Grimesutility retrieves kernel state and allows processes with
56dea673e9SRodney W. Grimesappropriate privilege to set kernel state.
57dea673e9SRodney W. GrimesThe state to be retrieved or set is described using a
58dea673e9SRodney W. Grimes``Management Information Base'' (``MIB'') style name,
59dea673e9SRodney W. Grimesdescribed as a dotted set of components.
601d86b91cSPoul-Henning Kamp.Pp
61d9b1bc77SPhilippe CharnierThe following options are available:
62d9b1bc77SPhilippe Charnier.Bl -tag -width indent
63d9b1bc77SPhilippe Charnier.It Fl a
64d9b1bc77SPhilippe CharnierList all the currently available string or integer values.
65d9b1bc77SPhilippe Charnier.It Fl A
66d9b1bc77SPhilippe CharnierList all the known MIB names including opaques.
67dea673e9SRodney W. GrimesThose with string or integer values will be printed as with the
68dea673e9SRodney W. Grimes.Fl a
691d86b91cSPoul-Henning Kampflag; for the opaque values,
701d86b91cSPoul-Henning Kampinformation about the format and the length is printed in addition the first
711d86b91cSPoul-Henning Kampfew bytes is dumped in hex.
72d9b1bc77SPhilippe Charnier.It Fl X
73d9b1bc77SPhilippe CharnierSame as
741d86b91cSPoul-Henning Kamp.Fl A
751d86b91cSPoul-Henning Kampexcept the entire value of opaque variables is hexdumped.
76d9b1bc77SPhilippe Charnier.It Fl n
77d9b1bc77SPhilippe CharnierSpecify that the printing of the field name should be
78dea673e9SRodney W. Grimessuppressed and that only its value should be output.
79dea673e9SRodney W. GrimesThis flag is useful for setting shell variables.
80dea673e9SRodney W. GrimesFor example, to save the pagesize in variable psize, use:
81dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact
82dea673e9SRodney W. Grimesset psize=`sysctl -n hw.pagesize`
83dea673e9SRodney W. Grimes.Ed
84d9b1bc77SPhilippe Charnier.It Fl b
85d9b1bc77SPhilippe CharnierForce the value of the variable(s) to be output in raw, binary
861d86b91cSPoul-Henning Kampformat.  No names are printed and no terminating newlines are output.
871d86b91cSPoul-Henning KampThis is mostly useful with a single variable.
88d9b1bc77SPhilippe Charnier.It Fl w Ar name=value ...
89d9b1bc77SPhilippe CharnierSet the MIB
90d9b1bc77SPhilippe Charnier.Ar name
91d9b1bc77SPhilippe Charnierto the new
92d9b1bc77SPhilippe Charnier.Ar value .
93d9b1bc77SPhilippe CharnierIf just a MIB style
94d9b1bc77SPhilippe Charnier.Ar name
95d9b1bc77SPhilippe Charnieris given,
96dea673e9SRodney W. Grimesthe corresponding value is retrieved.
97d9b1bc77SPhilippe Charnier.El
98dea673e9SRodney W. Grimes.Pp
99dea673e9SRodney W. GrimesThe information available from
100d9b1bc77SPhilippe Charnier.Nm
1011d86b91cSPoul-Henning Kampconsists of integers, strings, and opaques.
102d9b1bc77SPhilippe Charnier.Nm Sysctl
1031d86b91cSPoul-Henning Kamponly knows about a couple of opaque types, and will resort to hexdumps
1041d86b91cSPoul-Henning Kampfor the rest.
1051d86b91cSPoul-Henning KampThe opaque information is much more useful if retrieved by special
106dea673e9SRodney W. Grimespurpose programs such as
107dea673e9SRodney W. Grimes.Nm ps ,
108dea673e9SRodney W. Grimes.Nm systat ,
109dea673e9SRodney W. Grimesand
110dea673e9SRodney W. Grimes.Nm netstat .
1111d86b91cSPoul-Henning Kamp.Pp
1124a8d0283SMike PritchardThe string and integer information is summarized below.
113dea673e9SRodney W. GrimesFor a detailed description of these variable see
114dea673e9SRodney W. Grimes.Xr sysctl 3 .
1151d86b91cSPoul-Henning Kamp.Pp
116dea673e9SRodney W. GrimesThe changeable column indicates whether a process with appropriate
117dea673e9SRodney W. Grimesprivilege can change the value.
118dea673e9SRodney W. Grimes.Bl -column net.inet.ip.forwardingxxxxxx integerxxx
119dea673e9SRodney W. Grimes.It Sy Name	Type	Changeable
120dea673e9SRodney W. Grimes.It kern.ostype	string	no
121dea673e9SRodney W. Grimes.It kern.osrelease	string	no
122dea673e9SRodney W. Grimes.It kern.osrevision	integer	no
123dea673e9SRodney W. Grimes.It kern.version	string	no
124dea673e9SRodney W. Grimes.It kern.maxvnodes	integer	yes
1251c4d6295SJoseph Koshy.It kern.maxproc	integer	no
126e6373c9eSGuido van Rooij.It kern.maxprocperuid	integer	yes
127dea673e9SRodney W. Grimes.It kern.maxfiles	integer	yes
128e6373c9eSGuido van Rooij.It kern.maxfilesperproc	integer	yes
129dea673e9SRodney W. Grimes.It kern.argmax	integer	no
13069a45189SRobert Watson.It kern.suser_permitted	integer	yes
131dea673e9SRodney W. Grimes.It kern.securelevel	integer	raise only
132dea673e9SRodney W. Grimes.It kern.hostname	string	yes
133dea673e9SRodney W. Grimes.It kern.hostid	integer	yes
134dea673e9SRodney W. Grimes.It kern.clockrate	struct	no
135dea673e9SRodney W. Grimes.It kern.posix1version	integer	no
136dea673e9SRodney W. Grimes.It kern.ngroups	integer	no
137dea673e9SRodney W. Grimes.It kern.job_control	integer	no
138dea673e9SRodney W. Grimes.It kern.saved_ids	integer	no
139dea673e9SRodney W. Grimes.It kern.boottime	struct	no
1408e3847b2SGarrett Wollman.It kern.domainname	string	yes
141733144d9SSheldon Hearn.It kern.filedelay	integer	yes
142733144d9SSheldon Hearn.It kern.dirdelay	integer	yes
143733144d9SSheldon Hearn.It kern.metadelay	integer	yes
1448e3847b2SGarrett Wollman.It kern.osreldate	string	no
1458e3847b2SGarrett Wollman.It kern.bootfile	string	yes
146aa81f3a9SJoerg Wunsch.It kern.corefile	string	yes
14762052b46SJoerg Wunsch.It kern.logsigexit	integer	yes
148dea673e9SRodney W. Grimes.It vm.loadavg	struct	no
149dea673e9SRodney W. Grimes.It hw.machine	string	no
150dea673e9SRodney W. Grimes.It hw.model	string	no
151dea673e9SRodney W. Grimes.It hw.ncpu	integer	no
152dea673e9SRodney W. Grimes.It hw.byteorder	integer	no
153dea673e9SRodney W. Grimes.It hw.physmem	integer	no
154dea673e9SRodney W. Grimes.It hw.usermem	integer	no
155dea673e9SRodney W. Grimes.It hw.pagesize	integer	no
1568e3847b2SGarrett Wollman.It hw.floatingpoint	integer	no
157d1d9bf7eSKATO Takenori.It hw.machine_arch	string	no
1585a663072SAndrey A. Chernov.It machdep.console_device	dev_t	no
1595a663072SAndrey A. Chernov.It machdep.adjkerntz	integer	yes
1605a663072SAndrey A. Chernov.It machdep.disable_rtc_set	integer	yes
161dea673e9SRodney W. Grimes.It user.cs_path	string	no
162dea673e9SRodney W. Grimes.It user.bc_base_max	integer	no
163dea673e9SRodney W. Grimes.It user.bc_dim_max	integer	no
164dea673e9SRodney W. Grimes.It user.bc_scale_max	integer	no
165dea673e9SRodney W. Grimes.It user.bc_string_max	integer	no
166dea673e9SRodney W. Grimes.It user.coll_weights_max	integer	no
167dea673e9SRodney W. Grimes.It user.expr_nest_max	integer	no
168dea673e9SRodney W. Grimes.It user.line_max	integer	no
169dea673e9SRodney W. Grimes.It user.re_dup_max	integer	no
170dea673e9SRodney W. Grimes.It user.posix2_version	integer	no
171dea673e9SRodney W. Grimes.It user.posix2_c_bind	integer	no
172dea673e9SRodney W. Grimes.It user.posix2_c_dev	integer	no
173dea673e9SRodney W. Grimes.It user.posix2_char_term	integer	no
174dea673e9SRodney W. Grimes.It user.posix2_fort_dev	integer	no
175dea673e9SRodney W. Grimes.It user.posix2_fort_run	integer	no
176dea673e9SRodney W. Grimes.It user.posix2_localedef	integer	no
177dea673e9SRodney W. Grimes.It user.posix2_sw_dev	integer	no
178dea673e9SRodney W. Grimes.It user.posix2_upe	integer	no
179750f8dc9SBruce Evans.It user.stream_max	integer	no
180750f8dc9SBruce Evans.It user.tzname_max	integer	no
181dea673e9SRodney W. Grimes.El
182dea673e9SRodney W. Grimes.Sh EXAMPLES
183dea673e9SRodney W. GrimesFor example, to retrieve the maximum number of processes allowed
184b91e5f67SSteve Pricein the system, one would use the following request:
185dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact
186dea673e9SRodney W. Grimessysctl kern.maxproc
187dea673e9SRodney W. Grimes.Ed
188dea673e9SRodney W. Grimes.Pp
189dea673e9SRodney W. GrimesTo set the maximum number of processes allowed
190b91e5f67SSteve Priceper uid to 1000, one would use the following request:
191dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact
1921c4d6295SJoseph Koshysysctl -w kern.maxprocperuid=1000
193dea673e9SRodney W. Grimes.Ed
194dea673e9SRodney W. Grimes.Pp
195dea673e9SRodney W. GrimesInformation about the system clock rate may be obtained with:
196dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact
197dea673e9SRodney W. Grimessysctl kern.clockrate
198dea673e9SRodney W. Grimes.Ed
199dea673e9SRodney W. Grimes.Pp
200d9b1bc77SPhilippe CharnierInformation about the load average history may be obtained with:
201dea673e9SRodney W. Grimes.Bd -literal -offset indent -compact
202dea673e9SRodney W. Grimessysctl vm.loadavg
203dea673e9SRodney W. Grimes.Ed
2041d86b91cSPoul-Henning Kamp.Pp
2051d86b91cSPoul-Henning KampMore variables than these exist, and the best and likely only place
2061d86b91cSPoul-Henning Kampto search for their deeper meaning is undoubtedly the source where
2071d86b91cSPoul-Henning Kampthey are defined.
208dea673e9SRodney W. Grimes.Sh FILES
209dea673e9SRodney W. Grimes.Bl -tag -width <netinet/icmpXvar.h> -compact
210dea673e9SRodney W. Grimes.It Pa <sys/sysctl.h>
211dea673e9SRodney W. Grimesdefinitions for top level identifiers, second level kernel and hardware
212dea673e9SRodney W. Grimesidentifiers, and user level identifiers
213dea673e9SRodney W. Grimes.It Pa <sys/socket.h>
214dea673e9SRodney W. Grimesdefinitions for second level network identifiers
215dea673e9SRodney W. Grimes.It Pa <sys/gmon.h>
216dea673e9SRodney W. Grimesdefinitions for third level profiling identifiers
217dea673e9SRodney W. Grimes.It Pa <vm/vm_param.h>
218dea673e9SRodney W. Grimesdefinitions for second level virtual memory identifiers
219dea673e9SRodney W. Grimes.It Pa <netinet/in.h>
220dea673e9SRodney W. Grimesdefinitions for third level Internet identifiers and
221dea673e9SRodney W. Grimesfourth level IP identifiers
222dea673e9SRodney W. Grimes.It Pa <netinet/icmp_var.h>
223dea673e9SRodney W. Grimesdefinitions for fourth level ICMP identifiers
224dea673e9SRodney W. Grimes.It Pa <netinet/udp_var.h>
225dea673e9SRodney W. Grimesdefinitions for fourth level UDP identifiers
226dea673e9SRodney W. Grimes.El
227dea673e9SRodney W. Grimes.Sh SEE ALSO
22897a00e76SAlexey Zelkin.Xr sysctl 3 ,
22997a00e76SAlexey Zelkin.Xr blackhole 4 ,
2302cd4f9e1SDavid E. O'Brien.Xr sysctl.conf 5
2311d86b91cSPoul-Henning Kamp.Sh BUGS
232d9b1bc77SPhilippe Charnier.Nm Sysctl
2331d86b91cSPoul-Henning Kamppresently exploits an undocumented interface to the kernel
2344a8d0283SMike Pritchardsysctl facility to traverse the sysctl tree and to retrieve format
2351d86b91cSPoul-Henning Kampand name information.
2361d86b91cSPoul-Henning KampThis correct interface is being thought about for the time being.
237dea673e9SRodney W. Grimes.Sh HISTORY
238d9b1bc77SPhilippe Charnier.Nm Sysctl
23985cf659aSMike Pritchardfirst appeared in
24085cf659aSMike Pritchard.Bx 4.4 .
2411d86b91cSPoul-Henning Kamp.Pp
24285cf659aSMike PritchardIn
243d9b1bc77SPhilippe Charnier.Fx 2.2 ,
244d9b1bc77SPhilippe Charnier.Nm
24585cf659aSMike Pritchardwas significantly remodeled.
246