]> git.saurik.com Git - apple/system_cmds.git/blob - sysctl.tproj/sysctl.8
system_cmds-279.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 machdep.console_device dev_t no
146 .It net.inet.ip.forwarding integer yes
147 .It net.inet.ip.redirect integer yes
148 .It net.inet.ip.ttl integer yes
149 .It net.inet.icmp.maskrepl integer yes
150 .It net.inet.udp.checksum integer yes
151 .It hw.machine string no
152 .It hw.model string no
153 .It hw.ncpu integer no
154 .It hw.byteorder integer no
155 .It hw.physmem integer no
156 .It hw.usermem integer no
157 .It hw.pagesize integer no
158 .It user.cs_path string no
159 .It user.bc_base_max integer no
160 .It user.bc_dim_max integer no
161 .It user.bc_scale_max integer no
162 .It user.bc_string_max integer no
163 .It user.coll_weights_max integer no
164 .It user.expr_nest_max integer no
165 .It user.line_max integer no
166 .It user.re_dup_max integer no
167 .It user.posix2_version integer no
168 .It user.posix2_c_bind integer no
169 .It user.posix2_c_dev integer no
170 .It user.posix2_char_term integer no
171 .It user.posix2_fort_dev integer no
172 .It user.posix2_fort_run integer no
173 .It user.posix2_localedef integer no
174 .It user.posix2_sw_dev integer no
175 .It user.posix2_upe integer no
176 .El
177 .Pp
178 The
179 .Nm sysctl
180 program can get or set debugging variables
181 that have been identified for its display.
182 This information can be obtained by using the command:
183 .Bd -literal -offset indent
184 sysctl debug
185 .Ed
186 In addition,
187 .Nm sysctl
188 can extract information about the filesystems that have been compiled
189 into the running system.
190 This information can be obtained by using the command:
191 .Bd -literal -offset indent
192 sysctl vfs
193 .Ed
194 By default, only filesystems that are actively being used are listed.
195 Use of the
196 .Fl A
197 flag lists all the filesystems compiled into the running kernel.
198 .Sh EXAMPLES
199 .Pp
200 For example, to retrieve the maximum number of processes allowed
201 in the system, one would use the follow request:
202 .Bd -literal -offset indent -compact
203 sysctl kern.maxproc
204 .Ed
205 .Pp
206 To set the maximum number of processes allowed
207 in the system to 1000, one would use the follow request:
208 .Bd -literal -offset indent -compact
209 sysctl -w kern.maxproc=1000
210 .Ed
211 .Pp
212 Information about the system clock rate may be obtained with:
213 .Bd -literal -offset indent -compact
214 sysctl kern.clockrate
215 .Ed
216 .Pp
217 Information about the load average history may be obtained with
218 .Bd -literal -offset indent -compact
219 sysctl vm.loadavg
220 .Ed
221 .Sh FILES
222 .Bl -tag -width <netinet/icmpXvar.h> -compact
223 .It Pa <sys/sysctl.h>
224 definitions for top level identifiers, second level kernel and hardware
225 identifiers, and user level identifiers
226 .It Pa <sys/socket.h>
227 definitions for second level network identifiers
228 .It Pa <sys/gmon.h>
229 definitions for third level profiling identifiers
230 .It Pa <vm/vm_param.h>
231 definitions for second level virtual memory identifiers
232 .It Pa <netinet/in.h>
233 definitions for third level Internet identifiers and
234 fourth level IP identifiers
235 .It Pa <netinet/icmp_var.h>
236 definitions for fourth level ICMP identifiers
237 .It Pa <netinet/udp_var.h>
238 definitions for fourth level UDP identifiers
239 .El
240 .Sh SEE ALSO
241 .Xr sysctl 3
242 .Sh HISTORY
243 .Nm sysctl
244 first appeared in 4.4BSD.