SYSCTL(8)               OpenBSD System Manager's Manual              SYSCTL(8)

NAME
     sysctl - get or set kernel state

SYNOPSIS
     sysctl [-n] name ...
     sysctl [-n] -w name=value ...
     sysctl [-n] -aA

DESCRIPTION
     The sysctl utility retrieves kernel state and allows processes with ap-
     propriate privilege to set kernel state.  The state to be retrieved or
     set is described using a ``Management Information Base'' (``MIB'') style
     name, described as a dotted set of components.  The -a flag can be used
     to list all the currently available string or integer values.  The -A
     flag will list all the known MIB names including tables.  Those with
     string or integer values will be printed as with the -a flag; for the
     table values, the name of the utility to retrieve them is given.

     The -n flag specifies that the printing of the field name should be sup-
     pressed and that only its value should be output.  This flag is useful
     for setting shell variables.  For example, to save the pagesize in vari-
     able psize, use:
           set psize=`sysctl -n hw.pagesize`

     If just a MIB style name is given, the corresponding value is retrieved.
     If a value is to be set, the -w flag must be specified and the MIB name
     followed by an equal sign and the new value to be used.

     The information available from sysctl consists of integers, strings, and
     tables.  The tabular information can only be retrieved by special purpose
     programs such as ps, systat, and netstat. The string and integer informa-
     tion is summarized below.  For a detailed description of these variable
     see sysctl(3).  The changeable column indicates whether a process with
     appropriate privilege can change the value.

     Name                            Type          Changeable
     kern.ostype                     string        no
     kern.osrelease                  string        no
     kern.osrevision                 integer       no
     kern.osversion                  string        no
     kern.version                    string        no
     kern.maxvnodes                  integer       yes
     kern.maxproc                    integer       yes
     kern.maxfiles                   integer       yes
     kern.maxpartitions              integer       no
     kern.rawpartition               integer       no
     kern.argmax                     integer       no
     kern.securelevel                integer       raise only
     kern.hostname                   string        yes
     kern.domainname                 string        yes
     kern.hostid                     u_int         yes
     kern.clockrate                  struct        no
     kern.posix1version              integer       no
     kern.ngroups                    integer       no
     kern.job_control                integer       no
     kern.saved_ids                  integer       no
     kern.link_max                   integer       no
     kern.max_canon                  integer       no
     kern.max_input                  integer       no
     kern.name_max                   integer       no
     kern.path_max                   integer       no


     kern.pipe_buf                   integer       no
     kern.chown_restricted           integer       no
     kern.no_trunc                   integer       no
     kern.boottime                   struct        no
     kern.somaxconn                  integer       yes
     kern.sominconn                  integer       yes
     kern.usermount                  integer       yes
     kern.random                     struct        no
     kern.nosuidcoredump             integer       yes
     kern.fsync                      integer       no
     kern.sysvmsg                    integer       no
     kern.sysvsem                    integer       no
     kern.sysvshm                    integer       no
     kern.arandom                    u_int         no
     vm.loadavg                      struct        no
     vm.psstrings                    struct        no
     fs.posix.setuid                 integer       yes
     net.inet.ip.forwarding          integer       yes
     net.inet.ip.redirect            integer       yes
     net.inet.ip.ttl                 integer       yes
     net.inet.ip.sourceroute         integer       yes
     net.inet.ip.directed-broadcast  integer       yes
     net.inet.ip.portfirst           integer       yes
     net.inet.ip.portlast            integer       yes
     net.inet.ip.porthifirst         integer       yes
     net.inet.ip.porthilast          integer       yes
     net.inet.ip.maxqueue            integer       yes
     net.inet.ip.encdebug            integer       yes
     net.inet.icmp.maskrepl          integer       yes
     net.inet.icmp.bmcastecho        integer       yes
     net.inet.ip4.allow              integer       yes
     net.inet.tcp.rfc1323            integer       yes
     net.inet.tcp.keepinittime       integer       yes
     net.inet.tcp.keepidle           integer       yes
     net.inet.tcp.keepintvl          integer       yes
     net.inet.tcp.slowhz             integer       no
     net.inet.tcp.baddynamic         array         yes
     net.inet.tcp.sack               integer       yes
     net.inet.tcp.mssdflt            integer       yes
     net.inet.udp.checksum           integer       yes
     net.inet.udp.baddynamic         array         yes
     net.inet.esp.enable             integer       yes
     net.inet.ah.enable              integer       yes
     net.ipx.ipx.recvspace           integer       yes
     net.ipx.ipx.sendspace           integer       yes
     debug.syncprt                   integer       yes
     debug.busyprt                   integer       yes
     debug.doclusterread             integer       yes
     debug.doclusterwrite            integer       yes
     debug.doreallocblks             integer       yes
     debug.doasyncfree               integer       yes
     debug.prtrealloc                integer       yes
     hw.machine                      string        no
     hw.model                        string        no
     hw.ncpu                         integer       no
     hw.byteorder                    integer       no
     hw.physmem                      integer       no
     hw.usermem                      integer       no
     hw.pagesize                     integer       no
     machdep.console_device          dev_t         no
     machdep.apmwarn                 integer       yes (i386 only)
     machdep.kbdreset                integer       yes (i386 only)
     machdep.allowaperture           integer       yes (i386 only, XFree86)
     user.cs_path                    string        no


     user.bc_base_max                integer       no
     user.bc_dim_max                 integer       no
     user.bc_scale_max               integer       no
     user.bc_string_max              integer       no
     user.coll_weights_max           integer       no
     user.expr_nest_max              integer       no
     user.line_max                   integer       no
     user.re_dup_max                 integer       no
     user.posix2_version             integer       no
     user.posix2_c_bind              integer       no
     user.posix2_c_dev               integer       no
     user.posix2_char_term           integer       no
     user.posix2_fort_dev            integer       no
     user.posix2_fort_run            integer       no
     user.posix2_localedef           integer       no
     user.posix2_sw_dev              integer       no
     user.posix2_upe                 integer       no
     user.stream_max                 integer       no
     user.tzname_max                 integer       no
     ddb.radix                       integer       yes
     ddb.max_width                   integer       yes
     ddb.max_line                    integer       yes
     ddb.tab_stop_width              integer       yes
     ddb.panic                       integer       yes
     ddb.console                     integer       yes

     The sysctl program can get or set debugging variables that have been
     identified for its display.  This information can be obtained by using
     the command:

           sysctl debug
     In addition, sysctl can extract information about the filesystems that
     have been compiled into the running system.  This information can be ob-
     tained by using the command:

           sysctl vfs
     By default, only filesystems that are actively being used are listed.
     Use of the -A flag lists all the filesystems compiled into the running
     kernel.

EXAMPLES
     For example, to retrieve the maximum number of processes allowed in the
     system, one would use the follow request:
           sysctl kern.maxproc

     To set the maximum number of processes allowed in the system to 1000, one
     would use the follow request:
           sysctl -w kern.maxproc=1000

     Information about the system clock rate may be obtained with:
           sysctl kern.clockrate

     Information about the load average history may be obtained with
           sysctl vm.loadavg

     To make the chown(2) system call use traditional BSD semantics (don't
     clear setuid/setgid bits), one would do the following:
           sysctl -w fs.posix.setuid=0

     Set the list of reserved TCP ports that should not be allocated by the
     kernel dynamically.  This can be used to keep daemons from stealing a
     specific port that another program needs to function.  List elements may
     be separated by commas and/or whitespace.
           sysctl -w net.inet.tcp.baddynamic=749,750,751,760,761,871

     It is also possible to add or remove ports from the current list.
           sysctl -w net.inet.tcp.baddynamic=+748
           sysctl -w net.inet.tcp.baddynamic=-871

FILES
     <sys/sysctl.h>        definitions for top level identifiers, second level
                           kernel and hardware identifiers, and user level
                           identifiers
     <dev/rndvar.h>        definitions for random(4) device's statistics
                           structure
     <sys/socket.h>        definitions for second level network identifiers
     <sys/gmon.h>          definitions for third level profiling identifiers
     <vm/vm_param.h>       definitions for second level virtual memory identi-
                           fiers
     <netinet/in.h>        definitions for third level Internet identifiers
                           and fourth level IP identifiers
     <netinet/icmp_var.h>  definitions for fourth level ICMP identifiers
     <netinet/udp_var.h>   definitions for fourth level UDP identifiers
     <netipx/ipx_var.h>    definitions for third level IPX identifiers and
                           fourth level IPX identifiers
     <ddb/db_var.h>        definitions for second level ddb identifiers

SEE ALSO
     sysctl(3)

HISTORY
     sysctl first appeared in 4.4BSD.

OpenBSD 2.6                       May 9, 1995                                4
