1.\" $NetBSD: sysctl.3,v 1.82 2002/01/15 02:36:40 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. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by the University of 17.\" California, Berkeley and its contributors. 18.\" 4. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 35.\" 36.Dd June 24, 1999 37.Dt SYSCTL 3 38.Os 39.Sh NAME 40.Nm sysctl 41.Nd get or set system information 42.Sh LIBRARY 43.Lb libc 44.Sh SYNOPSIS 45.Fd #include <sys/param.h> 46.Fd #include <sys/sysctl.h> 47.Ft int 48.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" 49.Sh DESCRIPTION 50The 51.Nm 52function retrieves system information and allows processes with 53appropriate privileges to set system information. 54The information available from 55.Nm 56consists of integers, strings, and tables. 57Information may be retrieved and set from the command interface 58using the 59.Xr sysctl 8 60utility. 61.Pp 62Unless explicitly noted below, 63.Nm 64returns a consistent snapshot of the data requested. 65Consistency is obtained by locking the destination 66buffer into memory so that the data may be copied out without blocking. 67Calls to 68.Nm 69are serialized to avoid deadlock. 70.Pp 71The state is described using a ``Management Information Base'' (MIB) 72style name, listed in 73.Fa name , 74which is a 75.Fa namelen 76length array of integers. 77.Pp 78The information is copied into the buffer specified by 79.Fa oldp . 80The size of the buffer is given by the location specified by 81.Fa oldlenp 82before the call, 83and that location gives the amount of data copied after a successful call. 84If the amount of data available is greater 85than the size of the buffer supplied, 86the call supplies as much data as fits in the buffer provided 87and returns with the error code ENOMEM. 88If the old value is not desired, 89.Fa oldp 90and 91.Fa oldlenp 92should be set to NULL. 93.Pp 94The size of the available data can be determined by calling 95.Nm 96with a NULL parameter for 97.Fa oldp . 98The size of the available data will be returned in the location pointed to by 99.Fa oldlenp . 100For some operations, the amount of space may change often. 101For these operations, 102the system attempts to round up so that the returned size is 103large enough for a call to return the data shortly thereafter. 104.Pp 105To set a new value, 106.Fa newp 107is set to point to a buffer of length 108.Fa newlen 109from which the requested value is to be taken. 110If a new value is not to be set, 111.Fa newp 112should be set to NULL and 113.Fa newlen 114set to 0. 115.Pp 116The top level names are defined with a CTL_ prefix in 117.Pa <sys/sysctl.h> , 118and are as follows. 119The next and subsequent levels down are found in the include files 120listed here, and described in separate sections below. 121.Pp 122.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent 123.It Sy Pa Name Next level names Description 124.It CTL\_KERN sys/sysctl.h High kernel limits 125.It CTL\_VM uvm/uvm_param.h Virtual memory 126.It CTL\_VFS sys/mount.h Filesystem 127.It CTL\_NET sys/socket.h Networking 128.It CTL\_DEBUG sys/sysctl.h Debugging 129.It CTL\_HW sys/sysctl.h Generic CPU, I/O 130.It CTL\_MACHDEP sys/sysctl.h Machine dependent 131.It CTL\_USER sys/sysctl.h User-level 132.It CTL\_DDB sys/sysctl.h In-kernel debugger 133.It CTL\_PROC sys/sysctl.h Per-process 134.It CTL\_VENDOR ? Vendor specific 135.El 136.Pp 137For example, the following retrieves the maximum number of processes allowed 138in the system: 139.Bd -literal -offset indent -compact 140int mib[2], maxproc; 141size_t len; 142.sp 143mib[0] = CTL_KERN; 144mib[1] = KERN_MAXPROC; 145len = sizeof(maxproc); 146sysctl(mib, 2, &maxproc, &len, NULL, 0); 147.Ed 148.sp 149To retrieve the standard search path for the system utilities: 150.Bd -literal -offset indent -compact 151int mib[2]; 152size_t len; 153char *p; 154.sp 155mib[0] = CTL_USER; 156mib[1] = USER_CS_PATH; 157sysctl(mib, 2, NULL, &len, NULL, 0); 158p = malloc(len); 159sysctl(mib, 2, p, &len, NULL, 0); 160.Ed 161.Sh CTL_DEBUG 162The debugging variables vary from system to system. 163A debugging variable may be added or deleted without need to recompile 164.Nm 165to know about it. 166Each time it runs, 167.Nm 168gets the list of debugging variables from the kernel and 169displays their current values. 170The system defines twenty 171.Ns ( Va struct ctldebug ) 172variables named 173.Dv debug0 174through 175.Dv debug19 . 176They are declared as separate variables so that they can be 177individually initialized at the location of their associated variable. 178The loader prevents multiple use of the same variable by issuing errors 179if a variable is initialized in more than one place. 180For example, to export the variable 181.Dv dospecialcheck 182as a debugging variable, the following declaration would be used: 183.Bd -literal -offset indent -compact 184int dospecialcheck = 1; 185struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck }; 186.Ed 187.Sh CTL_VFS 188A distinguished second level name, VFS_GENERIC, 189is used to get general information about all filesystems. 190One of its third level identifiers is VFS_MAXTYPENUM 191that gives the highest valid filesystem type number. 192Its other third level identifier is VFS_CONF that 193returns configuration information about the filesystem 194type given as a fourth level identifier. 195The remaining second level identifiers are the 196filesystem type number returned by a 197.Xr statfs 2 198call or from VFS_CONF. 199The third level identifiers available for each filesystem 200are given in the header file that defines the mount 201argument structure for that filesystem. 202.Sh CTL_HW 203The string and integer information available for the CTL_HW level 204is detailed below. 205The changeable column shows whether a process with appropriate 206privilege may change the value. 207.Bl -column "Second level nameXXXXXX" integerXXX -offset indent 208.It Sy Pa Second level name Type Changeable 209.It HW\_MACHINE string no 210.It HW\_MODEL string no 211.It HW\_NCPU integer no 212.It HW\_BYTEORDER integer no 213.It HW\_PHYSMEM integer no 214.It HW\_USERMEM integer no 215.It HW\_PAGESIZE integer no 216.\".It HW\_DISKNAMES struct no 217.\".It HW\_DISKSTATS struct no 218.It HW\_MACHINE\_ARCH string no 219.It HW\_ALIGNBYTES integer no 220.El 221.Pp 222.Bl -tag -width "123456" 223.It Li HW_MACHINE 224The machine class. 225.It Li HW_MODEL 226The machine model 227.It Li HW_NCPU 228The number of cpus. 229.ne 1i 230.It Li HW_BYTEORDER 231The byteorder (4,321, or 1,234). 232.It Li HW_PHYSMEM 233The bytes of physical memory. 234.It Li HW_USERMEM 235The bytes of non-kernel memory. 236.It Li HW_PAGESIZE 237The software page size. 238.\".It Fa HW_DISKNAMES 239.\".It Fa HW_DISKSTATS 240.It Li HW_MACHINE_ARCH 241The machine cpu class. 242.It Li HW_ALIGNBYTES 243Alignment constraint for all possible data types. 244This shows the value 245.Dv ALIGNBYTES 246in 247.Pa /usr/include/machine/param.h , 248at the kernel compilation time. 249.El 250.Sh CTL_KERN 251The string and integer information available for the CTL_KERN level 252is detailed below. 253The changeable column shows whether a process with appropriate 254privilege may change the value. 255The types of data currently available are process information, 256system vnodes, the open file entries, routing table entries, 257virtual memory statistics, load average history, and clock rate 258information. 259.Bl -column "KERNXCHOWNXRESTRICTEDXXX" "struct clockrateXXX" -offset indent 260.It Sy Pa Second level name Type Changeable 261.It KERN\_ARGMAX integer no 262.It KERN\_AUTONICETIME integer yes 263.It KERN\_AUTONICEVAL integer yes 264.It KERN\_BOOTTIME struct timeval no 265.It KERN\_CCPU integer no 266.It KERN\_CLOCKRATE struct clockinfo no 267.It KERN\_CP\_TIME long[\|] no 268.It KERN\_DEFCORENAME string yes 269.It KERN\_DOMAINNAME string yes 270.It KERN\_FILE struct file no 271.It KERN\_FSCALE integer no 272.It KERN\_FSYNC integer no 273.It KERN\_HOSTID integer yes 274.It KERN\_HOSTNAME string yes 275.It KERN\_IOV\_MAX integer no 276.It KERN\_JOB\_CONTROL integer no 277.It KERN\_LOGIN\_NAME\_MAX integer no 278.It KERN\_LOGSIGEXIT integer yes 279.It KERN\_MAPPED\_FILES integer no 280.It KERN\_MAXFILES integer yes 281.It KERN\_MAXPARTITIONS integer no 282.It KERN\_MAXPROC integer yes 283.It KERN\_MAXPTYS integer yes 284.It KERN\_MAXVNODES integer yes 285.It KERN\_MBUF node not applicable 286.It KERN\_MEMLOCK integer no 287.It KERN\_MEMLOCK\_RANGE integer no 288.It KERN\_MEMORY\_PROTECTION integer no 289.It KERN\_MSGBUF char[\|] no 290.It KERN\_MSGBUFSIZE integer no 291.It KERN\_NGROUPS integer no 292.It KERN\_NTPTIME struct ntptimeval no 293.It KERN\_OSRELEASE string no 294.It KERN\_OSREV integer no 295.It KERN\_OSTYPE string no 296.It KERN\_POSIX1 integer no 297.It KERN\_PROC struct kinfo_proc no 298.It KERN\_PROC2 struct kinfo_proc2 no 299.It KERN\_PROC\_ARGS string no 300.It KERN\_PROF node not applicable 301.It KERN\_RAWPARTITION integer no 302.It KERN\_ROOT\_DEVICE string no 303.It KERN\_RTC\_OFFSET integer no 304.It KERN\_SAVED\_IDS integer no 305.It KERN\_SECURELVL integer raise only 306.It KERN\_SYNCHRONIZED\_IO integer no 307.It KERN\_SYSVIPC\_INFO node not applicable 308.It KERN\_SYSVMSG integer no 309.It KERN\_SYSVSEM integer no 310.It KERN\_SYSVSHM integer no 311.It KERN\_VERSION string no 312.It KERN\_VNODE struct vnode no 313.El 314.ne 1i 315.Pp 316.Bl -tag -width "123456" 317.It Li KERN_ARGMAX 318The maximum bytes of argument to 319.Xr execve 2 . 320.It Li KERN_AUTONICETIME 321The number of seconds of cpu-time a non-root process may accumulate before 322having its priority lowered from the default to the value of KERN_AUTONICEVAL. 323If set to 0, automatic lowering of priority is not performed, and if set to -1 324all non-root processes are immediately lowered. 325.It Li KERN_AUTONICEVAL 326The priority assigned for automatically niced processes. 327.It Li KERN_BOOTTIME 328A 329.Va struct timeval 330structure is returned. 331This structure contains the time that the system was booted. 332.It Li KERN_CCPU 333The scheduler exponential decay value. 334.It Li KERN_CLOCKRATE 335A 336.Va struct clockinfo 337structure is returned. 338This structure contains the clock, statistics clock and profiling clock 339frequencies, the number of micro-seconds per hz tick, and the clock 340skew rate. 341.It Li KERN_CP_TIME 342Return an array if CPUSTATES longs is returned. This array contains the 343number of clock ticks spent in different CPU states. 344.It Li KERN_DEFCORENAME 345Default template for the name of core dump files (see also PROC_PID_CORENAME 346in the per-process variables CTL_PROC, and 347.Xr core 5 348for format of this template). The default value is 349.Nm %n.core 350and can be changed with the kernel configuration option 351.Cd options DEFCORENAME 352(see 353.Xr options 4 354). 355.It Li KERN_DOMAINNAME 356Get or set the YP domain name. 357.It Li KERN_FILE 358Return the entire file table. 359The returned data consists of a single 360.Va struct filehead 361followed by an array of 362.Va struct file , 363whose size depends on the current number of such objects in the system. 364.It Li KERN_FSCALE 365The kernel fixed-point scale factor. 366.It Li KERN_FSYNC 367Return 1 if the POSIX 1003.1b File Synchronization Option is available 368on this system, 369otherwise 0. 370.It Li KERN_HOSTID 371Get or set the host id. 372.It Li KERN_HOSTNAME 373Get or set the hostname. 374.It Li KERN_IOV_MAX 375Return the maximum number of 376.Va iovec 377structures that a process has available for use with 378.Xr preadv 2 , 379.Xr pwritev 2 , 380.Xr readv 2 , 381.Xr recvmsg 2 , 382.Xr sendmsg 2 383and 384.Xr writev 2 . 385.It Li KERN_JOB_CONTROL 386Return 1 if job control is available on this system, otherwise 0. 387.It Li KERN_LOGIN_NAME_MAX 388The size of the storage required for a login name, in bytes, 389including the terminating NUL. 390.It Li KERN_LOGSIGEXIT 391If this flag is non-zero, the kernel will 392.Xr log 9 393all process exits due to signals which create a 394.Xr core 5 395file, and whether the coredump was created. 396.It Li KERN_MAPPED_FILES 397Returns 1 if the POSIX 1003.1b Memory Mapped Files Option is available 398on this system, 399otherwise 0. 400.It Li KERN_MAXFILES 401The maximum number of open files that may be open in the system. 402.It Li KERN_MAXPARTITIONS 403The maximum number of partitions allowed per disk. 404.It Li KERN_MAXPROC 405The maximum number of simultaneous processes the system will allow. 406.It Li KERN_MAXPTYS 407The maximum number of pseudo terminals. This value can be both 408raised and lowered, though it cannot 409be set lower than number of currently used ptys. See also 410.Xr pty 4 . 411.It Li KERN_MAXVNODES 412The maximum number of vnodes available on the system. This can only 413be raised. 414.It Li KERN_MBUF 415Return information about the mbuf control variables. 416the third level names for the mbuf variables are detailed below. 417The changeable column shows whether a process with appropriate 418privilege may change the value. 419.Bl -column "MBUFXNMBCLUSTERSXXX" "struct integerXXX" -offset indent 420.It MBUF\_MSIZE integer yes 421.It MBUF\_MCLBYTES integer yes 422.It MBUF\_NMBCLUSTERS integer yes 423.It MBUF\_MBLOWAT integer yes 424.It MBUF\_MCLLOWAT integer yes 425.El 426.Pp 427The variables are as follows: 428.Bl -tag -width "123456" 429.It Li MBUF_MSIZE 430The mbuf base size. 431.It Li MBUF_MCLBYTES 432The mbuf cluster size. 433.It Li MBUF_NMBCLUSTERS 434The limit on the number of mbuf clusters. 435The variable can only be increased, and only increased on machines with 436direct-mapped pool pages 437.It Li MBUF_MBLOWAT 438The mbuf low water mark. 439.It Li MBUF_MCLLOWAT 440The mbuf cluster low water mark. 441.El 442.It Li KERN_MEMLOCK 443Returns 1 if the POSIX 1003.1b Process Memory Locking Option is available 444on this system, 445otherwise 0. 446.It Li KERN_MEMLOCK_RANGE 447Returns 1 if the POSIX 1003.1b Range Memory Locking Option is available 448on this system, 449otherwise 0. 450.It Li KERN_MEMORY_PROTECTION 451Returns 1 if the POSIX 1003.1b Memory Protection Option is available 452on this system, 453otherwise 0. 454.It Li KERN_MSGBUF 455The kernel message buffer, rotated so that the head of the circular kernel 456message buffer is returned at the start of the buffer specified by 457.Fa oldp . 458The returned data may contain NUL bytes. 459.It Li KERN_MSGBUFSIZE 460The maximum number of characters that the kernel message buffer can hold. 461.It Li KERN_NGROUPS 462The maximum number of supplemental groups. 463.It Li KERN_NO_TRUNC 464Return 1 if file names longer than KERN_NAME_MAX are truncated. 465.It Li KERN_NTPTIME 466A 467.Va struct ntptimeval 468structure is returned. 469This structure contains data used by the 470.Xr ntpd 8 471program. 472.It Li KERN_OSRELEASE 473The system release string. 474.It Li KERN_OSREV 475The system revision string. 476.It Li KERN_OSTYPE 477The system type string. 478.It Li KERN_PATH_MAX 479The maximum number of bytes in a pathname. 480.It Li KERN_POSIX1 481The version of ISO/IEC 9945 (POSIX 1003.1) with which the system 482attempts to comply. 483.It Li KERN_PROC 484Return the entire process table, or a subset of it. 485An array of 486.Va struct kinfo_proc 487structures is returned, 488whose size depends on the current number of such objects in the system. 489The third and fourth level names are as follows: 490.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent 491.It Pa Third level name Fourth level is: 492.It KERN\_PROC\_ALL None 493.It KERN\_PROC\_PID A process ID 494.It KERN\_PROC\_PGRP A process group 495.It KERN\_PROC\_SESSION A session ID 496.It KERN\_PROC\_TTY A tty device 497.It KERN\_PROC\_UID A user ID 498.It KERN\_PROC\_RUID A real user ID 499.It KERN\_PROC\_GID A group ID 500.It KERN\_PROC\_RGID A real group ID 501.El 502.It Li KERN_PROC2 503As for KERN_PROC, but an array of 504.Va struct kinfo_proc2 505structures are returned. The fifth level name is the size of the 506.Va struct kinfo_proc2 507and the sixth level name is the number of structures to return. 508.It Li KERN_PROC_ARGS 509Return the argv or environment strings (or the number thereof) 510of a process. Multiple strings are returned separated by NUL 511characters. The third level name is the process ID. The fourth 512level name is as follows: 513.Bl -column "Third level nameXXXXXX" -offset indent 514.It KERN\_PROC\_ARGV The argv strings 515.It KERN\_PROC\_NARGV The number of argv strings 516.It KERN\_PROC\_ENV The environ strings 517.It KERN\_PROC\_NENV The number of environ strings 518.El 519.It Li KERN_PROF 520Return profiling information about the kernel. 521If the kernel is not compiled for profiling, 522attempts to retrieve any of the KERN_PROF values will 523fail with EOPNOTSUPP. 524The third level names for the string and integer profiling information 525is detailed below. 526The changeable column shows whether a process with appropriate 527privilege may change the value. 528.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent 529.It Sy Pa Third level name Type Changeable 530.It GPROF\_STATE integer yes 531.It GPROF\_COUNT u_short[\|] yes 532.It GPROF\_FROMS u_short[\|] yes 533.It GPROF\_TOS struct tostruct yes 534.It GPROF\_GMONPARAM struct gmonparam no 535.El 536.Pp 537The variables are as follows: 538.Bl -tag -width "123456" 539.It Li GPROF_STATE 540Returns GMON_PROF_ON or GMON_PROF_OFF to show that profiling 541is running or stopped. 542.It Li GPROF_COUNT 543Array of statistical program counter counts. 544.It Li GPROF_FROMS 545Array indexed by program counter of call-from points. 546.It Li GPROF_TOS 547Array of 548.Va struct tostruct 549describing destination of calls and their counts. 550.It Li GPROF_GMONPARAM 551Structure giving the sizes of the above arrays. 552.El 553.It Li KERN_RAWPARTITION 554The raw partition of a disk (a == 0). 555.It Li KERN_ROOT_DEVICE 556The name of the root device. 557.It Li KERN_RTC_OFFSET 558Return the offset of real time clock from UTC in minutes. 559.It Li KERN_SAVED_IDS 560Returns 1 if saved set-group and saved set-user ID is available. 561.It Li KERN_SECURELVL 562The system security level. 563This level may be raised by processes with appropriate privilege. 564It may only be lowered by process 1. 565.It Li KERN_SYNCHRONIZED_IO 566Returns 1 if the POSIX 1003.1b Synchronized I/O Option is available 567on this system, 568otherwise 0. 569.It Li KERN_SYSVIPC_INFO 570Return System V style IPC configuration and run-time information. 571The third level name selects the System V style IPC facility. 572.Bl -column "KERN_SYSVIPC_MSG_INFOXXX" "struct shm_sysctl_infoXXX" -offset indent 573.It Sy Pa Third level name Type 574.It KERN\_SYSVIPC\_MSG\_INFO struct msg_sysctl_info 575.It KERN\_SYSVIPC\_SEM\_INFO struct sem_sysctl_info 576.It KERN\_SYSVIPC\_SHM\_INFO struct shm_sysctl_info 577.El 578.Pp 579.Bl -tag -width "123456" 580.It Li KERN_SYSVIPC_MSG_INFO 581Return information on the System V style message facility. The 582.Sy msg_sysctl_info 583structure is defined in 584.Aq Pa sys/msg.h . 585.It Li KERN_SYSVIPC_SEM_INFO 586Return information on the System V style semaphore facility. The 587.Sy sem_sysctl_info 588structure is defined in 589.Aq Pa sys/sem.h . 590.It Li KERN_SYSVIPC_SHM_INFO 591Return information on the System V style shared memory facility. The 592.Sy shm_sysctl_info 593structure is defined in 594.Aq Pa sys/shm.h . 595.El 596.It Li KERN_SYSVMSG 597Returns 1 if System V style message queue functionality is available 598on this system, 599otherwise 0. 600.It Li KERN_SYSVSEM 601Returns 1 if System V style semaphore functionality is available 602on this system, 603otherwise 0. 604.It Li KERN_SYSVSHM 605Returns 1 if System V style share memory functionality is available 606on this system, 607otherwise 0. 608.It Li KERN_VERSION 609The system version string. 610.It Li KERN_VNODE 611Return the entire vnode table. 612Note, the vnode table is not necessarily a consistent snapshot of 613the system. 614The returned data consists of an array whose size depends on the 615current number of such objects in the system. 616Each element of the array contains the kernel address of a vnode 617.Va struct vnode * 618followed by the vnode itself 619.Va struct vnode . 620.El 621.Sh CTL_MACHDEP 622The set of variables defined is architecture dependent. 623Most architectures define at least the following variables. 624.Bl -column "CONSOLE_DEVICEXXX" "integerXXX" -offset indent 625.It Sy Pa Second level name Type Changeable 626.It Li CPU_CONSDEV dev_t no 627.El 628.Sh CTL_NET 629The string and integer information available for the CTL_NET level 630is detailed below. 631The changeable column shows whether a process with appropriate 632privilege may change the value. 633.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent 634.It Sy Pa Second level name Type Changeable 635.It PF\_ROUTE routing messages no 636.It PF\_INET IPv4 values yes 637.It PF\_INET6 IPv6 values yes 638.El 639.Pp 640.Bl -tag -width "123456" 641.It Li PF_ROUTE 642Return the entire routing table or a subset of it. 643The data is returned as a sequence of routing messages (see 644.Xr route 4 645for the header file, format and meaning). 646The length of each message is contained in the message header. 647.Pp 648The third level name is a protocol number, which is currently always 0. 649The fourth level name is an address family, which may be set to 0 to 650select all address families. 651The fifth and sixth level names are as follows: 652.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent 653.It Pa Fifth level name Sixth level is: 654.It NET\_RT\_FLAGS rtflags 655.It NET\_RT\_DUMP None 656.It NET\_RT\_IFLIST None 657.El 658.It Li PF_INET 659Get or set various global information about the IPv4 660.Pq Internet Protocol version 4 . 661The third level name is the protocol. 662The fourth level name is the variable name. 663The currently defined protocols and names are: 664.Bl -column "Protocol name" "Variable nameXX" "integer" "yes" -offset indent 665.It Pa Protocol name Variable name Type Changeable 666.It ip forwarding integer yes 667.It ip redirect integer yes 668.It ip ttl integer yes 669.It ip forwsrcrt integer yes 670.It ip directed-broadcast integer yes 671.It ip allowsrcrt integer yes 672.It ip subnetsarelocal integer yes 673.It ip mtudisc integer yes 674.It ip anonportmin integer yes 675.It ip anonportmax integer yes 676.It ip mtudisctimeout integer yes 677.It ip gifttl integer yes 678.It ip lowportmin integer yes 679.It ip lowportmax integer yes 680.It ip maxfragpacket integer yes 681.It icmp maskrepl integer yes 682.It icmp errppslimit integer yes 683.It icmp rediraccept integer yes 684.It icmp redirtimeout integer yes 685.It tcp rfc1323 integer yes 686.It tcp sendspace integer yes 687.It tcp recvspace integer yes 688.It tcp mssdflt integer yes 689.It tcp syn_cache_limit integer yes 690.It tcp syn_bucket_limit integer yes 691.It tcp syn_cache_interval integer yes 692.It tcp init_win integer yes 693.It tcp mss_ifmtu integer yes 694.It tcp sack integer yes 695.It tcp win_scale integer yes 696.It tcp timestamps integer yes 697.It tcp compat_42 integer yes 698.It tcp cwm integer yes 699.It tcp cwm_burstsize integer yes 700.It tcp ack_on_push integer yes 701.It tcp keepidle integer yes 702.It tcp keepintvl integer yes 703.It tcp keepcnt integer yes 704.It tcp slowhz integer no 705.It tcp newreno integer yes 706.It tcp log_refused integer yes 707.It tcp rstppslimit integer yes 708.It udp checksum integer yes 709.It udp sendspace integer yes 710.It udp recvspace integer yes 711.El 712.Pp 713The variables are as follows: 714.Bl -tag -width "123456" 715.It Li ip.forwarding 716Returns 1 when IP forwarding is enabled for the host, 717meaning that the host is acting as a router. 718.It Li ip.redirect 719Returns 1 when ICMP redirects may be sent by the host. 720This option is ignored unless the host is routing IP packets, 721and should normally be enabled on all systems. 722.It Li ip.ttl 723The maximum time-to-live (hop count) value for an IP packet sourced by 724the system. 725This value applies to normal transport protocols, not to ICMP. 726.It Li ip.forwsrcrt 727Returns 1 when forwarding of source-routed packets is enabled for 728the host. This value may only be changed if the kernel security 729level is less than 1. 730.It Li ip.directed-broadcast 731Returns 1 if directed broadcast behavior is enabled for the host. 732.It Li ip.allowsrcrt 733Returns 1 if the host accepts source routed packets. 734.It Li ip.subnetsarelocal 735Returns 1 if subnets are to be considered local addresses. 736.It Li ip.mtudisc 737Returns 1 if Path MTU Discovery is enabled. 738.It Li ip.anonportmin 739The lowest port number to use for TCP and UDP ephemeral port allocation. 740This cannot be set to less than 1024 or greater than 65535. 741.It Li ip.anonportmax 742The highest port number to use for TCP and UDP ephemeral port allocation. 743This cannot be set to less than 1024 or greater than 65535, and must 744be greater than 745.Li ip.anonportmin . 746.It Li ip.mtudisctimeout 747Returns the number of seconds in which a route added by the Path MTU 748Discovery engine will time out. When the route times out, the Path 749MTU Discovery engine will attempt to probe a larger path MTU. 750.It Li ip.gifttl 751The maximum time-to-live (hop count) value for an IPv4 packet generated by 752.Xr gif 4 753tunnel interface. 754.It Li ip.lowportmin 755The lowest port number to use for TCP and UDP reserved port allocation. 756This cannot be set to less than 0 or greater than 1024, and must 757be smaller than 758.Li ip.lowportmax . 759.It Li ip.lowportmax 760The highest port number to use for TCP and UDP reserved port allocation. 761This cannot be set to less than 0 or greater than 1024, and must 762be greater than 763.Li ip.lowportmin . 764.It Li ip.maxfragpackets 765The maximum number of fragmented packets the node will accept. 7660 means that the node will not accept any fragmented packets. 767-1 means that the node will accept as many fragmented packets as it receives. 768The flag is provided basically for avoiding possible DoS attacks. 769.It Li icmp.maskrepl 770Returns 1 if ICMP network mask requests are to be answered. 771.It Li icmp.errppslimit 772The variable specifies the maximum number of outgoing ICMP error messages, 773per second. 774ICMP error messages that exceeded the value are subject to rate limitation 775and will not go out from the node. 776Negative value disables rate limitation. 777.It Li icmp.rediraccept 778If set to non-zero, the host will accept ICMP redirect packets. 779Note that routers will never accept ICMP redirect packets, 780and the variable is meaningful on IP hosts only. 781.It Li icmp.redirtimeout 782The variable specifies lifetime of routing entries generated by incoming 783ICMP redirect. This defaults to zero; if the system is not running 784a routing daemon like 785.Xr routed 8 786than this value can be set to remove the routes added by redirect. 787A reasonable value to use would be 600 seconds. 788.It Li tcp.rfc1323 789Returns 1 if RFC1323 extensions to TCP are enabled. 790.It Li tcp.sendspace 791Returns the default TCP send buffer size. 792.It Li tcp.recvspace 793Returns the default TCP receive buffer size. 794.It Li tcp.mssdflt 795Returns the default maximum segment size both advertsized to the peer 796and to use when the peer does not advertize a maximum segment size to 797us during connection setup. Do not change this value unless you really 798know what you are doing. 799.It Li tcp.syn_cache_limit 800Returns the maximum number of entries allowed in the TCP compressed state 801engine. 802.It Li tcp.syn_bucket_limit 803Returns the maximum number of entries allowed per hash bucket in the TCP 804compressed state engine. 805.It Li tcp.syn_cache_interval 806Returns the TCP compressed state engine's timer interval. 807.It Li tcp.init_win 808Returns a value indicating the TCP initial congestion window. If this 809value is 0, an auto-tuning algorithm designed to use an initial window 810of approximately 4K bytes is in use. Otherwise, this value indicates 811a fixed number of packets. 812.It Li tcp.mss_ifmtu 813Returns 1 if TCP calculates the outgoing maximum segment size based on 814the MTU of the appropriate interface. Otherwise, it is calculated based on 815the greater of the MTU of the interface, and the largest (non-loopback) 816interface MTU on the system. 817.It Li tcp.sack 818TCP Selective ACKnowledgement (RFC 2018) is not implemented in 819.Nx 820at this time. 821Changing this value will have no effect. 822.It Li tcp.win_scale 823If rfc1323 is enabled, a value of 1 indicates RFC1323 window scale options, 824for increasing the TCP window size, are enabled. 825.It Li tcp.timestamps 826If rfc1323 is enabled, a value of 1 indicates RFC1323 time stamp options, 827used for measuring TCP round trip times, are enabled. 828.It Li tcp.compat_42 829Returns 1 if work-arounds for bugs in the 4.2BSD TCP implementation are 830enabled. Use of this option is not recommended, although it may be 831required in order to communicate with extremely old TCP implementations. 832.It Li tcp.cwm 833Returns 1 if use of the Hughes/Touch/Heidemann Congestion Window Monitoring 834algorithm is enabled. This algorithm prevents line-rate bursts of packets 835that could otherwise occur when data begins flowing on an idle TCP 836connection. These line-rate bursts can contribute to network and router 837congestion. This can be particularly useful on World Wide Web servers 838which support HTTP/1.1, which has lingering connections. 839.It Li tcp.cwm_burstsize 840Returns the Congestion Window Monitoring allowed burst size, in terms 841of packet count. 842.It Li tcp.ack_on_push 843Returns 1 if TCP is to immediately transmit an ACK upon reception of 844a packet with PUSH set. This can avoid losing a round trip time in some 845rare situations, but has the caveat of potentially defeating TCP's delayed 846ACK algorithm. Use of this option is generally not recommended, but 847the variable exists in case your configuration really needs it. 848.It Li tcp.keepidle 849Time a connection must be idle before keepalives are sent (if keepalives 850are enabled for the connection). See also tcp.slowhz. 851.It Li tcp.keepintvl 852Time after a keepalive probe is sent until, in the absence of any response, 853another probe is sent. See also tcp.slowhz. 854.It Li tcp.keepcnt 855Number of keepalive probes sent before declaring a connection dead. If 856set to zero, there is no limit; keepalives will be sent until some kind of 857response is received from the peer. 858.It Li tcp.slowhz 859The units for tcp.keepidle and tcp.keepintvl; those variables are in ticks 860of a clock that ticks tcp.slowhz times per second. (That is, their values 861must be divided by the tcp.slowhz value to get times in seconds.) 862.It Li tcp.newreno 863Returns 1 if the use of J. Hoe's NewReno congestion control algorithm is 864enabled. This algorithm improves the start-up behavior of TCP connections. 865.It Li tcp.log_refused 866Returns 1 if refused TCP connections to the host will be logged. 867.It Li tcp.rstppslimit 868The variable specifies the maximum number of outgoing TCP RST packets, 869per second. 870TCP RST packet that exceeded the value are subject to rate limitation 871and will not go out from the node. 872Negative value disables rate limitation. 873.It Li udp.checksum 874Returns 1 when UDP checksums are being computed and checked. 875Disabling UDP checksums is strongly discouraged. 876.It Li udp.sendspace 877Returns the default UDP send buffer size. 878.It Li udp.recvspace 879Returns the default UDP receive buffer size. 880.El 881.Pp 882For variables net.*.ipsec, please refer to 883.Xr ipsec 4 . 884.It Li PF_INET6 885Get or set various global information about the IPv6 886.Pq Internet Protocol version 6 . 887The third level name is the protocol. 888The fourth level name is the variable name. 889The currently defined protocols and names are: 890.Bl -column "Protocol name" "Variable nameXX" "integer" "yes" -offset indent 891.It Pa Protocol name Variable name Type Changeable 892.It ip6 forwarding integer yes 893.It ip6 redirect integer yes 894.It ip6 hlim integer yes 895.It ip6 maxfragpackets integer yes 896.It ip6 accept_rtadv integer yes 897.It ip6 keepfaith integer yes 898.It ip6 log_interval integer yes 899.It ip6 hdrnestlimit integer yes 900.It ip6 dad_count integer yes 901.It ip6 auto_flowlabel integer yes 902.It ip6 defmcasthlim integer yes 903.It ip6 gif_hlim integer yes 904.It ip6 kame_version string no 905.It ip6 use_deprecated integer yes 906.It ip6 rr_prune integer yes 907.It ip6 bindv6only integer yes 908.It ip6 anonportmin integer yes 909.It ip6 anonportmax integer yes 910.It ip6 lowportmin integer yes 911.It ip6 lowportmax integer yes 912.It icmp6 rediraccept integer yes 913.It icmp6 redirtimeout integer yes 914.It icmp6 nd6_prune integer yes 915.It icmp6 nd6_delay integer yes 916.It icmp6 nd6_umaxtries integer yes 917.It icmp6 nd6_mmaxtries integer yes 918.It icmp6 nd6_useloopback integer yes 919.It icmp6 nodeinfo integer yes 920.It icmp6 errppslimit integer yes 921.It icmp6 nd6_maxnudhint integer yes 922.It icmp6 mtudisc_hiwat integer yes 923.It icmp6 mtudisc_lowat integer yes 924.It icmp6 nd6_debug integer yes 925.It udp6 sendspace integer yes 926.It udp6 recvspace integer yes 927.El 928.Pp 929The variables are as follows: 930.Bl -tag -width "123456" 931.It Li ip6.forwarding 932Returns 1 when IPv6 forwarding is enabled for the node, 933meaning that the node is acting as a router. 934Returns 0 when IPv6 forwarding is disabled for the node, 935meaning that the node is acting as a host. 936IPv6 specification defines node behavior for 937.Dq router 938case and 939.Dq host 940case quite differently, and changing this variable during operation 941may cause serious trouble. 942It is recommended to configure the variable at bootstrap time, 943and bootstrap time only. 944.It Li ip6.redirect 945Returns 1 when ICMPv6 redirects may be sent by the node. 946This option is ignored unless the node is routing IP packets, 947and should normally be enabled on all systems. 948.It Li ip6.hlim 949The default hop limit value for an IPv6 unicast packet sourced by the node. 950This value applies to all the transport protocols on top of IPv6. 951There are APIs to override the value, as documented in 952.Xr ip6 4 . 953.It Li ip6.maxfragpackets 954The maximum number of fragmented packets the node will accept. 9550 means that the node will not accept any fragmented packets. 956-1 means that the node will accept as many fragmented packets as it receives. 957The flag is provided basically for avoiding possible DoS attacks. 958.It Li ip6.accept_rtadv 959If set to non-zero, the node will accept ICMPv6 router advertisement packets 960and autoconfigures address prefixes and default routers. 961The node must be a host 962.Pq not a router 963for the option to be meaningful. 964.It Li ip6.keepfaith 965If set to non-zero, it enables 966.Dq FAITH 967TCP relay IPv6-to-IPv4 translator code in the kernel. 968Refer 969.Xr faith 4 970and 971.Xr faithd 8 972for detail. 973.It Li ip6.log_interval 974The variable controls amount of logs generated by IPv6 packet 975forwarding engine, by seting interval between log output 976.Pq in seconds . 977.It Li ip6.hdrnestlimit 978The number of IPv6 extension headers permitted on incoming IPv6 packets. 979If set to 0, the node will accept as many extension headers as possible. 980.It Li ip6.dad_count 981The variable cofigures number of IPv6 DAD 982.Pq duplicated address detection 983probe packets. 984The packets will be generated when IPv6 interface addresses are configured. 985.It Li ip6.auto_flowlabel 986On connected transport protocol packets, 987fill IPv6 flowlabel field to help intermediate routers to identify packet flows. 988.It Li ip6.defmcasthlim 989The default hop limit value for an IPv6 multicast packet sourced by the node. 990This value applies to all the transport protocols on top of IPv6. 991There are APIs to override the value, as documented in 992.Xr ip6 4 . 993.It Li ip6.gif_hlim 994The maximum hop limit value for an IPv6 packet generated by 995.Xr gif 4 996tunnel interface. 997.It Li ip6.kame_version 998The string identifies the version of KAME IPv6 stack implemented in the kernel. 999.It Li ip6.use_deprecated 1000The variable controls use of deprecated address, specified in RFC2462 5.5.4. 1001.It Li ip6.rr_prune 1002The variable specifies interval between IPv6 router renumbering prefix 1003babysitting, in seconds. 1004.It Li ip6.bindv6only 1005The variable specifies initial value for 1006.Dv IPV6_BINDV6ONLY 1007socket option for 1008.Dv AF_INET6 1009socket. 1010Please refer to 1011.Xr ip6 4 1012for detail. 1013.It Li ip6.anonportmin 1014The lowest port number to use for TCP and UDP ephemeral port allocation. 1015This cannot be set to less than 1024 or greater than 65535. 1016.It Li ip6.anonportmax 1017The highest port number to use for TCP and UDP ephemeral port allocation. 1018This cannot be set to less than 1024 or greater than 65535, and must 1019be greater than 1020.Li ip6.anonportmin . 1021.It Li ip6.lowportmin 1022The lowest port number to use for TCP and UDP reserved port allocation. 1023This cannot be set to less than 0 or greater than 1024, and must 1024be smaller than 1025.Li ip6.lowportmax . 1026.It Li ip6.lowportmax 1027The highest port number to use for TCP and UDP reserved port allocation. 1028This cannot be set to less than 0 or greater than 1024, and must 1029be greater than 1030.Li ip6.lowportmin . 1031.It Li icmp6.rediraccept 1032If set to non-zero, the host will accept ICMPv6 redirect packets. 1033Note that IPv6 routers will never accept ICMPv6 redirect packets, 1034and the variable is meaningful on IPv6 hosts 1035.Pq non-router 1036only. 1037.It Li icmp6.redirtimeout 1038The variable specifies lifetime of routing entries generated by incoming 1039ICMPv6 redirect. 1040.It Li icmp6.nd6_prune 1041The variable specifies interval between IPv6 neighbor cache babysitting, 1042in seconds. 1043.It Li icmp6.nd6_delay 1044The variable specifies 1045.Dv DELAY_FIRST_PROBE_TIME 1046timing constant in IPv6 neighbor discovery specification 1047.Pq RFC2461 , 1048in seconds. 1049.It Li icmp6.nd6_umaxtries 1050The variable specifies 1051.Dv MAX_UNICAST_SOLICIT 1052constant in IPv6 neighbor discovery specification 1053.Pq RFC2461 . 1054.It Li icmp6.nd6_mmaxtries 1055The variable specifies 1056.Dv MAX_MULTICAST_SOLICIT 1057constant in IPv6 neighbor discovery specification 1058.Pq RFC2461 . 1059.It Li icmp6.nd6_useloopback 1060If set to non-zero, kernel IPv6 stack will use loopback interface for 1061local traffic. 1062.It Li icmp6.nodeinfo 1063The variable enables responses to ICMPv6 node information queries. 1064If you set the variable to 0, reponses will not be generated for 1065ICMPv6 node information queries. 1066Since node information queries can have a security impact, it is 1067possible to fine tune which responses should be answered. 1068Two separate bits can be set. 1069.Bl -tag -width "12345" 1070.It 1 1071Respond to ICMPv6 FQDN queries, e.g. 1072.Li ping6 -w . 1073.It 2 1074Respond to ICMPv6 node addresses queries, e.g. 1075.Li ping6 -a . 1076.El 1077.It Li icmp6.errppslimit 1078The variable specifies the maximum number of outgoing ICMPv6 error messages, 1079per second. 1080ICMPv6 error messages that exceeded the value are subject to rate limitation 1081and will not go out from the node. 1082Negative value disables rate limitation. 1083.It Li icmp6.nd6_maxnudhint 1084IPv6 neighbor discovery permits upper layer protocols to supply reachability 1085hints, to avoid unnecessary neighbor discovery exchanges. 1086The variable defines the number of consecutive hints the neighbor discovery 1087layer will take. 1088For example, by setting the variable to 3, neighbor discovery layer 1089will take 3 consecutive hints in maximum. 1090After receiving 3 hints, neighbor discovery layer will perform 1091normal neighbor discovery process. 1092.It Li icmp6.mtudisc_hiwat 1093.It Li icmp6.mtudisc_lowat 1094The variables define the maximum number of routing table entries, 1095created due to path MTU discovery 1096.Pq prevents denial-of-service attacks with ICMPv6 too big messages . 1097When IPv6 path MTU discovery happens, we keep path MTU information into 1098the routing table. 1099If the number of routing table entries exceed the value, 1100the kernel will not attempt to keep the path MTU information. 1101.Li icmp6.mtudisc_hiwat 1102is used when we have verified ICMPv6 too big messages. 1103.Li icmp6.mtudisc_lowat 1104is used when we have unverified ICMPv6 too big messages. 1105Verification is performed by using address/port pairs kept in connected pcbs. 1106Negative value disables the upper limit. 1107.It Li icmp6.nd6_debug 1108If set to non-zero, kernel IPv6 neighbor discovery code will generate 1109debugging messages. 1110The debug outputs are useful to diagnose IPv6 interoperability issues. 1111The flag must be set to 0 for normal operation. 1112.El 1113.Pp 1114We reuse net.*.tcp for 1115.Tn TCP 1116over 1117.Tn IPv6 , 1118and therefore we do not have variables net.*.tcp6. 1119Variables net.inet6.udp6 have identical meaning to net.inet.udp. 1120Please refer to 1121.Li PF_INET 1122section above. 1123For variables net.*.ipsec6, please refer to 1124.Xr ipsec 4 . 1125.El 1126.Sh CTL_PROC 1127The string and integer information available for the CTL_PROC 1128is detailed below. 1129The changeable column shows whether a process with appropriate 1130privilege may change the value. 1131These values are per-process, and as such may change from one process 1132to another. When a process is created, the default values are inherited from 1133its parent. When a set-user-ID or set-group-ID binary is executed, the 1134value of PROC_PID_CORENAME is reset to the system default value. 1135The second level name is either the magic value PROC_CURPROC, which 1136points to the current process, or the PID of the target process. 1137.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" "yes" -offset indent 1138.It Sy Pa Third level name Type Changeable 1139.It PROC\_PID\_CORENAME string yes 1140.It PROC\_PID\_LIMIT node not applicable 1141.El 1142.Bl -tag -width "123456" 1143.Pp 1144.It Li PROC_PID_CORENAME 1145The template used for the core dump file name (see 1146.Xr core 5 1147for details). The base name must either be 1148.Nm core 1149or end with the suffix ``.core'' (the super-user may set arbitrary names). By 1150default it points to KERN_DEFCORENAME. 1151.It Li PROC_PID_LIMIT 1152Return resources limits, as defined for the 1153.Xr getrlimit 2 1154and 1155.Xr setrlimit 2 1156system calls. 1157The fourth level name is one of: 1158.Bl -tag -width PROC_PID_LIMIT_MEMLOCKAA 1159.It Li PROC_PID_LIMIT_CPU 1160The maximum amount of cpu time (in seconds) to be used by each process. 1161.It Li PROC_PID_LIMIT_FSIZE 1162The largest size (in bytes) file that may be created. 1163.It Li PROC_PID_LIMIT_DATA 1164The maximum size (in bytes) of the data segment for a process; 1165this defines how far a program may extend its break with the 1166.Xr sbrk 2 1167system call. 1168.It Li PROC_PID_LIMIT_STACK 1169The maximum size (in bytes) of the stack segment for a process; 1170this defines how far a program's stack segment may be extended. 1171Stack extension is performed automatically by the system. 1172.It Li PROC_PID_LIMIT_CORE 1173The largest size (in bytes) 1174.Pa core 1175file that may be created. 1176.It Li PROC_PID_LIMIT_RSS 1177The maximum size (in bytes) to which a process's resident set size may 1178grow. 1179This imposes a limit on the amount of physical memory to be given to 1180a process; if memory is tight, the system will prefer to take memory 1181from processes that are exceeding their declared resident set size. 1182.It Li PROC_PID_LIMIT_MEMLOCK 1183The maximum size (in bytes) which a process may lock into memory 1184using the 1185.Xr mlock 2 1186function. 1187.It Li PROC_PID_LIMIT_NPROC 1188The maximum number of simultaneous processes for this user id. 1189.It Li PROC_PID_LIMIT_NOFILE 1190The maximum number of open files for this process. 1191.El 1192.Pp 1193The fifth level name is one of PROC_PID_LIMIT_TYPE_SOFT or 1194PROC_PID_LIMIT_TYPE_HARD, to select respectively the soft or hard limit. 1195Both are of type integer. 1196.El 1197.Sh CTL_USER 1198The string and integer information available for the CTL_USER level 1199is detailed below. 1200The changeable column shows whether a process with appropriate 1201privilege may change the value. 1202.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent 1203.It Sy Pa Second level name Type Changeable 1204.It USER\_BC\_BASE\_MAX integer no 1205.It USER\_BC\_DIM\_MAX integer no 1206.It USER\_BC\_SCALE\_MAX integer no 1207.It USER\_BC\_STRING\_MAX integer no 1208.It USER\_COLL\_WEIGHTS\_MAX integer no 1209.It USER\_CS\_PATH string no 1210.It USER\_EXPR\_NEST\_MAX integer no 1211.It USER\_LINE\_MAX integer no 1212.It USER\_POSIX2\_CHAR\_TERM integer no 1213.It USER\_POSIX2\_C\_BIND integer no 1214.It USER\_POSIX2\_C\_DEV integer no 1215.It USER\_POSIX2\_FORT\_DEV integer no 1216.It USER\_POSIX2\_FORT\_RUN integer no 1217.It USER\_POSIX2\_LOCALEDEF integer no 1218.It USER\_POSIX2\_SW\_DEV integer no 1219.It USER\_POSIX2\_UPE integer no 1220.It USER\_POSIX2\_VERSION integer no 1221.It USER\_RE\_DUP\_MAX integer no 1222.It USER\_STREAM\_MAX integer no 1223.It USER\_TZNAME\_MAX integer no 1224.El 1225.Bl -tag -width "123456" 1226.Pp 1227.It Li USER_BC_BASE_MAX 1228The maximum ibase/obase values in the 1229.Xr bc 1 1230utility. 1231.It Li USER_BC_DIM_MAX 1232The maximum array size in the 1233.Xr bc 1 1234utility. 1235.It Li USER_BC_SCALE_MAX 1236The maximum scale value in the 1237.Xr bc 1 1238utility. 1239.It Li USER_BC_STRING_MAX 1240The maximum string length in the 1241.Xr bc 1 1242utility. 1243.It Li USER_COLL_WEIGHTS_MAX 1244The maximum number of weights that can be assigned to any entry of 1245the LC_COLLATE order keyword in the locale definition file. 1246.It Li USER_CS_PATH 1247Return a value for the 1248.Ev PATH 1249environment variable that finds all the standard utilities. 1250.It Li USER_EXPR_NEST_MAX 1251The maximum number of expressions that can be nested within 1252parenthesis by the 1253.Xr expr 1 1254utility. 1255.It Li USER_LINE_MAX 1256The maximum length in bytes of a text-processing utility's input 1257line. 1258.It Li USER_POSIX2_CHAR_TERM 1259Return 1 if the system supports at least one terminal type capable of 1260all operations described in POSIX 1003.2, otherwise 0. 1261.It Li USER_POSIX2_C_BIND 1262Return 1 if the system's C-language development facilities support the 1263C-Language Bindings Option, otherwise 0. 1264.It Li USER_POSIX2_C_DEV 1265Return 1 if the system supports the C-Language Development Utilities Option, 1266otherwise 0. 1267.It Li USER_POSIX2_FORT_DEV 1268Return 1 if the system supports the FORTRAN Development Utilities Option, 1269otherwise 0. 1270.It Li USER_POSIX2_FORT_RUN 1271Return 1 if the system supports the FORTRAN Runtime Utilities Option, 1272otherwise 0. 1273.It Li USER_POSIX2_LOCALEDEF 1274Return 1 if the system supports the creation of locales, otherwise 0. 1275.It Li USER_POSIX2_SW_DEV 1276Return 1 if the system supports the Software Development Utilities Option, 1277otherwise 0. 1278.It Li USER_POSIX2_UPE 1279Return 1 if the system supports the User Portability Utilities Option, 1280otherwise 0. 1281.It Li USER_POSIX2_VERSION 1282The version of POSIX 1003.2 with which the system attempts to comply. 1283.It Li USER_RE_DUP_MAX 1284The maximum number of repeated occurrences of a regular expression 1285permitted when using interval notation. 1286.ne 1i 1287.It Li USER_STREAM_MAX 1288The minimum maximum number of streams that a process may have open 1289at any one time. 1290.It Li USER_TZNAME_MAX 1291The minimum maximum number of types supported for the name of a 1292timezone. 1293.El 1294.Sh CTL_VM 1295The string and integer information available for the CTL_VM level 1296is detailed below. 1297The changeable column shows whether a process with appropriate 1298privilege may change the value. 1299.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent 1300.It Sy Pa Second level name Type Changeable 1301.It VM\_ANONMAX int yes 1302.It VM\_ANONMIN int yes 1303.It VM\_EXECMAX int yes 1304.It VM\_EXECMIN int yes 1305.It VM\_FILEMAX int yes 1306.It VM\_FILEMIN int yes 1307.It VM\_LOADAVG struct loadavg no 1308.It VM\_MAXSLP int no 1309.It VM\_METER struct vmtotal no 1310.It VM\_NKMEMPAGES int no 1311.It VM\_USPACE int no 1312.It VM\_UVMEXP struct uvmexp no 1313.It VM\_UVMEXP2 struct uvmexp_sysctl no 1314.El 1315.Pp 1316.Bl -tag -width "123456" 1317.It Li VM_ANONMAX 1318The percentage of physical memory which will be reclaimed 1319from other types of memory usage to store anonymous application data. 1320.It Li VM_ANONMIN 1321The percentage of physical memory which will be always be available for 1322anonymous application data. 1323.It Li VM_EXECMAX 1324The percentage of physical memory which will be reclaimed 1325from other types of memory usage to store cached executable data. 1326.It Li VM_EXECMIN 1327The percentage of physical memory which will be always be available for 1328cached executable data. 1329.It Li VM_FILEMAX 1330The percentage of physical memory which will be reclaimed 1331from other types of memory usage to store cached file data. 1332.It Li VM_FILEMIN 1333The percentage of physical memory which will be always be available for 1334cached file data. 1335.It Li VM_LOADAVG 1336Return the load average history. 1337The returned data consists of a 1338.Va struct loadavg . 1339.It Li VM_MAXSLP 1340The value of the maxslp kernel global variable. 1341.It Li VM_METER 1342Return system wide virtual memory statistics. 1343The returned data consists of a 1344.Va struct vmtotal . 1345.It Li VM_USPACE 1346The number of bytes allocated for each kernel stack. 1347.It Li VM_UVMEXP 1348Return system wide virtual memory statistics. 1349The returned data consists of a 1350.Va struct uvmexp . 1351.It Li VM_UVMEXP2 1352Return system wide virtual memory statistics. 1353The returned data consists of a 1354.Va struct uvmexp_sysctl . 1355.El 1356.Sh CTL_DDB 1357The integer information available for the CTL_DDB level is detailed below. 1358The changeable column shows whether a process with appropriate 1359privilege may change the value. 1360.Bl -column "DBCTL_TABSTOPSXXX" "integerXXX" -offset indent 1361.It Sy Pa Second level name Type Changeable 1362.It DBCTL\_RADIX integer yes 1363.It DBCTL\_MAXOFF integer yes 1364.It DBCTL\_LINES integer yes 1365.It DBCTL\_TABSTOPS integer yes 1366.It DBCTL\_ONPANIC integer yes 1367.It DBCTL\_FROMCONSOLE integer yes 1368.El 1369.Pp 1370.Bl -tag -width "123456" 1371.It Li DBCTL_RADIX 1372The input and output radix. 1373.It Li DBCTL_MAXOFF 1374The maximum symbol offset. 1375.It Li DBCTL_LINES 1376Number of display lines. 1377.It Li DBCTL_TABSTOPS 1378Tab width. 1379.It Li DBCTL_ONPANIC 1380If non-zero, DDB will be entered when the kernel panics. 1381.It Li DBCTL_FROMCONSOLE 1382If not zero, DDB may be entered by sending a break on a serial 1383console or by a special key sequence on a graphics console. 1384.El 1385.Pp 1386These MIB nodes are also available as variables from within the 1387DDB. See 1388.Xr ddb 4 1389for more details. 1390.Sh CTL_VENDOR 1391The "vendor" toplevel name is reserved to be used by vendors who wish to 1392have their own private MIB tree. Intended use is to store values under 1393.Dq vendor.<yourname>.* . 1394.Sh RETURN VALUES 1395If the call to 1396.Nm 1397is successful, the number of bytes copied out is returned. 1398Otherwise \-1 is returned and 1399.Va errno 1400is set appropriately. 1401.Sh FILES 1402.Bl -tag -width <netinet6/udp6Xvar.h> -compact 1403.It Pa <sys/sysctl.h> 1404definitions for top level identifiers, second level kernel and hardware 1405identifiers, and user level identifiers 1406.It Pa <sys/socket.h> 1407definitions for second level network identifiers 1408.It Pa <sys/gmon.h> 1409definitions for third level profiling identifiers 1410.It Pa <uvm/uvm_param.h> 1411definitions for second level virtual memory identifiers 1412.It Pa <netinet/in.h> 1413definitions for third level IPv4/v6 identifiers and 1414fourth level IPv4/v6 identifiers 1415.It Pa <netinet/icmp_var.h> 1416definitions for fourth level ICMP identifiers 1417.It Pa <netinet/icmp6.h> 1418definitions for fourth level ICMPv6 identifiers 1419.It Pa <netinet/tcp_var.h> 1420definitions for fourth level TCP identifiers 1421.It Pa <netinet/udp_var.h> 1422definitions for fourth level UDP identifiers 1423.It Pa <netinet6/udp6_var.h> 1424definitions for fourth level IPv6 UDP identifiers 1425.It Pa <netinet6/ipsec.h> 1426definitions for fourth level IPsec identifiers 1427.El 1428.Sh ERRORS 1429The following errors may be reported: 1430.Bl -tag -width Er 1431.It Bq Er EFAULT 1432The buffer 1433.Fa name , 1434.Fa oldp , 1435.Fa newp , 1436or length pointer 1437.Fa oldlenp 1438contains an invalid address. 1439.It Bq Er EINVAL 1440The 1441.Fa name 1442array is less than two or greater than CTL_MAXNAME. 1443.It Bq Er EINVAL 1444A non-null 1445.Fa newp 1446is given and its specified length in 1447.Fa newlen 1448is too large or too small. 1449.It Bq Er ENOMEM 1450The length pointed to by 1451.Fa oldlenp 1452is too short to hold the requested value. 1453.It Bq Er ENOTDIR 1454The 1455.Fa name 1456array specifies an intermediate rather than terminal name. 1457.It Bq Er EOPNOTSUPP 1458The 1459.Fa name 1460array specifies a value that is unknown. 1461.It Bq Er EPERM 1462An attempt is made to set a read-only value. 1463.It Bq Er EPERM 1464A process without appropriate privilege attempts to set a value. 1465.It Bq Er EPERM 1466An attempt to change a value protected by the current kernel security 1467level is made. 1468.El 1469.Sh SEE ALSO 1470.Xr ipsec 4 , 1471.Xr sysctl 8 1472.Sh HISTORY 1473The 1474.Nm 1475function first appeared in 1476.Bx 4.4 . 1477