xref: /original-bsd/usr.sbin/sysctl/sysctl.8 (revision b3c06cab)
1.\" Copyright (c) 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"	@(#)sysctl.8	8.2 (Berkeley) 05/09/95
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
16.Op Fl n
17.Ar name ...
18.Nm sysctl
19.Op Fl n
20.Fl w
21.Ar name=value ...
22.Nm sysctl
23.Op Fl n
24.Fl aA
25.Sh DESCRIPTION
26The
27.Nm sysctl
28utility retrieves kernel state and allows processes with
29appropriate privilege to set kernel state.
30The state to be retrieved or set is described using a
31``Management Information Base'' (``MIB'') style name,
32described as a dotted set of components.
33The
34.Fl a
35flag can be used to list all the currently available string or integer values.
36The
37.Fl A
38flag will list all the known MIB names including tables.
39Those with string or integer values will be printed as with the
40.Fl a
41flag; for the table values,
42the name of the utility to retrieve them is given.
43.Pp
44The
45.Fl n
46flag specifies that the printing of the field name should be
47suppressed and that only its value should be output.
48This flag is useful for setting shell variables.
49For example, to save the pagesize in variable psize, use:
50.Bd -literal -offset indent -compact
51set psize=`sysctl -n hw.pagesize`
52.Ed
53.Pp
54If just a MIB style name is given,
55the corresponding value is retrieved.
56If a value is to be set, the
57.Fl w
58flag must be specified and the MIB name followed
59by an equal sign and the new value to be used.
60.Pp
61The information available from
62.Nm sysctl
63consists of integers, strings, and tables.
64The tabular information can only be retrieved by special
65purpose programs such as
66.Nm ps ,
67.Nm systat ,
68and
69.Nm netstat .
70The string and integer information is summaried below.
71For a detailed description of these variable see
72.Xr sysctl 3 .
73The changeable column indicates whether a process with appropriate
74privilege can change the value.
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
102.It kern.boottime	struct	no
103.It vm.loadavg	struct	no
104.It machdep.console_device	dev_t	no
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
135.El
136.Pp
137The
138.Nm sysctl
139program can get or set debugging variables
140that have been identified for its display.
141This information can be obtained by using the command:
142.Bd -literal -offset indent
143sysctl debug
144.Ed
145In addition,
146.Nm sysctl
147can extract information about the filesystems that have been compiled
148into the running system.
149This information can be obtained by using the command:
150.Bd -literal -offset indent
151sysctl vfs
152.Ed
153By default, only filesystems that are actively being used are listed.
154Use of the
155.Fl A
156flag lists all the filesystems compiled into the running kernel.
157.Sh EXAMPLES
158.Pp
159For example, to retrieve the maximum number of processes allowed
160in the system, one would use the follow request:
161.Bd -literal -offset indent -compact
162sysctl kern.maxproc
163.Ed
164.Pp
165To set the maximum number of processes allowed
166in the system to 1000, one would use the follow request:
167.Bd -literal -offset indent -compact
168sysctl -w kern.maxproc=1000
169.Ed
170.Pp
171Information about the system clock rate may be obtained with:
172.Bd -literal -offset indent -compact
173sysctl kern.clockrate
174.Ed
175.Pp
176Information about the load average history may be obtained with
177.Bd -literal -offset indent -compact
178sysctl vm.loadavg
179.Ed
180.Sh FILES
181.Bl -tag -width <netinet/icmpXvar.h> -compact
182.It Pa <sys/sysctl.h>
183definitions for top level identifiers, second level kernel and hardware
184identifiers, and user level identifiers
185.It Pa <sys/socket.h>
186definitions for second level network identifiers
187.It Pa <sys/gmon.h>
188definitions for third level profiling identifiers
189.It Pa <vm/vm_param.h>
190definitions for second level virtual memory identifiers
191.It Pa <netinet/in.h>
192definitions for third level Internet identifiers and
193fourth level IP identifiers
194.It Pa <netinet/icmp_var.h>
195definitions for fourth level ICMP identifiers
196.It Pa <netinet/udp_var.h>
197definitions for fourth level UDP identifiers
198.El
199.Sh SEE ALSO
200.Xr sysctl 3
201.Sh HISTORY
202.Nm sysctl
203first appeared in 4.4BSD.
204