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