xref: /original-bsd/usr.sbin/sysctl/sysctl.8 (revision a991fe1f)
176f30379Sbostic.\" Copyright (c) 1993
276f30379Sbostic.\"	The Regents of the University of California.  All rights reserved.
399aed44dSmckusick.\"
499aed44dSmckusick.\" %sccs.include.redist.roff%
599aed44dSmckusick.\"
6*a991fe1fSmckusick.\"	@(#)sysctl.8	8.2 (Berkeley) 05/09/95
799aed44dSmckusick.\"
899aed44dSmckusick.Dd ""
999aed44dSmckusick.Dt SYSCTL 8
1099aed44dSmckusick.Os
1199aed44dSmckusick.Sh NAME
1299aed44dSmckusick.Nm sysctl
1399aed44dSmckusick.Nd get or set kernel state
1499aed44dSmckusick.Sh SYNOPSIS
1599aed44dSmckusick.Nm sysctl
16f41e9959Smckusick.Op Fl n
1799aed44dSmckusick.Ar name ...
1899aed44dSmckusick.Nm sysctl
19f41e9959Smckusick.Op Fl n
20f41e9959Smckusick.Fl w
2199aed44dSmckusick.Ar name=value ...
2299aed44dSmckusick.Nm sysctl
23f41e9959Smckusick.Op Fl n
2499aed44dSmckusick.Fl aA
2599aed44dSmckusick.Sh DESCRIPTION
2699aed44dSmckusickThe
2799aed44dSmckusick.Nm sysctl
2899aed44dSmckusickutility retrieves kernel state and allows processes with
2999aed44dSmckusickappropriate privilege to set kernel state.
3099aed44dSmckusickThe state to be retrieved or set is described using a
3199aed44dSmckusick``Management Information Base'' (``MIB'') style name,
3299aed44dSmckusickdescribed as a dotted set of components.
3399aed44dSmckusickThe
3499aed44dSmckusick.Fl a
3599aed44dSmckusickflag can be used to list all the currently available string or integer values.
3699aed44dSmckusickThe
3799aed44dSmckusick.Fl A
3899aed44dSmckusickflag will list all the known MIB names including tables.
3999aed44dSmckusickThose with string or integer values will be printed as with the
4099aed44dSmckusick.Fl a
4199aed44dSmckusickflag; for the table values,
4299aed44dSmckusickthe name of the utility to retrieve them is given.
4399aed44dSmckusick.Pp
44f41e9959SmckusickThe
45f41e9959Smckusick.Fl n
46f41e9959Smckusickflag specifies that the printing of the field name should be
47f41e9959Smckusicksuppressed and that only its value should be output.
48f41e9959SmckusickThis flag is useful for setting shell variables.
49f41e9959SmckusickFor example, to save the pagesize in variable psize, use:
50f41e9959Smckusick.Bd -literal -offset indent -compact
51f41e9959Smckusickset psize=`sysctl -n hw.pagesize`
52f41e9959Smckusick.Ed
53f41e9959Smckusick.Pp
5499aed44dSmckusickIf just a MIB style name is given,
5599aed44dSmckusickthe corresponding value is retrieved.
5699aed44dSmckusickIf a value is to be set, the
5799aed44dSmckusick.Fl w
5899aed44dSmckusickflag must be specified and the MIB name followed
5999aed44dSmckusickby an equal sign and the new value to be used.
6099aed44dSmckusick.Pp
6199aed44dSmckusickThe information available from
6299aed44dSmckusick.Nm sysctl
6399aed44dSmckusickconsists of integers, strings, and tables.
6499aed44dSmckusickThe tabular information can only be retrieved by special
6599aed44dSmckusickpurpose programs such as
6699aed44dSmckusick.Nm ps ,
6799aed44dSmckusick.Nm systat ,
6899aed44dSmckusickand
6999aed44dSmckusick.Nm netstat .
70b9605661SmckusickThe string and integer information is summaried below.
71b9605661SmckusickFor a detailed description of these variable see
72b9605661Smckusick.Xr sysctl 3 .
7399aed44dSmckusickThe changeable column indicates whether a process with appropriate
7499aed44dSmckusickprivilege can change the value.
7519aa7224Smckusick.Bl -column net.inet.ip.forwardingxxxxxx integerxxx
7619aa7224Smckusick.It Sy Name	Type	Changeable
7719aa7224Smckusick.It kern.ostype	string	no
7819aa7224Smckusick.It kern.osrelease	string	no
7919aa7224Smckusick.It kern.osrevision	integer	no
8019aa7224Smckusick.It kern.version	string	no
8119aa7224Smckusick.It kern.maxvnodes	integer	yes
8219aa7224Smckusick.It kern.maxproc	integer	yes
8319aa7224Smckusick.It kern.maxfiles	integer	yes
8419aa7224Smckusick.It kern.argmax	integer	no
8519aa7224Smckusick.It kern.securelevel	integer	raise only
8619aa7224Smckusick.It kern.hostname	string	yes
8719aa7224Smckusick.It kern.hostid	integer	yes
8819aa7224Smckusick.It kern.clockrate	struct	no
8919aa7224Smckusick.It kern.posix1version	integer	no
9019aa7224Smckusick.It kern.ngroups	integer	no
9119aa7224Smckusick.It kern.job_control	integer	no
9219aa7224Smckusick.It kern.saved_ids	integer	no
9319aa7224Smckusick.It kern.link_max	integer	no
9419aa7224Smckusick.It kern.max_canon	integer	no
9519aa7224Smckusick.It kern.max_input	integer	no
9619aa7224Smckusick.It kern.name_max	integer	no
9719aa7224Smckusick.It kern.path_max	integer	no
9819aa7224Smckusick.It kern.pipe_buf	integer	no
9919aa7224Smckusick.It kern.chown_restricted	integer	no
10019aa7224Smckusick.It kern.no_trunc	integer	no
10119aa7224Smckusick.It kern.vdisable	integer	no
10284d72896Smckusick.It kern.boottime	struct	no
10319aa7224Smckusick.It vm.loadavg	struct	no
1042307fee6Smckusick.It machdep.console_device	dev_t	no
10519aa7224Smckusick.It net.inet.ip.forwarding	integer	yes
10619aa7224Smckusick.It net.inet.ip.redirect	integer	yes
10719aa7224Smckusick.It net.inet.ip.ttl	integer	yes
10819aa7224Smckusick.It net.inet.icmp.maskrepl	integer	yes
10919aa7224Smckusick.It net.inet.udp.checksum	integer	yes
11019aa7224Smckusick.It hw.machine	string	no
11119aa7224Smckusick.It hw.model	string	no
11219aa7224Smckusick.It hw.ncpu	integer	no
11319aa7224Smckusick.It hw.byteorder	integer	no
11419aa7224Smckusick.It hw.physmem	integer	no
11519aa7224Smckusick.It hw.usermem	integer	no
11619aa7224Smckusick.It hw.pagesize	integer	no
11719aa7224Smckusick.It user.cs_path	string	no
11819aa7224Smckusick.It user.bc_base_max	integer	no
11919aa7224Smckusick.It user.bc_dim_max	integer	no
12019aa7224Smckusick.It user.bc_scale_max	integer	no
12119aa7224Smckusick.It user.bc_string_max	integer	no
12219aa7224Smckusick.It user.coll_weights_max	integer	no
12319aa7224Smckusick.It user.expr_nest_max	integer	no
12419aa7224Smckusick.It user.line_max	integer	no
12519aa7224Smckusick.It user.re_dup_max	integer	no
12619aa7224Smckusick.It user.posix2_version	integer	no
12719aa7224Smckusick.It user.posix2_c_bind	integer	no
12819aa7224Smckusick.It user.posix2_c_dev	integer	no
12919aa7224Smckusick.It user.posix2_char_term	integer	no
13019aa7224Smckusick.It user.posix2_fort_dev	integer	no
13119aa7224Smckusick.It user.posix2_fort_run	integer	no
13219aa7224Smckusick.It user.posix2_localedef	integer	no
13319aa7224Smckusick.It user.posix2_sw_dev	integer	no
13419aa7224Smckusick.It user.posix2_upe	integer	no
13599aed44dSmckusick.El
136*a991fe1fSmckusick.Pp
137*a991fe1fSmckusickThe
138*a991fe1fSmckusick.Nm sysctl
139*a991fe1fSmckusickprogram can get or set debugging variables
140*a991fe1fSmckusickthat have been identified for its display.
141*a991fe1fSmckusickThis information can be obtained by using the command:
142*a991fe1fSmckusick.Bd -literal -offset indent
143*a991fe1fSmckusicksysctl debug
144*a991fe1fSmckusick.Ed
145*a991fe1fSmckusickIn addition,
146*a991fe1fSmckusick.Nm sysctl
147*a991fe1fSmckusickcan extract information about the filesystems that have been compiled
148*a991fe1fSmckusickinto the running system.
149*a991fe1fSmckusickThis information can be obtained by using the command:
150*a991fe1fSmckusick.Bd -literal -offset indent
151*a991fe1fSmckusicksysctl vfs
152*a991fe1fSmckusick.Ed
153*a991fe1fSmckusickBy default, only filesystems that are actively being used are listed.
154*a991fe1fSmckusickUse of the
155*a991fe1fSmckusick.Fl A
156*a991fe1fSmckusickflag lists all the filesystems compiled into the running kernel.
15799aed44dSmckusick.Sh EXAMPLES
15899aed44dSmckusick.Pp
15999aed44dSmckusickFor example, to retrieve the maximum number of processes allowed
16099aed44dSmckusickin the system, one would use the follow request:
16199aed44dSmckusick.Bd -literal -offset indent -compact
16299aed44dSmckusicksysctl kern.maxproc
16399aed44dSmckusick.Ed
16499aed44dSmckusick.Pp
16599aed44dSmckusickTo set the maximum number of processes allowed
16699aed44dSmckusickin the system to 1000, one would use the follow request:
16799aed44dSmckusick.Bd -literal -offset indent -compact
16899aed44dSmckusicksysctl -w kern.maxproc=1000
16999aed44dSmckusick.Ed
17099aed44dSmckusick.Pp
17199aed44dSmckusickInformation about the system clock rate may be obtained with:
17299aed44dSmckusick.Bd -literal -offset indent -compact
17399aed44dSmckusicksysctl kern.clockrate
17499aed44dSmckusick.Ed
17599aed44dSmckusick.Pp
17699aed44dSmckusickInformation about the load average history may be obtained with
17799aed44dSmckusick.Bd -literal -offset indent -compact
17899aed44dSmckusicksysctl vm.loadavg
17999aed44dSmckusick.Ed
18099aed44dSmckusick.Sh FILES
18119aa7224Smckusick.Bl -tag -width <netinet/icmpXvar.h> -compact
18299aed44dSmckusick.It Pa <sys/sysctl.h>
18319aa7224Smckusickdefinitions for top level identifiers, second level kernel and hardware
18419aa7224Smckusickidentifiers, and user level identifiers
18599aed44dSmckusick.It Pa <sys/socket.h>
18699aed44dSmckusickdefinitions for second level network identifiers
18719aa7224Smckusick.It Pa <sys/gmon.h>
18819aa7224Smckusickdefinitions for third level profiling identifiers
18999aed44dSmckusick.It Pa <vm/vm_param.h>
19099aed44dSmckusickdefinitions for second level virtual memory identifiers
19119aa7224Smckusick.It Pa <netinet/in.h>
19219aa7224Smckusickdefinitions for third level Internet identifiers and
19319aa7224Smckusickfourth level IP identifiers
19419aa7224Smckusick.It Pa <netinet/icmp_var.h>
19519aa7224Smckusickdefinitions for fourth level ICMP identifiers
19619aa7224Smckusick.It Pa <netinet/udp_var.h>
19719aa7224Smckusickdefinitions for fourth level UDP identifiers
19899aed44dSmckusick.El
19999aed44dSmckusick.Sh SEE ALSO
20019aa7224Smckusick.Xr sysctl 3
20199aed44dSmckusick.Sh HISTORY
20299aed44dSmckusick.Nm sysctl
20399aed44dSmckusickfirst appeared in 4.4BSD.
204