sysctl - NetBSD Manual Pages

Command: Section: Arch: Collection:  
SYSCTL(8)               NetBSD System Manager's Manual               SYSCTL(8)

sysctl - get or set kernel state
sysctl [-n] name ... sysctl [-n] [-q] -w name=value ... sysctl [-n] -a sysctl [-n] -A sysctl [-n] [-q] -f file
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 -f flag specifies the name of a file to read and process. Blank lines and comments (beginning with `#') are ignored. Line continuations with `\' are permitted. Remaining lines are processed similarly to com- mand line arguments of the form name or name=value. The -w flag is im- plied by -f. The -q flag may be used with -f and -w to indicate that nothing should be printed for writes unless an error is detected. The `proc' top-level MIB has a special semantic: it represent per-process values and as such may differ from one process to another. The second- level name is the pid of the process (in decimal form), or the special word `curproc'. For variables below `proc.<pid>.rlimit', the integer value may be replaced with the string `unlimited' if it matches the magic value used to disable a limit. 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 infor- mation 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 ddb.fromconsole integer yes ddb.lines integer yes ddb.maxoff integer yes ddb.maxwidth integer yes ddb.onpanic integer yes ddb.radix integer yes ddb.tabstops integer yes hw.alignbytes integer no hw.byteorder integer no hw.disknames string no hw.diskstats struct no hw.machine string no hw.machine_arch string no hw.model string no hw.ncpu integer no hw.pagesize integer no hw.physmem integer no hw.usermem integer no hw.cnmagic string yes kern.argmax integer no kern.autonicetime integer yes kern.autoniceval integer yes kern.boottime struct no kern.chown_restricted integer no kern.clockrate struct no kern.defcorename string yes kern.fsync integer no kern.hostid integer yes kern.hostname string yes kern.iov_max integer no kern.job_control integer no kern.link_max integer no kern.login_name_max integer no kern.logsigexit integer yes kern.max_canon integer no kern.max_input integer no kern.maxfiles integer yes kern.maxpartitions integer no kern.maxproc integer yes kern.maxptys integer yes, special kern.maxvnodes integer raise only kern.mapped_files integer no kern.memlock integer no kern.memlock_rage integer no kern.memory_protection integer no kern.mbuf.mblowat integer yes kern.mbuf.mcllowat integer yes kern.mbuf.mclsize integer no kern.mbuf.msize integer no kern.mbuf.nmbclusters integer raise only kern.msgbufsize integer no kern.name_max integer no kern.ngroups integer no kern.no_trunc integer no kern.osrelease string no kern.osrevision integer no kern.ostype string no kern.path_max integer no kern.pipe.maxkvasz integer yes kern.pipe.maxloankvasz integer yes kern.pipe.maxbigpipes integer yes kern.pipe.nbigpipes integer no kern.pipe.kvasize integer no kern.posix1version integer no kern.rawpartition integer no kern.saved_ids integer no kern.securelevel integer raise only kern.synchronized_io integer no kern.sysvmsg integer no kern.sysvsem integer no kern.sysvshm integer no kern.tkstat.nin quad no kern.tkstat.nout quad no kern.tkstat.cancc quad no kern.tkstat.rawcc quad no kern.vdisable integer no kern.version string no machdep.console_device dev_t no net.inet.icmp.maskrepl integer yes net.inet.icmp.errppslimit integer yes net.inet.icmp.rediraccept integer yes net.inet.icmp.redirtimeout integer yes net.inet.ip.allowsrcrt integer yes net.inet.ip.anonportmax integer yes net.inet.ip.anonportmin integer yes net.inet.ip.directed-broadcast integer yes net.inet.ip.forwarding integer yes net.inet.ip.forwsrcrt integer yes net.inet.ip.maxfragpacket integer yes net.inet.ip.lowportmax integer yes net.inet.ip.lowportmin integer yes net.inet.ip.mtudisc integer yes net.inet.ip.mtudisctimeout integer yes net.inet.ip.redirect integer yes net.inet.ip.subnetsarelocal integer yes net.inet.ip.ttl integer yes net.inet.ipsec.ah_cleartos integer yes net.inet.ipsec.ah_net_deflev integer yes net.inet.ipsec.ah_offsetmask integer yes net.inet.ipsec.ah_trans_deflev integer yes net.inet.ipsec.def_policy integer yes net.inet.ipsec.dfbit integer yes net.inet.ipsec.ecn integer yes net.inet.ipsec.esp_net_deflev integer yes net.inet.ipsec.esp_trans_deflev integer yes net.inet.ipsec.inbound_call_ike integer yes net.inet.tcp.ack_on_push integer yes net.inet.tcp.compat_42 integer yes net.inet.tcp.cwm integer yes net.inet.tcp.cwm_burstsize integer yes net.inet.tcp.init_win integer yes net.inet.tcp.keepcnt integer yes net.inet.tcp.keepidle integer yes net.inet.tcp.keepintvl integer yes net.inet.tcp.log_refused integer yes net.inet.tcp.mss_ifmtu integer yes net.inet.tcp.mssdflt integer yes net.inet.tcp.recvspace integer yes net.inet.tcp.rfc1323 integer yes net.inet.tcp.rstppslimit integer yes net.inet.tcp.sack integer yes net.inet.tcp.sendspace integer yes net.inet.tcp.slowhz integer no net.inet.tcp.syn_bucket_limit integer yes net.inet.tcp.syn_cache_interval integer yes net.inet.tcp.syn_cache_limit integer yes net.inet.tcp.timestamps integer yes net.inet.tcp.win_scale integer yes net.inet.udp.checksum integer yes net.inet.udp.recvspace integer yes net.inet.udp.sendspace integer yes net.inet6.icmp6.errppslimit integer yes net.inet6.icmp6.mtudisc_hiwat integer yes net.inet6.icmp6.mtudisc_lowat integer yes net.inet6.icmp6.nd6_debug integer yes net.inet6.icmp6.nd6_delay integer yes net.inet6.icmp6.nd6_maxnudhint integer yes net.inet6.icmp6.nd6_mmaxtries integer yes net.inet6.icmp6.nd6_prune integer yes net.inet6.icmp6.nd6_umaxtries integer yes net.inet6.icmp6.nd6_useloopback integer yes net.inet6.icmp6.nodeinfo integer yes net.inet6.icmp6.rediraccept integer yes net.inet6.icmp6.redirtimeout integer yes net.inet6.ip6.accept_rtadv integer yes net.inet6.ip6.anonportmax integer yes net.inet6.ip6.anonportmin integer yes net.inet6.ip6.auto_flowlabel integer yes net.inet6.ip6.v6only integer yes net.inet6.ip6.dad_count integer yes net.inet6.ip6.defmcasthlim integer yes net.inet6.ip6.forwarding integer yes net.inet6.ip6.gif_hlim integer yes net.inet6.ip6.hdrnestlimit integer yes net.inet6.ip6.hlim integer yes net.inet6.ip6.kame_version string no net.inet6.ip6.keepfaith integer yes net.inet6.ip6.log_interval integer yes net.inet6.ip6.lowportmax integer yes net.inet6.ip6.lowportmin integer yes net.inet6.ip6.maxfragpackets integer yes net.inet6.ip6.redirect integer yes net.inet6.ip6.rr_prune integer yes net.inet6.ip6.use_deprecated integer yes net.inet6.ipsec6.ah_net_deflev integer yes net.inet6.ipsec6.ah_trans_deflev integer yes net.inet6.ipsec6.def_policy integer yes net.inet6.ipsec6.ecn integer yes net.inet6.ipsec6.esp_net_deflev integer yes net.inet6.ipsec6.esp_trans_deflev integer yes net.inet6.ipsec6.inbound_call_ike integer yes net.inet6.udp6.recvspace integer yes net.inet6.udp6.sendspace integer yes net.key.acq_exp_int integer yes net.key.acq_maxtime integer yes net.key.ah_keymin integer yes net.key.debug integer yes net.key.esp_auth integer yes net.key.esp_keymin integer yes net.key.kill_int integer yes net.key.random_int integer yes net.key.spi_max_value integer yes net.key.spi_min_value integer yes net.key.spi_try integer yes proc.<pid>.corename string yes proc.<pid>.rlimit.coredumpsize.hard integer yes proc.<pid>.rlimit.coredumpsize.soft integer yes proc.<pid>.rlimit.cputime.hard integer yes proc.<pid>.rlimit.cputime.soft integer yes proc.<pid>.rlimit.datasize.hard integer yes proc.<pid>.rlimit.datasize.soft integer yes proc.<pid>.rlimit.filesize.hard integer yes proc.<pid>.rlimit.filesize.soft integer yes proc.<pid>.rlimit.maxproc.hard integer yes proc.<pid>.rlimit.maxproc.soft integer yes proc.<pid>.rlimit.memorylocked.hard integer yes proc.<pid>.rlimit.memorylocked.soft integer yes proc.<pid>.rlimit.memoryuse.hard integer yes proc.<pid>.rlimit.memoryuse.soft integer yes proc.<pid>.rlimit.stacksize.hard integer yes proc.<pid>.rlimit.stacksize.soft integer yes 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.cs_path string no user.expr_nest_max integer no user.line_max 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.posix2_version integer no user.re_dup_max integer no vendor.<vendor>.* ? vendor specific vfs.generic.usermount integer yes vfs.nfs.iothreads integer yes vm.anonmax integer yes vm.anonmin integer yes vm.execmax integer yes vm.execmin integer yes vm.filemax integer yes vm.filemin integer yes vm.loadavg struct no vm.nkmempages integer no vm.uvmexp struct no vm.uvmexp2 struct no vm.vmmeter struct no Entries found under ``vendor.<vendor>'' are left to be specified (and used) by vendors using the NetBSD operating system in their products. Values and structure are vendor-defined, and no registry exists right now.
<sys/sysctl.h> definitions for top level identifiers, second lev- el kernel and hardware identifiers, and user level identifiers <sys/socket.h> definitions for second level network identifiers <sys/gmon.h> definitions for third level profiling identifiers <uvm/uvm_param.h> definitions for second level virtual memory iden- tifiers <netinet/in.h> definitions for third level IPv4/v6 identifiers and fourth level IPv4/v6 identifiers <netinet/icmp_var.h> definitions for fourth level ICMP identifiers <netinet/icmp6.h> definitions for fourth level ICMPv6 identifiers <netinet/tcp_var.h> definitions for fourth level TCP identifiers <netinet/udp_var.h> definitions for fourth level UDP identifiers <netinet6/udp6_var.h> definitions for fourth level IPv6 UDP identifiers <netinet6/ipsec.h> definitions for fourth level IPsec identifiers <netkey/key_var.h> definitions for third level PF_KEY identifiers
For example, to retrieve the maximum number of processes allowed in the system, one would use the following request: sysctl kern.maxproc To set the maximum number of processes allowed in the system to 1000, one would use the following 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 view the values of the per-process variables of the current shell, the request: sysctl proc.$$ can be used if the shell interpreter replaces $$ with it's pid (this is true for most shells). To redirect core dumps to the /var/tmp/<username> directory, sysctl -w proc.$$.corename=/var/tmp/%u/%n.core Shall be used. sysctl -w proc.curproc.corename=/var/tmp/%u/%n.core changes the value for the sysctl process itself, and will not have the desired effect.
sysctl first appeared in 4.4BSD. NetBSD 1.6 June 6, 1993 6
Powered by man-cgi (2020-09-24). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.