]> git.saurik.com Git - apple/system_cmds.git/blob - sysctl.tproj/sysctl.8
system_cmds-336.tar.gz
[apple/system_cmds.git] / sysctl.tproj / 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 .\" @(#)sysctl.8 8.2 (Berkeley) 5/9/95
33 .\"
34 .Dd "May 9, 1995"
35 .Dt SYSCTL 8
36 .Os
37 .Sh NAME
38 .Nm sysctl
39 .Nd get or set kernel state
40 .Sh SYNOPSIS
41 .Nm sysctl
42 .Op Fl bn
43 .Ar name ...
44 .Nm sysctl
45 .Op Fl bn
46 .Fl w
47 .Ar name=value ...
48 .Nm sysctl
49 .Op Fl bn
50 .Fl a
51 .Nm sysctl
52 .Op Fl bn
53 .Fl A
54 .Nm sysctl
55 .Op Fl bn
56 .Fl X
57 .Sh DESCRIPTION
58 The
59 .Nm sysctl
60 utility retrieves kernel state and allows processes with
61 appropriate privilege to set kernel state.
62 The state to be retrieved or set is described using a
63 ``Management Information Base'' (``MIB'') style name,
64 described as a dotted set of components.
65 .Pp
66 The following options are available:
67 .Bl -tag -width indent
68 .It Fl A
69 List all MIB variables including opaque variables (which are normally suppressed).
70 The format and length are printed, as well as a hex dump of the first sixteen bytes of the value.
71 .It Fl a
72 List all the currently available non-opaque values.
73 This option is ignored if one or more variable names are specified on
74 the command line.
75 .It Fl b
76 Force the value of the variable(s) to be output in raw, binary format.
77 No names are printed and no terminating newlines are output.
78 This is mostly useful with a single variable.
79 .It Fl n
80 Show only variable values, not their names.
81 This option is useful for setting shell variables.
82 For instance, to save the pagesize in variable
83 .Va psize ,
84 use:
85 .Pp
86 .Dl "set psize=`sysctl -n hw.pagesize`"
87 .It Fl X
88 Same as
89 .Fl A
90 but prints a hex dump of the entire value instead of just the first few bytes.
91 .It Fl w Ar name=value
92 Used to set values. The MIB name (
93 .Ar name
94 ) followed by an equal sign and the new value (
95 .Ar value
96 ) to be used.
97 .El
98 .Pp
99 If just a MIB style name is given,
100 the corresponding value is retrieved.
101 .Pp
102 The information available from
103 .Nm sysctl
104 consists of integers, strings, and tables.
105 The tabular information can only be retrieved by special
106 purpose programs such as
107 .Nm ps ,
108 .Nm systat ,
109 and
110 .Nm netstat .
111 The string and integer information is summarized below.
112 For a detailed description of these variable see
113 .Xr sysctl 3 .
114 The changeable column indicates whether a process with appropriate
115 privilege can change the value.
116 .Bl -column net.inet.ip.forwardingxxxxxx integerxxx
117 .It Sy Name Type Changeable
118 .It kern.ostype string no
119 .It kern.osrelease string no
120 .It kern.osrevision integer no
121 .It kern.version string no
122 .It kern.maxvnodes integer yes
123 .It kern.maxproc integer yes
124 .It kern.maxfiles integer yes
125 .It kern.argmax integer no
126 .It kern.securelevel integer raise only
127 .It kern.hostname string yes
128 .It kern.hostid integer yes
129 .It kern.clockrate struct no
130 .It kern.posix1version integer no
131 .It kern.ngroups integer no
132 .It kern.job_control integer no
133 .It kern.saved_ids integer no
134 .It kern.link_max integer no
135 .It kern.max_canon integer no
136 .It kern.max_input integer no
137 .It kern.name_max integer no
138 .It kern.path_max integer no
139 .It kern.pipe_buf integer no
140 .It kern.chown_restricted integer no
141 .It kern.no_trunc integer no
142 .It kern.vdisable integer no
143 .It kern.boottime struct no
144 .It vm.loadavg struct no
145 .It vm.swapusage struct no
146 .It machdep.console_device dev_t no
147 .It net.inet.ip.forwarding integer yes
148 .It net.inet.ip.redirect integer yes
149 .It net.inet.ip.ttl integer yes
150 .It net.inet.icmp.maskrepl integer yes
151 .It net.inet.udp.checksum integer yes
152 .It hw.machine string no
153 .It hw.model string no
154 .It hw.ncpu integer no
155 .It hw.byteorder integer no
156 .It hw.physmem integer no
157 .It hw.usermem integer no
158 .It hw.pagesize integer no
159 .It user.cs_path string no
160 .It user.bc_base_max integer no
161 .It user.bc_dim_max integer no
162 .It user.bc_scale_max integer no
163 .It user.bc_string_max integer no
164 .It user.coll_weights_max integer no
165 .It user.expr_nest_max integer no
166 .It user.line_max integer no
167 .It user.re_dup_max integer no
168 .It user.posix2_version integer no
169 .It user.posix2_c_bind integer no
170 .It user.posix2_c_dev integer no
171 .It user.posix2_char_term integer no
172 .It user.posix2_fort_dev integer no
173 .It user.posix2_fort_run integer no
174 .It user.posix2_localedef integer no
175 .It user.posix2_sw_dev integer no
176 .It user.posix2_upe integer no
177 .El
178 .Pp
179 The
180 .Nm sysctl
181 program can get or set debugging variables
182 that have been identified for its display.
183 This information can be obtained by using the command:
184 .Bd -literal -offset indent
185 sysctl debug
186 .Ed
187 In addition,
188 .Nm sysctl
189 can extract information about the filesystems that have been compiled
190 into the running system.
191 This information can be obtained by using the command:
192 .Bd -literal -offset indent
193 sysctl vfs
194 .Ed
195 By default, only filesystems that are actively being used are listed.
196 Use of the
197 .Fl A
198 flag lists all the filesystems compiled into the running kernel.
199 .Sh EXAMPLES
200 .Pp
201 For example, to retrieve the maximum number of processes allowed
202 in the system, one would use the follow request:
203 .Bd -literal -offset indent -compact
204 sysctl kern.maxproc
205 .Ed
206 .Pp
207 To set the maximum number of processes allowed
208 in the system to 1000, one would use the follow request:
209 .Bd -literal -offset indent -compact
210 sysctl -w kern.maxproc=1000
211 .Ed
212 .Pp
213 Information about the system clock rate may be obtained with:
214 .Bd -literal -offset indent -compact
215 sysctl kern.clockrate
216 .Ed
217 .Pp
218 Information about the load average history may be obtained with:
219 .Bd -literal -offset indent -compact
220 sysctl vm.loadavg
221 .Ed
222 .Pp
223 Information about the system's swap space usage may be obtained with:
224 .Bd -literal -offset indent -compact
225 sysctl vm.swapusage
226 .Ed
227 .Sh FILES
228 .Bl -tag -width <netinet/icmpXvar.h> -compact
229 .It Pa <sys/sysctl.h>
230 definitions for top level identifiers, second level kernel and hardware
231 identifiers, and user level identifiers
232 .It Pa <sys/socket.h>
233 definitions for second level network identifiers
234 .It Pa <sys/gmon.h>
235 definitions for third level profiling identifiers
236 .It Pa <vm/vm_param.h>
237 definitions for second level virtual memory identifiers
238 .It Pa <netinet/in.h>
239 definitions for third level Internet identifiers and
240 fourth level IP identifiers
241 .It Pa <netinet/icmp_var.h>
242 definitions for fourth level ICMP identifiers
243 .It Pa <netinet/udp_var.h>
244 definitions for fourth level UDP identifiers
245 .El
246 .Sh SEE ALSO
247 .Xr sysctl 3
248 .Sh HISTORY
249 .Nm sysctl
250 first appeared in 4.4BSD.