1.\" $NetBSD: sysctl.3,v 1.16 1997/09/19 19:17:17 leo 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.1 (Berkeley) 6/4/93 35.\" 36.Dd June 4, 1993 37.Dt SYSCTL 3 38.Os 39.Sh NAME 40.Nm sysctl 41.Nd get or set system information 42.Sh SYNOPSIS 43.Fd #include <sys/param.h> 44.Fd #include <sys/sysctl.h> 45.Ft int 46.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" 47.Sh DESCRIPTION 48The 49.Nm sysctl 50function retrieves system information and allows processes with 51appropriate privileges to set system information. 52The information available from 53.Nm sysctl 54consists of integers, strings, and tables. 55Information may be retrieved and set from the command interface 56using the 57.Xr sysctl 8 58utility. 59.Pp 60Unless explicitly noted below, 61.Nm sysctl 62returns a consistent snapshot of the data requested. 63Consistency is obtained by locking the destination 64buffer into memory so that the data may be copied out without blocking. 65Calls to 66.Nm sysctl 67are serialized to avoid deadlock. 68.Pp 69The state is described using a ``Management Information Base'' (MIB) 70style name, listed in 71.Fa name , 72which is a 73.Fa namelen 74length array of integers. 75.Pp 76The information is copied into the buffer specified by 77.Fa oldp . 78The size of the buffer is given by the location specified by 79.Fa oldlenp 80before the call, 81and that location gives the amount of data copied after a successful call. 82If the amount of data available is greater 83than the size of the buffer supplied, 84the call supplies as much data as fits in the buffer provided 85and returns with the error code ENOMEM. 86If the old value is not desired, 87.Fa oldp 88and 89.Fa oldlenp 90should be set to NULL. 91.Pp 92The size of the available data can be determined by calling 93.Nm sysctl 94with a NULL parameter for 95.Fa oldp . 96The size of the available data will be returned in the location pointed to by 97.Fa oldlenp . 98For some operations, the amount of space may change often. 99For these operations, 100the system attempts to round up so that the returned size is 101large enough for a call to return the data shortly thereafter. 102.Pp 103To set a new value, 104.Fa newp 105is set to point to a buffer of length 106.Fa newlen 107from which the requested value is to be taken. 108If a new value is not to be set, 109.Fa newp 110should be set to NULL and 111.Fa newlen 112set to 0. 113.Pp 114The top level names are defined with a CTL_ prefix in 115.Pa <sys/sysctl.h> , 116and are as follows. 117The next and subsequent levels down are found in the include files 118listed here, and described in separate sections below. 119.Pp 120.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent 121.It Sy Pa Name Next level names Description 122.It CTL\_DEBUG sys/sysctl.h Debugging 123.It CTL\_FS sys/sysctl.h File system 124.It CTL\_HW sys/sysctl.h Generic CPU, I/O 125.It CTL\_KERN sys/sysctl.h High kernel limits 126.It CTL\_MACHDEP sys/sysctl.h Machine dependent 127.It CTL\_NET sys/socket.h Networking 128.It CTL\_USER sys/sysctl.h User-level 129.It CTL\_VM vm/vm_param.h Virtual memory 130.El 131.Pp 132For example, the following retrieves the maximum number of processes allowed 133in the system: 134.Bd -literal -offset indent -compact 135int mib[2], maxproc; 136size_t len; 137.sp 138mib[0] = CTL_KERN; 139mib[1] = KERN_MAXPROC; 140len = sizeof(maxproc); 141sysctl(mib, 2, &maxproc, &len, NULL, 0); 142.Ed 143.sp 144To retrieve the standard search path for the system utilities: 145.Bd -literal -offset indent -compact 146int mib[2]; 147size_t len; 148char *p; 149.sp 150mib[0] = CTL_USER; 151mib[1] = USER_CS_PATH; 152sysctl(mib, 2, NULL, &len, NULL, 0); 153p = malloc(len); 154sysctl(mib, 2, p, &len, NULL, 0); 155.Ed 156.Sh CTL_DEBUG 157The debugging variables vary from system to system. 158A debugging variable may be added or deleted without need to recompile 159.Nm sysctl 160to know about it. 161Each time it runs, 162.Nm sysctl 163gets the list of debugging variables from the kernel and 164displays their current values. 165The system defines twenty 166.Ns ( Va struct ctldebug ) 167variables named 168.Nm debug0 169through 170.Nm debug19 . 171They are declared as separate variables so that they can be 172individually initialized at the location of their associated variable. 173The loader prevents multiple use of the same variable by issuing errors 174if a variable is initialized in more than one place. 175For example, to export the variable 176.Nm dospecialcheck 177as a debugging variable, the following declaration would be used: 178.Bd -literal -offset indent -compact 179int dospecialcheck = 1; 180struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck }; 181.Ed 182.Sh CTL_FS 183There are currently no second level names for the file system. 184.Sh CTL_HW 185The string and integer information available for the CTL_HW level 186is detailed below. 187The changeable column shows whether a process with appropriate 188privilege may change the value. 189.Bl -column "Second level nameXXXXXX" integerXXX -offset indent 190.It Sy Pa Second level name Type Changeable 191.It HW\_MACHINE string no 192.It HW\_MODEL string no 193.It HW\_NCPU integer no 194.It HW\_BYTEORDER integer no 195.It HW\_PHYSMEM integer no 196.It HW\_USERMEM integer no 197.It HW\_PAGESIZE integer no 198.It HW\_MACHINE\_ARCH string no 199.\".It HW\_DISKNAMES integer no 200.\".It HW\_DISKSTATS integer no 201.El 202.Pp 203.Bl -tag -width "123456" 204.It Li HW_MACHINE 205The machine class. 206.It Li HW_MODEL 207The machine model 208.It Li HW_NCPU 209The number of cpus. 210.It Li HW_BYTEORDER 211The byteorder (4,321, or 1,234). 212.It Li HW_PHYSMEM 213The bytes of physical memory. 214.It Li HW_USERMEM 215The bytes of non-kernel memory. 216.It Li HW_PAGESIZE 217The software page size. 218.It Li HW_MACHINE_ARCH 219The machine cpu class. 220.\".It Fa HW_DISKNAMES 221.\".It Fa HW_DISKSTATS 222.El 223.Sh CTL_KERN 224The string and integer information available for the CTL_KERN level 225is detailed below. 226The changeable column shows whether a process with appropriate 227privilege may change the value. 228The types of data currently available are process information, 229system vnodes, the open file entries, routing table entries, 230virtual memory statistics, load average history, and clock rate 231information. 232.Bl -column "KERNXCHOWNXRESTRICTEDXXX" "struct clockrateXXX" -offset indent 233.It Sy Pa Second level name Type Changeable 234.It KERN\_ARGMAX integer no 235.It KERN\_AUTONICETIME integer yes 236.It KERN\_AUTONICEVAL integer yes 237.It KERN\_BOOTTIME struct timeval no 238.It KERN\_CHOWN\_RESTRICTED integer no 239.It KERN\_CLOCKRATE struct clockinfo no 240.It KERN\_DOMAINNAME string yes 241.It KERN\_FILE struct file no 242.It KERN\_HOSTID integer yes 243.It KERN\_HOSTNAME string yes 244.It KERN\_JOB\_CONTROL integer no 245.It KERN\_LINK\_MAX integer no 246.It KERN\_MAXFILES integer yes 247.It KERN\_MAXPARTITIONS integer no 248.It KERN\_MAXPROC integer yes 249.It KERN\_MAXVNODES integer yes 250.It KERN\_MAX\_CANON integer no 251.It KERN\_MAX\_INPUT integer no 252.It KERN\_MSGBUFSIZE integer no 253.It KERN\_NAME\_MAX integer no 254.It KERN\_NGROUPS integer no 255.It KERN\_NO\_TRUNC integer no 256.It KERN\_OSRELEASE string no 257.It KERN\_OSREV integer no 258.It KERN\_OSTYPE string no 259.It KERN\_PATH\_MAX integer no 260.It KERN\_PIPE\_BUF integer no 261.It KERN\_POSIX1 integer no 262.It KERN\_PROC struct proc no 263.It KERN\_PROF node not applicable 264.It KERN\_RAWPARTITION integer no 265.It KERN\_SAVED\_IDS integer no 266.It KERN\_SECURELVL integer raise only 267.It KERN\_VDISABLE integer no 268.It KERN\_VERSION string no 269.It KERN\_VNODE struct vnode no 270.El 271.Pp 272.Bl -tag -width "123456" 273.It Li KERN_ARGMAX 274The maximum bytes of argument to 275.Xr exec 2 . 276.It Li KERN_AUTONICETIME 277The number of seconds of cpu-time a non-root process may accumulate before 278having its priority lowered from the default to the value of KERN_AUTONICEVAL. 279If set to 0, automatic lowering of priority is not performed, and if set to -1 280all non-root processes are immediately lowered. 281.It Li KERN_AUTONICEVAL 282The priority assigned for automatically niced processes. 283.It Li KERN_BOOTTIME 284A 285.Va struct timeval 286structure is returned. 287This structure contains the time that the system was booted. 288.It Li KERN_CHOWN_RESTRICTED 289Return 1 if appropriate privileges are required for the 290.Xr chown 2 291system call, otherwise 0. 292.It Li KERN_CLOCKRATE 293A 294.Va struct clockinfo 295structure is returned. 296This structure contains the clock, statistics clock and profiling clock 297frequencies, the number of micro-seconds per hz tick, and the clock 298skew rate. 299.It Li KERN_DOMAINNAME 300Get or set the YP domain name. 301.It Li KERN_FILE 302Return the entire file table. 303The returned data consists of a single 304.Va struct filehead 305followed by an array of 306.Va struct file , 307whose size depends on the current number of such objects in the system. 308.It Li KERN_HOSTID 309Get or set the host id. 310.It Li KERN_HOSTNAME 311Get or set the hostname. 312.It Li KERN_JOB_CONTROL 313Return 1 if job control is available on this system, otherwise 0. 314.It Li KERN_LINK_MAX 315The maximum file link count. 316.It Li KERN_MAXFILES 317The maximum number of open files that may be open in the system. 318.It Li KERN_MAXPARTITIONS 319The maximum number of partitions allowed per disk. 320.It Li KERN_MAXPROC 321The maximum number of simultaneous processes the system will allow. 322.It Li KERN_MAXVNODES 323The maximum number of vnodes available on the system. 324.It Li KERN_MAX_CANON 325The maximum number of bytes in terminal canonical input line. 326.It Li KERN_MAX_INPUT 327The minimum maximum number of bytes for which space is available in 328a terminal input queue. 329.It Li KERN_MSGBUFSIZE 330The maximum number of characters that the kernel message buffer can hold. 331.It Li KERN_NAME_MAX 332The maximum number of bytes in a file name. 333.It Li KERN_NGROUPS 334The maximum number of supplemental groups. 335.It Li KERN_NO_TRUNC 336Return 1 if file names longer than KERN_NAME_MAX are truncated. 337.It Li KERN_OSRELEASE 338The system release string. 339.It Li KERN_OSREV 340The system revision string. 341.It Li KERN_OSTYPE 342The system type string. 343.It Li KERN_PATH_MAX 344The maximum number of bytes in a pathname. 345.It Li KERN_PIPE_BUF 346The maximum number of bytes which will be written atomically to a pipe. 347.It Li KERN_POSIX1 348The version of ISO/IEC 9945 (POSIX 1003.1) with which the system 349attempts to comply. 350.It Li KERN_PROC 351Return the entire process table, or a subset of it. 352An array of 353.Va struct kinfo_proc 354structures is returned, 355whose size depends on the current number of such objects in the system. 356The third and fourth level names are as follows: 357.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent 358.It Pa Third level name Fourth level is: 359.It KERN\_PROC\_ALL None 360.It KERN\_PROC\_PID A process ID 361.It KERN\_PROC\_PGRP A process group 362.It KERN\_PROC\_TTY A tty device 363.It KERN\_PROC\_UID A user ID 364.It KERN\_PROC\_RUID A real user ID 365.El 366.It Li KERN_PROF 367Return profiling information about the kernel. 368If the kernel is not compiled for profiling, 369attempts to retrieve any of the KERN_PROF values will 370fail with EOPNOTSUPP. 371The third level names for the string and integer profiling information 372is detailed below. 373The changeable column shows whether a process with appropriate 374privilege may change the value. 375.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent 376.It Sy Pa Third level name Type Changeable 377.It GPROF\_STATE integer yes 378.It GPROF\_COUNT u_short[\|] yes 379.It GPROF\_FROMS u_short[\|] yes 380.It GPROF\_TOS struct tostruct yes 381.It GPROF\_GMONPARAM struct gmonparam no 382.El 383.Pp 384The variables are as follows: 385.Bl -tag -width "123456" 386.It Li GPROF_STATE 387Returns GMON_PROF_ON or GMON_PROF_OFF to show that profiling 388is running or stopped. 389.It Li GPROF_COUNT 390Array of statistical program counter counts. 391.It Li GPROF_FROMS 392Array indexed by program counter of call-from points. 393.It Li GPROF_TOS 394Array of 395.Va struct tostruct 396describing destination of calls and their counts. 397.It Li GPROF_GMONPARAM 398Structure giving the sizes of the above arrays. 399.El 400.It Li KERN_RAWPARTITION 401The raw partition of a disk (a == 0). 402.It Li KERN_SAVED_IDS 403Returns 1 if saved set-group and saved set-user ID is available. 404.It Li KERN_SECURELVL 405The system security level. 406This level may be raised by processes with appropriate privilege. 407It may only be lowered by process 1. 408.It Li KERN_VDISABLE 409Returns the terminal character disabling value. 410.It Li KERN_VERSION 411The system version string. 412.It Li KERN_VNODE 413Return the entire vnode table. 414Note, the vnode table is not necessarily a consistent snapshot of 415the system. 416The returned data consists of an array whose size depends on the 417current number of such objects in the system. 418Each element of the array contains the kernel address of a vnode 419.Va struct vnode * 420followed by the vnode itself 421.Va struct vnode . 422.El 423.Sh CTL_MACHDEP 424The set of variables defined is architecture dependent. 425Most architectures define at least the following variables. 426.Bl -column "CONSOLE_DEVICEXXX" "integerXXX" -offset indent 427.It Sy Pa Second level name Type Changeable 428.It Li CPU_CONSDEV dev_t no 429.El 430.Sh CTL_NET 431The string and integer information available for the CTL_NET level 432is detailed below. 433The changeable column shows whether a process with appropriate 434privilege may change the value. 435.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent 436.It Sy Pa Second level name Type Changeable 437.It PF\_ROUTE routing messages no 438.It PF\_INET internet values yes 439.El 440.Pp 441.Bl -tag -width "123456" 442.It Li PF_ROUTE 443Return the entire routing table or a subset of it. 444The data is returned as a sequence of routing messages (see 445.Xr route 4 446for the header file, format and meaning). 447The length of each message is contained in the message header. 448.Pp 449The third level name is a protocol number, which is currently always 0. 450The fourth level name is an address family, which may be set to 0 to 451select all address families. 452The fifth and sixth level names are as follows: 453.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent 454.It Pa Fifth level name Sixth level is: 455.It NET\_RT\_FLAGS rtflags 456.It NET\_RT\_DUMP None 457.It NET\_RT\_IFLIST None 458.El 459.It Li PF_INET 460Get or set various global information about the internet protocols. 461The third level name is the protocol. 462The fourth level name is the variable name. 463The currently defined protocols and names are: 464.Bl -column "Protocol name" "Variable nameXX" "integer" "yes" -offset indent 465.It Pa Protocol name Variable name Type Changeable 466.It ip forwarding integer yes 467.It ip redirect integer yes 468.It ip ttl integer yes 469.It ip forwsrcrt integer yes 470.It ip directed-broadcast integer yes 471.It icmp maskrepl integer yes 472.It tcp rfc1323 integer yes 473.It tcp sendspace integer yes 474.It tcp recvspace integer yes 475.It tcp syn_cache_limit integer yes 476.It tcp syn_bucket_limit integer yes 477.It tcp syn_cache_interval integer yes 478.It udp checksum integer yes 479.It udp sendspace integer yes 480.It udp recvspace integer yes 481.El 482.Pp 483The variables are as follows: 484.Bl -tag -width "123456" 485.It Li ip.forwarding 486Returns 1 when IP forwarding is enabled for the host, 487meaning that the host is acting as a router. 488.It Li ip.redirect 489Returns 1 when ICMP redirects may be sent by the host. 490This option is ignored unless the host is routing IP packets, 491and should normally be enabled on all systems. 492.It Li ip.ttl 493The maximum time-to-live (hop count) value for an IP packet sourced by 494the system. 495This value applies to normal transport protocols, not to ICMP. 496.It Li ip.forwsrcrt 497Returns 1 when forwarding of source-routed packets is enabled for 498the host. This value may only be changed if the kernel security 499level is less than 1. 500.It Li ip.directed-broadcast 501Returns 1 if directed broadcast behavior is enabled for the host. 502.It Li icmp.maskrepl 503Returns 1 if ICMP network mask requests are to be answered. 504.It Li tcp.rfc1323 505Returns 1 if RFC1323 extensions to TCP are enabled. 506.It Li tcp.sendspace 507Returns the default TCP send buffer size. 508.It Li tcp.recvspace 509Returns the default TCP receive buffer size. 510.It Li tcp.syn_cache_limit 511Returns the maximum number of entries allowed in the TCP compressed state 512engine. 513.It Li tcp.syn_bucket_limit 514Returns the maximum number of entries allowed per hash bucket in the TCP 515compressed state engine. 516.It Li tcp.syn_cache_interval 517Returns the TCP compressed state engine's timer interval. 518.It Li udp.checksum 519Returns 1 when UDP checksums are being computed and checked. 520Disabling UDP checksums is strongly discouraged. 521.It Li udp.sendspace 522Returns the default UDP send buffer size. 523.It Li udp.recvspace 524Returns the default UDP receive buffer size. 525.El 526.Sh CTL_USER 527The string and integer information available for the CTL_USER level 528is detailed below. 529The changeable column shows whether a process with appropriate 530privilege may change the value. 531.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent 532.It Sy Pa Second level name Type Changeable 533.It USER\_BC\_BASE\_MAX integer no 534.It USER\_BC\_DIM\_MAX integer no 535.It USER\_BC\_SCALE\_MAX integer no 536.It USER\_BC\_STRING\_MAX integer no 537.It USER\_COLL\_WEIGHTS\_MAX integer no 538.It USER\_CS\_PATH string no 539.It USER\_EXPR\_NEST\_MAX integer no 540.It USER\_LINE\_MAX integer no 541.It USER\_POSIX2\_CHAR\_TERM integer no 542.It USER\_POSIX2\_C\_BIND integer no 543.It USER\_POSIX2\_C\_DEV integer no 544.It USER\_POSIX2\_FORT\_DEV integer no 545.It USER\_POSIX2\_FORT\_RUN integer no 546.It USER\_POSIX2\_LOCALEDEF integer no 547.It USER\_POSIX2\_SW\_DEV integer no 548.It USER\_POSIX2\_UPE integer no 549.It USER\_POSIX2\_VERSION integer no 550.It USER\_RE\_DUP\_MAX integer no 551.It USER\_STREAM\_MAX integer no 552.It USER\_TZNAME\_MAX integer no 553.El 554.Bl -tag -width "123456" 555.Pp 556.It Li USER_BC_BASE_MAX 557The maximum ibase/obase values in the 558.Xr bc 1 559utility. 560.It Li USER_BC_DIM_MAX 561The maximum array size in the 562.Xr bc 1 563utility. 564.It Li USER_BC_SCALE_MAX 565The maximum scale value in the 566.Xr bc 1 567utility. 568.It Li USER_BC_STRING_MAX 569The maximum string length in the 570.Xr bc 1 571utility. 572.It Li USER_COLL_WEIGHTS_MAX 573The maximum number of weights that can be assigned to any entry of 574the LC_COLLATE order keyword in the locale definition file. 575.It Li USER_CS_PATH 576Return a value for the 577.Ev PATH 578environment variable that finds all the standard utilities. 579.It Li USER_EXPR_NEST_MAX 580The maximum number of expressions that can be nested within 581parenthesis by the 582.Xr expr 1 583utility. 584.It Li USER_LINE_MAX 585The maximum length in bytes of a text-processing utility's input 586line. 587.It Li USER_POSIX2_CHAR_TERM 588Return 1 if the system supports at least one terminal type capable of 589all operations described in POSIX 1003.2, otherwise 0. 590.It Li USER_POSIX2_C_BIND 591Return 1 if the system's C-language development facilities support the 592C-Language Bindings Option, otherwise 0. 593.It Li USER_POSIX2_C_DEV 594Return 1 if the system supports the C-Language Development Utilities Option, 595otherwise 0. 596.It Li USER_POSIX2_FORT_DEV 597Return 1 if the system supports the FORTRAN Development Utilities Option, 598otherwise 0. 599.It Li USER_POSIX2_FORT_RUN 600Return 1 if the system supports the FORTRAN Runtime Utilities Option, 601otherwise 0. 602.It Li USER_POSIX2_LOCALEDEF 603Return 1 if the system supports the creation of locales, otherwise 0. 604.It Li USER_POSIX2_SW_DEV 605Return 1 if the system supports the Software Development Utilities Option, 606otherwise 0. 607.It Li USER_POSIX2_UPE 608Return 1 if the system supports the User Portability Utilities Option, 609otherwise 0. 610.It Li USER_POSIX2_VERSION 611The version of POSIX 1003.2 with which the system attempts to comply. 612.It Li USER_RE_DUP_MAX 613The maximum number of repeated occurrences of a regular expression 614permitted when using interval notation. 615.It Li USER_STREAM_MAX 616The minimum maximum number of streams that a process may have open 617at any one time. 618.It Li USER_TZNAME_MAX 619The minimum maximum number of types supported for the name of a 620timezone. 621.El 622.Sh CTL_VM 623The string and integer information available for the CTL_VM level 624is detailed below. 625The changeable column shows whether a process with appropriate 626privilege may change the value. 627.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent 628.It Sy Pa Second level name Type Changeable 629.It VM\_LOADAVG struct loadavg no 630.It VM\_METER struct vmtotal no 631.El 632.Pp 633.Bl -tag -width "123456" 634.It Li VM_LOADAVG 635Return the load average history. 636The returned data consists of a 637.Va struct loadavg . 638.It Li VM_METER 639Return the system wide virtual memory statistics. 640The returned data consists of a 641.Va struct vmtotal . 642.El 643.Sh CTL_DDB 644The integer information available for the CTL_DDB level is detailed below. 645The changeable column shows whether a process with appropriate 646privilege may change the value. 647.Bl -column "DBCTL_TABSTOPSXXX" "integerXXX" -offset indent 648.It Sy Pa Second level name Type Changeable 649.It DBCTL\_RADIX integer yes 650.It DBCTL\_MAXOFF integer yes 651.It DBCTL\_LINES integer yes 652.It DBCTL\_TABSTOPS integer yes 653.It DBCTL\_ONPANIC integer yes 654.El 655.Pp 656.Bl -tag -width "123456" 657.It Li DBCTL_RADIX 658The input and output radix. 659.It Li DBCTL_MAXOFF 660The maximum symbol offset. 661.It Li DBCTL_LINES 662Number of display lines. 663.It Li DBCTL_TABSTOPS 664Tab width. 665.It Li DBCTL_ONPANIC 666If non-zero, DDB will be entered when the kernel panics. 667.El 668.Pp 669These MIB nodes are also available as variables from within the 670DDB. See 671.Xr ddb 4 672for more details. 673.Sh RETURN VALUES 674If the call to 675.Nm sysctl 676is successful, 0 is returned. 677Otherwise \-1 is returned and 678.Va errno 679is set appropriately. 680.Sh ERRORS 681The following errors may be reported: 682.Bl -tag -width Er 683.It Bq Er EFAULT 684The buffer 685.Fa name , 686.Fa oldp , 687.Fa newp , 688or length pointer 689.Fa oldlenp 690contains an invalid address. 691.It Bq Er EINVAL 692The 693.Fa name 694array is less than two or greater than CTL_MAXNAME. 695.It Bq Er EINVAL 696A non-null 697.Fa newp 698is given and its specified length in 699.Fa newlen 700is too large or too small. 701.It Bq Er ENOMEM 702The length pointed to by 703.Fa oldlenp 704is too short to hold the requested value. 705.It Bq Er ENOTDIR 706The 707.Fa name 708array specifies an intermediate rather than terminal name. 709.It Bq Er EOPNOTSUPP 710The 711.Fa name 712array specifies a value that is unknown. 713.It Bq Er EPERM 714An attempt is made to set a read-only value. 715.It Bq Er EPERM 716A process without appropriate privilege attempts to set a value. 717.It Bq Er EPERM 718An attempt to change a value protected by the current kernel security 719level is made. 720.El 721.Sh FILES 722.Bl -tag -width <netinet/icmpXvar.h> -compact 723.It Pa <sys/sysctl.h> 724definitions for top level identifiers, second level kernel and hardware 725identifiers, and user level identifiers 726.It Pa <sys/socket.h> 727definitions for second level network identifiers 728.It Pa <sys/gmon.h> 729definitions for third level profiling identifiers 730.It Pa <vm/vm_param.h> 731definitions for second level virtual memory identifiers 732.It Pa <netinet/in.h> 733definitions for third level Internet identifiers and 734fourth level IP identifiers 735.It Pa <netinet/icmp_var.h> 736definitions for fourth level ICMP identifiers 737.It Pa <netinet/tcp_var.h> 738definitions for fourth level TCP identifiers 739.It Pa <netinet/udp_var.h> 740definitions for fourth level UDP identifiers 741.El 742.Sh SEE ALSO 743.Xr sysctl 8 744.Sh HISTORY 745The 746.Nm sysctl 747function first appeared in 4.4BSD. 748