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