Commit | Line | Data |
---|---|---|
a42b3e1b KB |
1 | .\" Copyright (c) 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
a2f6e68d KM |
3 | .\" |
4 | .\" %sccs.include.redist.roff% | |
5 | .\" | |
a42b3e1b | 6 | .\" @(#)sysctl.8 8.1 (Berkeley) %G% |
a2f6e68d KM |
7 | .\" |
8 | .Dd "" | |
9 | .Dt SYSCTL 8 | |
10 | .Os | |
11 | .Sh NAME | |
12 | .Nm sysctl | |
13 | .Nd get or set kernel state | |
14 | .Sh SYNOPSIS | |
15 | .Nm sysctl | |
a9158f3c | 16 | .Op Fl n |
a2f6e68d KM |
17 | .Ar name ... |
18 | .Nm sysctl | |
a9158f3c KM |
19 | .Op Fl n |
20 | .Fl w | |
a2f6e68d KM |
21 | .Ar name=value ... |
22 | .Nm sysctl | |
a9158f3c | 23 | .Op Fl n |
a2f6e68d KM |
24 | .Fl aA |
25 | .Sh DESCRIPTION | |
26 | The | |
27 | .Nm sysctl | |
28 | utility retrieves kernel state and allows processes with | |
29 | appropriate privilege to set kernel state. | |
30 | The state to be retrieved or set is described using a | |
31 | ``Management Information Base'' (``MIB'') style name, | |
32 | described as a dotted set of components. | |
33 | The | |
34 | .Fl a | |
35 | flag can be used to list all the currently available string or integer values. | |
36 | The | |
37 | .Fl A | |
38 | flag will list all the known MIB names including tables. | |
39 | Those with string or integer values will be printed as with the | |
40 | .Fl a | |
41 | flag; for the table values, | |
42 | the name of the utility to retrieve them is given. | |
43 | .Pp | |
a9158f3c KM |
44 | The |
45 | .Fl n | |
46 | flag specifies that the printing of the field name should be | |
47 | suppressed and that only its value should be output. | |
48 | This flag is useful for setting shell variables. | |
49 | For example, to save the pagesize in variable psize, use: | |
50 | .Bd -literal -offset indent -compact | |
51 | set psize=`sysctl -n hw.pagesize` | |
52 | .Ed | |
53 | .Pp | |
a2f6e68d KM |
54 | If just a MIB style name is given, |
55 | the corresponding value is retrieved. | |
56 | If a value is to be set, the | |
57 | .Fl w | |
58 | flag must be specified and the MIB name followed | |
59 | by an equal sign and the new value to be used. | |
60 | .Pp | |
61 | The information available from | |
62 | .Nm sysctl | |
63 | consists of integers, strings, and tables. | |
64 | The tabular information can only be retrieved by special | |
65 | purpose programs such as | |
66 | .Nm ps , | |
67 | .Nm systat , | |
68 | and | |
69 | .Nm netstat . | |
8fd129b4 KM |
70 | The string and integer information is summaried below. |
71 | For a detailed description of these variable see | |
72 | .Xr sysctl 3 . | |
a2f6e68d KM |
73 | The changeable column indicates whether a process with appropriate |
74 | privilege can change the value. | |
cc45a638 KM |
75 | .Bl -column net.inet.ip.forwardingxxxxxx integerxxx |
76 | .It Sy Name Type Changeable | |
77 | .It kern.ostype string no | |
78 | .It kern.osrelease string no | |
79 | .It kern.osrevision integer no | |
80 | .It kern.version string no | |
81 | .It kern.maxvnodes integer yes | |
82 | .It kern.maxproc integer yes | |
83 | .It kern.maxfiles integer yes | |
84 | .It kern.argmax integer no | |
85 | .It kern.securelevel integer raise only | |
86 | .It kern.hostname string yes | |
87 | .It kern.hostid integer yes | |
88 | .It kern.clockrate struct no | |
89 | .It kern.posix1version integer no | |
90 | .It kern.ngroups integer no | |
91 | .It kern.job_control integer no | |
92 | .It kern.saved_ids integer no | |
93 | .It kern.link_max integer no | |
94 | .It kern.max_canon integer no | |
95 | .It kern.max_input integer no | |
96 | .It kern.name_max integer no | |
97 | .It kern.path_max integer no | |
98 | .It kern.pipe_buf integer no | |
99 | .It kern.chown_restricted integer no | |
100 | .It kern.no_trunc integer no | |
101 | .It kern.vdisable integer no | |
ec88f0bb | 102 | .It kern.boottime struct no |
cc45a638 | 103 | .It vm.loadavg struct no |
a5aff51d | 104 | .It machdep.console_device dev_t no |
cc45a638 KM |
105 | .It net.inet.ip.forwarding integer yes |
106 | .It net.inet.ip.redirect integer yes | |
107 | .It net.inet.ip.ttl integer yes | |
108 | .It net.inet.icmp.maskrepl integer yes | |
109 | .It net.inet.udp.checksum integer yes | |
110 | .It hw.machine string no | |
111 | .It hw.model string no | |
112 | .It hw.ncpu integer no | |
113 | .It hw.byteorder integer no | |
114 | .It hw.physmem integer no | |
115 | .It hw.usermem integer no | |
116 | .It hw.pagesize integer no | |
117 | .It user.cs_path string no | |
118 | .It user.bc_base_max integer no | |
119 | .It user.bc_dim_max integer no | |
120 | .It user.bc_scale_max integer no | |
121 | .It user.bc_string_max integer no | |
122 | .It user.coll_weights_max integer no | |
123 | .It user.expr_nest_max integer no | |
124 | .It user.line_max integer no | |
125 | .It user.re_dup_max integer no | |
126 | .It user.posix2_version integer no | |
127 | .It user.posix2_c_bind integer no | |
128 | .It user.posix2_c_dev integer no | |
129 | .It user.posix2_char_term integer no | |
130 | .It user.posix2_fort_dev integer no | |
131 | .It user.posix2_fort_run integer no | |
132 | .It user.posix2_localedef integer no | |
133 | .It user.posix2_sw_dev integer no | |
134 | .It user.posix2_upe integer no | |
a2f6e68d KM |
135 | .El |
136 | .Sh EXAMPLES | |
137 | .Pp | |
138 | For example, to retrieve the maximum number of processes allowed | |
139 | in the system, one would use the follow request: | |
140 | .Bd -literal -offset indent -compact | |
141 | sysctl kern.maxproc | |
142 | .Ed | |
143 | .Pp | |
144 | To set the maximum number of processes allowed | |
145 | in the system to 1000, one would use the follow request: | |
146 | .Bd -literal -offset indent -compact | |
147 | sysctl -w kern.maxproc=1000 | |
148 | .Ed | |
149 | .Pp | |
150 | Information about the system clock rate may be obtained with: | |
151 | .Bd -literal -offset indent -compact | |
152 | sysctl kern.clockrate | |
153 | .Ed | |
154 | .Pp | |
155 | Information about the load average history may be obtained with | |
156 | .Bd -literal -offset indent -compact | |
157 | sysctl vm.loadavg | |
158 | .Ed | |
159 | .Sh FILES | |
cc45a638 | 160 | .Bl -tag -width <netinet/icmpXvar.h> -compact |
a2f6e68d | 161 | .It Pa <sys/sysctl.h> |
cc45a638 KM |
162 | definitions for top level identifiers, second level kernel and hardware |
163 | identifiers, and user level identifiers | |
a2f6e68d KM |
164 | .It Pa <sys/socket.h> |
165 | definitions for second level network identifiers | |
cc45a638 KM |
166 | .It Pa <sys/gmon.h> |
167 | definitions for third level profiling identifiers | |
a2f6e68d KM |
168 | .It Pa <vm/vm_param.h> |
169 | definitions for second level virtual memory identifiers | |
cc45a638 KM |
170 | .It Pa <netinet/in.h> |
171 | definitions for third level Internet identifiers and | |
172 | fourth level IP identifiers | |
173 | .It Pa <netinet/icmp_var.h> | |
174 | definitions for fourth level ICMP identifiers | |
175 | .It Pa <netinet/udp_var.h> | |
176 | definitions for fourth level UDP identifiers | |
a2f6e68d KM |
177 | .El |
178 | .Sh SEE ALSO | |
cc45a638 | 179 | .Xr sysctl 3 |
a2f6e68d KM |
180 | .Sh HISTORY |
181 | .Nm sysctl | |
182 | first appeared in 4.4BSD. |