]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/sysctl/sysctl.8
This commit was generated by cvs2svn to compensate for changes in r51885,
[FreeBSD/FreeBSD.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$
34 .\"
35 .Dd September 23, 1994
36 .Dt SYSCTL 8
37 .Os
38 .Sh NAME
39 .Nm sysctl
40 .Nd get or set kernel state
41 .Sh SYNOPSIS
42 .Nm sysctl
43 .Op Fl bdn
44 .Ar name ...
45 .Nm sysctl
46 .Op Fl bn
47 .Fl w
48 .Ar name=value ...
49 .Nm sysctl
50 .Op Fl bdn
51 .Fl aAX
52 .Sh DESCRIPTION
53 The
54 .Nm
55 utility retrieves kernel state and allows processes with
56 appropriate privilege to set kernel state.
57 The state to be retrieved or set is described using a
58 ``Management Information Base'' (``MIB'') style name,
59 described as a dotted set of components.
60 .Pp
61 The following options are available:
62 .Bl -tag -width indent
63 .It Fl a
64 List all the currently available string or integer values.
65 .It Fl A
66 List all the known MIB names including opaques.
67 Those with string or integer values will be printed as with the
68 .Fl a
69 flag; for the opaque values,
70 information about the format and the length is printed in addition the first
71 few bytes is dumped in hex.
72 .It Fl X 
73 Same as
74 .Fl A
75 except the entire value of opaque variables is hexdumped.
76 .It Fl n
77 Specify that the printing of the field name should be
78 suppressed and that only its value should be output.
79 This flag is useful for setting shell variables.
80 For example, to save the pagesize in variable psize, use:
81 .Bd -literal -offset indent -compact
82 set psize=`sysctl -n hw.pagesize`
83 .Ed
84 .It Fl b
85 Force the value of the variable(s) to be output in raw, binary
86 format.  No names are printed and no terminating newlines are output.
87 This is mostly useful with a single variable.
88 .It Fl d
89 Display the description rather than the value of the requested
90 variable(s).
91 .It Fl w Ar name=value ...
92 Set the MIB
93 .Ar name
94 to the new
95 .Ar value .
96 If just a MIB style
97 .Ar name
98 is given,
99 the corresponding value is retrieved.
100 .El
101 .Pp
102 The information available from
103 .Nm
104 consists of integers, strings, and opaques.
105 .Nm Sysctl
106 only knows about a couple of opaque types, and will resort to hexdumps
107 for the rest.
108 The opaque information is much more useful if retrieved by special
109 purpose programs such as
110 .Nm ps ,
111 .Nm systat ,
112 and
113 .Nm netstat .
114 .Pp
115 The string and integer information is summarized below.
116 For a detailed description of these variable see
117 .Xr sysctl 3 .
118 .Pp
119 The changeable column indicates whether a process with appropriate
120 privilege can change the value.
121 .Bl -column net.inet.ip.forwardingxxxxxx integerxxx
122 .It Sy Name     Type    Changeable
123 .It kern.ostype string  no
124 .It kern.osrelease      string  no
125 .It kern.osrevision     integer no
126 .It kern.version        string  no
127 .It kern.maxvnodes      integer yes
128 .It kern.maxproc        integer no
129 .It kern.maxprocperuid  integer yes
130 .It kern.maxfiles       integer yes
131 .It kern.maxfilesperproc        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.boottime       struct  no
142 .It kern.domainname     string  yes
143 .It kern.update integer yes
144 .It kern.osreldate      string  no
145 .It kern.bootfile       string  yes
146 .It kern.corefile       string  yes
147 .It kern.logsigexit     integer yes
148 .It vm.loadavg  struct  no
149 .It hw.machine  string  no
150 .It hw.model    string  no
151 .It hw.ncpu     integer no
152 .It hw.byteorder        integer no
153 .It hw.physmem  integer no
154 .It hw.usermem  integer no
155 .It hw.pagesize integer no
156 .It hw.floatingpoint    integer no
157 .It hw.machine_arch     string  no
158 .It machdep.console_device      dev_t   no
159 .It machdep.adjkerntz   integer yes
160 .It machdep.disable_rtc_set     integer yes
161 .It user.cs_path        string  no
162 .It user.bc_base_max    integer no
163 .It user.bc_dim_max     integer no
164 .It user.bc_scale_max   integer no
165 .It user.bc_string_max  integer no
166 .It user.coll_weights_max       integer no
167 .It user.expr_nest_max  integer no
168 .It user.line_max       integer no
169 .It user.re_dup_max     integer no
170 .It user.posix2_version integer no
171 .It user.posix2_c_bind  integer no
172 .It user.posix2_c_dev   integer no
173 .It user.posix2_char_term       integer no
174 .It user.posix2_fort_dev        integer no
175 .It user.posix2_fort_run        integer no
176 .It user.posix2_localedef       integer no
177 .It user.posix2_sw_dev  integer no
178 .It user.posix2_upe     integer no
179 .It user.stream_max     integer no
180 .It user.tzname_max     integer no
181 .El
182 .Sh EXAMPLES
183 For example, to retrieve the maximum number of processes allowed
184 in the system, one would use the follow request:
185 .Bd -literal -offset indent -compact
186 sysctl kern.maxproc
187 .Ed
188 .Pp
189 To set the maximum number of processes allowed
190 per uid to 1000, one would use the follow request:
191 .Bd -literal -offset indent -compact
192 sysctl -w kern.maxprocperuid=1000
193 .Ed
194 .Pp
195 Information about the system clock rate may be obtained with:
196 .Bd -literal -offset indent -compact
197 sysctl kern.clockrate
198 .Ed
199 .Pp
200 Information about the load average history may be obtained with:
201 .Bd -literal -offset indent -compact
202 sysctl vm.loadavg
203 .Ed
204 .Pp
205 More variables than these exist, and the best and likely only place 
206 to search for their deeper meaning is undoubtedly the source where
207 they are defined.
208 .Sh FILES
209 .Bl -tag -width <netinet/icmpXvar.h> -compact
210 .It Pa <sys/sysctl.h>
211 definitions for top level identifiers, second level kernel and hardware
212 identifiers, and user level identifiers
213 .It Pa <sys/socket.h>
214 definitions for second level network identifiers
215 .It Pa <sys/gmon.h>
216 definitions for third level profiling identifiers
217 .It Pa <vm/vm_param.h>
218 definitions for second level virtual memory identifiers
219 .It Pa <netinet/in.h>
220 definitions for third level Internet identifiers and
221 fourth level IP identifiers
222 .It Pa <netinet/icmp_var.h>
223 definitions for fourth level ICMP identifiers
224 .It Pa <netinet/udp_var.h>
225 definitions for fourth level UDP identifiers
226 .El
227 .Sh SEE ALSO
228 .Xr sysctl 3
229 .Xr blackhole 4
230 .Sh BUGS
231 .Nm Sysctl
232 presently exploits an undocumented interface to the kernel
233 sysctl facility to traverse the sysctl tree and to retrieve format 
234 and name information. 
235 This correct interface is being thought about for the time being.
236 .Sh HISTORY
237 .Nm Sysctl
238 first appeared in
239 .Bx 4.4 .
240 .Pp
241 In 
242 .Fx 2.2 ,
243 .Nm
244 was significantly remodeled.