1.\" $NetBSD: sysctl.3,v 1.186 2006/10/13 21:12:51 wiz 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.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 31.\" 32.Dd October 9, 2006 33.Dt SYSCTL 3 34.Os 35.Sh NAME 36.Nm sysctl , 37.Nm sysctlbyname , 38.Nm sysctlgetmibinfo , 39.Nm sysctlnametomib 40.Nd get or set system information 41.Sh LIBRARY 42.Lb libc 43.Sh SYNOPSIS 44.In sys/param.h 45.In sys/sysctl.h 46.Ft int 47.Fn sysctl "const int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" \ 48"const void *newp" "size_t newlen" 49.Ft int 50.Fn sysctlbyname "const char *sname" "void *oldp" "size_t *oldlenp" \ 51"void *newp" "size_t newlen" 52.Ft int 53.Fn sysctlgetmibinfo "const char *sname" "int *name" "u_int *namelenp" \ 54"char *cname" "size_t *csz" "struct sysctlnode **rnode" "int v" 55.Ft int 56.Fn sysctlnametomib "const char *sname" "int *name" "size_t *namelenp" 57.Sh DESCRIPTION 58The 59.Nm 60function retrieves system information and allows processes with 61appropriate privileges to set system information. 62The information available from 63.Nm 64consists of integers, strings, and tables. 65Information may be retrieved and set from the command interface 66using the 67.Xr sysctl 8 68utility. 69.Pp 70Unless explicitly noted below, 71.Nm 72returns a consistent snapshot of the data requested. 73Consistency is obtained by locking the destination 74buffer into memory so that the data may be copied out without blocking. 75Calls to 76.Nm 77are serialized to avoid deadlock. 78.Pp 79The state is described using a ``Management Information Base'' (MIB) 80style name, listed in 81.Fa name , 82which is a 83.Fa namelen 84length array of integers. 85.Pp 86The 87.Fn sysctlbyname 88function accepts a string representation of a MIB entry and internally 89maps it to the appropriate numeric MIB representation. 90Its semantics are otherwise no different from 91.Fn sysctl . 92.Pp 93The information is copied into the buffer specified by 94.Fa oldp . 95The size of the buffer is given by the location specified by 96.Fa oldlenp 97before the call, 98and that location gives the amount of data copied after a successful call. 99If the amount of data available is greater 100than the size of the buffer supplied, 101the call supplies as much data as fits in the buffer provided 102and returns with the error code ENOMEM. 103If the old value is not desired, 104.Fa oldp 105and 106.Fa oldlenp 107should be set to 108.Dv NULL . 109.Pp 110The size of the available data can be determined by calling 111.Nm 112with a 113.Dv NULL 114parameter for 115.Fa oldp . 116The size of the available data will be returned in the location pointed to by 117.Fa oldlenp . 118For some operations, the amount of space may change often. 119For these operations, 120the system attempts to round up so that the returned size is 121large enough for a call to return the data shortly thereafter. 122.Pp 123To set a new value, 124.Fa newp 125is set to point to a buffer of length 126.Fa newlen 127from which the requested value is to be taken. 128If a new value is not to be set, 129.Fa newp 130should be set to 131.Dv NULL 132and 133.Fa newlen 134set to 0. 135.Pp 136The 137.Fn sysctlnametomib 138function can be used to map the string representation of a MIB entry 139to the numeric version. 140The 141.Fa name 142argument should point to an array of integers large enough to hold the 143MIB, and 144.Fa namelenp 145should indicate the number of integer slots available. 146Following a successful translation, the size_t indicated by 147.Fa namelenp 148will be changed to show the number of slots consumed. 149.Pp 150The 151.Fn sysctlgetmibinfo 152function performs name translation similar to 153.Fn sysctlnametomib , 154but also canonicalizes the name (or returns the first erroneous token 155from the string being parsed) into the space indicated by 156.Fa cname 157and 158.Fa csz . 159.Fa csz 160should indicate the size of the buffer pointed to by 161.Fa cname 162and on return, will indicate the size of the returned string including 163the trailing 164.Sq nul 165character. 166.Pp 167The 168.Fa rnode 169and 170.Fa v 171arguments to 172.Fn sysctlgetmibinfo 173are used to provide a tree for it to parse into, and to get back 174either a pointer to, or a copy of, the terminal node. 175If 176.Fa rnode 177is 178.Dv NULL , 179.Fn sysctlgetmibinfo 180uses its own internal tree for parsing, and checks it against the 181kernel at each call, to make sure that the name-to-number mapping is 182kept up to date. 183The 184.Fa v 185argument is ignored in this case. 186If 187.Fa rnode 188is not 189.Dv NULL 190but the pointer it references is, on a successful return, 191.Fa rnode 192will be adjusted to point to a copy of the terminal node. 193The 194.Fa v 195argument indicates which version of the 196.Nm 197node structure the caller wants. 198The application must later 199.Fn free 200this copy. 201If neither 202.Fa rnode 203nor the pointer it references are 204.Dv NULL , 205the pointer is used as the address of a tree over which the parsing is 206done. 207In this last case, the tree is not checked against the kernel, no 208refreshing of the mappings is performed, and the value given by 209.Fa v 210must agree with the version indicated by the tree. 211It is recommended that applications always use 212.Dv SYSCTL_VERSION 213as the value for 214.Fa v , 215as defined in the include file 216.Pa sys/sysctl.h . 217.Pp 218The top level names are defined with a CTL_ prefix in 219.Aq Pa sys/sysctl.h , 220and are as follows. 221The next and subsequent levels down are found in the include files 222listed here, and described in separate sections below. 223.Pp 224.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent 225.It Sy Name Next level names Description 226.It CTL\_KERN sys/sysctl.h High kernel limits 227.It CTL\_VM uvm/uvm_param.h Virtual memory 228.It CTL\_VFS sys/mount.h Filesystem 229.It CTL\_NET sys/socket.h Networking 230.It CTL\_DEBUG sys/sysctl.h Debugging 231.It CTL\_HW sys/sysctl.h Generic CPU, I/O 232.It CTL\_MACHDEP sys/sysctl.h Machine dependent 233.It CTL\_USER sys/sysctl.h User-level 234.It CTL\_DDB sys/sysctl.h In-kernel debugger 235.It CTL\_PROC sys/sysctl.h Per-process 236.It CTL\_VENDOR ? Vendor specific 237.It CTL\_EMUL sys/sysctl.h Emulation settings 238.It CTL\_SECURITY sys/sysctl.h Security settings 239.El 240.Pp 241For example, the following retrieves the maximum number of processes allowed 242in the system: 243.Bd -literal -offset indent -compact 244int mib[2], maxproc; 245size_t len; 246.sp 247mib[0] = CTL_KERN; 248mib[1] = KERN_MAXPROC; 249len = sizeof(maxproc); 250sysctl(mib, 2, \*[Am]maxproc, \*[Am]len, NULL, 0); 251.Ed 252.sp 253To retrieve the standard search path for the system utilities: 254.Bd -literal -offset indent -compact 255int mib[2]; 256size_t len; 257char *p; 258.sp 259mib[0] = CTL_USER; 260mib[1] = USER_CS_PATH; 261sysctl(mib, 2, NULL, \*[Am]len, NULL, 0); 262p = malloc(len); 263sysctl(mib, 2, p, \*[Am]len, NULL, 0); 264.Ed 265.Sh CTL_DEBUG 266The debugging variables vary from system to system. 267A debugging variable may be added or deleted without need to recompile 268.Nm 269to know about it. 270Each time it runs, 271.Nm 272gets the list of debugging variables from the kernel and 273displays their current values. 274The system defines twenty 275.Va ( struct ctldebug ) 276variables named 277.Dv debug0 278through 279.Dv debug19 . 280They are declared as separate variables so that they can be 281individually initialized at the location of their associated variable. 282The loader prevents multiple use of the same variable by issuing errors 283if a variable is initialized in more than one place. 284For example, to export the variable 285.Dv dospecialcheck 286as a debugging variable, the following declaration would be used: 287.Bd -literal -offset indent -compact 288int dospecialcheck = 1; 289struct ctldebug debug5 = { "dospecialcheck", \*[Am]dospecialcheck }; 290.Ed 291.Pp 292Note that the dynamic implementation of 293.Nm 294currently in use largely makes this particular 295.Nm 296interface obsolete. 297See 298.Xr sysctl 8 299.\" and 300.\" .Xr sysctl 9 301for more information. 302.Sh CTL_VFS 303A distinguished second level name, VFS_GENERIC, 304is used to get general information about all filesystems. 305One of its third level identifiers is VFS_MAXTYPENUM 306that gives the highest valid filesystem type number. 307Its other third level identifier is VFS_CONF that 308returns configuration information about the filesystem 309type given as a fourth level identifier. 310The remaining second level identifiers are the 311filesystem type number returned by a 312.Xr statvfs 2 313call or from VFS_CONF. 314The third level identifiers available for each filesystem 315are given in the header file that defines the mount 316argument structure for that filesystem. 317.Sh CTL_HW 318The string and integer information available for the CTL_HW level 319is detailed below. 320The changeable column shows whether a process with appropriate 321privilege may change the value. 322.Bl -column "Second level nameXXXXXX" "struct disk_sysctlXXX" -offset indent 323.It Sy Second level name Type Changeable 324.It HW\_ALIGNBYTES integer no 325.It HW\_BYTEORDER integer no 326.It HW\_CNMAGIC string yes 327.It HW\_DISKNAMES string no 328.It HW\_DISKSTATS struct no 329.It HW\_MACHINE string no 330.It HW\_MACHINE\_ARCH string no 331.It HW\_MODEL string no 332.It HW\_NCPU integer no 333.It HW\_PAGESIZE integer no 334.It HW\_PHYSMEM integer no 335.It HW\_PHYSMEM64 quad no 336.It HW\_USERMEM integer no 337.It HW\_USERMEM64 quad no 338.El 339.Pp 340.Bl -tag -width "123456" 341.It Li HW_ALIGNBYTES 342Alignment constraint for all possible data types. 343This shows the value 344.Dv ALIGNBYTES 345in 346.Pa /usr/include/machine/param.h , 347at the kernel compilation time. 348.It Li HW_BYTEORDER 349The byteorder (4,321, or 1,234). 350.It Li HW_CNMAGIC 351The console magic key sequence. 352.It Li HW_DISKNAMES 353The list of (space separated) disk device and NFS mount names on the system. 354.It Li HW_IOSTATNAMES 355A space separated list of devices that will have I/O statistics 356collected on them. 357.It Li HW_IOSTATS 358Return statistical information on the NFS mounts, disk and tape 359devices on the system. 360An array of 361.Va struct io_sysctl 362structures is returned, 363whose size depends on the current number of such objects in the system. 364The third level name is the size of the 365.Va struct io_sysctl . 366The type of object can be determined by examining the 367.Va type 368element of 369.Va struct io_sysctl . 370Which can be 371.Dv IOSTAT_DISK 372(disk drive), 373.Dv IOSTAT_TAPE 374(tape drive), or 375.Dv IOSTAT_NFS 376(NFS mount). 377.It Li HW_MACHINE 378The machine class. 379.It Li HW_MACHINE_ARCH 380The machine CPU class. 381.It Li HW_MODEL 382The machine model. 383.It Li HW_NCPU 384The number of CPUs. 385.ne 1i 386.It Li HW_PAGESIZE 387The software page size. 388.It Li HW_PHYSMEM 389The bytes of physical memory as a 32-bit integer. 390.It Li HW_PHYSMEM64 391The bytes of physical memory as a 64-bit integer. 392.It Li HW_USERMEM 393The bytes of non-kernel memory as a 32-bit integer. 394.It Li HW_USERMEM64 395The bytes of non-kernel memory as a 64-bit integer. 396.El 397.Sh CTL_KERN 398The string and integer information available for the CTL_KERN level 399is detailed below. 400The changeable column shows whether a process with appropriate 401privilege may change the value. 402The types of data currently available are process information, 403system vnodes, the open file entries, routing table entries, 404virtual memory statistics, load average history, and clock rate 405information. 406.Bl -column "KERNXPOSIXXREADERXWRITERXLOCKS" "struct clockrateXXX" -offset indent 407.It Sy Second level name Type Changeable 408.It KERN\_ARGMAX integer no 409.It KERN\_AUTONICETIME integer yes 410.It KERN\_AUTONICEVAL integer yes 411.It KERN\_BOOTTIME struct timeval no 412.It KERN\_BUFQ node not applicable 413.It KERN\_CCPU integer no 414.It KERN\_CLOCKRATE struct clockinfo no 415.It KERN\_CONSDEV integer no 416.It KERN\_CP\_ID struct no 417.It KERN\_CP\_TIME uint64_t[\|] no 418.It KERN\_DEFCORENAME string yes 419.It KERN\_DOMAINNAME string yes 420.It KERN\_DRIVERS struct kinfo_drivers no 421.It KERN\_FILE struct file no 422.It KERN\_FORKFSLEEP integer yes 423.It KERN\_FSCALE integer no 424.It KERN\_FSYNC integer no 425.It KERN\_HARDCLOCK\_TICKS integer no 426.It KERN\_HOSTID integer yes 427.It KERN\_HOSTNAME string yes 428.It KERN\_IOV\_MAX integer no 429.It KERN\_JOB\_CONTROL integer no 430.It KERN\_LABELOFFSET integer no 431.It KERN\_LABELSECTOR integer no 432.It KERN\_LOGIN\_NAME\_MAX integer no 433.It KERN\_LOGSIGEXIT integer yes 434.It KERN\_MAPPED\_FILES integer no 435.It KERN\_MAXFILES integer yes 436.It KERN\_MAXPARTITIONS integer no 437.It KERN\_MAXPHYS integer no 438.It KERN\_MAXPROC integer yes 439.It KERN\_MAXPTYS integer yes 440.It KERN\_MAXVNODES integer yes 441.It KERN\_MBUF node not applicable 442.It KERN\_MEMLOCK integer no 443.It KERN\_MEMLOCK\_RANGE integer no 444.It KERN\_MEMORY\_PROTECTION integer no 445.It KERN\_MONOTONIC\_CLOCK integer no 446.It KERN\_MSGBUF integer no 447.It KERN\_MSGBUFSIZE integer no 448.It KERN\_NGROUPS integer no 449.It KERN\_NTPTIME struct ntptimeval no 450.It KERN\_OSRELEASE string no 451.It KERN\_OSREV integer no 452.It KERN\_OSTYPE string no 453.It KERN\_PIPE node not applicable 454.It KERN\_POSIX1 integer no 455.It KERN\_POSIX\_BARRIERS integer no 456.It KERN\_POSIX\_READER\_WRITER\_LOCKS integer no 457.It KERN\_POSIX\_SEMAPHORES integer no 458.It KERN\_POSIX\_SPIN\_LOCKS integer no 459.It KERN\_POSIX\_THREADS integer no 460.It KERN\_POSIX\_TIMERS integer no 461.It KERN\_PROC struct kinfo_proc no 462.It KERN\_PROC2 struct kinfo_proc2 no 463.It KERN\_PROC\_ARGS string no 464.It KERN\_PROF node not applicable 465.It KERN\_RAWPARTITION integer no 466.It KERN\_ROOT\_DEVICE string no 467.It KERN\_ROOT\_PARTITION integer no 468.It KERN\_RTC\_OFFSET integer yes 469.It KERN\_SAVED\_IDS integer no 470.It KERN\_SECURELVL integer raise only 471.It KERN\_SYNCHRONIZED\_IO integer no 472.It KERN\_SYSVIPC\_INFO node not applicable 473.It KERN\_SYSVMSG integer no 474.It KERN\_SYSVSEM integer no 475.It KERN\_SYSVSHM integer no 476.It KERN\_TIMEX struct no 477.It KERN\_TKSTAT node not applicable 478.It KERN\_URANDOM integer no 479.It KERN\_VERIEXEC node not applicable 480.It KERN\_VERSION string no 481.It KERN\_VNODE struct vnode no 482.El 483.ne 1i 484.Pp 485.Bl -tag -width "123456" 486.It Li KERN_ARGMAX 487The maximum bytes of argument to 488.Xr execve 2 . 489.It Li KERN_AUTONICETIME 490The number of seconds of CPU-time a non-root process may accumulate before 491having its priority lowered from the default to the value of KERN_AUTONICEVAL. 492If set to 0, automatic lowering of priority is not performed, and if set to \-1 493all non-root processes are immediately lowered. 494.It Li KERN_AUTONICEVAL 495The priority assigned for automatically niced processes. 496.It Li KERN_BOOTTIME 497A 498.Va struct timeval 499structure is returned. 500This structure contains the time that the system was booted. 501.It Li KERN_CCPU 502The scheduler exponential decay value. 503.It Li KERN_CLOCKRATE 504A 505.Va struct clockinfo 506structure is returned. 507This structure contains the clock, statistics clock and profiling clock 508frequencies, the number of micro-seconds per hz tick, and the clock 509skew rate. 510.It Li KERN_CONSDEV 511Console device. 512.It Li KERN_CP_ID 513Mapping of CPU number to CPU id. 514.It Li KERN_CP_TIME 515Returns an array of CPUSTATES uint64_ts. 516This array contains the 517number of clock ticks spent in different CPU states. 518On multi-processor systems, the sum across all CPUs is returned unless 519appropriate space is given for one data set for each CPU. 520Data for a specific CPU can also be obtained by adding the number of the 521CPU at the end of the MIB, enlarging it by one. 522.It Li KERN_DEFCORENAME 523Default template for the name of core dump files (see also PROC_PID_CORENAME 524in the per-process variables CTL_PROC, and 525.Xr core 5 526for format of this template). 527The default value is 528.Nm %n.core 529and can be changed with the kernel configuration option 530.Cd options DEFCORENAME 531(see 532.Xr options 4 533). 534.It Li KERN_DOMAINNAME 535Get or set the YP domain name. 536.It Li KERN_DUMP_ON_PANIC 537Perform a crash dump on system panic. 538.It Li KERN_DRIVERS 539Return an array of 540.Va struct kinfo_drivers 541that contains the name and major device numbers of all the device drivers 542in the current kernel. 543The 544.Va d_name 545field is always a NUL terminated string. 546The 547.Va d_bmajor 548field will be set to \-1 if the driver doesn't have a block device. 549.It Li KERN_FILE 550Return the entire file table. 551The returned data consists of a single 552.Va struct filelist 553followed by an array of 554.Va struct file , 555whose size depends on the current number of such objects in the system. 556.It Li KERN_FORKFSLEEP 557If 558.Xr fork 2 559system call fails due to limit on number of processes (either 560the global maxproc limit or user's one), wait for this many 561milliseconds before returning 562.Er EAGAIN 563error to process. 564Useful to keep heavily forking runaway processes in bay. 565Default zero (no sleep). 566Maximum is 20 seconds. 567.It Li KERN_FSCALE 568The kernel fixed-point scale factor. 569.It Li KERN_FSYNC 570Return 1 if the POSIX 1003.1b File Synchronization Option is available 571on this system, 572otherwise 0. 573.It Li KERN_HARDCLOCK_TICKS 574Returns the number of 575.Xr hardclock 9 576ticks. 577.It Li KERN_HOSTID 578Get or set the host id. 579.It Li KERN_HOSTNAME 580Get or set the hostname. 581.It Li KERN_IOV_MAX 582Return the maximum number of 583.Va iovec 584structures that a process has available for use with 585.Xr preadv 2 , 586.Xr pwritev 2 , 587.Xr readv 2 , 588.Xr recvmsg 2 , 589.Xr sendmsg 2 590and 591.Xr writev 2 . 592.It Li KERN_JOB_CONTROL 593Return 1 if job control is available on this system, otherwise 0. 594.It Li KERN_LABELOFFSET 595The offset within the sector specified by KERN_LABELSECTOR of the 596.Xr disklabel 5 . 597.It Li KERN_LABELSECTOR 598The sector number containing the 599.Xr disklabel 5 . 600.It Li KERN_LOGIN_NAME_MAX 601The size of the storage required for a login name, in bytes, 602including the terminating NUL. 603.It Li KERN_LOGSIGEXIT 604If this flag is non-zero, the kernel will 605.Xr log 9 606all process exits due to signals which create a 607.Xr core 5 608file, and whether the coredump was created. 609.It Li KERN_MAPPED_FILES 610Returns 1 if the POSIX 1003.1b Memory Mapped Files Option is available 611on this system, 612otherwise 0. 613.It Li KERN_MAXFILES 614The maximum number of open files that may be open in the system. 615.It Li KERN_MAXPARTITIONS 616The maximum number of partitions allowed per disk. 617.It Li KERN_MAXPHYS 618Maximum raw I/O transfer size. 619.It Li KERN_MAXPROC 620The maximum number of simultaneous processes the system will allow. 621.It Li KERN_MAXPTYS 622The maximum number of pseudo terminals. 623This value can be both raised and lowered, though it cannot 624be set lower than number of currently used ptys. 625See also 626.Xr pty 4 . 627.It Li KERN_MAXVNODES 628The maximum number of vnodes available on the system. 629This can only be raised. 630.It Li KERN_MBUF 631Return information about the mbuf control variables. 632the third level names for the mbuf variables are detailed below. 633The changeable column shows whether a process with appropriate 634privilege may change the value. 635.Bl -column "MBUFXNMBCLUSTERSXXX" "struct integerXXX" -offset indent 636.It Sy Third level name Type Changeable 637.It MBUF\_MBLOWAT integer yes 638.It MBUF\_MCLBYTES integer yes 639.It MBUF\_MCLLOWAT integer yes 640.It MBUF\_MSIZE integer yes 641.It MBUF\_NMBCLUSTERS integer yes 642.El 643.Pp 644The variables are as follows: 645.Bl -tag -width "123456" 646.It Li MBUF_MBLOWAT 647The mbuf low water mark. 648.It Li MBUF_MCLBYTES 649The mbuf cluster size. 650.It Li MBUF_MCLLOWAT 651The mbuf cluster low water mark. 652.It Li MBUF_MSIZE 653The mbuf base size. 654.It Li MBUF_NMBCLUSTERS 655The limit on the number of mbuf clusters. 656The variable can only be increased, and only increased on machines with 657direct-mapped pool pages. 658.El 659.It Li KERN_MEMLOCK 660Returns 1 if the POSIX 1003.1b Process Memory Locking Option is available 661on this system, 662otherwise 0. 663.It Li KERN_MEMLOCK_RANGE 664Returns 1 if the POSIX 1003.1b Range Memory Locking Option is available 665on this system, 666otherwise 0. 667.It Li KERN_MEMORY_PROTECTION 668Returns 1 if the POSIX 1003.1b Memory Protection Option is available 669on this system, 670otherwise 0. 671.It Li KERN_MONOTONIC_CLOCK 672Returns the standard version the implementation of the POSIX 1003.1b 673Monotonic Clock Option conforms to, 674otherwise 0. 675.It Li KERN_MSGBUF 676The kernel message buffer, rotated so that the head of the circular kernel 677message buffer is returned at the start of the buffer specified by 678.Fa oldp . 679The returned data may contain NUL bytes. 680.It Li KERN_MSGBUFSIZE 681The maximum number of characters that the kernel message buffer can hold. 682.It Li KERN_NGROUPS 683The maximum number of supplemental groups. 684.It Li KERN_NTPTIME 685A 686.Va struct ntptimeval 687structure is returned. 688This structure contains data used by the 689.Xr ntpd 8 690program. 691.It Li KERN_OSRELEASE 692The system release string. 693.It Li KERN_OSREV 694The system revision string. 695.It Li KERN_OSTYPE 696The system type string. 697.It Li KERN_PIPE 698Pipe settings. 699The third level names for the integer pipe settings is detailed below. 700The changeable column shows whether a process with appropriate 701privilege may change the value. 702.Bl -column "KERNXPIPEXFOOXXX" "integerXXX" -offset indent 703.It Sy Third level name Type Changeable 704.It KERN\_PIPE\_KVASIZ integer yes 705.It KERN\_PIPE\_MAXBIGPIPES integer yes 706.It KERN\_PIPE\_MAXKVASZ integer yes 707.It KERN\_PIPE\_LIMITKVA integer yes 708.It KERN\_PIPE\_NBIGPIPES integer yes 709.El 710.Pp 711The variables are as follows: 712.Bl -tag -width "123456" 713.It Li KERN_PIPE_KVASIZ 714Amount of kernel memory consumed by pipe buffers. 715.It Li KERN_PIPE_MAXBIGPIPES 716Maximum number of "big" pipes. 717.It Li KERN_PIPE_MAXKVASZ 718Maximum amount of kernel memory to be used for pipes. 719.It Li KERN_PIPE_LIMITKVA 720Limit for direct transfers via page loan. 721.It Li KERN_PIPE_NBIGPIPES 722Number of "big" pipes. 723.El 724.It Li KERN_POSIX1 725The version of ISO/IEC 9945 (POSIX 1003.1) with which the system 726attempts to comply. 727.It Li KERN_POSIX_BARRIERS 728The version of 729.St -p1003.1 730and its 731Barriers 732option to which the system attempts to conform, 733otherwise 0. 734.It Li KERN_POSIX_READER_WRITER_LOCKS 735The version of 736.St -p1003.1 737and its 738Read-Write Locks 739option to which the system attempts to conform, 740otherwise 0. 741.It Li KERN_POSIX_SEMAPHORES 742The version of 743.St -p1003.1 744and its 745Semaphores 746option to which the system attempts to conform, 747otherwise 0. 748.It Li KERN_POSIX_SPIN_LOCKS 749The version of 750.St -p1003.1 751and its 752Spin Locks 753option to which the system attempts to conform, 754otherwise 0. 755.It Li KERN_POSIX_THREADS 756The version of 757.St -p1003.1 758and its 759Threads 760option to which the system attempts to conform, 761otherwise 0. 762.It Li KERN_POSIX_TIMERS 763The version of 764.St -p1003.1 765and its 766Timers 767option to which the system attempts to conform, 768otherwise 0. 769.It Li KERN_PROC 770Return the entire process table, or a subset of it. 771An array of 772.Va struct kinfo_proc 773structures is returned, 774whose size depends on the current number of such objects in the system. 775The third and fourth level names are as follows: 776.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent 777.It Sy Third level name Fourth level is: 778.It KERN\_PROC\_ALL None 779.It KERN\_PROC\_GID A group ID 780.It KERN\_PROC\_PID A process ID 781.It KERN\_PROC\_PGRP A process group 782.It KERN\_PROC\_RGID A real group ID 783.It KERN\_PROC\_RUID A real user ID 784.It KERN\_PROC\_SESSION A session ID 785.It KERN\_PROC\_TTY A tty device 786.It KERN\_PROC\_UID A user ID 787.El 788.It Li KERN_PROC2 789As for KERN_PROC, but an array of 790.Va struct kinfo_proc2 791structures are returned. 792The fifth level name is the size of the 793.Va struct kinfo_proc2 794and the sixth level name is the number of structures to return. 795.It Li KERN_PROC_ARGS 796Return the argv or environment strings (or the number thereof) 797of a process. 798Multiple strings are returned separated by NUL characters. 799The third level name is the process ID. 800The fourth level name is as follows: 801.Bl -column "Third level nameXXXXXX" -offset indent 802.It KERN\_PROC\_ARGV The argv strings 803.It KERN\_PROC\_ENV The environ strings 804.It KERN\_PROC\_NARGV The number of argv strings 805.It KERN\_PROC\_NENV The number of environ strings 806.El 807.It Li KERN_PROF 808Return profiling information about the kernel. 809If the kernel is not compiled for profiling, 810attempts to retrieve any of the KERN_PROF values will 811fail with EOPNOTSUPP. 812The third level names for the string and integer profiling information 813is detailed below. 814The changeable column shows whether a process with appropriate 815privilege may change the value. 816.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent 817.It Sy Third level name Type Changeable 818.It GPROF\_COUNT u_short[\|] yes 819.It GPROF\_FROMS u_short[\|] yes 820.It GPROF\_GMONPARAM struct gmonparam no 821.It GPROF\_STATE integer yes 822.It GPROF\_TOS struct tostruct yes 823.El 824.Pp 825The variables are as follows: 826.Bl -tag -width "123456" 827.It Li GPROF_COUNT 828Array of statistical program counter counts. 829.It Li GPROF_FROMS 830Array indexed by program counter of call-from points. 831.It Li GPROF_GMONPARAM 832Structure giving the sizes of the above arrays. 833.It Li GPROF_STATE 834Profiling state. 835If set to GMON_PROF_ON, starts profiling. 836If set to GMON_PROF_OFF, stops profiling. 837.It Li GPROF_TOS 838Array of 839.Va struct tostruct 840describing destination of calls and their counts. 841.El 842.It Li KERN_RAWPARTITION 843The raw partition of a disk (a == 0). 844.It Li KERN_ROOT_DEVICE 845The name of the root device (e.g., 846.Dq wd0 ) . 847.It Li KERN_ROOT_PARTITION 848The root partition on the root device (a == 0). 849.It Li KERN_RTC_OFFSET 850Return the offset of real time clock from UTC in minutes. 851.It Li KERN_SAVED_IDS 852Returns 1 if saved set-group and saved set-user ID is available. 853.It Li KERN_SBMAX 854Maximum socket buffer size. 855.It Li KERN_SECURELVL 856The system security level. 857This level may be raised by processes with appropriate privilege. 858It may only be lowered by process 1. 859.It Li KERN_SOMAXKVA 860Maximum amount of kernel memory to be used for socket buffers. 861.It Li KERN_SYNCHRONIZED_IO 862Returns 1 if the POSIX 1003.1b Synchronized I/O Option is available 863on this system, 864otherwise 0. 865.It Li KERN_SYSVIPC_INFO 866Return System V style IPC configuration and run-time information. 867The third level name selects the System V style IPC facility. 868.Bl -column "KERN_SYSVIPC_MSG_INFOXXX" "struct shm_sysctl_infoXXX" -offset indent 869.It Sy Third level name Type 870.It KERN\_SYSVIPC\_MSG\_INFO struct msg_sysctl_info 871.It KERN\_SYSVIPC\_SEM\_INFO struct sem_sysctl_info 872.It KERN\_SYSVIPC\_SHM\_INFO struct shm_sysctl_info 873.El 874.Pp 875.Bl -tag -width "123456" 876.It Li KERN_SYSVIPC_MSG_INFO 877Return information on the System V style message facility. 878The 879.Sy msg_sysctl_info 880structure is defined in 881.Aq Pa sys/msg.h . 882.It Li KERN_SYSVIPC_SEM_INFO 883Return information on the System V style semaphore facility. 884The 885.Sy sem_sysctl_info 886structure is defined in 887.Aq Pa sys/sem.h . 888.It Li KERN_SYSVIPC_SHM_INFO 889Return information on the System V style shared memory facility. 890The 891.Sy shm_sysctl_info 892structure is defined in 893.Aq Pa sys/shm.h . 894.El 895.It Li KERN_SYSVMSG 896Returns 1 if System V style message queue functionality is available 897on this system, 898otherwise 0. 899.It Li KERN_SYSVSEM 900Returns 1 if System V style semaphore functionality is available 901on this system, 902otherwise 0. 903.It Li KERN_SYSVSHM 904Returns 1 if System V style share memory functionality is available 905on this system, 906otherwise 0. 907.It Li KERN_TIMEX 908Not available. 909.It Li KERN_TKSTAT 910Return information about the number of characters sent and received 911on ttys. 912The third level names for the tty statistic variables are detailed below. 913The changeable column shows whether a process 914with appropriate privilege may change the value. 915.Bl -column "KERNXTKSTATXRAWCCXXX" "struct integerXXX" -offset indent 916.It Sy Third level name Type Changeable 917.It KERN\_TKSTAT\_CANCC quad no 918.It KERN\_TKSTAT\_NIN quad no 919.It KERN\_TKSTAT\_NOUT quad no 920.It KERN\_TKSTAT\_RAWCC quad no 921.El 922.Pp 923The variables are as follows: 924.Bl -tag -width "123456" 925.It Li KERN_TKSTAT_CANCC 926The number of canonical input characters. 927.It Li KERN_TKSTAT_NIN 928The total number of input characters. 929.It Li KERN_TKSTAT_NOUT 930The total number of output characters. 931.It Li KERN_TKSTAT_RAWCC 932The number of raw input characters. 933.El 934.It Li KERN_URND 935Random integer value. 936.It Li KERN_VERIEXEC 937Tunings for Verixec. 938Third level names for the Veriexec variables are detailed below. 939The changeable column shows whether a process with appropriate privilege may 940change the value or only raise it. 941Only the superuser can modify these variables. 942.Bl -column "VERIEXECXALGORITHMSXXX" "struct integerXXX" -offset indent 943.It Sy Third level name Type Changeable 944.It VERIEXEC\_ALGORITHMS string no 945.It VERIEXEC\_COUNT node not applicable 946.It VERIEXEC\_STRICT integer raise only 947.It VERIEXEC\_VERBOSE integer yes 948.El 949.Pp 950The variables are as follows: 951.Bl -tag -width "123456" 952.It Li VERIEXEC_ALGORITHMS 953Returns a string with the supported algorithms in Veriexec. 954.It Li VERIEXEC_COUNT 955Sub-nodes are added to this node as new mounts are monitored by Veriexec. 956Each mount will be under its own 957.No tableN 958node. 959Under each node there will be three variables, indicating the mount 960point, the file-system type, and the number of entries. 961.It Li VERIEXEC_STRICT 962Controls the strict level of Veriexec. 963The strict level defines how Veriexec will treat various situations. 964.Pp 965In strict level 0, the system is in learning mode and will only warn about 966fingerprint mismatches, as well as allow removal of fingerprinted files. 967It is the only level where fingerprints can be loaded. 968.Pp 969In strict level 1, the system is in IDS mode. 970It will deny access to files with mismatched fingerprints. 971Write access to monitored files will be permitted, but once modified, further 972access to them will be denied. 973Monitored files cannot be removed. 974If a disk will be opened for raw writing, Veriexec will invalidate all 975fingerprints on that disk, if it is monitored. 976.Pp 977In strict level 2, the system is in IPS mode. 978It has all effects of 979strict level 1, plus it will deny write access to monitored files and enforce 980access type (direct, indirect, file). 981Execution of non-monitored files is denied. 982Opening of raw disks for writing will be denied if the disk is monitored. 983Attempts to write to kernel memory, either via 984.Pa /dev/mem 985or 986.Pa /dev/kmem , 987will be denied to protect Veriexec's internal data-structures. 988.Pp 989Strict level 3 operates as lockdown mode. 990It will have all effects of 991strict level 2, but it will also prevent access to non-monitored files. 992Furthermore, it will prevent addition of new files to the system, and 993allow writing only to files opened before the strict level was raised. 994All attempts to open a disk for raw writing will be denied. 995.It Li VERIEXEC_VERBOSE 996Controls the verbosity level of Veriexec. 997If 0, only the minimal 998indication required will be given about what's happening - fingerprint 999mismatches, removal of entries from the tables, modification of a 1000fingerprinted file. 1001If 1, more messages will be printed (ie., when a file with a valid 1002fingerprint is accessed). 1003Verbose level 2 is debug mode. 1004.El 1005.It Li KERN_VERSION 1006The system version string. 1007.It Li KERN_VNODE 1008Return the entire vnode table. 1009Note, the vnode table is not necessarily a consistent snapshot of 1010the system. 1011The returned data consists of an array whose size depends on the 1012current number of such objects in the system. 1013Each element of the array contains the kernel address of a vnode 1014.Va struct vnode * 1015followed by the vnode itself 1016.Va struct vnode . 1017.It Li kern.coredump.setid 1018Settings related to set-id processes coredumps. 1019By default, set-id processes do not dump core in situations where 1020other processes would. 1021The settings in this node allows an administrator to change this 1022behavior. 1023.Pp 1024.Bl -tag -width "123456" 1025.It Li kern.coredump.setid.dump 1026If non-zero, set-id processes will dump core. 1027.It Li kern.coredump.setid.group 1028The group-id for the set-id processes' coredump. 1029.It Li kern.coredump.setid.mode 1030The mode for the set-id processes' coredump. 1031See 1032.Xr chmod 1 . 1033.It Li kern.coredump.setid.owner 1034The user-id that will be used as the owner of the set-id processes' 1035coredump. 1036.It Li kern.coredump.setid.path 1037The path to which set-id processes' coredumps will be saved to. 1038Same syntax as kern.defcorename. 1039.El 1040.El 1041.Sh CTL_MACHDEP 1042The set of variables defined is architecture dependent. 1043Most architectures define at least the following variables. 1044.Bl -column "CONSOLE_DEVICEXXX" "integerXXX" -offset indent 1045.It Sy Second level name Type Changeable 1046.It Li CPU_CONSDEV dev_t no 1047.El 1048.Sh CTL_NET 1049The string and integer information available for the CTL_NET level 1050is detailed below. 1051The changeable column shows whether a process with appropriate 1052privilege may change the value. 1053The second and third levels are typically the protocol family and 1054protocol number, though this is not always the case. 1055.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent 1056.It Sy Second level name Type Changeable 1057.It PF\_ROUTE routing messages no 1058.It PF\_INET IPv4 values yes 1059.It PF\_INET6 IPv6 values yes 1060.It PF\_KEY IPsec key management values yes 1061.El 1062.Pp 1063.Bl -tag -width "123456" 1064.It Li PF_ROUTE 1065Return the entire routing table or a subset of it. 1066The data is returned as a sequence of routing messages (see 1067.Xr route 4 1068for the header file, format and meaning). 1069The length of each message is contained in the message header. 1070.Pp 1071The third level name is a protocol number, which is currently always 0. 1072The fourth level name is an address family, which may be set to 0 to 1073select all address families. 1074The fifth and sixth level names are as follows: 1075.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent 1076.It Sy Fifth level name Sixth level is: 1077.It NET\_RT\_FLAGS rtflags 1078.It NET\_RT\_DUMP None 1079.It NET\_RT\_IFLIST None 1080.El 1081.It Li PF_INET 1082Get or set various global information about the IPv4 1083.Pq Internet Protocol version 4 . 1084The third level name is the protocol. 1085The fourth level name is the variable name. 1086The currently defined protocols and names are: 1087.Bl -column "Protocol name" "Variable nameXX" "integer" "yes" -offset indent 1088.It Sy Protocol name Variable name Type Changeable 1089.It arp down integer yes 1090.It arp keep integer yes 1091.It arp prune integer yes 1092.It arp refresh integer yes 1093.It carp allow integer yes 1094.It carp preempt integer yes 1095.It carp log integer yes 1096.It carp arpbalance integer yes 1097.It icmp errppslimit integer yes 1098.It icmp maskrepl integer yes 1099.It icmp rediraccept integer yes 1100.It icmp redirtimeout integer yes 1101.It ip allowsrcrt integer yes 1102.It ip anonportmax integer yes 1103.It ip anonportmin integer yes 1104.It ip checkinterface integer yes 1105.It ip directed-broadcast integer yes 1106.It ip do_loopback_cksum integer yes 1107.It ip forwarding integer yes 1108.It ip forwsrcrt integer yes 1109.It ip gifttl integer yes 1110.It ip grettl integer yes 1111.It ip hostzerobroadcast integer yes 1112.It ip lowportmin integer yes 1113.It ip lowportmax integer yes 1114.It ip maxflows integer yes 1115.It ip maxfragpackets integer yes 1116.It ip mtudisc integer yes 1117.It ip mtudisctimeout integer yes 1118.It ip random_id integer yes 1119.It ip redirect integer yes 1120.It ip subnetsarelocal integer yes 1121.It ip ttl integer yes 1122.It tcp rfc1323 integer yes 1123.It tcp sendspace integer yes 1124.It tcp recvspace integer yes 1125.It tcp mssdflt integer yes 1126.It tcp syn_cache_limit integer yes 1127.It tcp syn_bucket_limit integer yes 1128.It tcp syn_cache_interval integer yes 1129.It tcp init_win integer yes 1130.It tcp init_win_local integer yes 1131.It tcp mss_ifmtu integer yes 1132.It tcp win_scale integer yes 1133.It tcp timestamps integer yes 1134.It tcp compat_42 integer yes 1135.It tcp cwm integer yes 1136.It tcp cwm_burstsize integer yes 1137.It tcp ack_on_push integer yes 1138.It tcp keepidle integer yes 1139.It tcp keepintvl integer yes 1140.It tcp keepcnt integer yes 1141.It tcp slowhz integer no 1142.It tcp log_refused integer yes 1143.It tcp rstppslimit integer yes 1144.It tcp ident struct no 1145.It tcp sack.enable integer yes 1146.It tcp sack.globalholes integer no 1147.It tcp sack.globalmaxholes integer yes 1148.It tcp sack.maxholes integer yes 1149.It tcp ecn.enable integer yes 1150.It tcp ecn.maxretries integer yes 1151.It tcp congctl.selected string yes 1152.It tcp congctl.available string yes 1153.It udp checksum integer yes 1154.It udp do_loopback_cksum integer yes 1155.It udp recvspace integer yes 1156.It udp sendspace integer yes 1157.El 1158.Pp 1159The variables are as follows: 1160.Bl -tag -width "123456" 1161.It Li arp.down 1162Failed ARP entry lifetime. 1163.It Li arp.keep 1164Valid ARP entry lifetime. 1165.It Li arp.prune 1166ARP cache pruning interval. 1167.It Li arp.refresh 1168ARP entry refresh interval. 1169.It Li carp.allow 1170If set to 0, incoming 1171.Xr carp 4 1172packets will not be processed. 1173If set to any other value, processing will occur. 1174Enabled by default. 1175.It Li carp.arpbalance 1176If set to any value other than 0, the ARP balancing functionality of 1177.Xr carp 4 1178is enabled. 1179When ARP requests are received for an IP address which is part of any virtual 1180host, carp will hash the source IP in the ARP request to select one of the 1181virtual hosts from the set of all the virtual hosts which have that IP address. 1182The master of that host will respond with the correct virtual MAC address. 1183Disabled by default. 1184.It Li carp.log 1185If set to any value other than 0, 1186.Xr carp 4 1187will log errors. 1188Disabled by default. 1189.It Li carp.preempt 1190If set to 0, 1191.Xr carp 4 1192will not attempt to become master if it is receiving advertisements from 1193another active master. 1194If set to any other value, carp will become master of the virtual host if it 1195believes it can send advertisements more frequently than the current master. 1196Disabled by default. 1197.It Li ip.allowsrcrt 1198If set to 1, the host accepts source routed packets. 1199.It Li ip.anonportmax 1200The highest port number to use for TCP and UDP ephemeral port allocation. 1201This cannot be set to less than 1024 or greater than 65535, and must 1202be greater than 1203.Li ip.anonportmin . 1204.It Li ip.anonportmin 1205The lowest port number to use for TCP and UDP ephemeral port allocation. 1206This cannot be set to less than 1024 or greater than 65535. 1207.It Li ip.checkinterface 1208If set to non-zero, the host will reject packets addressed to it 1209that arrive on an interface not bound to that address. 1210Currently, this must be disabled if ipnat is used to translate the 1211destination address to another local interface, or if addresses 1212are added to the loopback interface instead of the interface where 1213the packets for those packets are received. 1214.It Li ip.directed-broadcast 1215If set to 1, enables directed broadcast behavior for the host. 1216.It Li ip.do_loopback_cksum 1217Perform IP checksum on loopback. 1218.It Li ip.forwarding 1219If set to 1, enables IP forwarding for the host, 1220meaning that the host is acting as a router. 1221.It Li ip.forwsrcrt 1222If set to 1, enables forwarding of source-routed packets for the host. 1223This value may only be changed if the kernel security level is less than 1. 1224.It Li ip.gifttl 1225The maximum time-to-live (hop count) value for an IPv4 packet generated by 1226.Xr gif 4 1227tunnel interface. 1228.It Li ip.grettl 1229The maximum time-to-live (hop count) value for an IPv4 packet generated by 1230.Xr gre 4 1231tunnel interface. 1232.It Li ip.hostzerobroadcast 1233All zeroes address is broadcast address. 1234.It Li ip.lowportmax 1235The highest port number to use for TCP and UDP reserved port allocation. 1236This cannot be set to less than 0 or greater than 1024, and must 1237be greater than 1238.Li ip.lowportmin . 1239.It Li ip.lowportmin 1240The lowest port number to use for TCP and UDP reserved port allocation. 1241This cannot be set to less than 0 or greater than 1024, and must 1242be smaller than 1243.Li ip.lowportmax . 1244.It Li ip.maxflows 1245IP Fast Forwarding is enabled by default. 1246If set to 0, IP Fast Forwarding is disabled. 1247.Li ip.maxflows 1248controls the maximum amount of flows which can be created. 1249The default value is 256. 1250.It Li ip.maxfragpackets 1251The maximum number of fragmented packets the node will accept. 12520 means that the node will not accept any fragmented packets. 1253\-1 means that the node will accept as many fragmented packets as it receives. 1254The flag is provided basically for avoiding possible DoS attacks. 1255.It Li ip.mtudisc 1256If set to 1, enables Path MTU Discovery (RFC 1191). 1257When Path MTU Discovery is enabled, the transmitted TCP segment 1258size will be determined by the advertised maximum segment size 1259(MSS) from the remote end, as constrained by the path MTU. 1260If MTU Discovery is disabled, the transmitted segment size will 1261never be greater than 1262.Li tcp.mssdflt 1263(the local maximum segment size). 1264.It Li ip.mtudisctimeout 1265The number of seconds in which a route added by the Path MTU 1266Discovery engine will time out. 1267When the route times out, the Path 1268MTU Discovery engine will attempt to probe a larger path MTU. 1269.It Li ip.random_id 1270Assign random ip_id values. 1271.It Li ip.redirect 1272If set to 1, ICMP redirects may be sent by the host. 1273This option is ignored unless the host is routing IP packets, 1274and should normally be enabled on all systems. 1275.It Li ip.subnetsarelocal 1276If set to 1, subnets are to be considered local addresses. 1277.It Li ip.ttl 1278The maximum time-to-live (hop count) value for an IP packet sourced by 1279the system. 1280This value applies to normal transport protocols, not to ICMP. 1281.It Li icmp.errppslimit 1282The variable specifies the maximum number of outgoing ICMP error messages, 1283per second. 1284ICMP error messages that exceeded the value are subject to rate limitation 1285and will not go out from the node. 1286Negative value disables rate limitation. 1287.It Li icmp.maskrepl 1288If set to 1, ICMP network mask requests are to be answered. 1289.It Li icmp.rediraccept 1290If set to non-zero, the host will accept ICMP redirect packets. 1291Note that routers will never accept ICMP redirect packets, 1292and the variable is meaningful on IP hosts only. 1293.It Li icmp.redirtimeout 1294The variable specifies lifetime of routing entries generated by incoming 1295ICMP redirect. 1296This defaults to 600 seconds. 1297.It Li icmp.returndatabytes 1298Number of bytes to return in an ICMP error message. 1299.It Li tcp.ack_on_push 1300If set to 1, TCP is to immediately transmit an ACK upon reception of 1301a packet with PUSH set. 1302This can avoid losing a round trip time in some rare situations, 1303but has the caveat of potentially defeating TCP's delayed ACK algorithm. 1304Use of this option is generally not recommended, but 1305the variable exists in case your configuration really needs it. 1306.It Li tcp.compat_42 1307If set to 1, enables work-arounds for bugs in the 4.2BSD TCP implementation. 1308Use of this option is not recommended, although it may be 1309required in order to communicate with extremely old TCP implementations. 1310.It Li tcp.cwm 1311If set to 1, enables use of the Hughes/Touch/Heidemann Congestion Window 1312Monitoring algorithm. 1313This algorithm prevents line-rate bursts of packets that could 1314otherwise occur when data begins flowing on an idle TCP connection. 1315These line-rate bursts can contribute to network and router congestion. 1316This can be particularly useful on World Wide Web servers 1317which support HTTP/1.1, which has lingering connections. 1318.It Li tcp.cwm_burstsize 1319The Congestion Window Monitoring allowed burst size, in terms 1320of packet count. 1321.It Li tcp.delack_ticks 1322Number of ticks to delay sending an ACK. 1323.It Li tcp.do_loopback_cksum 1324Perform TCP checksum on loopback. 1325.It Li tcp.init_win 1326A value indicating the TCP initial congestion window. 1327If this value is 0, an auto-tuning algorithm designed to use an initial 1328window of approximately 4K bytes is in use. 1329Otherwise, this value indicates a fixed number of packets. 1330.It Li tcp.init_win_local 1331Like 1332.Li tcp.init_win , 1333but used when communicating with hosts on a local network. 1334.It Li tcp.keepcnt 1335Number of keepalive probes sent before declaring a connection dead. 1336If set to zero, there is no limit; 1337keepalives will be sent until some kind of 1338response is received from the peer. 1339.It Li tcp.keepidle 1340Time a connection must be idle before keepalives are sent (if keepalives 1341are enabled for the connection). 1342See also tcp.slowhz. 1343.It Li tcp.keepintvl 1344Time after a keepalive probe is sent until, in the absence of any response, 1345another probe is sent. 1346See also tcp.slowhz. 1347.It Li tcp.log_refused 1348If set to 1, refused TCP connections to the host will be logged. 1349.It Li tcp.mss_ifmtu 1350If set to 1, TCP calculates the outgoing maximum segment size based on 1351the MTU of the appropriate interface. 1352If set to 0, it is calculated based on the greater of the MTU of the 1353interface, and the largest (non-loopback) interface MTU on the system. 1354.It Li tcp.mssdflt 1355The default maximum segment size both advertised to the peer 1356and to use when either the peer does not advertise a maximum segment size to 1357us during connection setup or Path MTU Discovery 1358.Li ( ip.mtudisc ) 1359is disabled. 1360Do not change this value unless you really know what you are doing. 1361.It Li tcp.newreno 1362If set to 1, enables the use of J. 1363Hoe's NewReno congestion control algorithm. 1364This algorithm improves the start-up behavior of TCP connections. 1365.It Li tcp.recvspace 1366The default TCP receive buffer size. 1367.It Li tcp.rfc1323 1368If set to 1, enables RFC 1323 extensions to TCP. 1369.It Li tcp.rstppslimit 1370The variable specifies the maximum number of outgoing TCP RST packets, 1371per second. 1372TCP RST packet that exceeded the value are subject to rate limitation 1373and will not go out from the node. 1374Negative value disables rate limitation. 1375.It Li tcp.sack.enable 1376If set to 1, enables RFC 2018 Selective ACKnowledgement. 1377.It Li tcp.sack.globalholes 1378Global number of TCP SACK holes. 1379.It Li tcp.sack.globalmaxholes 1380Global maximum number of TCP SACK holes. 1381.It Li tcp.sack.maxholes 1382Maximum number of TCP SACK holes allowed per connection. 1383.It Li tcp.ecn.enable 1384If set to 1, enables RFC 3168 Explicit Congestion Notification. 1385.It Li tcp.ecn.maxretries 1386Number of times to retry sending the ECN-setup packet. 1387.It Li tcp.sendspace 1388The default TCP send buffer size. 1389.It Li tcp.slowhz 1390The units for tcp.keepidle and tcp.keepintvl; those variables are in ticks 1391of a clock that ticks tcp.slowhz times per second. 1392(That is, their values 1393must be divided by the tcp.slowhz value to get times in seconds.) 1394.It Li tcp.syn_bucket_limit 1395The maximum number of entries allowed per hash bucket in the TCP 1396compressed state engine. 1397.It Li tcp.syn_cache_limit 1398The maximum number of entries allowed in the TCP compressed state 1399engine. 1400.It Li tcp.timestamps 1401If rfc1323 is enabled, a value of 1 indicates RFC 1323 time stamp options, 1402used for measuring TCP round trip times, are enabled. 1403.It Li tcp.win_scale 1404If rfc1323 is enabled, a value of 1 indicates RFC 1323 window scale options, 1405for increasing the TCP window size, are enabled. 1406.It Li tcp.congctl.available 1407The available TCP congestion control algorithms. 1408.It Li tcp.congctl.selected 1409The currently selected TCP congestion control algorithm. 1410.It Li udp.checksum 1411If set to 1, UDP checksums are being computed. 1412Received non-zero UDP checksums are always checked. 1413Disabling UDP checksums is strongly discouraged. 1414.It Li udp.sendspace 1415The default UDP send buffer size. 1416.It Li udp.recvspace 1417The default UDP receive buffer size. 1418.El 1419.Pp 1420For variables net.*.ipsec, please refer to 1421.Xr ipsec 4 . 1422.It Li PF_INET6 1423Get or set various global information about the IPv6 1424.Pq Internet Protocol version 6 . 1425The third level name is the protocol. 1426The fourth level name is the variable name. 1427The currently defined protocols and names are: 1428.Bl -column "Protocol name" "Variable nameXX" "integer" "yes" -offset indent 1429.It Sy Protocol name Variable name Type Changeable 1430.It icmp6 errppslimit integer yes 1431.It icmp6 mtudisc_hiwat integer yes 1432.It icmp6 mtudisc_lowat integer yes 1433.It icmp6 nd6_debug integer yes 1434.It icmp6 nd6_delay integer yes 1435.It icmp6 nd6_maxnudhint integer yes 1436.It icmp6 nd6_mmaxtries integer yes 1437.It icmp6 nd6_prune integer yes 1438.It icmp6 nd6_umaxtries integer yes 1439.It icmp6 nd6_useloopback integer yes 1440.It icmp6 nodeinfo integer yes 1441.It icmp6 rediraccept integer yes 1442.It icmp6 redirtimeout integer yes 1443.It ip6 accept_rtadv integer yes 1444.It ip6 anonportmax integer yes 1445.It ip6 anonportmin integer yes 1446.It ip6 auto_flowlabel integer yes 1447.It ip6 dad_count integer yes 1448.It ip6 defmcasthlim integer yes 1449.It ip6 forwarding integer yes 1450.It ip6 gifhlim integer yes 1451.It ip6 hlim integer yes 1452.It ip6 hdrnestlimit integer yes 1453.It ip6 kame_version string no 1454.It ip6 keepfaith integer yes 1455.It ip6 log_interval integer yes 1456.It ip6 lowportmax integer yes 1457.It ip6 lowportmin integer yes 1458.It ip6 maxfragpackets integer yes 1459.It ip6 maxfrags integer yes 1460.It ip6 redirect integer yes 1461.It ip6 rr_prune integer yes 1462.It ip6 use_deprecated integer yes 1463.It ip6 v6only integer yes 1464.It udp6 do_loopback_cksum integer yes 1465.It udp6 recvspace integer yes 1466.It udp6 sendspace integer yes 1467.El 1468.Pp 1469The variables are as follows: 1470.Bl -tag -width "123456" 1471.It Li ip6.accept_rtadv 1472If set to non-zero, the node will accept ICMPv6 router advertisement packets 1473and autoconfigures address prefixes and default routers. 1474The node must be a host 1475.Pq not a router 1476for the option to be meaningful. 1477.It Li ip6.anonportmax 1478The highest port number to use for TCP and UDP ephemeral port allocation. 1479This cannot be set to less than 1024 or greater than 65535, and must 1480be greater than 1481.Li ip6.anonportmin . 1482.It Li ip6.anonportmin 1483The lowest port number to use for TCP and UDP ephemeral port allocation. 1484This cannot be set to less than 1024 or greater than 65535. 1485.It Li ip6.auto_flowlabel 1486On connected transport protocol packets, 1487fill IPv6 flowlabel field to help intermediate routers to identify packet flows. 1488.It Li ip6.dad_count 1489The variable configures number of IPv6 DAD 1490.Pq duplicated address detection 1491probe packets. 1492The packets will be generated when IPv6 interface addresses are configured. 1493.It Li ip6.defmcasthlim 1494The default hop limit value for an IPv6 multicast packet sourced by the node. 1495This value applies to all the transport protocols on top of IPv6. 1496There are APIs to override the value, as documented in 1497.Xr ip6 4 . 1498.It Li ip6.forwarding 1499If set to 1, enables IPv6 forwarding for the node, 1500meaning that the node is acting as a router. 1501If set to 0, disables IPv6 forwarding for the node, 1502meaning that the node is acting as a host. 1503IPv6 specification defines node behavior for 1504.Dq router 1505case and 1506.Dq host 1507case quite differently, and changing this variable during operation 1508may cause serious trouble. 1509It is recommended to configure the variable at bootstrap time, 1510and bootstrap time only. 1511.It Li ip6.gifhlim 1512The maximum hop limit value for an IPv6 packet generated by 1513.Xr gif 4 1514tunnel interface. 1515.It Li ip6.hdrnestlimit 1516The number of IPv6 extension headers permitted on incoming IPv6 packets. 1517If set to 0, the node will accept as many extension headers as possible. 1518.It Li ip6.hlim 1519The default hop limit value for an IPv6 unicast packet sourced by the node. 1520This value applies to all the transport protocols on top of IPv6. 1521There are APIs to override the value, as documented in 1522.Xr ip6 4 . 1523.It Li ip6.kame_version 1524The string identifies the version of KAME IPv6 stack implemented in the kernel. 1525.It Li ip6.keepfaith 1526If set to non-zero, it enables 1527.Dq FAITH 1528TCP relay IPv6-to-IPv4 translator code in the kernel. 1529Refer 1530.Xr faith 4 1531and 1532.Xr faithd 8 1533for detail. 1534.It Li ip6.log_interval 1535The variable controls amount of logs generated by IPv6 packet 1536forwarding engine, by setting interval between log output 1537.Pq in seconds . 1538.It Li ip6.lowportmax 1539The highest port number to use for TCP and UDP reserved port allocation. 1540This cannot be set to less than 0 or greater than 1024, and must 1541be greater than 1542.Li ip6.lowportmin . 1543.It Li ip6.lowportmin 1544The lowest port number to use for TCP and UDP reserved port allocation. 1545This cannot be set to less than 0 or greater than 1024, and must 1546be smaller than 1547.Li ip6.lowportmax . 1548.It Li ip6.maxfragpackets 1549The maximum number of fragmented packets the node will accept. 15500 means that the node will not accept any fragmented packets. 1551\-1 means that the node will accept as many fragmented packets as it receives. 1552The flag is provided basically for avoiding possible DoS attacks. 1553.It Li ip6.maxfrags 1554The maximum number of fragments the node will accept. 15550 means that the node will not accept any fragments. 1556\-1 means that the node will accept as many fragments as it receives. 1557The flag is provided basically for avoiding possible DoS attacks. 1558.It Li ip6.redirect 1559If set to 1, ICMPv6 redirects may be sent by the node. 1560This option is ignored unless the node is routing IP packets, 1561and should normally be enabled on all systems. 1562.It Li ip6.rr_prune 1563The variable specifies interval between IPv6 router renumbering prefix 1564babysitting, in seconds. 1565.It Li ip6.use_deprecated 1566The variable controls use of deprecated address, specified in RFC 2462 5.5.4. 1567.It Li ip6.v6only 1568The variable specifies initial value for 1569.Dv IPV6_V6ONLY 1570socket option for 1571.Dv AF_INET6 1572socket. 1573Please refer to 1574.Xr ip6 4 1575for detail. 1576.It Li icmp6.errppslimit 1577The variable specifies the maximum number of outgoing ICMPv6 error messages, 1578per second. 1579ICMPv6 error messages that exceeded the value are subject to rate limitation 1580and will not go out from the node. 1581Negative value disables rate limitation. 1582.It Li icmp6.mtudisc_hiwat 1583.It Li icmp6.mtudisc_lowat 1584The variables define the maximum number of routing table entries, 1585created due to path MTU discovery 1586.Pq prevents denial-of-service attacks with ICMPv6 too big messages . 1587When IPv6 path MTU discovery happens, we keep path MTU information into 1588the routing table. 1589If the number of routing table entries exceed the value, 1590the kernel will not attempt to keep the path MTU information. 1591.Li icmp6.mtudisc_hiwat 1592is used when we have verified ICMPv6 too big messages. 1593.Li icmp6.mtudisc_lowat 1594is used when we have unverified ICMPv6 too big messages. 1595Verification is performed by using address/port pairs kept in connected pcbs. 1596Negative value disables the upper limit. 1597.It Li icmp6.nd6_debug 1598If set to non-zero, kernel IPv6 neighbor discovery code will generate 1599debugging messages. 1600The debug outputs are useful to diagnose IPv6 interoperability issues. 1601The flag must be set to 0 for normal operation. 1602.It Li icmp6.nd6_delay 1603The variable specifies 1604.Dv DELAY_FIRST_PROBE_TIME 1605timing constant in IPv6 neighbor discovery specification 1606.Pq RFC 2461 , 1607in seconds. 1608.It Li icmp6.nd6_maxnudhint 1609IPv6 neighbor discovery permits upper layer protocols to supply reachability 1610hints, to avoid unnecessary neighbor discovery exchanges. 1611The variable defines the number of consecutive hints the neighbor discovery 1612layer will take. 1613For example, by setting the variable to 3, neighbor discovery layer 1614will take 3 consecutive hints in maximum. 1615After receiving 3 hints, neighbor discovery layer will perform 1616normal neighbor discovery process. 1617.It Li icmp6.nd6_mmaxtries 1618The variable specifies 1619.Dv MAX_MULTICAST_SOLICIT 1620constant in IPv6 neighbor discovery specification 1621.Pq RFC 2461 . 1622.It Li icmp6.nd6_prune 1623The variable specifies interval between IPv6 neighbor cache babysitting, 1624in seconds. 1625.It Li icmp6.nd6_umaxtries 1626The variable specifies 1627.Dv MAX_UNICAST_SOLICIT 1628constant in IPv6 neighbor discovery specification 1629.Pq RFC 2461 . 1630.It Li icmp6.nd6_useloopback 1631If set to non-zero, kernel IPv6 stack will use loopback interface for 1632local traffic. 1633.It Li icmp6.nodeinfo 1634The variable enables responses to ICMPv6 node information queries. 1635If you set the variable to 0, responses will not be generated for 1636ICMPv6 node information queries. 1637Since node information queries can have a security impact, it is 1638possible to fine tune which responses should be answered. 1639Two separate bits can be set. 1640.Bl -tag -width "12345" 1641.It 1 1642Respond to ICMPv6 FQDN queries, e.g. 1643.Li ping6 -w . 1644.It 2 1645Respond to ICMPv6 node addresses queries, e.g. 1646.Li ping6 -a . 1647.El 1648.It Li icmp6.rediraccept 1649If set to non-zero, the host will accept ICMPv6 redirect packets. 1650Note that IPv6 routers will never accept ICMPv6 redirect packets, 1651and the variable is meaningful on IPv6 hosts 1652.Pq non-router 1653only. 1654.It Li icmp6.redirtimeout 1655The variable specifies lifetime of routing entries generated by incoming 1656ICMPv6 redirect. 1657.It Li udp6.do_loopback_cksum 1658Perform UDP checksum on loopback. 1659.It Li udp6.recvspace 1660Default UDP receive buffer size. 1661.It Li udp6.sendspace 1662Default UDP send buffer size. 1663.El 1664.Pp 1665We reuse net.*.tcp for 1666.Tn TCP 1667over 1668.Tn IPv6 , 1669and therefore we do not have variables net.*.tcp6. 1670Variables net.inet6.udp6 have identical meaning to net.inet.udp. 1671Please refer to 1672.Li PF_INET 1673section above. 1674For variables net.*.ipsec6, please refer to 1675.Xr ipsec 4 . 1676.It Li PF_KEY 1677Get or set various global information about the IPsec key management. 1678The third level name is the variable name. 1679The currently defined variable and names are: 1680.Bl -column "blockacq_lifetime" "integer" "yes" -offset indent 1681.It Sy Variable name Type Changeable 1682.It debug integer yes 1683.It spi_try integer yes 1684.It spi_min_value integer yes 1685.It spi_max_value integer yes 1686.It larval_lifetime integer yes 1687.It blockacq_count integer yes 1688.It blockacq_lifetime integer yes 1689.It esp_keymin integer yes 1690.It esp_auth integer yes 1691.It ah_keymin integer yes 1692.El 1693The variables are as follows: 1694.Bl -tag -width "123456" 1695.It Li debug 1696Turn on debugging message from within the kernel. 1697The value is a bitmap, as defined in 1698.Pa /usr/include/netkey/key_debug.h . 1699.It Li spi_try 1700The number of times the kernel will try to obtain an unique SPI 1701when it generates it from random number generator. 1702.It Li spi_min_value 1703Minimum SPI value when generating it within the kernel. 1704.It Li spi_max_value 1705Maximum SPI value when generating it within the kernel. 1706.It Li larval_lifetime 1707Lifetime for LARVAL SAD entries, in seconds. 1708.It Li blockacq_count 1709Number of ACQUIRE PF_KEY messages to be blocked after an ACQUIRE message. 1710It avoids flood of ACQUIRE PF_KEY from being sent from the kernel to the 1711key management daemon. 1712.It Li blockacq_lifetime 1713Lifetime of ACQUIRE PF_KEY message. 1714.It Li esp_keymin 1715Minimum ESP key length, in bits. 1716The value is used when the kernel creates proposal payload 1717on ACQUIRE PF_KEY message. 1718.It Li esp_auth 1719Whether ESP authentication should be used or not. 1720Non-zero value indicates that ESP authentication should be used. 1721The value is used when the kernel creates proposal payload 1722on ACQUIRE PF_KEY message. 1723.It Li ah_keymin 1724Minimum AH key length, in bits, 1725The value is used when the kernel creates proposal payload 1726on ACQUIRE PF_KEY message. 1727.El 1728.El 1729.Sh CTL_PROC 1730The string and integer information available for the CTL_PROC 1731is detailed below. 1732The changeable column shows whether a process with appropriate 1733privilege may change the value. 1734These values are per-process, 1735and as such may change from one process to another. 1736When a process is created, 1737the default values are inherited from its parent. 1738When a set-user-ID or set-group-ID binary is executed, the 1739value of PROC_PID_CORENAME is reset to the system default value. 1740The second level name is either the magic value PROC_CURPROC, which 1741points to the current process, or the PID of the target process. 1742.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" "yes" -offset indent 1743.It Sy Third level name Type Changeable 1744.It PROC\_PID\_CORENAME string yes 1745.It PROC\_PID\_LIMIT node not applicable 1746.It PROC\_PID\_STOPFORK int yes 1747.It PROC\_PID\_STOPEXEC int yes 1748.It PROC\_PID\_STOPEXIT int yes 1749.El 1750.Bl -tag -width "123456" 1751.Pp 1752.It Li PROC_PID_CORENAME 1753The template used for the core dump file name (see 1754.Xr core 5 1755for details). 1756The base name must either be 1757.Nm core 1758or end with the suffix ``.core'' (the super-user may set arbitrary names). 1759By default it points to KERN_DEFCORENAME. 1760.It Li PROC_PID_LIMIT 1761Return resources limits, as defined for the 1762.Xr getrlimit 2 1763and 1764.Xr setrlimit 2 1765system calls. 1766The fourth level name is one of: 1767.Bl -tag -width PROC_PID_LIMIT_MEMLOCKAA 1768.It Li PROC_PID_LIMIT_CPU 1769The maximum amount of CPU time (in seconds) to be used by each process. 1770.It Li PROC_PID_LIMIT_FSIZE 1771The largest size (in bytes) file that may be created. 1772.It Li PROC_PID_LIMIT_DATA 1773The maximum size (in bytes) of the data segment for a process; 1774this defines how far a program may extend its break with the 1775.Xr sbrk 2 1776system call. 1777.It Li PROC_PID_LIMIT_STACK 1778The maximum size (in bytes) of the stack segment for a process; 1779this defines how far a program's stack segment may be extended. 1780Stack extension is performed automatically by the system. 1781.It Li PROC_PID_LIMIT_CORE 1782The largest size (in bytes) 1783.Pa core 1784file that may be created. 1785.It Li PROC_PID_LIMIT_RSS 1786The maximum size (in bytes) to which a process's resident set size may 1787grow. 1788This imposes a limit on the amount of physical memory to be given to 1789a process; if memory is tight, the system will prefer to take memory 1790from processes that are exceeding their declared resident set size. 1791.It Li PROC_PID_LIMIT_MEMLOCK 1792The maximum size (in bytes) which a process may lock into memory 1793using the 1794.Xr mlock 2 1795function. 1796.It Li PROC_PID_LIMIT_NPROC 1797The maximum number of simultaneous processes for this user id. 1798.It Li PROC_PID_LIMIT_NOFILE 1799The maximum number of open files for this process. 1800.El 1801.Pp 1802The fifth level name is one of PROC_PID_LIMIT_TYPE_SOFT or 1803PROC_PID_LIMIT_TYPE_HARD, to select respectively the soft or hard limit. 1804Both are of type integer. 1805.It Li PROC_PID_STOPFORK 1806If non zero, the process' children will be stopped after 1807.Xr fork 2 1808calls. 1809The children is created in the SSTOP state and is never scheduled 1810for running before being stopped. 1811This feature helps attaching a process with a debugger such as 1812.Xr gdb 1 1813before it had the opportunity to actually do anything. 1814.Pp 1815This value is inherited by the process's children, and it also 1816apply to emulation specific system calls that fork a new process, such as 1817.Fn sproc 1818or 1819.Fn clone . 1820.It Li PROC_PID_STOPEXEC 1821If non zero, the process will be stopped on next 1822.Xr exec 3 1823call. 1824The process created by 1825.Xr exec 3 1826is created in the SSTOP state and is never scheduled for running 1827before being stopped. 1828This feature helps attaching a process with a debugger such as 1829.Xr gdb 1 1830before it had the opportunity to actually do anything. 1831.Pp 1832This value is inherited by the process's children. 1833.It Li PROC_PID_STOPEXIT 1834If non zero, the process will be stopped on when it has cause to exit, 1835either by way of calling 1836.Xr exit 3 , 1837.Xr _exit 2 , 1838or by the receipt of a specific signal. 1839The process is stopped before any of its resources or vm space is 1840released allowing examination of the termination state of a process 1841before it disappears. 1842This feature can be used to examine the final conditions of the 1843process's vmspace via 1844.Xr pmap 1 1845or its resource settings with 1846.Xr sysctl 8 1847before it disappears. 1848.Pp 1849This value is also inherited by the process's children. 1850.El 1851.Sh CTL_USER 1852The string and integer information available for the CTL_USER level 1853is detailed below. 1854The changeable column shows whether a process with appropriate 1855privilege may change the value. 1856.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent 1857.It Sy Second level name Type Changeable 1858.It USER\_BC\_BASE\_MAX integer no 1859.It USER\_BC\_DIM\_MAX integer no 1860.It USER\_BC\_SCALE\_MAX integer no 1861.It USER\_BC\_STRING\_MAX integer no 1862.It USER\_COLL\_WEIGHTS\_MAX integer no 1863.It USER\_CS\_PATH string no 1864.It USER\_EXPR\_NEST\_MAX integer no 1865.It USER\_LINE\_MAX integer no 1866.It USER\_POSIX2\_CHAR\_TERM integer no 1867.It USER\_POSIX2\_C\_BIND integer no 1868.It USER\_POSIX2\_C\_DEV integer no 1869.It USER\_POSIX2\_FORT\_DEV integer no 1870.It USER\_POSIX2\_FORT\_RUN integer no 1871.It USER\_POSIX2\_LOCALEDEF integer no 1872.It USER\_POSIX2\_SW\_DEV integer no 1873.It USER\_POSIX2\_UPE integer no 1874.It USER\_POSIX2\_VERSION integer no 1875.It USER\_RE\_DUP\_MAX integer no 1876.It USER\_STREAM\_MAX integer no 1877.It USER\_TZNAME\_MAX integer no 1878.It USER\_ATEXIT\_MAX integer no 1879.El 1880.Bl -tag -width "123456" 1881.Pp 1882.It Li USER_BC_BASE_MAX 1883The maximum ibase/obase values in the 1884.Xr bc 1 1885utility. 1886.It Li USER_BC_DIM_MAX 1887The maximum array size in the 1888.Xr bc 1 1889utility. 1890.It Li USER_BC_SCALE_MAX 1891The maximum scale value in the 1892.Xr bc 1 1893utility. 1894.It Li USER_BC_STRING_MAX 1895The maximum string length in the 1896.Xr bc 1 1897utility. 1898.It Li USER_COLL_WEIGHTS_MAX 1899The maximum number of weights that can be assigned to any entry of 1900the LC_COLLATE order keyword in the locale definition file. 1901.It Li USER_CS_PATH 1902Return a value for the 1903.Ev PATH 1904environment variable that finds all the standard utilities. 1905.It Li USER_EXPR_NEST_MAX 1906The maximum number of expressions that can be nested within 1907parenthesis by the 1908.Xr expr 1 1909utility. 1910.It Li USER_LINE_MAX 1911The maximum length in bytes of a text-processing utility's input 1912line. 1913.It Li USER_POSIX2_CHAR_TERM 1914Return 1 if the system supports at least one terminal type capable of 1915all operations described in POSIX 1003.2, otherwise 0. 1916.It Li USER_POSIX2_C_BIND 1917Return 1 if the system's C-language development facilities support the 1918C-Language Bindings Option, otherwise 0. 1919.It Li USER_POSIX2_C_DEV 1920Return 1 if the system supports the C-Language Development Utilities Option, 1921otherwise 0. 1922.It Li USER_POSIX2_FORT_DEV 1923Return 1 if the system supports the FORTRAN Development Utilities Option, 1924otherwise 0. 1925.It Li USER_POSIX2_FORT_RUN 1926Return 1 if the system supports the FORTRAN Runtime Utilities Option, 1927otherwise 0. 1928.It Li USER_POSIX2_LOCALEDEF 1929Return 1 if the system supports the creation of locales, otherwise 0. 1930.It Li USER_POSIX2_SW_DEV 1931Return 1 if the system supports the Software Development Utilities Option, 1932otherwise 0. 1933.It Li USER_POSIX2_UPE 1934Return 1 if the system supports the User Portability Utilities Option, 1935otherwise 0. 1936.It Li USER_POSIX2_VERSION 1937The version of POSIX 1003.2 with which the system attempts to comply. 1938.It Li USER_RE_DUP_MAX 1939The maximum number of repeated occurrences of a regular expression 1940permitted when using interval notation. 1941.ne 1i 1942.It Li USER_STREAM_MAX 1943The minimum maximum number of streams that a process may have open 1944at any one time. 1945.It Li USER_TZNAME_MAX 1946The minimum maximum number of types supported for the name of a 1947timezone. 1948.It Li USER_ATEXIT_MAX 1949The maximum number of functions that may be registered with 1950.Xr atexit 3 . 1951.El 1952.Sh CTL_VM 1953The string and integer information available for the CTL_VM level 1954is detailed below. 1955The changeable column shows whether a process with appropriate 1956privilege may change the value. 1957.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent 1958.It Sy Second level name Type Changeable 1959.It VM\_ANONMAX int yes 1960.It VM\_ANONMIN int yes 1961.It VM\_BUFCACHE int yes 1962.It VM\_BUFMEM int no 1963.It VM\_BUFMEM_HIWATER int yes 1964.It VM\_BUFMEM_LOWATER int yes 1965.It VM\_EXECMAX int yes 1966.It VM\_EXECMIN int yes 1967.It VM\_FILEMAX int yes 1968.It VM\_FILEMIN int yes 1969.It VM\_LOADAVG struct loadavg no 1970.It VM\_MAXSLP int no 1971.It VM\_METER struct vmtotal no 1972.It VM\_NKMEMPAGES int no 1973.It VM\_USPACE int no 1974.It VM\_UVMEXP struct uvmexp no 1975.It VM\_UVMEXP2 struct uvmexp_sysctl no 1976.El 1977.Pp 1978.Bl -tag -width "123456" 1979.It Li VM_ANONMAX 1980The percentage of physical memory which will be reclaimed 1981from other types of memory usage to store anonymous application data. 1982.It Li VM_ANONMIN 1983The percentage of physical memory which will be always be available for 1984anonymous application data. 1985.It Li VM_BUFCACHE 1986The percentage of physical memory which will be available 1987for the buffer cache. 1988.It Li VM_BUFMEM 1989The amount of kernel memory that is being used by the buffer cache. 1990.It Li VM_BUFMEM_LOWATER 1991The minimum amount of kernel memory to reserve for the 1992buffer cache. 1993.It Li VM_BUFMEM_HIWATER 1994The maximum amount of kernel memory to be used for the 1995buffer cache. 1996.It Li VM_EXECMAX 1997The percentage of physical memory which will be reclaimed 1998from other types of memory usage to store cached executable data. 1999.It Li VM_EXECMIN 2000The percentage of physical memory which will be always be available for 2001cached executable data. 2002.It Li VM_FILEMAX 2003The percentage of physical memory which will be reclaimed 2004from other types of memory usage to store cached file data. 2005.It Li VM_FILEMIN 2006The percentage of physical memory which will be always be available for 2007cached file data. 2008.It Li VM_LOADAVG 2009Return the load average history. 2010The returned data consists of a 2011.Va struct loadavg . 2012.It Li VM_MAXSLP 2013The value of the maxslp kernel global variable. 2014.It Li VM_METER 2015Return system wide virtual memory statistics. 2016The returned data consists of a 2017.Va struct vmtotal . 2018.It Li VM_USPACE 2019The number of bytes allocated for each kernel stack. 2020.It Li VM_UVMEXP 2021Return system wide virtual memory statistics. 2022The returned data consists of a 2023.Va struct uvmexp . 2024.It Li VM_UVMEXP2 2025Return system wide virtual memory statistics. 2026The returned data consists of a 2027.Va struct uvmexp_sysctl . 2028.El 2029.Sh CTL_DDB 2030The integer information available for the CTL_DDB level is detailed below. 2031The changeable column shows whether a process with appropriate 2032privilege may change the value. 2033.Bl -column "DBCTL_TABSTOPSXXX" "integerXXX" -offset indent 2034.It Sy Second level name Type Changeable 2035.It DBCTL\_RADIX integer yes 2036.It DBCTL\_MAXOFF integer yes 2037.It DBCTL\_LINES integer yes 2038.It DBCTL\_TABSTOPS integer yes 2039.It DBCTL\_ONPANIC integer yes 2040.It DBCTL\_FROMCONSOLE integer yes 2041.El 2042.Pp 2043.Bl -tag -width "123456" 2044.It Li DBCTL_RADIX 2045The input and output radix. 2046.It Li DBCTL_MAXOFF 2047The maximum symbol offset. 2048.It Li DBCTL_LINES 2049Number of display lines. 2050.It Li DBCTL_TABSTOPS 2051Tab width. 2052.It Li DBCTL_ONPANIC 2053If non-zero, DDB will be entered when the kernel panics. 2054.It Li DBCTL_FROMCONSOLE 2055If not zero, DDB may be entered by sending a break on a serial 2056console or by a special key sequence on a graphics console. 2057.El 2058.Pp 2059These MIB nodes are also available as variables from within the DDB. 2060See 2061.Xr ddb 4 2062for more details. 2063.Sh CTL_SECURITY 2064The security level contains various security-related settings for 2065the system. Available settings are detailed below. 2066.Pp 2067.Bl -tag -width "123456" 2068.It Li security.curtain 2069If non-zero, will filter return objects according to the user-id 2070requesting information about them, preventing from users any 2071access to objects they don't own. 2072.Pp 2073At the moment, it affects 2074.Xr ps 1 , 2075.Xr netstat 1 2076(for 2077.Dv PF_INET , 2078.Dv PF_INET6 , 2079and 2080.Dv PF_UNIX 2081PCBs), and 2082.Xr w 1 . 2083.It Li security.pax 2084Settings for PaX -- exploit mitigation features. 2085.Pp 2086.Bl -tag -width "123456" 2087.It Li security.pax.mprotect.enable 2088Enable PaX MPROTECT restrictions. 2089.Pp 2090These are 2091.Xr mprotect 2 2092restrictions to better enforce a W^X policy. The value of this 2093knob must be non-zero for PaX MPROTECT to be enabled, even if a 2094process is already marked with 2095.Em P_PAXMPROTECT . 2096.It Li security.pax.mprotect.global 2097Specifies the default global policy for programs without an 2098explicit enable/disable flag. 2099.Pp 2100When non-zero, all programs will get the PaX MPROTECT restrictions, 2101except those exempted with 2102.Xr paxctl 1 . 2103Otherwise, all programs will not get the PaX MPROTECT restrictions, 2104except those specifically marked as such with 2105.Xr paxctl 1 . 2106.El 2107.El 2108.Sh CTL_VENDOR 2109The "vendor" toplevel name is reserved to be used by vendors who wish to 2110have their own private MIB tree. 2111Intended use is to store values under 2112.Dq vendor.\*[Lt]yourname\*[Gt].* . 2113.Sh DYNAMIC OPERATIONS 2114Several meta-identifiers are provided to perform operations on the 2115.Nm 2116tree itself, or support alternate means of accessing the data 2117instrumented by the 2118.Nm 2119tree. 2120.Bl -column CTLXCREATESYMXXX 2121.It Sy Name Description 2122.It CTL\_QUERY Retrieve a mapping of names to numbers below a given node 2123.It CTL\_CREATE Create a new node 2124.It CTL\_CREATESYM Create a new node by its kernel symbol 2125.It CTL\_DESTROY Destroy a node 2126.It CTL\_DESCRIBE Retrieve node descriptions 2127.El 2128.Pp 2129The core interface to all of these meta-functions is the structure 2130that the kernel uses to describe the tree internally, as defined in 2131.Aq Pa sys/sysctl.h 2132as: 2133.Pp 2134.Bd -literal 2135struct sysctlnode { 2136 uint32_t sysctl_flags; /* flags and type */ 2137 int32_t sysctl_num; /* mib number */ 2138 char sysctl_name[SYSCTL_NAMELEN]; /* node name */ 2139 uint32_t sysctl_ver; /* node's version vs. rest of tree */ 2140 uint32_t __rsvd; 2141 union { 2142 struct { 2143 uint32_t suc_csize; /* size of child node array */ 2144 uint32_t suc_clen; /* number of valid children */ 2145 struct sysctlnode* suc_child; /* array of child nodes */ 2146 } scu_child; 2147 struct { 2148 void *sud_data; /* pointer to external data */ 2149 size_t sud_offset; /* offset to data */ 2150 } scu_data; 2151 int32_t scu_alias; /* node this node refers to */ 2152 int32_t scu_idata; /* immediate "int" data */ 2153 u_quad_t scu_qdata; /* immediate "u_quad_t" data */ 2154 } sysctl_un; 2155 size_t _sysctl_size; /* size of instrumented data */ 2156 sysctlfn _sysctl_func; /* access helper function */ 2157 struct sysctlnode *sysctl_parent; /* parent of this node */ 2158 const char *sysctl_desc; /* description of node */ 2159}; 2160 2161#define sysctl_csize sysctl_un.scu_child.suc_csize 2162#define sysctl_clen sysctl_un.scu_child.suc_clen 2163#define sysctl_child sysctl_un.scu_child.suc_child 2164#define sysctl_data sysctl_un.scu_data.sud_data 2165#define sysctl_offset sysctl_un.scu_data.sud_offset 2166#define sysctl_alias sysctl_un.scu_alias 2167#define sysctl_idata sysctl_un.scu_idata 2168#define sysctl_qdata sysctl_un.scu_qdata 2169.Ed 2170.Pp 2171Querying the tree to discover the name to number mapping permits 2172dynamic discovery of all the data that the tree currently has 2173instrumented. 2174For example, to discover all the nodes below the 2175CTL_VFS node: 2176.Pp 2177.Bd -literal -offset indent -compact 2178struct sysctlnode query, vfs[128]; 2179int mib[2]; 2180size_t len; 2181.sp 2182mib[0] = CTL_VFS; 2183mib[1] = CTL_QUERY; 2184memset(\*[Am]query, 0, sizeof(query)); 2185query.sysctl_flags = SYSCTL_VERSION; 2186len = sizeof(vfs); 2187sysctl(mib, 2, \*[Am]vfs[0], \*[Am]len, \*[Am]query, sizeof(query)); 2188.Ed 2189.Pp 2190Note that a reference to an empty node with 2191.Fa sysctl_flags 2192set to 2193.Dv SYSCTL_VERSION 2194is passed to sysctl in order to indicate the version that the program 2195is using. 2196All dynamic operations passing nodes into sysctl require that the 2197version be explicitly specified. 2198.Pp 2199Creation and destruction of nodes works by constructing part of a new 2200node description (or a description of the existing node) and invoking 2201CTL_CREATE (or CTL_CREATESYM) or CTL_DESTROY at the parent of the new 2202node, with a pointer to the new node passed via the 2203.Fa new 2204and 2205.Fa newlen 2206arguments. 2207If valid values for 2208.Fa old 2209and 2210.Fa oldlenp 2211are passed, a copy of the new node once in the tree will be returned. 2212If the create operation fails because a node with the same name or MIB 2213number exists, a copy of the conflicting node will be returned. 2214.Pp 2215The minimum requirements for creating a node are setting the 2216.Fa sysctl_flags 2217to indicate the new node's type, 2218.Fa sysctl_num 2219to either the new node's number (or CTL_CREATE or CTL_CREATESYM if a 2220dynamically allocated MIB number is acceptable), 2221.Fa sysctl_size 2222to the size of the data to be instrumented (which must agree with the 2223given type), and 2224.Fa sysctl_name 2225must be set to the new node's name. 2226Nodes that are not of type 2227.Dq node 2228must also have some description of the data to be instrumented, which 2229will vary depending on what is to be instrumented. 2230.Pp 2231If existing kernel data is to be covered by this new node, its address 2232should be given in 2233.Fa sysctl_data 2234or, if CTL_CREATESYM is used, 2235.Fa sysctl_data 2236should be set to a string containing its name from the kernel's symbol 2237table. 2238If new data is to be instrumented and an initial value is available, 2239the new integer or quad type data should be placed into either 2240.Fa sysctl_idata 2241or 2242.Fa sysctl_qdata , 2243respectively, along with the SYSCTL_IMMEDIATE flag being set, or 2244.Fa sysctl_data 2245should be set to point to a copy of the new data, and the 2246SYSCTL_OWNDATA flag must be set. 2247This latter method is the only way that new string and struct type 2248nodes can be initialized. 2249Invalid kernel addresses are accepted, but any attempt to access those 2250nodes will return an error. 2251.Pp 2252The 2253.Fa sysctl_csize , 2254.Fa sysctl_clen , 2255.Fa sysctl_child , 2256.Fa sysctl_parent , 2257and 2258.Fa sysctl_alias 2259members are used by the kernel to link the tree together and must be 2260.Dv NULL 2261or 0. 2262Nodes created in this manner cannot have helper functions, so 2263.Fa sysctl_func 2264must also be 2265.Dv NULL . 2266If the 2267.Fa sysctl_ver 2268member is non-zero, it must match either the version of the parent or 2269the version at the root of the MIB or an error is returned. 2270This can be used to ensure that nodes are only added or removed from a 2271known state of the tree. 2272Note: It may not be possible to determine the version at the root 2273of the tree. 2274.Pp 2275This example creates a new subtree and adds a node to it that controls the 2276.Fa audiodebug 2277kernel variable, thereby making it tunable at at any time, without 2278needing to use 2279.Xr ddb 4 2280or 2281.Xr kvm 3 2282to alter the kernel's memory directly. 2283.Pp 2284.Bd -literal -offset indent -compact 2285struct sysctlnode node; 2286int mib[2]; 2287size_t len; 2288.sp 2289mib[0] = CTL_CREATE; /* create at top-level */ 2290len = sizeof(node); 2291memset(\*[Am]node, 0, len); 2292node.sysctl_flags = SYSCTL_VERSION|CTLFLAG_READWRITE|CTLTYPE_NODE; 2293snprintf(node.sysctl_name, sizeof(node.sysctl_name), "local"); 2294node.sysctl_num = CTL_CREATE; /* request dynamic MIB number */ 2295sysctl(\*[Am]mib[0], 1, \*[Am]node, \*[Am]len, \*[Am]node, len); 2296.sp 2297mib[0] = node.sysctl_num; /* use new MIB number */ 2298mib[1] = CTL_CREATESYM; /* create at second level */ 2299len = sizeof(node); 2300memset(\*[Am]node, 0, len); 2301node.sysctl_flags = SYSCTL_VERSION|CTLFLAG_READWRITE|CTLTYPE_INT; 2302snprintf(node.sysctl_name, sizeof(node.sysctl_name), "audiodebug"); 2303node.sysctl_num = CTL_CREATE; 2304node.sysctl_data = "audiodebug"; /* kernel symbol to be used */ 2305sysctl(\*[Am]mib[0], 2, NULL, NULL, \*[Am]node, len); 2306.Ed 2307.Pp 2308The process for deleting nodes is similar, but less data needs to 2309be supplied. 2310Only the 2311.Fa sysctl_num 2312field 2313needs to be filled in; almost all other fields must be left blank. 2314The 2315.Fa sysctl_name 2316and/or 2317.Fa sysctl_ver 2318fields can be filled in with the name and version of the existing node 2319as additional checks on what will be deleted. 2320If all the given data fail to match any node, nothing will be deleted. 2321If valid values for 2322.Fa old 2323and 2324.Fa oldlenp 2325are supplied and a node is deleted, a copy of what was in the MIB tree 2326will be returned. 2327.Pp 2328This sample code shows the deletion of the two nodes created in the 2329above example: 2330.Pp 2331.Bd -literal -offset indent -compact 2332int mib[2]; 2333.sp 2334len = sizeof(node); 2335memset(\*[Am]node, 0, len); 2336node.sysctl_flags = SYSCTL_VERSION; 2337.sp 2338mib[0] = 3214; /* assumed number for "local" */ 2339mib[1] = CTL_DESTROY; 2340node.sysctl_num = 3215; /* assumed number for "audiodebug" */ 2341sysctl(\*[Am]mib[0], 2, NULL, NULL, \*[Am]node, len); 2342.sp 2343mib[0] = CTL_DESTROY; 2344node.sysctl_num = 3214; /* now deleting "local" */ 2345sysctl(\*[Am]mib[0], 1, NULL, NULL, \*[Am]node, len); 2346.Ed 2347.Pp 2348Descriptions of each of the nodes can also be retrieved, if they are 2349available. 2350Descriptions can be retrieved in bulk at each level or on a per-node 2351basis. 2352The layout of the buffer into which the descriptions are returned is a 2353series of variable length structures, each of which describes its own 2354size. 2355The length indicated includes the terminating 2356.Sq nul 2357character. 2358Nodes that have no description or where the description is not 2359available are indicated by an empty string. 2360The 2361.Fa descr_ver 2362will match the 2363.Fa sysctl_ver 2364value for a given node, so that descriptions for nodes whose number 2365have been recycled can be detected and ignored or discarded. 2366.Pp 2367.Bd -literal 2368struct sysctldesc { 2369 int32_t descr_num; /* mib number of node */ 2370 uint32_t descr_ver; /* version of node */ 2371 uint32_t descr_len; /* length of description string */ 2372 char descr_str[1]; /* not really 1...see above */ 2373}; 2374.Ed 2375.Pp 2376The 2377.Fn NEXT_DESCR 2378macro can be used to skip to the next description in the retrieved 2379list. 2380.Pp 2381.Bd -literal -offset indent -compact 2382struct sysctlnode desc; 2383struct sysctldesc *d; 2384char buf[1024]; 2385int mib[2]; 2386size_t len; 2387.sp 2388/* retrieve kern-level descriptions */ 2389mib[0] = CTL_KERN; 2390mib[1] = CTL_DESCRIBE; 2391d = (struct sysctldesc *)\*[Am]buf[0]; 2392len = sizeof(buf); 2393sysctl(mib, 2, d, \*[Am]len, NULL, 0); 2394while ((caddr_t)d \*[Lt] (caddr_t)\*[Am]buf[len]) { 2395 printf("node %d: %.*s\\n", d-\*[Gt]descr_num, d-\*[Gt]descr_len, 2396 d-\*[Gt]descr_str); 2397 d = NEXT_DESCR(d); 2398} 2399.sp 2400/* retrieve description for kern.securelevel */ 2401memset(\*[Am]desc, 0, sizeof(desc)); 2402desc.sysctl_flags = SYSCTL_VERSION; 2403desc.sysctl_num = KERN_SECURELEVEL; 2404d = (struct sysctldesc *)\*[Am]buf[0]; 2405len = sizeof(buf); 2406sysctl(mib, 2, d, \*[Am]len, \*[Am]desc, sizeof(desc)); 2407printf("kern.securelevel: %.*s\\n", d-\*[Gt]descr_len, d-\*[Gt]descr_str); 2408.Ed 2409.Pp 2410Descriptions can also be set as follows, subject to the following rules: 2411.Pp 2412.Bl -bullet -compact 2413.It 2414The kernel securelevel is at zero or lower 2415.It 2416The caller has super-user privileges 2417.It 2418The node does not currently have a description 2419.It 2420The node is not marked as 2421.Dq permanent 2422.El 2423.Pp 2424.Bd -literal -offset indent -compact 2425struct sysctlnode desc; 2426int mib[2]; 2427.sp 2428/* presuming the given top-level node was just added... */ 2429mib[0] = 3214; /* mib numbers taken from previous examples */ 2430mib[1] = CTL_DESCRIBE; 2431memset(\*[Am]desc, 0, sizeof(desc)); 2432desc.sysctl_flags = SYSCTL_VERSION; 2433desc.sysctl_num = 3215; 2434desc.sysctl_desc = "audio debug control knob"; 2435sysctl(mib, 2, NULL, NULL, \*[Am]desc, sizeof(desc)); 2436.Ed 2437.Pp 2438Upon successfully setting a description, the new description will be 2439returned in the space indicated by the 2440.Fa oldp 2441and 2442.Fa oldlenp 2443arguments. 2444.Pp 2445The 2446.Fa sysctl_flags 2447field in the struct sysctlnode contains the sysctl version, node type 2448information, and a number of flags. 2449The macros 2450.Fn SYSCTL_VERS , 2451.Fn SYSCTL_TYPE , 2452and 2453.Fn SYSCTL_FLAGS 2454can be used to access the different fields. 2455Valid flags are: 2456.Bl -column CTLFLAGXPERMANENTXXX 2457.It Sy Name Description 2458.It CTLFLAG\_READONLY Node is read-only 2459.It CTLFLAG\_READONLY1 Node becomes read-only at securelevel 1 2460.It CTLFLAG\_READONLY2 Node becomes read-only at securelevel 2 2461.It CTLFLAG\_READWRITE Node is writable by the superuser 2462.It CTLFLAG\_ANYWRITE Node is writable by anyone 2463.It CTLFLAG\_PRIVATE Node is readable only by the superuser 2464.It CTLFLAG\_PERMANENT Node cannot be removed (cannot be set by 2465processes) 2466.It CTLFLAG\_OWNDATA Node owns data and does not instrument 2467existing data 2468.It CTLFLAG\_IMMEDIATE Node contains instrumented data and does not 2469instrument existing data 2470.It CTLFLAG\_HEX Node's contents should be displayed in a hexadecimal 2471form 2472.It CTLFLAG\_ROOT Node is the root of a tree (cannot be set at 2473any time) 2474.It CTLFLAG\_ANYNUMBER Node matches any MIB number (cannot be set by 2475processes) 2476.It CTLFLAG\_HIDDEN Node not displayed by default 2477.It CTLFLAG\_ALIAS Node refers to a sibling node (cannot be set 2478by processes) 2479.It CTLFLAG\_OWNDESC Node owns its own description string space 2480.El 2481.Sh RETURN VALUES 2482If the call to 2483.Nm 2484is successful, the number of bytes copied out is returned. 2485Otherwise \-1 is returned and 2486.Va errno 2487is set appropriately. 2488.Sh FILES 2489.Bl -tag -width \*[Lt]netinet6/udp6Xvar.h\*[Gt] -compact 2490.It Aq Pa sys/sysctl.h 2491definitions for top level identifiers, second level kernel and hardware 2492identifiers, and user level identifiers 2493.It Aq Pa sys/socket.h 2494definitions for second level network identifiers 2495.It Aq Pa sys/gmon.h 2496definitions for third level profiling identifiers 2497.It Aq Pa uvm/uvm_param.h 2498definitions for second level virtual memory identifiers 2499.It Aq Pa netinet/in.h 2500definitions for third level IPv4/v6 identifiers and 2501fourth level IPv4/v6 identifiers 2502.It Aq Pa netinet/icmp_var.h 2503definitions for fourth level ICMP identifiers 2504.It Aq Pa netinet/icmp6.h 2505definitions for fourth level ICMPv6 identifiers 2506.It Aq Pa netinet/tcp_var.h 2507definitions for fourth level TCP identifiers 2508.It Aq Pa netinet/udp_var.h 2509definitions for fourth level UDP identifiers 2510.It Aq Pa netinet6/udp6_var.h 2511definitions for fourth level IPv6 UDP identifiers 2512.It Aq Pa netinet6/ipsec.h 2513definitions for fourth level IPsec identifiers 2514.It Aq Pa netkey/key_var.h 2515definitions for third level PF_KEY identifiers 2516.It Aq Pa machine/cpu.h 2517definitions for second level machdep identifiers 2518.El 2519.Sh ERRORS 2520The following errors may be reported: 2521.Bl -tag -width Er 2522.It Bq Er EFAULT 2523The buffer 2524.Fa name , 2525.Fa oldp , 2526.Fa newp , 2527or length pointer 2528.Fa oldlenp 2529contains an invalid address, or the requested value is temporarily 2530unavailable. 2531.It Bq Er EINVAL 2532The 2533.Fa name 2534array is zero or greater than CTL_MAXNAME. 2535.It Bq Er EINVAL 2536A non-null 2537.Fa newp 2538is given and its specified length in 2539.Fa newlen 2540is too large or too small, or the given value is not acceptable for 2541the given node. 2542.It Bq Er ENOMEM 2543The length pointed to by 2544.Fa oldlenp 2545is too short to hold the requested value. 2546.It Bq Er EISDIR 2547The 2548.Fa name 2549array specifies an intermediate rather than terminal name. 2550.It Bq Er ENOTDIR 2551The 2552.Fa name 2553array specifies a node below a node that addresses data. 2554.It Bq Er ENOENT 2555The 2556.Fa name 2557array specifies a node that does not exist in the tree. 2558.It Bq Er ENOENT 2559An attempt was made to destroy a node that does not exist, or to 2560create or destroy a node below a node that does not exist. 2561.It Bq Er ENOTEMPTY 2562An attempt was made to destroy a node that still has children. 2563.It Bq Er EOPNOTSUPP 2564The 2565.Fa name 2566array specifies a value that is unknown or a meta-operation was 2567attempted that the requested node does not support. 2568.It Bq Er EPERM 2569An attempt is made to set a read-only value. 2570.It Bq Er EPERM 2571A process without appropriate privilege attempts to set a value or to 2572create or destroy a node. 2573.It Bq Er EPERM 2574An attempt to change a value protected by the current kernel security 2575level is made. 2576.El 2577.Sh SEE ALSO 2578.Xr ipsec 4 , 2579.Xr tcp 4 , 2580.Xr sysctl 8 2581.\" .Xr sysctl 9 2582.Sh HISTORY 2583The 2584.Nm 2585function first appeared in 2586.Bx 4.4 . 2587