jcs's openbsd hax
openbsd
at jcs 2429 lines 89 kB view raw
1.\" $OpenBSD: sysctl.2,v 1.70 2025/09/16 09:19:43 florian Exp $ 2.\" 3.\" Copyright (c) 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.Dd $Mdocdate: September 16 2025 $ 31.Dt SYSCTL 2 32.Os 33.Sh NAME 34.Nm sysctl 35.Nd get or set system information 36.Sh SYNOPSIS 37.In sys/types.h 38.In sys/sysctl.h 39.Ft int 40.Fn sysctl "const int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" 41.Sh DESCRIPTION 42The 43.Fn sysctl 44function retrieves system information and allows processes with 45appropriate privileges to set system information. 46The information available from 47.Fn sysctl 48consists of integers, strings, and tables. 49Information may be retrieved and set using the 50.Xr sysctl 8 51utility; 52the variable names used by this utility are given here in parentheses. 53.Pp 54Unless explicitly noted below, 55.Fn sysctl 56returns a consistent snapshot of the data requested. 57Consistency is obtained by locking the destination 58buffer into memory so that the data may be copied out without blocking. 59Calls to 60.Fn sysctl 61are serialized to avoid deadlock. 62.Pp 63The state is described using a 64.Dq Management Information Base (MIB) 65style name, listed in 66.Fa name , 67which is a 68.Fa namelen 69length array of integers. 70.Pp 71The information is copied into the buffer specified by 72.Fa oldp . 73The size of the buffer is given by the location specified by 74.Fa oldlenp 75before the call, 76and that location gives the amount of data copied after a successful call. 77If the amount of data available is greater 78than the size of the buffer supplied, 79the call supplies as much data as fits in the buffer provided 80and returns with the error code 81.Er ENOMEM . 82If the old value is not desired, 83.Fa oldp 84and 85.Fa oldlenp 86should be set to 87.Dv NULL . 88.Pp 89The size of the available data can be determined by calling 90.Fn sysctl 91with a 92.Dv NULL 93parameter for 94.Fa oldp . 95The size of the available data will be returned in the location pointed to by 96.Fa oldlenp . 97For some operations, the amount of space may change often. 98For these operations, 99the system attempts to round up so that the returned size is 100large enough for a call to return the data shortly thereafter. 101.Pp 102The terminating NUL character is included in the lengths of string values. 103.Pp 104To set a new value, 105.Fa newp 106is set to point to a buffer of length 107.Fa newlen 108from which the requested value is to be taken. 109If a new value is not to be set, 110.Fa newp 111should be set to 112.Dv NULL 113and 114.Fa newlen 115set to 0. 116.Pp 117The top level names are defined with a 118.Dv CTL_ 119prefix in 120.In sys/sysctl.h , 121and are as follows. 122The next and subsequent levels down are found in the include files 123listed here, and described in separate sections below. 124.Bl -column "CTL_MACHDEP" "ufs/ffs/ffs_extern.h" "Description" -offset indent 125.It Sy "Name" Ta Sy "Next level names" Ta Sy "Description" 126.It Dv CTL_DDB Ta "ddb/db_var.h" Ta "Kernel debugger" 127.It Dv CTL_DEBUG Ta "sys/sysctl.h" Ta "Debugging" 128.It Dv CTL_HW Ta "sys/sysctl.h" Ta "Generic CPU, I/O" 129.It Dv CTL_KERN Ta "sys/sysctl.h" Ta "High kernel limits" 130.It Dv CTL_MACHDEP Ta "sys/sysctl.h" Ta "Machine dependent" 131.It Dv CTL_NET Ta "sys/socket.h" Ta "Networking" 132.It Dv CTL_VFS Ta "ufs/ffs/ffs_extern.h" Ta "Virtual file system" 133.It Dv CTL_VM Ta "uvm/uvmexp.h" Ta "Virtual memory" 134.El 135.Pp 136For example, the following retrieves the maximum number of processes allowed 137in the system: 138.Bd -literal -offset indent 139int mib[2], maxproc; 140size_t len; 141 142mib[0] = CTL_KERN; 143mib[1] = KERN_MAXPROC; 144len = sizeof(maxproc); 145if (sysctl(mib, 2, &maxproc, &len, NULL, 0) == -1) 146 err(1, "sysctl"); 147.Ed 148.Ss CTL_DDB 149Integer information and settable variables are available for the 150.Dv CTL_DDB level , 151as described below. 152More information is also available in 153.Xr ddb 4 . 154.Bl -column "Second level name" "integer" "Changeable" -offset indent 155.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable" 156.It Dv DBCTL_CONSOLE Ta "integer" Ta "yes" 157.It Dv DBCTL_LOG Ta "integer" Ta "yes" 158.It Dv DBCTL_MAXLINE Ta "integer" Ta "yes" 159.It Dv DBCTL_MAXWIDTH Ta "integer" Ta "yes" 160.It Dv DBCTL_PANIC Ta "integer" Ta "yes" 161.It Dv DBCTL_RADIX Ta "integer" Ta "yes" 162.It Dv DBCTL_TABSTOP Ta "integer" Ta "yes" 163.It Dv DBCTL_TRIGGER Ta "integer" Ta "yes" 164.El 165.Bl -tag -width "123456" 166.It Dv DBCTL_CONSOLE Pq Va ddb.console 167When this variable is set, an architecture dependent magic key sequence 168on the console or a debugger button will permit entry into the kernel debugger. 169When running with a 170.Xr securelevel 7 171greater than 0, 172this variable may not be raised. 173.It Dv DBCTL_LOG Pq Va ddb.log 174When set, ddb output is also logged in the kernel message buffer. 175.It Dv DBCTL_MAXLINE Pq Va ddb.max_line 176Determines the number of lines to page in 177.Xr ddb 4 . 178This variable is also available as the ddb 179.Dv $lines 180variable. 181.It Dv DBCTL_MAXWIDTH Pq Va ddb.max_width 182Determines the maximum width of a line in 183.Xr ddb 4 . 184This variable is also available as the ddb 185.Dv $maxwidth 186variable. 187.It Dv DBCTL_PANIC Pq Va ddb.panic 188When this variable is set, system panics may drop into the kernel debugger. 189When running with a 190.Xr securelevel 7 191greater than 0, 192this variable may not be raised. 193.It Dv DBCTL_RADIX Pq Va ddb.radix 194Determines the default radix or base for non-prefixed numbers 195entered into 196.Xr ddb 4 . 197This variable is also available as the ddb 198.Dv $radix 199variable. 200.It Dv DBCTL_TABSTOP Pq Va ddb.tab_stop_width 201Width of a tab stop in 202.Xr ddb 4 . 203This variable is also available as the ddb 204.Dv $tabstops 205variable. 206.It Dv DBCTL_TRIGGER Pq Va ddb.trigger 207When 208.Dv DBCTL_CONSOLE 209is set, 210writing to 211.Dv DBCTL_TRIGGER 212causes the system to enter 213.Xr ddb 4 . 214When running with a 215.Xr securelevel 7 216greater than 0, 217the process writing to this variable must be running 218on the console in order to enter 219.Xr ddb 4 . 220.El 221.Ss CTL_DEBUG 222The debugging variables vary from system to system. 223A debugging variable may be added or deleted without need to recompile 224.Fn sysctl 225to know about it. 226Each time it runs, 227.Fn sysctl 228gets the list of debugging variables from the kernel and 229displays their current values. 230The system defines twenty 231.Vt struct ctldebug 232variables named 233.Va debug0 234through 235.Va debug19 . 236They are declared as separate variables so that they can be 237individually initialized at the location of their associated variable. 238The loader prevents multiple use of the same variable by issuing errors 239if a variable is initialized in more than one place. 240For example, to export the variable 241.Va dospecialcheck 242as a debugging variable, the following declaration would be used: 243.Bd -literal -offset indent 244int dospecialcheck = 1; 245struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck }; 246.Ed 247.Ss CTL_HW 248The string and integer information available for the 249.Dv CTL_HW 250level is detailed below. 251The changeable column shows whether a process with appropriate 252privileges may change the value. 253.Bl -column "Second level name" "integer" "Changeable" -offset indent 254.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable" 255.It Dv HW_ALLOWPOWERDOWN Ta "integer" Ta "yes" 256.It Dv HW_BATTERY Ta "node" Ta "not applicable" 257.It Dv HW_BYTEORDER Ta "integer" Ta "no" 258.It Dv HW_CPUSPEED Ta "integer" Ta "no" 259.It Dv HW_DISKCOUNT Ta "integer" Ta "no" 260.It Dv HW_DISKNAMES Ta "string" Ta "no" 261.It Dv HW_DISKSTATS Ta "struct" Ta "no" 262.It Dv HW_MACHINE Ta "string" Ta "no" 263.It Dv HW_MODEL Ta "string" Ta "no" 264.It Dv HW_NCPU Ta "integer" Ta "no" 265.It Dv HW_NCPUFOUND Ta "integer" Ta "no" 266.It Dv HW_NCPUONLINE Ta "integer" Ta "no" 267.It Dv HW_PAGESIZE Ta "integer" Ta "no" 268.It Dv HW_PERFPOLICY Ta "string" Ta "yes" 269.It Dv HW_PHYSMEM Ta "integer" Ta "no" 270.It Dv HW_PHYSMEM64 Ta "int64_t" Ta "no" 271.It Dv HW_POWER Ta "integer" Ta "no" 272.It Dv HW_PRODUCT Ta "string" Ta "no" 273.It Dv HW_SENSORS Ta "node" Ta "not applicable" 274.It Dv HW_SETPERF Ta "integer" Ta "yes" 275.It Dv HW_SMT Ta "integer" Ta "yes" 276.It Dv HW_UCOMNAMES Ta "string" Ta "no" 277.It Dv HW_USERMEM Ta "integer" Ta "no" 278.It Dv HW_USERMEM64 Ta "int64_t" Ta "no" 279.It Dv HW_UUID Ta "string" Ta "no" 280.It Dv HW_VENDOR Ta "string" Ta "no" 281.It Dv HW_VERSION Ta "string" Ta "no" 282.El 283.Bl -tag -width "123456" 284.It Dv HW_ALLOWPOWERDOWN Pq Va hw.allowpowerdown 285Some machines generate an interrupt when the power button is pressed 286and a driver can catch that interrupt. 287When this variable is set, such an event will cause the system to 288perform a regular shutdown and power off the machine. 289When running with a 290.Xr securelevel 7 291greater than 0, 292this variable may not be changed. 293.It Dv HW_BATTERY Pq Va hw.battery 294Control battery charging. 295These are only available on hardware that supports battery charging control. 296There are three subnodes: 297.Bl -column "HW_BATTERY_CHARGESTART" "integer" "Changeable" -offset indent 298.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 299.It Dv HW_BATTERY_CHARGEMODE Ta "integer" Ta "yes" 300.It Dv HW_BATTERY_CHARGESTART Ta "integer" Ta "maybe" 301.It Dv HW_BATTERY_CHARGESTOP Ta "integer" Ta "yes" 302.El 303.Pp 304Their meanings are as follows: 305.Bl -tag -width "123456" 306.It Dv HW_BATTERY_CHARGEMODE Pq Va hw.battery.chargemode 307Control if the battery is charged or discharged. 308A value of -1 means to (forcibly) discharge the battery. 309A value of 0 means to inhibit charging the battery. 310A value of 1 means to charge the battery, subject to the configured limits. 311.It Dv HW_BATTERY_CHARGESTART Pq Va hw.battery.chargestart 312The percentage below which the battery will start charging. 313Not all hardware allows setting this value. 314On hardware that does not allow setting this value the battery will typically 315start charging at a fixed percentage point below the value configured through 316.Dv HW_BATTERY_CHARGESTOP . 317.It Dv HW_BATTERY_CHARGESTOP Pq Va hw.battery.chargestop 318The percentage above which the battery will stop charging. 319Setting the value to 100 will fully charge the battery. 320.El 321.Pp 322By setting 323.Dv HW_BATTERY_CHARGEMODE 324to 1, and setting both 325.Dv HW_BATTERY_CHARGESTART 326and 327.Dv HW_BATTERY_CHARGESTOP , 328the battery will be kept charged at a percentage between the configured limits. 329.It Dv HW_BYTEORDER Pq Va hw.byteorder 330The byteorder (4321 or 1234). 331.It Dv HW_CPUSPEED Pq Va hw.cpuspeed 332The current CPU frequency 333.Pq in MHz . 334.It Dv HW_DISKCOUNT Pq Va hw.diskcount 335The number of disks currently attached to the system. 336.It Dv HW_DISKNAMES Pq Va hw.disknames 337A comma-separated list of disk names. 338.It Dv HW_DISKSTATS Pq Va hw.diskstats 339An array of 340.Vt struct diskstats 341structures containing disk statistics. 342.It Dv HW_MACHINE Pq Va hw.machine 343The kernel architecture as returned by 344.Xr uname 1 345.Fl m 346and by 347.Xr machine 1 . 348.It Dv HW_MODEL Pq Va hw.model 349The machine model. 350.It Dv HW_NCPU Pq Va hw.ncpu 351The number of CPUs configured. 352.It Dv HW_NCPUFOUND Pq Va hw.ncpufound 353The number of CPUs found. 354.It Dv HW_NCPUONLINE Pq Va hw.ncpuonline 355The number of CPUs online. 356.It Dv HW_PAGESIZE Pq Va hw.pagesize 357The software page size. 358.It Dv HW_PERFPOLICY Pq Va hw.perfpolicy 359The performance policy for power management. 360Can be one of 361.Dq manual , 362.Dq auto , 363or 364.Dq high . 365If the policy contains a comma, the second part specifies an alternative 366policy used while the system is running on battery. 367The 368.Nm 369API only exports the currently applicable policy. 370.\" XXX keep in sync with apmd(8) 371The default setting is 372.Dq high,auto . 373.It Dv HW_PHYSMEM 374The total physical memory, in bytes. 375This variable is deprecated; use 376.Dv HW_PHYSMEM64 377instead. 378.It Dv HW_PHYSMEM64 Pq Va hw.physmem 379The total physical memory, in bytes. 380.It Dv HW_POWER Pq Va hw.power 381Machine has wall-power. 382.It Dv HW_PRODUCT Pq Va hw.product 383The product name of the machine. 384.It Dv HW_SENSORS Pq Va hw.sensors 385Third level comprises an array of 386.Vt struct sensordev 387structures containing information about devices 388that may attach hardware monitoring sensors. 389.Pp 390Third, fourth and fifth levels together comprise an array of 391.Vt struct sensor 392structures containing snapshot readings of hardware monitoring sensors. 393In such usage, third level indicates the numerical representation 394of the sensor device name to which the sensor is attached 395(a device's xname and number are matched with the help of 396.Vt struct sensordev 397structure above), 398fourth level indicates sensor type and 399fifth level is an ordinal sensor number (unique to 400the specified sensor type on the specified sensor device). 401.Pp 402The 403.Sy sensordev 404and 405.Sy sensor 406structures 407and 408.Sy sensor_type 409enumeration 410are defined in 411.In sys/sensors.h . 412.It Dv HW_SERIALNO Pq Va hw.serialno 413The serial number of the machine. 414.It Dv HW_SETPERF Pq Va hw.setperf 415Current CPU performance 416.Pq percentage . 417It is only modifiable if 418.Dv HW_PERFPOLICY 419is set to 420.Dq manual . 421.It Dv HW_SMT Pq Va hw.smt 422If set to 1, enable simultaneous multithreading (SMT) on CPUs that 423support it. 424Disabled by default. 425.It Dv HW_UCOMNAMES Pq Va hw.ucomnames 426A comma-separated list of currently attached 427.Xr ucom 4 428devices in the following format: 429.Pp 430.Sm off 431.D1 Sy ucom Ar N : Sy usb Ar bus.rootport.route.interface 432.Sm on 433.Pp 434The 435.Ar route 436consists of five hexadecimal digits identifying the path from 437the root port to the port containing the 438.Ar interface . 439.It Dv HW_USERMEM 440The amount of available non-kernel memory in bytes. 441This variable is deprecated; use 442.Dv HW_USERMEM64 443instead. 444.It Dv HW_USERMEM64 Pq Va hw.usermem 445The amount of available non-kernel memory in bytes. 446.It Dv HW_UUID Pq Va hw.uuid 447The universal unique identification number assigned to the machine. 448.It Dv HW_VENDOR Pq Va hw.vendor 449The vendor name for this machine. 450.It Dv HW_VERSION Pq Va hw.version 451The version or revision of this machine. 452.El 453.Ss CTL_KERN 454The string and integer information available for the 455.Dv CTL_KERN 456level is detailed below. 457The changeable column shows whether a process with appropriate 458privileges may change the value. 459The types of data currently available are process information, 460system vnodes, the open file entries, routing table entries, 461virtual memory statistics, load average history, and clock rate 462information. 463.Bl -column "KERN_PROC_NOBROADCASTKILL" "u_int64_t[CPUSTATES]" "no" -offset indent 464.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable" 465.It Dv KERN_ALLOWDT Ta "integer" Ta "yes" 466.It Dv KERN_ALLOWKMEM Ta "integer" Ta "yes" 467.It Dv KERN_ARGMAX Ta "integer" Ta "no" 468.It Dv KERN_AUDIO Ta "node" Ta "yes" 469.It Dv KERN_BOOTTIME Ta "struct timeval" Ta "no" 470.It Dv KERN_CACHEPCT Ta "integer" Ta "yes" 471.It Dv KERN_CCPU Ta "integer" Ta "no" 472.It Dv KERN_CLOCKRATE Ta "struct clockinfo" Ta "no" 473.It Dv KERN_CONSDEV Ta "dev_t" Ta "no" 474.It Dv KERN_CPTIME Ta "long[CPUSTATES]" Ta "no" 475.It Dv KERN_CPTIME2 Ta "u_int64_t[CPUSTATES]" Ta "no" 476.It Dv KERN_CPUSTATS Ta "struct cpustats" Ta "no" 477.It Dv KERN_DOMAINNAME Ta "string" Ta "yes" 478.It Dv KERN_FILE Ta "struct kinfo_file" Ta "no" 479.It Dv KERN_FORKSTAT Ta "struct forkstat" Ta "no" 480.It Dv KERN_FSCALE Ta "integer" Ta "no" 481.It Dv KERN_FSYNC Ta "integer" Ta "no" 482.It Dv KERN_GLOBAL_PTRACE Ta "integer" Ta "yes" 483.It Dv KERN_HOSTID Ta "integer" Ta "yes" 484.It Dv KERN_HOSTNAME Ta "string" Ta "yes" 485.It Dv KERN_INTRCNT Ta "node" Ta "not applicable" 486.It Dv KERN_JOB_CONTROL Ta "integer" Ta "no" 487.It Dv KERN_MALLOCSTATS Ta "node" Ta "no" 488.It Dv KERN_MAXCLUSTERS Ta "integer" Ta "yes" 489.It Dv KERN_MAXFILES Ta "integer" Ta "yes" 490.It Dv KERN_MAXLOCKSPERUID Ta "integer" Ta "yes" 491.It Dv KERN_MAXPARTITIONS Ta "integer" Ta "no" 492.It Dv KERN_MAXPROC Ta "integer" Ta "yes" 493.It Dv KERN_MAXTHREAD Ta "integer" Ta "yes" 494.It Dv KERN_MAXVNODES Ta "integer" Ta "yes" 495.It Dv KERN_MBSTAT Ta "struct mbstat" Ta "no" 496.It Dv KERN_MSGBUF Ta "char[]" Ta "no" 497.It Dv KERN_MSGBUFSIZE Ta "integer" Ta "no" 498.It Dv KERN_NCHSTATS Ta "struct nchstats" Ta "no" 499.It Dv KERN_NFILES Ta "integer" Ta "no" 500.It Dv KERN_NGROUPS Ta "integer" Ta "no" 501.It Dv KERN_NOSUIDCOREDUMP Ta "integer" Ta "yes" 502.It Dv KERN_NPROCS Ta "integer" Ta "no" 503.It Dv KERN_NTHREADS Ta "integer" Ta "no" 504.It Dv KERN_NUMVNODES Ta "integer" Ta "no" 505.It Dv KERN_OSRELEASE Ta "string" Ta "no" 506.It Dv KERN_OSREV Ta "integer" Ta "no" 507.It Dv KERN_OSTYPE Ta "string" Ta "no" 508.It Dv KERN_OSVERSION Ta "string" Ta "no" 509.It Dv KERN_PFSTATUS Ta "struct pf_status" Ta "no" 510.It Dv KERN_POOL_DEBUG Ta "integer" Ta "yes" 511.It Dv KERN_POSIX1 Ta "integer" Ta "no" 512.It Dv KERN_PROC Ta "struct kinfo_proc" Ta "no" 513.It Dv KERN_PROC_ARGS Ta "node" Ta "not applicable" 514.It Dv KERN_PROC_CWD Ta "string" Ta "not applicable" 515.It Dv KERN_PROC_NOBROADCASTKILL Ta "node" Ta "not applicable" 516.It Dv KERN_PROC_VMMAP Ta "struct kinfo_vmentry" Ta "no" 517.It Dv KERN_PROF Ta "node" Ta "not applicable" 518.It Dv KERN_RAWPARTITION Ta "integer" Ta "no" 519.It Dv KERN_SAVED_IDS Ta "integer" Ta "no" 520.It Dv KERN_SECURELVL Ta "integer" Ta "raise only" 521.It Dv KERN_SEMINFO Ta "node" Ta "not applicable" 522.It Dv KERN_SHMINFO Ta "node" Ta "not applicable" 523.It Dv KERN_SOMAXCONN Ta "integer" Ta "yes" 524.It Dv KERN_SOMINCONN Ta "integer" Ta "yes" 525.It Dv KERN_SPLASSERT Ta "int" Ta "yes" 526.It Dv KERN_STACKGAPRANDOM Ta "integer" Ta "yes" 527.It Dv KERN_SYSVIPC_INFO Ta "node" Ta "not applicable" 528.It Dv KERN_SYSVMSG Ta "integer" Ta "no" 529.It Dv KERN_SYSVSEM Ta "integer" Ta "no" 530.It Dv KERN_SYSVSHM Ta "integer" Ta "no" 531.It Dv KERN_TIMECOUNTER Ta "node" Ta "not applicable" 532.It Dv KERN_TTY Ta "node" Ta "not applicable" 533.It Dv KERN_TTYCOUNT Ta "integer" Ta "no" 534.It Dv KERN_UTC_OFFSET Ta "integer" Ta "yes" 535.It Dv KERN_VERSION Ta "string" Ta "no" 536.It Dv KERN_VIDEO Ta "node" Ta "yes" 537.It Dv KERN_WATCHDOG Ta "node" Ta "not applicable" 538.It Dv KERN_WITNESS Ta "node" Ta "not applicable" 539.It Dv KERN_WXABORT Ta "integer" Ta "yes" 540.El 541.Bl -tag -width "123456" 542.It Dv KERN_ALLOWDT Pq Va kern.allowdt 543Allow userland processes access to 544.Pa /dev/dt . 545When running with a 546.Xr securelevel 7 547greater than 0, 548this variable may not be changed. 549.It Dv KERN_ALLOWKMEM Pq Va kern.allowkmem 550Allow userland processes access to 551.Pa /dev/mem 552and 553.Pa /dev/kmem . 554When running with a 555.Xr securelevel 7 556greater than 0, 557this variable may not be changed. 558.It Dv KERN_ARGMAX Pq Va kern.argmax 559The maximum number of bytes allowed among the arguments to 560.Xr execve 2 . 561.It Dv KERN_AUDIO Pq Va kern.audio 562Control device-independent aspects of the 563.Xr audio 4 564subsystem. 565.Bl -column "KERN_AUDIO_KBDCONTROL" "integer" "Changeable" -offset indent 566.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 567.It Dv KERN_AUDIO_RECORD Ta "integer" Ta "yes" 568.It Dv KERN_AUDIO_KBDCONTROL Ta "integer" Ta "yes" 569.El 570.Pp 571The variables are as follows: 572.Bl -tag -width "123456" 573.It Dv KERN_AUDIO_RECORD Pq Va kern.audio.record 574If set to the default value of 0, recording is muted by default 575for all audio devices. 576Otherwise, audio recording is enabled by default. 577For individual devices, this setting can be overridden with the 578.Xr mixerctl 8 579.Va record.enable 580variable. 581.It Dv KERN_AUDIO_KBDCONTROL Pq Va kern.audio.kbdcontrol 582If set to the default value of 1, the 583.Xr wskbd 4 584driver will attempt to adjust the level of the first 585.Xr audio 4 586device when the volume keys of multimedia keyboards are pressed. 587.El 588.It Dv KERN_BOOTTIME Pq Va kern.boottime 589A 590.Vt struct timeval 591structure is returned. 592This structure contains the time that the system was booted. 593.It Dv KERN_CACHEPCT Pq Va kern.bufcachepercent 594The maximum percentage of DMA-reachable physical memory 595the buffer cache may use. 596.It Dv KERN_CCPU Pq Va kern.ccpu 597The scheduler exponential decay value. 598.It Dv KERN_CLOCKRATE Pq Va kern.clockrate 599A 600.Vt struct clockinfo 601structure is returned. 602This structure contains the hard clock, statistics clock and profiling clock 603frequencies, and the number of microseconds per hard clock tick. 604.It Dv KERN_CONSDEV Pq Va kern.consdev 605The console device. 606.It Dv KERN_CPTIME Pq Va kern.cp_time 607An array of longs of size 608.Dv CPUSTATES 609is returned, containing statistics about the number of ticks spent by 610the system in interrupt processing, user processes 611.Po 612.Xr nice 1 613or normal 614.Pc , 615system processing, lock spinning, or idling. 616.It Dv KERN_CPTIME2 Pq Va kern.cp_time2 617Similar to 618.Dv KERN_CPTIME , 619but obtains information from only the single CPU specified by the 620third level name given. 621.It Dv KERN_CPUSTATS 622A 623.Vt struct cpustats 624structure is returned. 625This structure contains the array described in 626.Dv KERN_CPTIME2 627and a bit mask indicating the status of the CPU specified by the 628third level name. 629.It Dv KERN_DOMAINNAME Pq Va kern.domainname 630Get or set the YP domain name like with 631.Xr getdomainname 3 , 632.Xr setdomainname 3 , 633and 634.Xr domainname 1 . 635.It Dv KERN_FILE Pq Va kern.file 636Return the entire file table, or a subset of it. 637An array of 638.Vt struct kinfo_file 639structures is returned, 640whose size depends on the current number of selected files in the system. 641The third and fourth level names are as follows: 642.Bl -column "Third level name" "Fourth level is:" -offset indent 643.It Sy "Third level name" Ta Sy "Fourth level is:" 644.It Dv KERN_FILE_BYFILE Ta "A file type" 645.It Dv KERN_FILE_BYPID Ta "A process ID" 646.It Dv KERN_FILE_BYUID Ta "A user ID" 647.El 648.Pp 649The fifth level name is the size of the 650.Vt struct kinfo_file 651and the sixth level name is the number of structures to return. 652.It Dv KERN_FORKSTAT Pq Va kern.forkstat 653A 654.Vt struct forkstat 655structure is returned. 656This structure contains information about the number of 657.Xr fork 2 , 658.Xr vfork 2 , 659and 660.Xr __tfork 3 661system calls as well as kernel thread creations since system startup, 662and the number of pages of virtual memory involved in each. 663.It Dv KERN_FSCALE Pq Va kern.fscale 664The kernel fixed-point scale factor. 665.It Dv KERN_FSYNC Pq Va kern.fsync 666Return 1 if the File Synchronisation Option is available on this system, 667otherwise 0. 668.It Dv KERN_GLOBAL_PTRACE Pq Va kern.global_ptrace 669When set to 1, permit 670.Xr ptrace 2 671to attach to any process with the appropriate privileges. 672When set to 0, processes may only attach to their own descendants. 673.It Dv KERN_HOSTID Pq Va kern.hostid 674Get or set the host ID. 675.It Dv KERN_HOSTNAME Pq Va kern.hostname 676Get or set the hostname like with 677.Xr gethostname 3 , 678.Xr sethostname 3 , 679and 680.Xr hostname 1 . 681.It Dv KERN_JOB_CONTROL Pq Va kern.job_control 682Return 1 if job control is available on this system, otherwise 0. 683.It Dv KERN_MALLOCSTATS Pq Va kern.malloc 684Return kernel memory bucket statistics. 685The third level names are detailed below. 686There are no changeable values in this branch. 687.Bl -column "KERN_MALLOC_KMEMNAMES" "string" -offset indent 688.It Sy "Third level name" Ta Sy "Type" 689.It Dv KERN_MALLOC_BUCKET Ta "node" 690.It Dv KERN_MALLOC_BUCKETS Ta "string" 691.It Dv KERN_MALLOC_KMEMNAMES Ta "string" 692.It Dv KERN_MALLOC_KMEMSTATS Ta "node" 693.El 694.Pp 695The variables are as follows: 696.Bl -tag -width "123456" 697.It Dv KERN_MALLOC_BUCKET.<size> Pq Va kern.malloc.bucket 698A node containing the statistics for the memory bucket of the 699specified size (in decimal notation, the number of bytes per bucket 700element, e.g., 16, 32, 128). 701Each node returns a 702.Vt struct kmembuckets . 703.Pp 704If a value is specified that does not correspond directly to a 705bucket size, the statistics for the closest larger bucket size will be 706returned instead. 707.Pp 708Note that bucket sizes are typically powers of 2. 709.It Dv KERN_MALLOC_BUCKETS Pq Va kern.malloc.buckets 710Return a comma-separated list of the bucket sizes used by the kernel. 711.It Dv KERN_MALLOC_KMEMNAMES Pq Va kern.malloc.kmemnames 712Return a comma-separated list of the names of the kernel 713.Xr malloc 9 714types. 715.It Dv KERN_MALLOC_KMEMSTATS Pq Va kern.malloc.kmemstat 716A node containing the statistics for the memory types of the specified 717name. 718Each node returns a 719.Vt struct kmemstats . 720.El 721.It Dv KERN_MAXCLUSTERS Pq Va kern.maxclusters 722The maximum number of 723.Xr mbuf 9 724clusters that may be allocated. 725.It Dv KERN_MAXFILES Pq Va kern.maxfiles 726The maximum number of open files that may be open in the system. 727.It Dv KERN_MAXLOCKSPERUID Pq Va kern.maxlocksperuid 728The maximum number of file locks per user; 729the default is 1024. 730.It Dv KERN_MAXPARTITIONS Pq Va kern.maxpartitions 731The maximum number of partitions allowed per disk. 732.It Dv KERN_MAXPROC Pq Va kern.maxproc 733The maximum number of simultaneous processes the system will allow. 734.It Dv KERN_MAXTHREAD Pq Va kern.maxthread 735The maximum number of simultaneous threads the system will allow. 736.It Dv KERN_MAXVNODES Pq Va kern.maxvnodes 737The maximum number of vnodes available on the system. 738.It Dv KERN_MBSTAT Pq Va kern.mbstat 739A 740.Vt struct mbstat 741structure is returned, containing statistics on 742.Xr mbuf 9 743usage. 744.It Dv KERN_MSGBUF Pq Va kern.msgbuf 745Returns a buffer containing kernel log messages; 746see 747.Xr dmesg 8 . 748.It Dv KERN_MSGBUFSIZE Pq Va kern.msgbufsize 749The size of the kernel message buffer. 750.It Dv KERN_NCHSTATS Pq Va kern.nchstats 751A 752.Vt struct nchstats 753structure is returned. 754This structure contains information about the 755filename to 756.Xr inode 5 757mapping cache. 758.It Dv KERN_NFILES Pq Va kern.nfiles 759Number of open files. 760.It Dv KERN_NGROUPS Pq Va kern.ngroups 761The maximum number of supplemental groups. 762.It Dv KERN_NOSUIDCOREDUMP Pq Va kern.nosuidcoredump 763Whether a process may dump core after changing user or group ID: 764.Bl -column "value" "condition" "current directory" 765.It Sy "value" Ta Sy "condition" Ta Sy "dump core to" 766.It 0 Ta "euid == 0" Ta "current directory" 767.It 1 Ta "never" Ta "" 768.It 2 Ta "always" Ta Pa "/var/crash" 769.It 3 Ta "depends" Ta Pa "/var/crash/$programname/" 770.El 771.It Dv KERN_NPROCS Pq Va kern.nprocs 772The number of entries in the kernel process table. 773.It Dv KERN_NTHREADS Pq Va kern.nthreads 774The number of entries in the kernel thread table. 775.It Dv KERN_NUMVNODES Pq Va kern.numvnodes 776Number of vnodes in use. 777.It Dv KERN_OSRELEASE Pq Va kern.osrelease 778The system release string as returned by 779.Xr uname 1 780.Fl r . 781.It Dv KERN_OSREV Pq Va kern.osrevision 782The system revision number. 783.It Dv KERN_OSTYPE Pq Va kern.ostype 784The system type string as returned by 785.Xr uname 1 786.Fl s ; 787it is always 788.Dq Ox . 789.It Dv KERN_OSVERSION Pq Va kern.osversion 790The kernel build version as returned by 791.Xr uname 1 792.Fl v . 793.It Dv KERN_PFSTATUS 794The 795.Vt struct pf_status 796structure. 797.It Dv KERN_POOL_DEBUG Pq Va kern.pool_debug 798Modify the memory pool debug level. 799Valid values are: 800.Pp 801.Bl -tag -width 3n -offset indent -compact 802.It 0 803Disable pool debugging. 804.It 1 805Enable use after free detection. 806.It 2 807In addition to 1, when calling either 808.Xr malloc 9 809or 810.Xr pool_get 9 811with flags indicating that sleeping is allowed then always yield. 812Useful to detect potential races. 813.El 814.It Dv KERN_POSIX1 Pq Va kern.posix1version 815The version of ISO/IEC 9945 (POSIX 1003.1) with which the system 816attempts to comply. 817.It Dv KERN_PROC Pq Va kern.proc 818Return the entire process table, or a subset of it. 819An array of 820.Vt struct kinfo_proc 821structures is returned, 822whose size depends on the current number of selected processes in the system. 823The third and fourth level names are as follows: 824.Bl -column "KERN_PROC_SESSION" "Fourth level is:" -offset indent 825.It Sy "Third level name" Ta Sy "Fourth level is:" 826.It Dv KERN_PROC_ALL Ta "None" 827.It Dv KERN_PROC_KTHREAD Ta "A kernel thread" 828.It Dv KERN_PROC_PID Ta "A process ID" 829.It Dv KERN_PROC_PGRP Ta "A process group" 830.It Dv KERN_PROC_RUID Ta "A real user ID" 831.It Dv KERN_PROC_SESSION Ta "A session PID" 832.It Dv KERN_PROC_TTY Ta "A tty device" 833.It Dv KERN_PROC_UID Ta "A user ID" 834.El 835.Pp 836The fifth level name is the size of the 837.Vt struct kinfo_proc 838and the sixth level name is the number of structures to return. 839.It Dv KERN_PROC_ARGS Pq Va kern.procargs 840Returns the arguments or environment of a process. 841The third level name is the PID of the process. 842The fourth level name is one of: 843.Bl -column KERN_PROC_NARGV -offset indent 844.It Dv KERN_PROC_ARGV 845.It Dv KERN_PROC_ENV 846.It Dv KERN_PROC_NARGV 847.It Dv KERN_PROC_NENV 848.El 849.Pp 850.Dv KERN_PROC_NARGV 851and 852.Dv KERN_PROC_NENV 853return the number of elements as an 854.Vt int 855in the argv or env array. 856.Dv KERN_PROC_ARGV 857returns the argv array and 858.Dv KERN_PROC_ENV 859returns the environ array. 860The buffer pointed to by 861.Fa oldp 862is filled with an array of char pointers 863followed by the strings themselves. 864The last char pointer is a 865.Dv NULL 866pointer. 867.It Dv KERN_PROC_CWD Pq Va kern.proc_cwd 868Return the current working directory of a process. 869The third level name is the target process ID. 870A NUL-terminated string is returned. 871.It Dv KERN_PROC_NOBROADCASTKILL Pq Va kern.proc_nobroadcastkill 872When set, a process will no longer be signaled when sending broadcast signals. 873The third level name is the target process ID. 874.It Dv KERN_PROC_VMMAP Pq Va kern.proc_vmmap 875Return the entire process VM map entries. 876An array of 877.Vt struct kinfo_vmentry 878structures is returned, 879whose size depends on the current number of VM map entries 880of the selected process. 881Iteration is possible by setting the base address in the first element of 882.Vt struct kinfo_vmentry . 883.It Dv KERN_PROF Pq Va kern.profiling 884Return profiling information about the kernel. 885If the kernel is not compiled for profiling, 886attempts to retrieve any of the 887.Dv KERN_PROF 888values will fail with 889.Er EOPNOTSUPP . 890The third level names for the string and integer profiling information 891are detailed below. 892The changeable column shows whether a process with appropriate 893privileges may change the value. 894.Bl -column "Third level name" "struct gmonparam" -offset indent 895.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 896.It Dv GPROF_COUNT Ta "u_short[]" Ta "yes" 897.It Dv GPROF_FROMS Ta "u_short[]" Ta "yes" 898.It Dv GPROF_GMONPARAM Ta "struct gmonparam" Ta "no" 899.It Dv GPROF_STATE Ta "integer" Ta "yes" 900.It Dv GPROF_TOS Ta "struct tostruct" Ta "yes" 901.El 902.Pp 903The variables are as follows: 904.Bl -tag -width "123456" 905.It Dv GPROF_COUNT 906Array of statistical program counter counts. 907.It Dv GPROF_FROMS 908Array indexed by program counter of call-from points. 909.It Dv GPROF_GMONPARAM 910Structure giving the sizes of the above arrays. 911.It Dv GPROF_STATE 912Returns 913.Dv GMON_PROF_ON 914or 915.Dv GMON_PROF_OFF 916to show that profiling is running or stopped. 917.It Dv GPROF_TOS 918Array of 919.Vt struct tostruct 920describing destination of calls and their counts. 921.El 922.It Dv KERN_RAWPARTITION Pq Va kern.rawpartition 923The raw partition of a disk (a == 0). 924.It Dv KERN_SAVED_IDS Pq Va kern.saved_ids 925Returns 1 if saved set-group-ID and saved set-user-ID are available. 926.It Dv KERN_SECURELVL Pq Va kern.securelevel 927The system security level. 928This level may be raised by processes with appropriate privileges. 929It may only be lowered by process 1. 930.It Dv KERN_SEMINFO Pq Va kern.seminfo 931Return the elements of 932.Vt struct seminfo . 933If the kernel is not compiled with System V style semaphore support, 934attempts to retrieve any of the 935.Dv KERN_SEMINFO 936values will fail with 937.Er EOPNOTSUPP . 938The third level names for the elements of 939.Vt struct seminfo 940are detailed below. 941The changeable column shows whether a process with appropriate 942privileges may change the value. 943.Bl -column "KERN_SEMINFO_SEMMNI" "integer" "Changeable" -offset indent 944.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 945.It Dv KERN_SEMINFO_SEMAEM Ta "integer" Ta "no" 946.It Dv KERN_SEMINFO_SEMMNI Ta "integer" Ta "yes" 947.It Dv KERN_SEMINFO_SEMMNS Ta "integer" Ta "yes" 948.It Dv KERN_SEMINFO_SEMMNU Ta "integer" Ta "yes" 949.It Dv KERN_SEMINFO_SEMMSL Ta "integer" Ta "yes" 950.It Dv KERN_SEMINFO_SEMOPM Ta "integer" Ta "yes" 951.It Dv KERN_SEMINFO_SEMUME Ta "integer" Ta "no" 952.It Dv KERN_SEMINFO_SEMUSZ Ta "integer" Ta "no" 953.It Dv KERN_SEMINFO_SEMVMX Ta "integer" Ta "no" 954.El 955.Pp 956The variables are as follows: 957.Bl -tag -width "123456" 958.It Dv KERN_SEMINFO_SEMAEM Pq Va kern.seminfo.semaem 959The adjust on exit maximum value. 960.It Dv KERN_SEMINFO_SEMMNI Pq Va kern.seminfo.semmni 961The maximum number of semaphore identifiers allowed. 962.It Dv KERN_SEMINFO_SEMMNS Pq Va kern.seminfo.semmns 963The maximum number of semaphores allowed in the system. 964.It Dv KERN_SEMINFO_SEMMNU Pq Va kern.seminfo.semmnu 965The maximum number of semaphore undo structures allowed in the system. 966.It Dv KERN_SEMINFO_SEMMSL Pq Va kern.seminfo.semmsl 967The maximum number of semaphores allowed per ID. 968.It Dv KERN_SEMINFO_SEMOPM Pq Va kern.seminfo.semopm 969The maximum number of operations per 970.Xr semop 2 971call. 972.It Dv KERN_SEMINFO_SEMUME Pq Va kern.seminfo.semume 973The maximum number of undo entries per process. 974.It Dv KERN_SEMINFO_SEMUSZ Pq Va kern.seminfo.semusz 975The size (in bytes) of the undo structure. 976.It Dv KERN_SEMINFO_SEMVMX Pq Va kern.seminfo.semvmx 977The semaphore maximum value. 978.El 979.It Dv KERN_SHMINFO Pq Va kern.shminfo 980Return the elements of 981.Vt struct shminfo . 982If the kernel is not compiled with System V style shared memory support, 983attempts to retrieve any of the 984.Dv KERN_SHMINFO 985values will fail with 986.Er EOPNOTSUPP . 987The third level names for the elements of 988.Vt struct shminfo 989are detailed below. 990The changeable column shows whether a process with appropriate 991privileges may change the value. 992.Bl -column "KERN_SHMINFO_SHMMAX" "integer" "Changeable" -offset indent 993.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 994.It Dv KERN_SHMINFO_SHMALL Ta "integer" Ta "yes" 995.It Dv KERN_SHMINFO_SHMMAX Ta "integer" Ta "yes" 996.It Dv KERN_SHMINFO_SHMMIN Ta "integer" Ta "yes" 997.It Dv KERN_SHMINFO_SHMMNI Ta "integer" Ta "yes" 998.It Dv KERN_SHMINFO_SHMSEG Ta "integer" Ta "yes" 999.El 1000.Pp 1001The variables are as follows: 1002.Bl -tag -width "123456" 1003.It Dv KERN_SHMINFO_SHMALL Pq Va kern.shminfo.shmall 1004The maximum amount of total shared memory allowed in the system (in pages). 1005.It Dv KERN_SHMINFO_SHMMAX Pq Va kern.shminfo.shmmax 1006The maximum shared memory segment size (in bytes). 1007.It Dv KERN_SHMINFO_SHMMIN Pq Va kern.shminfo.shmmin 1008The minimum shared memory segment size (in bytes). 1009.It Dv KERN_SHMINFO_SHMMNI Pq Va kern.shminfo.shmmni 1010The maximum number of shared memory identifiers in the system. 1011.It Dv KERN_SHMINFO_SHMSEG Pq Va kern.shminfo.shmseg 1012The maximum number of shared memory segments per process. 1013.El 1014.It Dv KERN_SOMAXCONN Pq Va kern.somaxconn 1015Upper bound on the number of half-open connections a process can allow 1016to be associated with a socket, using 1017.Xr listen 2 . 1018The default value is 128. 1019.It Dv KERN_SOMINCONN Pq Va kern.sominconn 1020Lower bound on the number of half-open connections a process can allow 1021to be associated with a socket, using 1022.Xr listen 2 . 1023The default value is 80. 1024.It Dv KERN_SPLASSERT Pq Va kern.splassert 1025Modify the system interrupt priority level. 1026Valid values are: 1027.Pp 1028.Bl -tag -width 3n -offset indent -compact 1029.It 0 1030Disable error checking. 1031.It 1 1032Print a message if an error is detected. 1033.It 2 1034Print a message if an error is detected, 1035and a stack trace if possible. 1036.It 3 1037The same as 2, but also drop into the kernel debugger. 1038.El 1039.Pp 1040Any other value causes a system panic on errors. 1041See 1042.Xr splassert 9 1043for more information. 1044.It Dv KERN_STACKGAPRANDOM Pq Va kern.stackgap_random 1045Sets the range of the random value added to the stack pointer on each 1046program execution. 1047The random value is added to make buffer overflow exploitation slightly 1048harder. 1049The bigger the number, the harder it is to brute force this added protection, 1050but it also means bigger waste of memory. 1051.It Dv KERN_SYSVIPC_INFO Pq Va kern.sysvipc_info 1052Return System V style IPC configuration and run-time information. 1053The third level name selects the System V style IPC facility. 1054.Bl -column "KERN_SYSVIPC_MSG_INFO" "struct shm_sysctl_info" -offset indent 1055.It Sy "Third level name" Ta Sy "Type" 1056.It Dv KERN_SYSVIPC_MSG_INFO Ta "struct msg_sysctl_info" 1057.It Dv KERN_SYSVIPC_SEM_INFO Ta "struct sem_sysctl_info" 1058.It Dv KERN_SYSVIPC_SHM_INFO Ta "struct shm_sysctl_info" 1059.El 1060.Bl -tag -width "123456" 1061.It Dv KERN_SYSVIPC_MSG_INFO 1062Return information on the System V style message facility. 1063The 1064.Sy msg_sysctl_info 1065structure is defined in 1066.In sys/msg.h . 1067.It Dv KERN_SYSVIPC_SEM_INFO 1068Return information on the System V style semaphore facility. 1069The 1070.Sy sem_sysctl_info 1071structure is defined in 1072.In sys/sem.h . 1073.It Dv KERN_SYSVIPC_SHM_INFO 1074Return information on the System V style shared memory facility. 1075The 1076.Sy shm_sysctl_info 1077structure is defined in 1078.In sys/shm.h . 1079.El 1080.It Dv KERN_SYSVMSG Pq Va kern.sysvmsg 1081Returns 1 if System V style message queue functionality is available on this 1082system, otherwise 0. 1083.It Dv KERN_SYSVSEM Pq Va kern.sysvem 1084Returns 1 if System V style semaphore functionality is available on this 1085system, otherwise 0. 1086.It Dv KERN_SYSVSHM Pq Va kern.sysvshm 1087Returns 1 if System V style shared memory functionality is available on this 1088system, otherwise 0. 1089.It Dv KERN_TIMECOUNTER Pq Va kern.timecounter 1090Return statistics information about the kernel time counter. 1091The third level names information is detailed below. 1092The changeable column shows whether a process with appropriate 1093privileges may change the value. 1094.Bl -column "KERN_TIMECOUNTER_TIMESTEPWARNINGS" "integer" -offset indent 1095.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 1096.It Dv KERN_TIMECOUNTER_CHOICE Ta "string" Ta "no" 1097.It Dv KERN_TIMECOUNTER_HARDWARE Ta "string" Ta "yes" 1098.It Dv KERN_TIMECOUNTER_TICK Ta "integer" Ta "no" 1099.It Dv KERN_TIMECOUNTER_TIMESTEPWARNINGS Ta "integer" Ta "yes" 1100.El 1101.Pp 1102The variables are as follows: 1103.Bl -tag -width "123456" 1104.It Dv KERN_TIMECOUNTER_CHOICE Pq Va kern.timecounter.choice 1105Get the list of kernel time counter sources and their claimed 1106quality (higher is better). 1107.It Dv KERN_TIMECOUNTER_HARDWARE Pq Va kern.timecounter.hardware 1108Get or set the kernel time counter source by name. 1109.It Dv KERN_TIMECOUNTER_TICK Pq Va kern.timecounter.tick 1110Get the number of times we have reset the kernel time counter 1111information. 1112.It Dv KERN_TIMECOUNTER_TIMESTEPWARNINGS Pq Va kern.timecounter.timestepwarnings 1113Get or set a flag to log a message when the kernel time is 1114stepped. 1115.El 1116.It Dv KERN_TTY Pq Va kern.tty 1117Return statistics information about tty input/output. 1118The third level names information is detailed below. 1119The changeable column shows whether a process with appropriate 1120privileges may change the value. 1121.Bl -column "KERN_TTY_TKRAWCC" "struct itty" "Changeable" -offset indent 1122.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 1123.It Dv KERN_TTY_INFO Ta "struct itty" Ta "no" 1124.It Dv KERN_TTY_TKCANCC Ta "int64_t" Ta "no" 1125.It Dv KERN_TTY_TKNIN Ta "int64_t" Ta "no" 1126.It Dv KERN_TTY_TKNOUT Ta "int64_t" Ta "no" 1127.It Dv KERN_TTY_TKRAWCC Ta "int64_t" Ta "no" 1128.El 1129.Pp 1130The variables are as follows: 1131.Bl -tag -width "123456" 1132.It Dv KERN_TTY_INFO Pq Va kern.tty.ttyinfo 1133Returns an array of 1134.Vt struct itty 1135structures containing tty statistics. 1136.It Dv KERN_TTY_TKCANCC Pq Va kern.tty.tk_cancc 1137Returns the number of input characters in canonical mode. 1138.It Dv KERN_TTY_TKNIN Pq Va kern.tty.tk_nin 1139Returns the number of input characters from a 1140.Xr tty 4 . 1141.It Dv KERN_TTY_TKNOUT Pq Va kern.tty.tk_nout 1142Returns the number of output characters on a 1143.Xr tty 4 . 1144.It Dv KERN_TTY_TKRAWCC Pq Va kern.tty.tk_rawcc 1145Returns the number of input characters in raw mode. 1146.El 1147.It Dv KERN_TTYCOUNT Pq Va kern.ttycount 1148Number of available 1149.Xr tty 4 1150devices. 1151.It Dv KERN_UTC_OFFSET Pq Va kern.utc_offset 1152The real-time clock's 1153.Pq RTC 1154offset from 1155Coordinated Universal Time 1156.Pq UTC 1157expressed as minutes East of UTC+0. 1158When set, 1159time read from the RTC is adjusted to remove the offset 1160and time written to the RTC is adjusted to reapply it. 1161This may simplify multibooting with an operating system that 1162does not run the RTC in UTC mode. 1163When running with a 1164.Xr securelevel 7 1165greater than 0, 1166this variable may not be changed. 1167.It Dv KERN_VERSION Pq Va kern.version 1168The system version string. 1169.It Dv KERN_VIDEO Pq Va kern.video 1170Control device-independent aspects of the 1171.Xr video 4 1172subsystem. 1173Currently, there is one subnode: 1174.Bl -column "KERN_VIDEO_RECORD" "integer" "Changeable" -offset indent 1175.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 1176.It Dv KERN_VIDEO_RECORD Ta "integer" Ta "yes" 1177.El 1178.Pp 1179Its meaning is as follows: 1180.Bl -tag -width "123456" 1181.It Dv KERN_VIDEO_RECORD Pq Va kern.video.record 1182If set to the default value of 0, recording is blanked for all video devices. 1183If the value is non-zero, video recording is enabled. 1184.El 1185.It Dv KERN_WATCHDOG Pq Va kern.watchdog 1186Return information on hardware watchdog timers. 1187If the kernel does not support a hardware watchdog timer, 1188attempts to retrieve or set any of the 1189.Dv KERN_WATCHDOG 1190values will fail with 1191.Er EOPNOTSUPP . 1192.Bl -column "KERN_WATCHDOG_PERIOD" "integer" "Changeable" -offset indent 1193.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 1194.It Dv KERN_WATCHDOG_AUTO Ta "integer" Ta "yes" 1195.It Dv KERN_WATCHDOG_PERIOD Ta "integer" Ta "yes" 1196.El 1197.Pp 1198The variables are as follows: 1199.Bl -tag -width "123456" 1200.It Dv KERN_WATCHDOG_AUTO Pq Va kern.watchdog.auto 1201If set to 1, the kernel refreshes the watchdog timer periodically. 1202If set to 0, a userland process must ensure that the watchdog timer 1203gets refreshed by setting the 1204.Dv KERN_WATCHDOG_PERIOD 1205variable. 1206.It Dv KERN_WATCHDOG_PERIOD Pq Va kern.watchdog.period 1207The period of the watchdog timer in seconds. 1208Set to 0 to disable the watchdog timer. 1209.El 1210.It Dv KERN_WITNESS Pq Va kern.witness 1211Control settings of 1212.Xr witness 4 . 1213.Bl -column "KERN_WITNESS_LOCKTRACE" "integer" "Changeable" -offset indent 1214.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 1215.It Dv KERN_WITNESS_LOCKTRACE Ta "integer" Ta "yes" 1216.It Dv KERN_WITNESS_WATCH Ta "integer" Ta "yes" 1217.El 1218.Pp 1219The variables are as follows: 1220.Bl -tag -width "123456" 1221.It Dv KERN_WITNESS_LOCKTRACE Pq Va kern.witness.locktrace 1222When set, 1223.Xr witness 4 1224saves a stack trace on each lock acquisition. 1225The stack traces of acquired locks can be viewed using 1226.Xr ddb 4 . 1227.It Dv KERN_WITNESS_WATCH Pq Va kern.witness.watch 1228Control how 1229.Xr witness 4 1230behaves on error. 1231Valid values are: 1232.Pp 1233.Bl -tag -width 3n -offset indent -compact 1234.It -1 1235Disable 1236.Xr witness 4 1237completely. 1238System reboot is needed to re-enable it. 1239.It 0 1240Disable lock order checking. 1241.It 1 1242Print a message if an error is detected. 1243.It 2 1244Print a message if an error is detected, 1245and a stack trace if possible. 1246.It 3 1247The same as 2, but also drop into the kernel debugger. 1248.El 1249.El 1250.It Dv KERN_WXABORT Pq Va kern.wxabort 1251Generate an abort, 1252rather than returning an error, 1253on W^X violation. 1254.El 1255.Ss CTL_MACHDEP 1256The set of variables defined is architecture dependent. 1257Most architectures define at least the following variables. 1258.Bl -column "Second level name" "dev_t" "Changeable" -offset indent 1259.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable" 1260.It Dv CPU_CONSDEV Ta "dev_t" Ta "no" 1261.El 1262.Pp 1263Consult the example file 1264.Pa /etc/examples/sysctl.conf 1265for a non-exhaustive list of 1266.Va machdep 1267variables. 1268.Ss CTL_NET 1269The string and integer information available for the 1270.Dv CTL_NET 1271level is detailed below. 1272The changeable column shows whether a process with appropriate 1273privileges may change the value. 1274.Bl -column "Second level name" "routing messages" "Changeable" -offset indent 1275.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable" 1276.It Dv PF_ROUTE Ta "routing messages" Ta "no" 1277.It Dv PF_INET Ta "IPv4 values" Ta "yes" 1278.It Dv PF_INET6 Ta "IPv6 values" Ta "yes" 1279.It Dv PF_UNIX Ta "UNIX-domain values" Ta "yes" 1280.It Dv PF_KEY Ta "key management" Ta "no" 1281.It Dv PF_MPLS Ta "MPLS values" Ta "yes" 1282.It Dv PF_PIPEX Ta "PIPEX values" Ta "yes" 1283.El 1284.Bl -tag -width "123456" 1285.It Dv PF_ROUTE 1286Return the entire routing table or a subset of it. 1287The data is returned as a sequence of routing messages (see 1288.Xr route 4 1289for the header file, format, and meaning). 1290The length of each message is contained in the message header. 1291.Pp 1292The third level name is a protocol number, which is currently always 0. 1293The fourth level name is an address family, which may be set to 0 to 1294select all address families. 1295The fifth and sixth level names are as follows: 1296.Bl -column "Fifth level name" "Sixth level is:" -offset indent 1297.It Sy "Fifth level name" Ta Sy "Sixth level is:" 1298.It Dv NET_RT_DUMP Ta "priority" 1299.It Dv NET_RT_FLAGS Ta "rtflags" 1300.It Dv NET_RT_IFLIST Ta "None" 1301.It Dv NET_RT_IFNAMES Ta "None" 1302.It Dv NET_RT_STATS Ta "None" 1303.It Dv NET_RT_TABLE Ta "rtableid" 1304.El 1305.Bl -tag -width "123456" 1306.It Dv NET_RT_DUMP 1307If set to 0, show all routes. 1308If set to any number, show all routes with that number priority. 1309If set to a negative number, show routes that do not have the positive 1310priority value. 1311.El 1312.Pp 1313An optional seventh level name can be provided to select the routing table 1314on which to run the operation. 1315If not provided, the current routing table is used. 1316.It Dv PF_INET 1317Get or set various global information about IPv4 1318.Pq Internet Protocol version 4 . 1319The third level name is the protocol. 1320The fourth level name is the variable name. 1321The currently defined protocols and names are: 1322.Bl -column "Protocol name" "ipsec-expire-acquire" "structure" "Changeable" -offset 2n 1323.It Sy "Protocol name" Ta Sy "Variable name" Ta Sy "Type" Ta Sy "Changeable" 1324.It ah Ta enable Ta integer Ta yes 1325.It bpf Ta bufsize Ta integer Ta yes 1326.It bpf Ta maxbufsize Ta integer Ta yes 1327.It carp Ta allow Ta integer Ta yes 1328.It carp Ta log Ta integer Ta yes 1329.It carp Ta preempt Ta integer Ta yes 1330.It divert Ta recvspace Ta integer Ta yes 1331.It divert Ta sendspace Ta integer Ta yes 1332.It esp Ta enable Ta integer Ta yes 1333.It esp Ta udpencap Ta integer Ta yes 1334.It esp Ta udpencap_port Ta integer Ta yes 1335.It etherip Ta allow Ta integer Ta yes 1336.It gre Ta allow Ta integer Ta yes 1337.It gre Ta wccp Ta integer Ta yes 1338.It icmp Ta bmcastecho Ta integer Ta yes 1339.It icmp Ta errppslimit Ta integer Ta yes 1340.It icmp Ta maskrepl Ta integer Ta yes 1341.It icmp Ta rediraccept Ta integer Ta yes 1342.It icmp Ta redirtimeout Ta integer Ta yes 1343.It icmp Ta stats Ta structure Ta no 1344.It icmp Ta tstamprepl Ta integer Ta yes 1345.It ip Ta arpqueued Ta integer Ta no 1346.It ip Ta arpdown Ta integer Ta yes 1347.It ip Ta arptimeout Ta integer Ta yes 1348.It ip Ta arpq Ta node Ta "N/A" 1349.It ip Ta directed-broadcast Ta integer Ta yes 1350.It ip Ta encdebug Ta integer Ta yes 1351.It ip Ta forwarding Ta integer Ta yes 1352.It ip Ta ipsec-allocs Ta integer Ta yes 1353.It ip Ta ipsec-auth-alg Ta string Ta yes 1354.It ip Ta ipsec-bytes Ta integer Ta yes 1355.It ip Ta ipsec-comp-alg Ta string Ta yes 1356.It ip Ta ipsec-enc-alg Ta string Ta yes 1357.It ip Ta ipsec-expire-acquire Ta integer Ta yes 1358.It ip Ta ipsec-firstuse Ta integer Ta yes 1359.It ip Ta ipsec-invalid-life Ta integer Ta yes 1360.It ip Ta ipsec-pfs Ta integer Ta yes 1361.It ip Ta ipsec-soft-allocs Ta integer Ta yes 1362.It ip Ta ipsec-soft-bytes Ta integer Ta yes 1363.It ip Ta ipsec-soft-firstuse Ta integer Ta yes 1364.It ip Ta ipsec-soft-timeout Ta integer Ta yes 1365.It ip Ta ipsec-timeout Ta integer Ta yes 1366.It ip Ta maxqueue Ta integer Ta yes 1367.It ip Ta mforwarding Ta integer Ta yes 1368.It ip Ta mtudisc Ta integer Ta yes 1369.It ip Ta mtudisctimeout Ta integer Ta yes 1370.It ip Ta multipath Ta integer Ta yes 1371.It ip Ta portfirst Ta integer Ta yes 1372.It ip Ta porthifirst Ta integer Ta yes 1373.It ip Ta porthilast Ta integer Ta yes 1374.It ip Ta portlast Ta integer Ta yes 1375.It ip Ta redirect Ta integer Ta yes 1376.It ip Ta sourceroute Ta integer Ta yes 1377.It ip Ta stats Ta structure Ta no 1378.It ip Ta ttl Ta integer Ta yes 1379.It ipcomp Ta enable Ta integer Ta yes 1380.It ipip Ta allow Ta integer Ta yes 1381.It tcp Ta ackonpush Ta integer Ta yes 1382.It tcp Ta always_keepalive Ta integer Ta yes 1383.It tcp Ta baddynamic Ta array Ta yes 1384.It tcp Ta ecn Ta integer Ta yes 1385.It tcp Ta ident Ta structure Ta no 1386.It tcp Ta keepidle Ta integer Ta yes 1387.It tcp Ta keepinittime Ta integer Ta yes 1388.It tcp Ta keepintvl Ta integer Ta yes 1389.It tcp Ta mssdflt Ta integer Ta yes 1390.It tcp Ta reasslimit Ta integer Ta yes 1391.It tcp Ta rfc1323 Ta integer Ta yes 1392.It tcp Ta rfc3390 Ta integer Ta yes 1393.It tcp Ta rootonly Ta array Ta yes 1394.It tcp Ta rstppslimit Ta integer Ta yes 1395.It tcp Ta sack Ta integer Ta yes 1396.It tcp Ta stats Ta structure Ta no 1397.It tcp Ta synbucketlimit Ta integer Ta yes 1398.It tcp Ta syncachelimit Ta integer Ta yes 1399.It tcp Ta synhashsize Ta integer Ta yes 1400.It tcp Ta synuselimit Ta integer Ta yes 1401.It tcp Ta tso Ta integer Ta yes 1402.It udp Ta baddynamic Ta array Ta yes 1403.It udp Ta checksum Ta integer Ta yes 1404.It udp Ta recvspace Ta integer Ta yes 1405.It udp Ta rootonly Ta array Ta yes 1406.It udp Ta sendspace Ta integer Ta yes 1407.It udp Ta stats Ta structure Ta no 1408.El 1409.Pp 1410The variables are as follows: 1411.Bl -tag -width "123456" 1412.It Li ah.enable Pq Va net.inet.ah.enable 1413If set to 1, enable the Authentication Header 1414.Pq AH 1415IPsec protocol. 1416Enabled by default. 1417See 1418.Xr ipsec 4 1419for more information. 1420.It Li bpf.bufsize Pq Va net.bpf.bufsize 1421The initial size of 1422.Xr bpf 4 1423buffers. 1424.It Li bpf.maxbufsize Pq Va net.bpf.maxbufsize 1425The maximum size a user may request a 1426.Xr bpf 4 1427buffer to be. 1428.It Li carp.allow Pq Va net.inet.carp.allow 1429If set to 0, incoming 1430.Xr carp 4 1431packets will not be processed. 1432If set to any other value, processing will occur. 1433Enabled by default. 1434.It Li carp.log Pq Va net.inet.carp.log 1435Controls the verbosity of 1436.Xr carp 4 1437logging. 1438May be a value between 0 and 7 corresponding with 1439.Xr syslog 3 1440priorities. 1441The default value is 2. 1442.It Li carp.preempt Pq Va net.inet.carp.preempt 1443If set to 0, 1444.Xr carp 4 1445will not attempt to become master if it is receiving advertisements from 1446another active master. 1447If set to any other value, carp will become master of the virtual host if it 1448believes it can send advertisements more frequently than the current master. 1449Disabled by default. 1450.It Li divert.recvspace Pq Va net.inet.divert.recvspace 1451Returns the default divert receive buffer size. 1452.It Li divert.sendspace Pq Va net.inet.divert.sendspace 1453Returns the default divert send buffer size. 1454.It Li esp.enable Pq Va net.inet.esp.enable 1455If set to 1, enable the Encapsulating Security Payload 1456.Pq ESP 1457IPsec protocol. 1458Enabled by default. 1459See 1460.Xr ipsec 4 1461for more information. 1462.It Li esp.udpencap Pq Va net.inet.esp.udpencap 1463If set to 1, enable processing of UDP encapsulated ESP packets. 1464Enabled by default. 1465.It Li esp.udpencap_port Pq Va net.inet.udpencap_port 1466Contains the value of the UDP port that triggers 1467decapsulation for incoming UDP encapsulated ESP packets. 1468The default port is 4500. 1469.It Li etherip.allow Pq Va net.inet.etherip.allow 1470If set to 0, incoming Ethernet-in-IPv4 packets will not be processed. 1471If set to any other value, processing will occur. 1472.It Li gre.allow Pq Va net.inet.gre.allow 1473If set to 0, incoming GRE packets will not be processed. 1474If set to any other value, processing will occur. 1475.It Li gre.wccp Pq Va net.inet.gre.wccp 1476If set to 0, incoming WCCPv1-style GRE packets will not be processed. 1477If set to any other value, and gre.allow allows GRE packet processing, 1478WCCPv1-style GRE packets will be processed. 1479.It Li icmp.bmcastecho Pq Va net.inet.icmp.bmcastecho 1480If set to 1, respond to ICMP echo requests destined for 1481broadcast and multicast addresses. 1482Note, enabling this could open a system to a type of denial of service attack 1483called 1484.Qq smurfing , 1485and is thus not advised. 1486.It Li icmp.errppslimit Pq Va net.inet.icmp.errppslimit 1487This variable specifies the maximum number of outgoing ICMP error messages 1488per second. 1489ICMP error messages exceeding this value are subject to rate limitation 1490and will not go out from the node. 1491A negative value disables rate limitation. 1492.It Li icmp.maskrepl Pq Va kern.inet.icmp.maskrepl 1493Returns 1 if ICMP network mask requests are to be answered. 1494.It Li icmp.rediraccept Pq Va kern.inet.icmp.rediraccept 1495If set to non-zero, the host will accept ICMP redirect packets. 1496Note that routers will never accept ICMP redirect packets, 1497and the variable is meaningful on IP hosts only. 1498.It Li icmp.redirtimeout Pq Va net.inet.icmp.redrttimeout 1499This variable specifies the lifetime of routing entries generated by incoming 1500ICMP redirects. 1501The default timeout is 10 minutes. 1502.It Li icmp.stats Pq Va kern.inet.icmp.stats 1503Returns the ICMP statistics in a struct icmpstat. 1504.It Li icmp.tstamprepl Pq Va net.inet.icmp.tstamprepl 1505If set to 1, reply to ICMP timestamp requests. 1506If set to 0, ignore timestamp requests. 1507.It Li ip.arpqueued Pq Va net.inet.ip.arpqueued 1508Number of packets ARP resolution is holding onto until it gets a MAC 1509address for an IP. 1510.It Li ip.arpdown Pq Va net.inet.ip.arpdown 1511Lifetime of unresolved ARP entries, in seconds. 1512.It Li ip.arptimeout Pq Va net.inet.ip.arptimeout 1513Lifetime of resolved ARP entries, in seconds. 1514.It Li ip.arpq 1515Fifth level comprises an array of 1516.Vt struct ifqueue 1517structures containing information about ARP queue. 1518The fifth level names for the elements of 1519.Vt struct ifqueue 1520are detailed below. 1521.Bl -column "Fifth level name" "integer" "Changeable" -offset indent 1522.It Sy "Fifth level name" Ta Sy "Type" Ta Sy "Changeable" 1523.It Dv IFQCTL_DROPS Ta "integer" Ta "no" 1524.It Dv IFQCTL_LEN Ta "integer" Ta "no" 1525.It Dv IFQCTL_MAXLEN Ta "integer" Ta "yes" 1526.El 1527.Pp 1528The variables are as follows: 1529.Pp 1530.Bl -tag -width Ds -compact 1531.It Dv IFQCTL_DROPS Pq Va net.inet.ip.arpq.drops 1532Returns number of packet dropped. 1533.It Dv IFQCTL_LEN Pq Va net.inet.ip.arpq.len 1534Returns the current queue length. 1535.It Dv IFQCTL_MAXLEN Pq Va net.inet.ip.arpq.maxlen 1536Get or set the maximum number of queue length. 1537.El 1538.It Li ip.directed-broadcast Pq Va net.inet.ip.directed-broadcast 1539Returns 1 if directed broadcast behavior is enabled for the host. 1540.It Li ip.encdebug Pq Va net.inet.ip.encdebug 1541Returns 1 when error message reporting is enabled for the host. 1542If the kernel has been compiled with the 1543.Dv ENCDEBUG 1544option, 1545then debugging information will also be reported when this variable is set. 1546.It Li ip.forwarding Pq Va net.inet.ip.forwarding 1547If set to 0, IP forwarding is disabled. 1548The IP stack also requires the destination IP address of incoming packets 1549to match the IP address of the network interface the packet is bound to. 1550If set to 1, IP forwarding is enabled for the host, 1551indicating the host is acting as a router. 1552If set to 2, IP forwarding is restricted to traffic that has been 1553IPsec encapsulated or decapsulated by the host. 1554Enabling packet forwarding (values either 1 or 2) relaxes the requirements 1555on incoming packets, 1556so that its destination address must match just any IP address 1557bound to the host. 1558The default value is 0. 1559.It Li ip.ipsec-allocs Pq Va net.inet.ip.ipsec-allocs 1560The number of IPsec flows that can use a security association before 1561it expires. 1562If set to less than or equal to zero, the security association will not 1563expire because of this counter. 1564The default value is 0. 1565.It Li ip.ipsec-auth-alg Pq Va net.inet.ip.ipsec-auth-alg 1566This is the default authentication algorithm the kernel will instruct 1567key management daemons to negotiate when establishing security 1568associations on behalf of the kernel. 1569Such security associations can occur as a result of a process having 1570requested some security level through 1571.Xr setsockopt 2 , 1572or as a result of dynamic VPN entries. 1573Supported values are hmac-md5, hmac-sha1, and hmac-ripemd160. 1574If set to any other value, it is left to the key management daemons to 1575select an authentication algorithm for the security association. 1576The default value is hmac-sha1. 1577.It Li ip.ipsec-bytes Pq Va net.inet.ip.ipsec-bytes 1578The number of bytes that will be processed by a security association 1579before it expires. 1580If set to less than or equal to zero, the security association will not 1581expire because of this counter. 1582The default value is 0. 1583.It Li ip.ipsec-comp-alg Pq Va net.inet.ip.ipsec-comp-alg 1584The compression algorithm to use with an IP Compression Association 1585.Pq IPCA . 1586Currently the only possible value is 1587.Dq deflate . 1588.It Li ip.ipsec-enc-alg Pq Va net.inet.ip.ipsec-enc-alg 1589This is the default encryption algorithm the kernel will instruct key 1590management daemons to negotiate when establishing security 1591associations on behalf of the kernel. 1592Such security associations can occur as a result of a process having 1593requested some security level through 1594.Xr setsockopt 2 , 1595or as a result of dynamic VPN entries. 1596Supported values are aes, des, 3des, blowfish and cast128. 1597If set to any other value, it is left to the key management daemons to 1598select an encryption algorithm for the security association. 1599The default value is aes. 1600.It Li ip.ipsec-expire-acquire Pq Va net.inet.ip.ipsec-expire-acquire 1601How long the kernel should allow key management to dynamically acquire 1602security associations before re-sending a request. 1603The default value is 30 seconds. 1604.It Li ip.ipsec-firstuse Pq Va net.inet.ip.ipsec-firstuse 1605The number of seconds after a security association is first used before 1606it expires. 1607If set to less than or equal to zero, the security association will 1608not expire because of this timer. 1609The default value is 7200 seconds. 1610.It Li ip.ipsec-invalid-life Pq Va net.inet.ip.ipsec-invalid-life 1611The lifetime of embryonic Security Associations (SAs that key management 1612daemons have reserved but not fully established yet) in seconds. 1613If set to less than or equal to zero, embryonic SAs will not expire. 1614The default value is 60. 1615.It Li ip.ipsec-pfs Pq Va net.inet.ip.ipsec-pfs 1616If set to any non-zero value, the kernel will ask the key management 1617daemons to use Perfect Forward Secrecy when establishing IPsec 1618Security Associations. 1619Perfect Forward Secrecy makes IPsec Security Associations 1620cryptographically distinct from each other, such that breaking the key 1621for one such SA does not compromise any others. 1622Requiring PFS for every security association significantly increases the 1623computational load of 1624.Xr isakmpd 8 1625exchanges. 1626The default value is 1. 1627.It Li ip.ipsec-soft-allocs Pq Va net.inet.ip.ipsec-soft-allocs 1628The number of IPsec flows that can use a security association before a 1629message is sent by the kernel to key management for renegotiation 1630of the security association. 1631If set to less than or equal to zero, no message is sent to key 1632management. 1633The default value is 0. 1634.It Li ip.ipsec-soft-bytes Pq Va net.inet.ip.ipsec-soft-bytes 1635The number of bytes that will be processed by a security association 1636before a message is sent by the kernel to key management for 1637renegotiation of the security association. 1638If set to less than or equal to zero, no message is sent to key 1639management. 1640The default value is 0. 1641.It Li ip.ipsec-soft-firstuse Pq Va net.inet.ip.ipsec-soft-firstuse 1642The number of seconds after a security association is first used 1643before a message is sent by the kernel to key management for 1644renegotiation of the security association. 1645If set to less than or equal to zero, no message is sent to key 1646management. 1647The default value is 3600 seconds. 1648.It Li ip.ipsec-soft-timeout Pq Va net.inet.ip.ipsec-soft-timeout 1649The number of seconds after a security association is established 1650before a message is sent by the kernel to key management for 1651renegotiation of the security association. 1652If set to less than or equal to zero, no message is sent to key 1653management. 1654The default value is 80000 seconds. 1655.It Li ip.ipsec-timeout Pq Va net.inet.ip.ipsec-timeout 1656The number of seconds after a security association is established 1657before it will expire. 1658If set to less than or equal to zero, the security association will 1659not expire because of this timer. 1660The default value is 86400 seconds. 1661.It Li ip.maxqueue Pq Va net.inet.ip.maxqueue 1662Fragment flood protection. 1663Sets the maximum number of unassembled IP fragments in the fragment queue. 1664.It Li ip.mforwarding Pq Va net.inet.ip.mforwarding 1665If set to 1, then multicast forwarding is enabled for the host. 1666The default is 0. 1667.It Li ip.mtudisc Pq Va net.inet.ip.mtudisc 1668Returns 1 if Path MTU Discovery is enabled. 1669.It Li ip.mtudisctimeout Pq Va net.inet.ip.mtudisctimeout 1670Number of seconds in which a route added by the Path MTU 1671Discovery engine will time out. 1672When the route times out, the Path MTU Discovery engine will attempt 1673to probe a larger path MTU. 1674.It Li ip.multipath Pq Va net.inet.ip.multipath 1675This variable enables multipath routing for IPv4 addresses. 1676If set to 0, only the first route selected will be used for a given 1677destination regardless of how many routes exist in the routing table. 1678.It Li ip.portfirst Pq Va net.inet.ip.portfirst 1679Minimum registered port number for TCP/UDP port allocation. 1680Registered ports can be used by ordinary user processes 1681or programs executed by ordinary users. 1682Cannot be less than 1024 or greater than 49151. 1683Must be less than ip.portlast. 1684.It Li ip.porthifirst Pq Va net.inet.ip.porthifirst 1685Minimum dynamic/private port number for TCP/UDP port allocation. 1686Dynamic/private ports can be used by ordinary user processes 1687or programs executed by ordinary users. 1688Cannot be less than 49152 or greater than 65535. 1689Must be less than ip.porthilast. 1690.It Li ip.porthilast Pq Va net.inet.ip.porthilast 1691Maximum dynamic/private port number for TCP/UDP port allocation. 1692Dynamic/private ports can be used by ordinary user processes 1693or programs executed by ordinary users. 1694Cannot be less than 49152 or greater than 65535. 1695Must be greater than ip.porthifirst. 1696.It Li ip.portlast Pq Va net.inet.ip.portlast 1697Maximum registered port number for TCP/UDP port allocation. 1698Registered ports can be used by ordinary user processes 1699or programs executed by ordinary users. 1700Cannot be less than 1024 or greater than 49151. 1701Must be greater than ip.portfirst. 1702.It Li ip.redirect Pq Va net.inet.ip.redirect 1703Returns 1 when ICMP redirects may be sent by the host. 1704This option is ignored unless the host is routing IP packets, 1705and should normally be enabled on all systems. 1706.It Li ip.sourceroute Pq Va net.inet.ip.sourceroute 1707Returns 1 when forwarding of source-routed packets is enabled for 1708the host. 1709When running with a 1710.Xr securelevel 7 1711greater than 0, 1712this variable may not be changed. 1713.It Li ip.stats Pq Va net.inet.ip.stats 1714Returns the IP statistics in a struct ipstat. 1715.It Li ip.ttl Pq Va net.inet.ip.ttl 1716The maximum time-to-live (hop count) value for an IP packet 1717sourced by the system. 1718This value applies to normal transport protocols, not to ICMP. 1719.It Li ipcomp.enable Pq Va net.inet.ipcomp.enable 1720Enable the IPComp protocol. 1721See 1722.Xr ipcomp 4 1723for more information. 1724.It Li ipip.allow Pq Va net.inet.ipip.allow 1725If set to 0, incoming IP-in-IP packets will not be processed. 1726If set to any other value, processing will occur; furthermore, if set 1727to 2, no checks for spoofing of loopback addresses will be done. 1728This is useful only for debugging purposes, and should never be used 1729in production systems. 1730.It Li tcp.ackonpush Pq Va net.inet.tcp.ackonpush 1731Returns 1 if TCP segments with the 1732.Dv TH_PUSH 1733flag set are being acknowledged immediately, otherwise 0. 1734.It Li tcp.baddynamic Pq Va net.inet.tcp.baddynamic 1735An array of 1736.Vt in_port_t 1737is returned specifying the bitmask of TCP ports between 512 1738and 1023 inclusive that should not be allocated dynamically 1739by the kernel (i.e., they must be bound specifically by port number). 1740.It Li tcp.ecn Pq Va net.inet.tcp.ecn 1741Returns 1 if Explicit Congestion Notifications for TCP are enabled. 1742.It Li tcp.ident Pq Va net.inet.tcp.ident 1743A 1744.Vt struct tcp_ident_mapping 1745specifying a local and foreign endpoint of a TCP 1746socket is filled in with the effective and real UIDs of the process that 1747owns the socket. 1748If no such socket exists, then the effective and real UID values are 1749both set to \-1. 1750.It Li tcp.keepidle Pq Va net.inet.tcp.keepidle 1751If the socket option 1752.Dv SO_KEEPALIVE 1753has been set on a socket, then this value specifies how much time in seconds 1754a connection needs to be idle before keepalives are sent. 1755.It Li tcp.keepinittime Pq Va net.inet.tcp.keepinittime 1756Time in seconds to keep alive the initial SYN packet of a TCP handshake. 1757.It Li tcp.keepintvl Pq Va net.inet.tcp.keepintvl 1758Time in seconds after a keepalive probe is sent until, in the absence of any 1759response, another probe is sent. 1760.It Li tcp.always_keepalive Pq Va net.inet.tcp.always_keepalive 1761Act as if the option 1762.Dv SO_KEEPALIVE 1763was set on all TCP sockets. 1764.It Li tcp.mssdflt Pq Va net.inet.tcp.mssdflt 1765The maximum segment size that is used as default for non-local connections. 1766The default value is 512. 1767.It Li tcp.reasslimit Pq Va net.inet.tcp.reasslimit 1768The maximum number of out-of-order TCP 1769segments the system will store for reassembly. 1770.It Li tcp.rfc1323 Pq Va net.inet.tcp.rfc1323 1771Returns 1 if RFC 1323 extensions to TCP are enabled. 1772.It Li tcp.rfc3390 Pq Va net.inet.tcp.rfc3390 1773Returns 1 if the TCP Initial Window 1774is increased to 4 * MSS or 4380 bytes, as specified in RFC 3390. 1775Returns 2 if the TCP Initial Window 1776is increased to 10 * MSS or 14600 bytes, as specified in 1777RFC 6928. 1778.It Li tcp.rootonly Pq Va net.inet.tcp.rootonly 1779An array of 1780.Vt in_port_t 1781is returned specifying the bitmask of TCP ports 1782that can only be bound by processes with root euid. 1783When running with a 1784.Xr securelevel 7 1785greater than 0, 1786this variable may not be changed. 1787.It Li tcp.rstppslimit Pq Va net.inet.tcp.rstppslimit 1788This variable specifies the maximum number of outgoing TCP RST packets 1789per second. 1790TCP RST packets exceeding this value are subject to rate limitation 1791and will not go out from the node. 1792A negative value disables rate limitation. 1793.It Li tcp.sack Pq Va net.inet.tcp.sack 1794Returns 1 if RFC 2018 Selective Acknowledgements are enabled. 1795.It Li tcp.stats Pq Va net.inet.tcp.stats 1796Returns the TCP statistics in a struct tcpstat. 1797.It Li tcp.synbucketlimit Pq Va net.inet.tcp.synbucketlimit 1798The maximum number of entries allowed per hash bucket in the TCP SYN cache. 1799.It Li tcp.syncachelimit Pq Va net.inet.tcp.syncachelimit 1800The maximum number of entries allowed in the TCP SYN cache. 1801.It Li tcp.synhashsize Pq Va net.inet.tcp.synhashsize 1802The number of buckets in the TCP SYN cache hash array. 1803After the value is set, the actual size changes when the alternative 1804SYN cache becomes empty and both SYN caches are swapped. 1805.It Li tcp.synuselimit Pq Va net.inet.tcp.synuselimit 1806The minimum number of times the hash function for the TCP SYN cache is used 1807before it is reseeded. 1808.It Li tcp.tso Pq Va net.inet.tcp.tso 1809If set to 0, disable TCP segmentation offload (TSO). 1810If set to 1, TSO is enabled (the default). 1811.It Li udp.baddynamic Pq Va net.inet.udp.baddynamic 1812Analogous to 1813.Li tcp.baddynamic 1814but for UDP sockets. 1815.It Li udp.checksum Pq Va net.inet.udp.checksum 1816Returns 1 when UDP checksums are being computed and checked. 1817Disabling UDP checksums is strongly discouraged. 1818.It Li udp.recvspace Pq Va net.inet.udp.recvspace 1819Returns the default UDP receive buffer size. 1820.It Li udp.rootonly Pq Va net.inet.udp.rootonly 1821Analogous to 1822.Li tcp.rootonly 1823but for UDP sockets. 1824.It Li udp.sendspace Pq Va net.inet.udp.sendspace 1825Returns the default UDP send buffer size. 1826.It Li udp.stats Pq Va net.inet.udp.stats 1827Returns the UDP statistics in a struct udpstat. 1828.El 1829.It Dv PF_INET6 1830Get or set various global information about IPv6 1831.Pq Internet Protocol version 6 . 1832The third level name is the protocol. 1833The fourth level name is the variable name. 1834The currently defined protocols and names are: 1835.Bl -column "Protocol name" "multicast_mtudisc" "integer" "yes" -offset indent 1836.It Sy "Protocol name" Ta Sy "Variable name" Ta Sy "Type" Ta Sy "Changeable" 1837.It icmp6 Ta errppslimit Ta integer Ta yes 1838.It icmp6 Ta mtudisc_hiwat Ta integer Ta yes 1839.It icmp6 Ta mtudisc_lowat Ta integer Ta yes 1840.It icmp6 Ta nd6_delay Ta integer Ta yes 1841.It icmp6 Ta nd6_mmaxtries Ta integer Ta yes 1842.It icmp6 Ta nd6_umaxtries Ta integer Ta yes 1843.It icmp6 Ta redirtimeout Ta integer Ta yes 1844.It ip6 Ta dad_count Ta integer Ta yes 1845.It ip6 Ta dad_pending Ta integer Ta yes 1846.It ip6 Ta defmcasthlim Ta integer Ta yes 1847.It ip6 Ta forwarding Ta integer Ta yes 1848.It ip6 Ta hdrnestlimit Ta integer Ta yes 1849.It ip6 Ta hlim Ta integer Ta yes 1850.It ip6 Ta maxdynroutes Ta integer Ta yes 1851.It ip6 Ta maxfragpackets Ta integer Ta yes 1852.It ip6 Ta maxfrags Ta integer Ta yes 1853.It ip6 Ta mforwarding Ta integer Ta yes 1854.It ip6 Ta mtudisctimeout Ta integer Ta yes 1855.It ip6 Ta multicast_mtudisc Ta integer Ta yes 1856.It ip6 Ta multipath Ta integer Ta yes 1857.It ip6 Ta neighborgcthresh Ta integer Ta yes 1858.It ip6 Ta redirect Ta integer Ta yes 1859.El 1860.Pp 1861The variables are as follows: 1862.Pp 1863.Bl -tag -width "123456" -compact 1864.It Li icmp6.errppslimit Pq Va net.inet6.icmp6.errppslimit 1865This variable specifies the maximum number of outgoing ICMPv6 error messages 1866per second. 1867ICMPv6 error messages exceeding this value are subject to rate limitation 1868and will not go out from the node. 1869A negative value will disable the rate limitation. 1870.Pp 1871.It Li icmp6.mtudisc_hiwat Pq Va net.inet6.icmp6.mtudisc_hiwat 1872.It Li icmp6.mtudisc_lowat Pq Va net.inet6.icmp6.mtudisc_lowat 1873These variables define the maximum number of routing table entries 1874created due to path MTU discovery 1875.Pq preventing denial-of-service attacks with ICMPv6 too big messages . 1876After IPv6 path MTU discovery happens, path MTU information is kept in 1877the routing table. 1878If the number of routing table entries exceeds this value, 1879the kernel will not attempt to keep the path MTU information. 1880.Li icmp6.mtudisc_hiwat 1881is used when we have verified ICMPv6 too big messages. 1882.Li icmp6.mtudisc_lowat 1883is used when we have unverified ICMPv6 too big messages. 1884Verification is performed by using address/port pairs kept in connected PCBs. 1885A negative value disables the upper limit. 1886.Pp 1887.It Li icmp6.nd6_delay Pq Va net.inet6.icmp6.nd6_delay 1888This variable specifies the 1889.Dv DELAY_FIRST_PROBE_TIME 1890timing constant in IPv6 neighbor discovery specification 1891.Pq RFC 4861 , 1892in seconds. 1893.Pp 1894.It Li icmp6.nd6_mmaxtries Pq Va net.inet6.icmp6.nd6_mmaxtries 1895This variable specifies the 1896.Dv MAX_MULTICAST_SOLICIT 1897constant in IPv6 neighbor discovery specification 1898.Pq RFC 4861 . 1899.Pp 1900.It Li icmp6.nd6_umaxtries Pq Va net.inet6.icmp6.nd6_umaxtries 1901This variable specifies the 1902.Dv MAX_UNICAST_SOLICIT 1903constant in IPv6 neighbor discovery specification 1904.Pq RFC 4861 . 1905.Pp 1906.It Li icmp6.redirtimeout Pq Va net.inet6.icmp6.redirtimeout 1907The variable specifies the lifetime of routing entries generated by 1908incoming ICMPv6 redirects. 1909.Pp 1910.It Li ip6.dad_count Pq Va net.inet6.ip6.dad_count 1911This variable configures the number of IPv6 DAD 1912.Pq duplicated address detection 1913probe packets. 1914These packets are generated when IPv6 interfaces are first brought up. 1915.Pp 1916.It Li ip6.dad_pending Pq Va net.inet6.ip6.dad_pending 1917This variable displays the number of pending IPv6 DAD 1918.Pq duplicated address detection 1919before completion. 1920It is used to make sure that DAD is completed before 1921.Xr netstart 8 1922is executed. 1923.Pp 1924.It Li ip6.defmcasthlim Pq Va net.inet6.ip6.defmcasthlim 1925The default hop limit value for an IPv6 multicast packet sourced by the node. 1926This value applies to all the transport protocols on top of IPv6. 1927Methods for overriding this value are documented in 1928.Xr ip6 4 . 1929.Pp 1930.It Li ip6.forwarding Pq Va net.inet6.ip6.forwarding 1931Returns 1 when IPv6 forwarding is enabled for the node, 1932meaning that the node is acting as a router. 1933Returns 0 when IPv6 forwarding is disabled for the node, 1934meaning that the node is acting as a host. 1935Note that IPv6 defines node behavior for the 1936.Dq router 1937and 1938.Dq host 1939cases quite differently, and changing this variable during operation 1940may cause serious trouble. 1941Hence, this variable should only be set at bootstrap time. 1942As with IPv4, if forwarding is disabled then the destination address of 1943incoming packets must match the IP address bound to the interface. 1944If forwarding is enabled, the check is relaxed 1945so that the destination IP address of incoming packets must match 1946just any address bound to the host. 1947.Pp 1948.It Li ip6.hdrnestlimit Pq Va net.inet6.ip6.hdrnestlimit 1949The number of IPv6 extension headers permitted on incoming IPv6 packets. 1950If set to 0, the node will accept as many extension headers as possible. 1951.Pp 1952.It Li ip6.hlim Pq Va net.inet6.ip6.hlim 1953The default hop limit value for an IPv6 unicast packet sourced by the node. 1954This value applies to all the transport protocols on top of IPv6. 1955Methods for overriding this value are documented in 1956.Xr ip6 4 . 1957.Pp 1958.It Li ip6.maxdynroutes Pq Va net.inet6.ip6.maxdynroutes 1959Maximum number of routes created by redirect. 1960Set to negative to disable. 1961The default value is 4096. 1962.Pp 1963.It Li ip6.maxfragpackets Pq Va net.inet6.ip6.maxfragpackets 1964The maximum number of fragmented packets the node will accept. 19650 means that the node will not accept any fragmented packets. 1966\-1 means that the node will accept as many fragmented packets as it receives. 1967The flag is provided basically for avoiding possible DoS attacks. 1968.Pp 1969.It Li ip6.maxfrags Pq Va net.inet6.ip6.maxfrags 1970The maximum number of fragments the node will accept. 19710 means that the node will not accept any fragments. 1972\-1 means that the node will accept as many fragments as it receives. 1973The flag is provided basically for avoiding possible DoS attacks. 1974.Pp 1975.It Li ip6.mforwarding Pq Va net.inet6.ip6.mforwarding 1976If set to 1, then multicast forwarding is enabled for the host. 1977The default is 0. 1978.Pp 1979.It Li ip6.multicast_mtudisc Pq Va net.inet6.ip6.multicast_mtudisc 1980This variable controls generation of ICMPv6 Too Big messages 1981when the machine is performing as an IPv6 multicast router. 1982If set to 1, an ICMPv6 Too Big message will be generated for multicast packets 1983which were too big to be forwarded. 1984If set to 0, the ICMPv6 Too Big message will be suppressed. 1985.Pp 1986.It Li ip6.multipath Pq Va net.inet6.ip6.multipath 1987This variable enables multipath routing for IPv6 addresses. 1988If set to 0, only the first route selected will be used for a given 1989destination regardless of how many routes exist in the routing table. 1990.Pp 1991.It Li ip6.mtudisctimeout Pq Va net.inet6.ip6.mtudisctimeout 1992Number of seconds in which a route added by the Path MTU 1993Discovery engine will time out. 1994When the route times out, the Path MTU Discovery engine will attempt 1995to probe a larger path MTU. 1996.Pp 1997.It Li ip6.neighborgcthresh Pq Va net.inet6.ip6.neighborgcthresh 1998Maximum number of entries in neighbor cache. 1999Set to negative to disable. 2000The default value is 2048. 2001.Pp 2002.It Li ip6.redirect Pq Va net.inet6.ip6.redirect 2003Returns 1 when ICMPv6 redirects may be sent by the node. 2004This option is ignored unless the node is routing IP packets, 2005and should normally be enabled on all systems. 2006.El 2007.Pp 2008We reuse 2009.Li net.inet.tcp 2010and 2011.Li net.inet.udp 2012for TCP/UDP over IPv6. 2013.It Dv PF_UNIX 2014Get or set various global information about UNIX-domain protocol family. 2015The third level name is the socket type. 2016The fourth level name is the variable name. 2017The currently defined socket types and names are: 2018.Bl -column "Protocol name" "ipsec-expire-acquire" "structure" "Changeable" -offset 2n 2019.It Sy "Socket type" Ta Sy "Variable name" Ta Sy "Type" Ta Sy "Changeable" 2020.It stream Ta recvspace Ta integer Ta yes 2021.It stream Ta sendspace Ta integer Ta yes 2022.It dgram Ta recvspace Ta integer Ta yes 2023.It dgram Ta sendspace Ta integer Ta yes 2024.It seqpacket Ta recvspace Ta integer Ta yes 2025.It seqpacket Ta sendspace Ta integer Ta yes 2026.It inflight Ta Ta integer Ta no 2027.It deferred Ta Ta integer Ta no 2028.El 2029.Pp 2030The variables are as follows: 2031.Bl -tag -width "123456" 2032.It Li stream.recvspace Pq Va net.unix.stream.recvspace 2033Returns the default 2034.Dv SOCK_STREAM 2035receive buffer size. 2036.It Li stream.sendspace Pq Va net.unix.stream.sendspace 2037Returns the default 2038.Dv SOCK_STREAM 2039send buffer size. 2040.It Li dgram.recvspace Pq Va net.unix.dgram.recvspace 2041Returns the default 2042.Dv SOCK_DGRAM 2043receive buffer size. 2044.It Li dgram.sendspace Pq Va net.unix.dgram.sendspace 2045Returns the default 2046.Dv SOCK_DGRAM 2047send buffer size. 2048.It Li seqpacket.recvspace Pq Va net.unix.seqpacket.recvspace 2049Returns the default 2050.Dv SOCK_SEQPACKET 2051receive buffer size. 2052.It Li seqpacket.sendspace Pq Va net.unix.seqpacket.sendspace 2053Returns the default 2054.Dv SOCK_SEQPACKET 2055send buffer size. 2056.It Li inflight Pq Va net.unix.inflight 2057Returns the number of file descriptors inflight. 2058.It Li deferred Pq Va net.unix.deferred 2059Returns the number of file descriptors to be closed. 2060.El 2061.It Dv PF_KEY 2062Return 2063.Xr ipsec 4 2064database dumps. 2065The second level name is 2066.Dv PF_KEY_V2 . 2067The third level name selects the database as follows: 2068.Pp 2069.Bl -tag -width "NET_KEY_SADB_DUMP" -offset indent -compact 2070.It Dv NET_KEY_SADB_DUMP 2071Security Association database (SADB). 2072.It Dv NET_KEY_SPD_DUMP 2073IPsec flow database (SPD). 2074.El 2075.It Dv PF_MPLS 2076Get or set global information about MPLS (Multiprotocol Label Switching). 2077.Bl -column "MPLSCTL_MAPTTL_IP6 " "integer" "not applicable" -offset indent 2078.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 2079.It Dv MPLSCTL_DEFTTL Ta integer Ta yes 2080.It Dv MPLSCTL_MAPTTL_IP Ta integer Ta yes 2081.It Dv MPLSCTL_MAPTTL_IP6 Ta integer Ta yes 2082.El 2083.Bl -tag -width "123456" 2084.It Dv MPLSCTL_DEFTTL Pq Va net.mpls.ttl 2085Set or get the default TTL value which is used for MPLS (Shim) Header. 2086The default is 255. 2087.It Dv MPLSCTL_MAPTTL_IP Pq Va net.mpls.mapttl_ip 2088If set to 1, the TTL field is synchronized between the IP header and the 2089MPLS label stack. 2090If set to 0, the IP header TTL is not modified while passing through MPLS 2091and the MPLS label stack is initialized with the 2092.Dv MPLSCTL_DEFTTL . 2093The default is 1. 2094.It Dv MPLSCTL_MAPTTL_IP6 Pq Va net.mpls.mapttl_ip6 2095If set to 1, the TTL field is synchronized between the IPv6 header and the 2096MPLS label stack. 2097If set to 0, the IPv6 header TTL is not modified while passing through MPLS 2098and the MPLS label stack is initialized with the 2099.Dv MPLSCTL_DEFTTL . 2100The default is 0. 2101.El 2102.It Dv PF_PIPEX Pq Va net.pipex 2103Get or set global information about PIPEX. 2104.Pp 2105The currently defined variable names are: 2106.Bl -column "Third level name" "integer" "Changeable" -offset indent 2107.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 2108.It Dv PIPEXCTL_ENABLE Ta integer Ta yes 2109.El 2110.Bl -tag -width "123456" 2111.It Dv PIPEXCTL_ENABLE 2112If set to 1, enable PIPEX processing. 2113The default is 0. 2114.El 2115.El 2116.Ss CTL_VFS 2117The string and integer information available for the 2118.Dv CTL_VFS 2119level is detailed below. 2120The changeable column shows whether a process with appropriate 2121privileges may change the value. 2122.Bl -column "Second level name" "VFS generic info" "Changeable" -offset indent 2123.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable" 2124.It Dv VFS_GENERIC Ta "VFS generic info" Ta "no" 2125.It Dv "filesystem #" Ta "filesystem info" Ta "no" 2126.El 2127.Bl -tag -width "123456" 2128.It Dv VFS_GENERIC 2129This second level identifier requests generic information about the 2130VFS layer. 2131Within it, the following third level identifiers exist: 2132.Bl -column "Third level name" "struct vfsconf" "Changeable" -offset indent 2133.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 2134.It Dv VFS_CONF Ta "struct vfsconf" Ta "no" 2135.It Dv VFS_MAXTYPENUM Ta "int" Ta "no" 2136.El 2137.It filesystem # 2138After finding the filesystem dependent 2139.Va vfc_typenum 2140using 2141.Dv VFS_GENERIC 2142with 2143.Dv VFS_CONF , 2144it is possible to access filesystem dependent information. 2145.Pp 2146Some filesystems may contain settings. 2147.Bl -tag -width "123" 2148.It FFS 2149.Bl -column "FFS_SD_DIRECT_BLK_PTRS" "integer" "Changeable" -offset indent 2150.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 2151.It Dv FFS_DIRHASH_DIRSIZE Ta "integer" Ta "yes" 2152.It Dv FFS_DIRHASH_MAXMEM Ta "integer" Ta "yes" 2153.It Dv FFS_DIRHASH_MEM Ta "integer" Ta "no" 2154.It Dv FFS_MAX_SOFTDEPS Ta "integer" Ta "yes" 2155.It Dv FFS_SD_BLK_LIMIT_HIT Ta "integer" Ta "yes" 2156.It Dv FFS_SD_BLK_LIMIT_PUSH Ta "integer" Ta "yes" 2157.It Dv FFS_SD_DIR_ENTRY Ta "integer" Ta "yes" 2158.It Dv FFS_SD_DIRECT_BLK_PTRS Ta "integer" Ta "yes" 2159.It Dv FFS_SD_INDIR_BLK_PTRS Ta "integer" Ta "yes" 2160.It Dv FFS_SD_INO_LIMIT_HIT Ta "integer" Ta "yes" 2161.It Dv FFS_SD_INO_LIMIT_PUSH Ta "integer" Ta "yes" 2162.It Dv FFS_SD_INODE_BITMAP Ta "integer" Ta "yes" 2163.It Dv FFS_SD_SYNC_LIMIT_HIT Ta "integer" Ta "yes" 2164.It Dv FFS_SD_TICKDELAY Ta "integer" Ta "yes" 2165.It Dv FFS_SD_WORKLIST_PUSH Ta "integer" Ta "yes" 2166.El 2167.Bl -tag -width "123456" 2168.It Dv FFS_DIRHASH_DIRSIZE Pq Va vfs.ffs.dirhash_dirsize 2169The minimum size of a directory, in bytes, before it is considered for hashing. 2170.It Dv FFS_DIRHASH_MAXMEM Pq Va vfs.ffs.dirhash_maxmem 2171The maximum amount of memory, in bytes, to be used for storing directory 2172hashes. 2173.It Dv FFS_DIRHASH_MEM Pq Va vfs.ffs.dirhash_mem 2174The amount of memory currently used by all directory hashes. 2175.It Dv FFS_MAX_SOFTDEPS Pq Va vfs.ffs.max_softdeps 2176Maximum structures before slowdowns. 2177.It Dv FFS_SD_BLK_LIMIT_HIT Pq Va vfs.ffs.sd_blk_limit_hit 2178Number of times block slowdown imposed. 2179.It Dv FFS_SD_BLK_LIMIT_PUSH Pq Va vfs.ffs.sd_blk_limit_push 2180Number of times block limit neared. 2181.It Dv FFS_SD_DIR_ENTRY Pq Va vfs.ffs.sd_dir_entry 2182Bufs redirtied as dir entry cannot write. 2183.It Dv FFS_SD_DIRECT_BLK_PTRS Pq Va vfs.ffs.sd_direct_blk_ptrs 2184Bufs redirtied as direct ptrs not written. 2185.It Dv FFS_SD_INDIR_BLK_PTRS Pq Va vfs.ffs.sd_indir_blk_ptrs 2186Bufs redirtied as indirect ptrs not written. 2187.It Dv FFS_SD_INO_LIMIT_HIT Pq Va vfs.ffs.sd_ino_limit_hit 2188Number of times inode limit imposed. 2189.It Dv FFS_SD_INO_LIMIT_PUSH Pq Va vfs.ffs.sd_ino_limit_push 2190Number of times inode limit neared. 2191.It Dv FFS_SD_INODE_BITMAP Pq Va vfs.ffs.sd_inode_bitmap 2192Bufs redirtied as inode bitmap not written. 2193.It Dv FFS_SD_SYNC_LIMIT_HIT Pq Va vfs.ffs.sd_sync_limit_hit 2194Number of synchronous slowdowns imposed. 2195.It Dv FFS_SD_TICKDELAY Pq Va vfs.ffs.sd_tickdelay 2196Ticks to pause during slowdown. 2197.It Dv FFS_SD_WORKLIST_PUSH Pq Va vfs.ffs.sd_worklist_push 2198Number of worklist cleanups. 2199.El 2200.It NFS 2201.Bl -column "Third level name" "struct nfsstats" "Changeable" -offset indent 2202.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 2203.It Dv NFS_NFSSTATS Ta "struct nfsstats" Ta "yes" 2204.It Dv NFS_NIOTHREADS Ta "int" Ta "yes" 2205.El 2206.Bl -tag -width Ds 2207.It Dv NFS_NIOTHREADS Pq Va vfs.nfs.iothreads 2208The number of I/O kernel threads for NFS clients. 2209The default is 4; 2210the maximum is 20. 2211.El 2212.It FUSE 2213.Bl -column "FUSEFS_POOL_NBPAGES" "Type" "Changeable" -offset indent 2214.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 2215.It Dv FUSEFS_INFBUFS Ta "int" Ta "no" 2216.It Dv FUSEFS_OPENDEVS Ta "int" Ta "no" 2217.It Dv FUSEFS_POOL_NBPAGES Ta "int" Ta "no" 2218.It Dv FUSEFS_WAITFBUFS Ta "int" Ta "no" 2219.El 2220.Bl -tag -width Ds 2221.It Dv FUSEFS_INFBUFS Pq Va vfs.fuse.fusefs_fbufs_in 2222The number of inbound fusebufs. 2223.It Dv FUSEFS_OPENDEVS Pq Va vfs.fuse.fusefs_open_devices 2224The number of FUSE devices opened. 2225.It Dv FUSEFS_POOL_NBPAGES Pq Va vfs.fuse.fusefs_pool_pages 2226The number of pages used for fusebuf memory. 2227.It Dv FUSEFS_WAITFBUFS Pq Va vfs.fuse.fusefs_fbufs_wait 2228The number of fusebufs waiting for a response. 2229.El 2230.El 2231.El 2232.Ss CTL_VM 2233The string and integer information available for the 2234.Dv CTL_VM 2235level is detailed below. 2236The changeable column shows whether a process with appropriate 2237privileges may change the value. 2238.Bl -column "Second level name" "swap encrypt values" "yes" -offset indent 2239.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable" 2240.It Dv VM_ANONMIN Ta "integer" Ta "yes" 2241.It Dv VM_LOADAVG Ta "struct loadavg" Ta "no" 2242.It Dv VM_MALLOC_CONF Ta "string" Ta "yes" 2243.It Dv VM_MAXSLP Ta "integer" Ta "no" 2244.It Dv VM_METER Ta "struct vmtotal" Ta "no" 2245.It Dv VM_NKMEMPAGES Ta "integer" Ta "no" 2246.It Dv VM_PSSTRINGS Ta "struct psstrings" Ta "no" 2247.It Dv VM_SWAPENCRYPT Ta "swap encrypt values" Ta "yes" 2248.It Dv VM_USPACE Ta "integer" Ta "no" 2249.It Dv VM_UVMEXP Ta "struct uvmexp" Ta "no" 2250.It Dv VM_VNODEMIN Ta "integer" Ta "yes" 2251.It Dv VM_VTEXTMIN Ta "integer" Ta "yes" 2252.El 2253.Bl -tag -width "123456" 2254.It Dv VM_ANONMIN Pq Va vm.anonmin 2255Percentage of physical memory available for 2256pages which contain anonymous mapping. 2257.It Dv VM_LOADAVG Pq Va vm.loadavg 2258Return the load average history. 2259The returned data consists of a 2260.Vt struct loadavg . 2261.It Dv VM_MALLOC_CONF Pq Va vm.malloc_conf 2262String of option flags for the 2263.Xr malloc 3 2264family of functions 2265which will be applied to all programs starting in the future. 2266The string contains a maximum of 15 characters. 2267.It Dv VM_MAXSLP Pq Va vm.maxslp 2268The time for a process to be blocked before being swappable, 2269in seconds. 2270.It Dv VM_METER Pq Va vm.vmmeter 2271Return the system wide virtual memory statistics. 2272The returned data consists of a 2273.Vt struct vmtotal . 2274.It Dv VM_NKMEMPAGES Pq Va vm.nkmempages 2275Number of pages in kmem_map. 2276.It Dv VM_PSSTRINGS Pq Va vm.psstrings 2277Returns the address of the process 2278.Vt struct ps_strings . 2279The 2280.Xr ps 1 2281program uses it to locate the argument and environment strings. 2282.It Dv VM_SWAPENCRYPT 2283Contains statistics about swap encryption. 2284The string and integer information available for the third level is 2285detailed below. 2286.Bl -column "Third level name" "integer" "Changeable" -offset indent 2287.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable" 2288.It Dv SWPENC_CREATED Ta "integer" Ta "no" 2289.It Dv SWPENC_DELETED Ta "integer" Ta "no" 2290.It Dv SWPENC_ENABLE Ta "integer" Ta "yes" 2291.El 2292.Bl -tag -width "123456" 2293.It Dv SWPENC_CREATED Pq Va vm.swapencrypt.keyscreated 2294The number of encryption keys that have been randomly created. 2295The swap partition is divided into sections of normally 512KB. 2296Each section has its own encryption key. 2297.It Dv SWPENC_DELETED Pq Va vm.swapencrypt.keysdeleted 2298The number of encryption keys that have been deleted, thus effectively 2299erasing the data that has been encrypted with them. 2300Encryption keys are deleted when their reference counter reaches zero. 2301.It Dv SWPENC_ENABLE Pq Va vm.swapencrypt.enable 2302Set to 1 to enable swap encryption for all processes. 2303A 0 disables swap encryption. 2304Turning this option on does not affect swap data already on the disk, 2305but all newly written data will be encrypted. 2306When swap encryption is turned on, automatic 2307.Xr crash 8 2308dumps are disabled. 2309.El 2310.It Dv VM_USPACE Pq Va vm.uspace 2311The number of bytes allocated for each kernel stack. 2312.It Dv VM_UVMEXP Pq Va vm.uvmexp 2313Contains statistics about the UVM memory management system. 2314.It Dv VM_VNODEMIN Pq Va vm.vnodemin 2315Percentage of physical memory available for 2316pages which contain cached file data. 2317.It Dv VM_VTEXTMIN Pq Va vm.vtextmin 2318Percentage of physical memory available for 2319pages which contain cached executable data. 2320.El 2321.Sh RETURN VALUES 2322If the call to 2323.Fn sysctl 2324is unsuccessful, \-1 is returned and 2325.Va errno 2326is set appropriately. 2327.Sh FILES 2328.Bl -tag -width "uvm/uvmXswapXencrypt.h " -compact 2329.It In sys/sysctl.h 2330top level identifiers and second level kernel and hardware 2331identifiers 2332.It In sys/socket.h 2333second level network identifiers 2334.It In sys/gmon.h 2335third level profiling identifiers 2336.It In uvm/uvmexp.h 2337second level virtual memory identifiers 2338.It In uvm/uvm_swap_encrypt.h 2339third level virtual memory identifiers 2340.It In net/if.h 2341packet input/output queue identifiers 2342.It In net/pipex.h 2343third level PIPEX identifiers 2344.It In netinet/in.h 2345third and fourth level IPv4/v6 identifiers 2346.It In netinet/ip_divert.h 2347fourth level divert identifiers 2348.It In netinet/icmp_var.h 2349fourth level ICMP identifiers 2350.It In netinet/icmp6.h 2351fourth level ICMPv6 identifiers 2352.It In netinet/tcp_var.h 2353fourth level TCP identifiers 2354.It In netinet/udp_var.h 2355fourth level UDP identifiers 2356.It In ddb/db_var.h 2357second level ddb identifiers 2358.It In sys/mount.h 2359second level vfs identifiers 2360.It In miscfs/fuse/fusefs.h 2361third level fusefs identifiers 2362.It In nfs/nfs.h 2363third level NFS identifiers 2364.It In ufs/ffs/ffs_extern.h 2365third level FFS identifiers 2366.It In machine/cpu.h 2367second level CPU identifiers 2368.El 2369.Sh ERRORS 2370The following errors may be reported: 2371.Bl -tag -width Er 2372.It Bq Er EFAULT 2373The buffer 2374.Fa name , 2375.Fa oldp , 2376.Fa newp , 2377or length pointer 2378.Fa oldlenp 2379contains an invalid address. 2380.It Bq Er EINVAL 2381The 2382.Fa name 2383array is less than two or greater than 2384.Dv CTL_MAXNAME . 2385.It Bq Er EINVAL 2386A non-null 2387.Fa newp 2388pointer is given and its specified length in 2389.Fa newlen 2390is too large or too small. 2391.It Bq Er ENOMEM 2392The length pointed to by 2393.Fa oldlenp 2394is too short to hold the requested value. 2395.It Bq Er ENOENT 2396The mib specified does not exist, or exceeds the range that is possible. 2397.It Bq Er ENXIO 2398If the mib is a sparsely populated array, this error may be returned 2399instead. 2400.It Bq Er ENOTDIR 2401The 2402.Fa name 2403array specifies an intermediate rather than terminal name. 2404.It Bq Er EOPNOTSUPP 2405The 2406.Fa name 2407array specifies a value that is unknown. 2408.It Bq Er EPERM 2409An attempt is made to set a read-only value. 2410.It Bq Er EPERM 2411A process without appropriate privileges attempts to set a value. 2412.It Bq Er EPERM 2413An attempt to change a value protected by the current kernel security 2414level is made. 2415.It Bq Er ESRCH 2416No process could be found which corresponds to the given process ID. 2417.El 2418.Sh SEE ALSO 2419.Xr pathconf 2 , 2420.Xr sysconf 3 , 2421.Xr ddb 4 , 2422.Xr sysctl.conf 5 , 2423.Xr securelevel 7 , 2424.Xr sysctl 8 2425.Sh HISTORY 2426The 2427.Fn sysctl 2428function first appeared in 2429.Bx 4.4 .