1.\" Copyright (c) 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 33.\" 34.Dd May 9, 1995 35.Dt SYSCTL 3 36.Os 37.Sh NAME 38.Nm sysctl , 39.Nm sysctlbyname 40.Nd get or set system information 41.Sh SYNOPSIS 42.Fd #include <sys/types.h> 43.Fd #include <sys/sysctl.h> 44.Ft int 45.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" 46.Ft int 47.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" 48.Sh DESCRIPTION 49The 50.Fn sysctl 51function retrieves system information and allows processes with 52appropriate privileges to set system information. 53The information available from 54.Fn sysctl 55consists of integers, strings, and tables. 56Information may be retrieved and set from the command interface 57using the 58.Xr sysctl 8 59utility. 60.Pp 61Unless explicitly noted below, 62.Fn sysctl 63returns a consistent snapshot of the data requested. 64Consistency is obtained by locking the destination 65buffer into memory so that the data may be copied out without blocking. 66Calls to 67.Fn sysctl 68are serialized to avoid deadlock. 69.Pp 70The state is described using a ``Management Information Base'' (MIB) 71style name, listed in 72.Fa name , 73which is a 74.Fa namelen 75length array of integers. 76.Pp 77The 78.Fn sysctlbyname 79function accepts an ascii representation of the name and internally 80looks up the integer name vector. Apart from that, it behaves the same 81as the standard 82.Fn sysctl 83function. 84.Pp 85The information is copied into the buffer specified by 86.Fa oldp . 87The size of the buffer is given by the location specified by 88.Fa oldlenp 89before the call, 90and that location gives the amount of data copied after a successful call 91and after a call that returns with the error code ENOMEM. 92If the amount of data available is greater 93than the size of the buffer supplied, 94the call supplies as much data as fits in the buffer provided 95and returns with the error code ENOMEM. 96If the old value is not desired, 97.Fa oldp 98and 99.Fa oldlenp 100should be set to NULL. 101.Pp 102The size of the available data can be determined by calling 103.Fn sysctl 104with a NULL parameter for 105.Fa oldp . 106The size of the available data will be returned in the location pointed to by 107.Fa oldlenp . 108For some operations, the amount of space may change often. 109For these operations, 110the system attempts to round up so that the returned size is 111large enough for a call to return the data shortly thereafter. 112.Pp 113To set a new value, 114.Fa newp 115is set to point to a buffer of length 116.Fa newlen 117from which the requested value is to be taken. 118If a new value is not to be set, 119.Fa newp 120should be set to NULL and 121.Fa newlen 122set to 0. 123.Pp 124The top level names are defined with a CTL_ prefix in 125.Pa <sys/sysctl.h> , 126and are as follows. 127The next and subsequent levels down are found in the include files 128listed here, and described in separate sections below. 129.Pp 130.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent 131.It Sy Pa Name Next level names Description 132.It CTL\_DEBUG sys/sysctl.h Debugging 133.It CTL\_VFS sys/mount.h Filesystem 134.It CTL\_HW sys/sysctl.h Generic CPU, I/O 135.It CTL\_KERN sys/sysctl.h High kernel limits 136.It CTL\_MACHDEP sys/sysctl.h Machine dependent 137.It CTL\_NET sys/socket.h Networking 138.It CTL\_USER sys/sysctl.h User-level 139.It CTL\_VM vm/vm_param.h Virtual memory 140.El 141.Pp 142For example, the following retrieves the maximum number of processes allowed 143in the system: 144.Pp 145.Bd -literal -offset indent -compact 146int mib[2], maxproc; 147size_t len; 148 149mib[0] = CTL_KERN; 150mib[1] = KERN_MAXPROC; 151len = sizeof(maxproc); 152sysctl(mib, 2, &maxproc, &len, NULL, 0); 153.Ed 154.Pp 155To retrieve the standard search path for the system utilities: 156.Pp 157.Bd -literal -offset indent -compact 158int mib[2]; 159size_t len; 160char *p; 161 162mib[0] = CTL_USER; 163mib[1] = USER_CS_PATH; 164sysctl(mib, 2, NULL, &len, NULL, 0); 165p = malloc(len); 166sysctl(mib, 2, p, &len, NULL, 0); 167.Ed 168.Sh CTL_DEBUG 169The debugging variables vary from system to system. 170A debugging variable may be added or deleted without need to recompile 171.Fn sysctl 172to know about it. 173Each time it runs, 174.Fn sysctl 175gets the list of debugging variables from the kernel and 176displays their current values. 177The system defines twenty 178.Ns ( Va struct ctldebug ) 179variables named 180.Nm debug0 181through 182.Nm debug19 . 183They are declared as separate variables so that they can be 184individually initialized at the location of their associated variable. 185The loader prevents multiple use of the same variable by issuing errors 186if a variable is initialized in more than one place. 187For example, to export the variable 188.Nm dospecialcheck 189as a debugging variable, the following declaration would be used: 190.Bd -literal -offset indent -compact 191int dospecialcheck = 1; 192struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck }; 193.Ed 194.Sh CTL_VFS 195A distinguished second level name, VFS_GENERIC, 196is used to get general information about all filesystems. 197One of its third level identifiers is VFS_MAXTYPENUM 198that gives the highest valid filesystem type number. 199Its other third level identifier is VFS_CONF that 200returns configuration information about the filesystem 201type given as a fourth level identifier (see 202.Xr getvfsbyname 3 203as an example of its use). 204The remaining second level identifiers are the 205filesystem type number returned by a 206.Xr statfs 2 207call or from VFS_CONF. 208The third level identifiers available for each filesystem 209are given in the header file that defines the mount 210argument structure for that filesystem. 211.Sh CTL_HW 212The string and integer information available for the CTL_HW level 213is detailed below. 214The changeable column shows whether a process with appropriate 215privilege may change the value. 216.Bl -column "Second level nameXXXXXX" integerXXX -offset indent 217.It Sy Pa Second level name Type Changeable 218.It HW\_MACHINE string no 219.It HW\_MODEL string no 220.It HW\_NCPU integer no 221.It HW\_BYTEORDER integer no 222.It HW\_PHYSMEM integer no 223.It HW\_USERMEM integer no 224.It HW\_PAGESIZE integer no 225.It HW\_FLOATINGPOINT integer no 226.It HW\_MACHINE\_ARCH string no 227.\".It HW\_DISKNAMES integer no 228.\".It HW\_DISKSTATS integer no 229.El 230.Pp 231.Bl -tag -width "123456" 232.It Li HW_MACHINE 233The machine class. 234.It Li HW_MODEL 235The machine model 236.It Li HW_NCPU 237The number of cpus. 238.ne 1i 239.It Li HW_BYTEORDER 240The byteorder (4,321, or 1,234). 241.It Li HW_PHYSMEM 242The bytes of physical memory. 243.It Li HW_USERMEM 244The bytes of non-kernel memory. 245.It Li HW_PAGESIZE 246The software page size. 247.It Li HW_FLOATINGPOINT 248Nonzero if the floating point support is in hardware. 249.It Li HW_MACHINE_ARCH 250The machine dependent architecture type. 251.\".It Fa HW_DISKNAMES 252.\".It Fa HW_DISKSTATS 253.El 254.Sh CTL_KERN 255The string and integer information available for the CTL_KERN level 256is detailed below. 257The changeable column shows whether a process with appropriate 258privilege may change the value. 259The types of data currently available are process information, 260system vnodes, the open file entries, routing table entries, 261virtual memory statistics, load average history, and clock rate 262information. 263.Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent 264.It Sy Pa Second level name Type Changeable 265.It KERN\_ARGMAX integer no 266.It KERN\_BOOTFILE string yes 267.It KERN\_BOOTTIME struct timeval no 268.It KERN\_CLOCKRATE struct clockinfo no 269.It KERN\_FILE struct file no 270.It KERN\_HOSTID integer yes 271.It KERN\_HOSTNAME string yes 272.It KERN\_JOB\_CONTROL integer no 273.It KERN\_MAXFILES integer yes 274.It KERN\_MAXFILESPERPROC integer yes 275.It KERN\_MAXPROC integer yes 276.It KERN\_MAXPROCPERUID integer yes 277.It KERN\_MAXVNODES integer yes 278.It KERN\_NGROUPS integer no 279.It KERN\_NISDOMAINNAME string yes 280.It KERN\_OSRELDATE integer no 281.It KERN\_OSRELEASE string no 282.It KERN\_OSREV integer no 283.It KERN\_OSTYPE string no 284.It KERN\_POSIX1 integer no 285.It KERN\_PROC struct proc no 286.It KERN\_PROF node not applicable 287.It KERN\_SAVED\_IDS integer no 288.It KERN\_SECURELVL integer raise only 289.It KERN\_UPDATEINTERVAL integer no 290.It KERN\_VERSION string no 291.It KERN\_VNODE struct vnode no 292.El 293.ne 1i 294.Pp 295.Bl -tag -width "123456" 296.It Li KERN_ARGMAX 297The maximum bytes of argument to 298.Xr execve 2 . 299.It Li KERN_BOOTFILE 300The full pathname of the file from which the kernel was loaded. 301.It Li KERN_BOOTTIME 302A 303.Va struct timeval 304structure is returned. 305This structure contains the time that the system was booted. 306.It Li KERN_CLOCKRATE 307A 308.Va struct clockinfo 309structure is returned. 310This structure contains the clock, statistics clock and profiling clock 311frequencies, the number of micro-seconds per hz tick and the skew rate. 312.It Li KERN_FILE 313Return the entire file table. 314The returned data consists of a single 315.Va struct filehead 316followed by an array of 317.Va struct file , 318whose size depends on the current number of such objects in the system. 319.It Li KERN_HOSTID 320Get or set the host id. 321.It Li KERN_HOSTNAME 322Get or set the hostname. 323.It Li KERN_JOB_CONTROL 324Return 1 if job control is available on this system, otherwise 0. 325.It Li KERN_MAXFILES 326The maximum number of files that may be open in the system. 327.It Li KERN_MAXFILESPERPROC 328The maximum number of files that may be open for a single process. 329This limit only applies to processes with an effective uid of nonzero 330at the time of the open request. 331Files that have already been opened are not affected if the limit 332or the effective uid is changed. 333.It Li KERN_MAXPROC 334The maximum number of concurrent processes the system will allow. 335.It Li KERN_MAXPROCPERUID 336The maximum number of concurrent processes the system will allow 337for a single effective uid. 338This limit only applies to processes with an effective uid of nonzero 339at the time of a fork request. 340Processes that have already been started are not affected if the limit 341is changed. 342.It Li KERN_MAXVNODES 343The maximum number of vnodes available on the system. 344.It Li KERN_NGROUPS 345The maximum number of supplemental groups. 346.It Li KERN_NISDOMAINNAME 347The name of the current YP/NIS domain. 348.It Li KERN_OSRELDATE 349The system release date in YYYYMM format 350(January 1996 is encoded as 199601). 351.It Li KERN_OSRELEASE 352The system release string. 353.It Li KERN_OSREV 354The system revision string. 355.It Li KERN_OSTYPE 356The system type string. 357.It Li KERN_POSIX1 358The version of ISO/IEC 9945 (POSIX 1003.1) with which the system 359attempts to comply. 360.It Li KERN_PROC 361Return the entire process table, or a subset of it. 362An array of 363.Va struct kinfo_proc 364structures is returned, 365whose size depends on the current number of such objects in the system. 366The third and fourth level names are as follows: 367.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent 368.It Pa Third level name Fourth level is: 369.It KERN\_PROC\_ALL None 370.It KERN\_PROC\_PID A process ID 371.It KERN\_PROC\_PGRP A process group 372.It KERN\_PROC\_TTY A tty device 373.It KERN\_PROC\_UID A user ID 374.It KERN\_PROC\_RUID A real user ID 375.El 376.It Li KERN_PROF 377Return profiling information about the kernel. 378If the kernel is not compiled for profiling, 379attempts to retrieve any of the KERN_PROF values will 380fail with EOPNOTSUPP. 381The third level names for the string and integer profiling information 382is detailed below. 383The changeable column shows whether a process with appropriate 384privilege may change the value. 385.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent 386.It Sy Pa Third level name Type Changeable 387.It GPROF\_STATE integer yes 388.It GPROF\_COUNT u_short[\|] yes 389.It GPROF\_FROMS u_short[\|] yes 390.It GPROF\_TOS struct tostruct yes 391.It GPROF\_GMONPARAM struct gmonparam no 392.El 393.Pp 394The variables are as follows: 395.Bl -tag -width "123456" 396.It Li GPROF_STATE 397Returns GMON_PROF_ON or GMON_PROF_OFF to show that profiling 398is running or stopped. 399.It Li GPROF_COUNT 400Array of statistical program counter counts. 401.It Li GPROF_FROMS 402Array indexed by program counter of call-from points. 403.It Li GPROF_TOS 404Array of 405.Va struct tostruct 406describing destination of calls and their counts. 407.It Li GPROF_GMONPARAM 408Structure giving the sizes of the above arrays. 409.El 410.ne 1i 411.It Li KERN_SAVED_IDS 412Returns 1 if saved set-group and saved set-user ID is available. 413.It Li KERN_SECURELVL 414The system security level. 415This level may be raised by processes with appropriate privilege. 416It may only be lowered by process 1. 417.It Li KERN_VERSION 418The system version string. 419.It Li KERN_VNODE 420Return the entire vnode table. 421Note, the vnode table is not necessarily a consistent snapshot of 422the system. 423The returned data consists of an array whose size depends on the 424current number of such objects in the system. 425Each element of the array contains the kernel address of a vnode 426.Va struct vnode * 427followed by the vnode itself 428.Va struct vnode . 429.It Li KERN_UPDATEINTERVAL 430The interval between 431.Xr sync 2 432calls in the 433.Xr update 4 434process. 435.El 436.Sh CTL_MACHDEP 437The set of variables defined is architecture dependent. 438The following variables are defined for the i386 architecture. 439.Bl -column "CONSOLE_DEVICEXXX" "struct bootinfoXXX" -offset indent 440.It Sy Pa Second level name Type Changeable 441.It Li CPU_CONSDEV dev_t no 442.It Li CPU_ADJKERNTZ int yes 443.It Li CPU_DISRTCSET int yes 444.It Li CPU_BOOTINFO struct bootinfo no 445.It Li CPU_WALLCLOCK int yes 446.El 447.Sh CTL_NET 448The string and integer information available for the CTL_NET level 449is detailed below. 450The changeable column shows whether a process with appropriate 451privilege may change the value. 452.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent 453.It Sy Pa Second level name Type Changeable 454.It PF\_ROUTE routing messages no 455.It PF\_INET internet values yes 456.El 457.Pp 458.Bl -tag -width "123456" 459.It Li PF_ROUTE 460Return the entire routing table or a subset of it. 461The data is returned as a sequence of routing messages (see 462.Xr route 4 463for the header file, format and meaning). 464The length of each message is contained in the message header. 465.Pp 466The third level name is a protocol number, which is currently always 0. 467The fourth level name is an address family, which may be set to 0 to 468select all address families. 469The fifth and sixth level names are as follows: 470.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent 471.It Pa Fifth level name Sixth level is: 472.It NET\_RT\_FLAGS rtflags 473.It NET\_RT\_DUMP None 474.It NET\_RT\_IFLIST None 475.El 476.It Li PF_INET 477Get or set various global information about the internet protocols. 478The third level name is the protocol. 479The fourth level name is the variable name. 480The currently defined protocols and names are: 481.ne 1i 482.Bl -column "Protocol nameXXXXXX" "Variable nameXXX" "integerXXX" -offset indent 483.It Pa Protocol name Variable name Type Changeable 484.It ip forwarding integer yes 485.It ip redirect integer yes 486.It ip ttl integer yes 487.It icmp maskrepl integer yes 488.It udp checksum integer yes 489.El 490.Pp 491The variables are as follows: 492.Bl -tag -width "123456" 493.It Li ip.forwarding 494Returns 1 when IP forwarding is enabled for the host, 495meaning that the host is acting as a router. 496.It Li ip.redirect 497Returns 1 when ICMP redirects may be sent by the host. 498This option is ignored unless the host is routing IP packets, 499and should normally be enabled on all systems. 500.It Li ip.ttl 501The maximum time-to-live (hop count) value for an IP packet sourced by 502the system. 503This value applies to normal transport protocols, not to ICMP. 504.It Li icmp.maskrepl 505Returns 1 if ICMP network mask requests are to be answered. 506.It Li udp.checksum 507Returns 1 when UDP checksums are being computed and checked. 508Disabling UDP checksums is strongly discouraged. 509.El 510.Sh CTL_USER 511The string and integer information available for the CTL_USER level 512is detailed below. 513The changeable column shows whether a process with appropriate 514privilege may change the value. 515.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent 516.It Sy Pa Second level name Type Changeable 517.It USER\_BC\_BASE\_MAX integer no 518.It USER\_BC\_DIM\_MAX integer no 519.It USER\_BC\_SCALE\_MAX integer no 520.It USER\_BC\_STRING\_MAX integer no 521.It USER\_COLL\_WEIGHTS\_MAX integer no 522.It USER\_CS\_PATH string no 523.It USER\_EXPR\_NEST\_MAX integer no 524.It USER\_LINE\_MAX integer no 525.It USER\_POSIX2\_CHAR\_TERM integer no 526.It USER\_POSIX2\_C\_BIND integer no 527.It USER\_POSIX2\_C\_DEV integer no 528.It USER\_POSIX2\_FORT\_DEV integer no 529.It USER\_POSIX2\_FORT\_RUN integer no 530.It USER\_POSIX2\_LOCALEDEF integer no 531.It USER\_POSIX2\_SW\_DEV integer no 532.It USER\_POSIX2\_UPE integer no 533.It USER\_POSIX2\_VERSION integer no 534.It USER\_RE\_DUP\_MAX integer no 535.It USER\_STREAM\_MAX integer no 536.It USER\_TZNAME\_MAX integer no 537.El 538.Bl -tag -width "123456" 539.Pp 540.It Li USER_BC_BASE_MAX 541The maximum ibase/obase values in the 542.Xr bc 1 543utility. 544.It Li USER_BC_DIM_MAX 545The maximum array size in the 546.Xr bc 1 547utility. 548.It Li USER_BC_SCALE_MAX 549The maximum scale value in the 550.Xr bc 1 551utility. 552.It Li USER_BC_STRING_MAX 553The maximum string length in the 554.Xr bc 1 555utility. 556.It Li USER_COLL_WEIGHTS_MAX 557The maximum number of weights that can be assigned to any entry of 558the LC_COLLATE order keyword in the locale definition file. 559.It Li USER_CS_PATH 560Return a value for the 561.Ev PATH 562environment variable that finds all the standard utilities. 563.It Li USER_EXPR_NEST_MAX 564The maximum number of expressions that can be nested within 565parenthesis by the 566.Xr expr 1 567utility. 568.It Li USER_LINE_MAX 569The maximum length in bytes of a text-processing utility's input 570line. 571.It Li USER_POSIX2_CHAR_TERM 572Return 1 if the system supports at least one terminal type capable of 573all operations described in POSIX 1003.2, otherwise 0. 574.It Li USER_POSIX2_C_BIND 575Return 1 if the system's C-language development facilities support the 576C-Language Bindings Option, otherwise 0. 577.It Li USER_POSIX2_C_DEV 578Return 1 if the system supports the C-Language Development Utilities Option, 579otherwise 0. 580.It Li USER_POSIX2_FORT_DEV 581Return 1 if the system supports the FORTRAN Development Utilities Option, 582otherwise 0. 583.It Li USER_POSIX2_FORT_RUN 584Return 1 if the system supports the FORTRAN Runtime Utilities Option, 585otherwise 0. 586.It Li USER_POSIX2_LOCALEDEF 587Return 1 if the system supports the creation of locales, otherwise 0. 588.It Li USER_POSIX2_SW_DEV 589Return 1 if the system supports the Software Development Utilities Option, 590otherwise 0. 591.It Li USER_POSIX2_UPE 592Return 1 if the system supports the User Portability Utilities Option, 593otherwise 0. 594.It Li USER_POSIX2_VERSION 595The version of POSIX 1003.2 with which the system attempts to comply. 596.It Li USER_RE_DUP_MAX 597The maximum number of repeated occurrences of a regular expression 598permitted when using interval notation. 599.ne 1i 600.It Li USER_STREAM_MAX 601The minimum maximum number of streams that a process may have open 602at any one time. 603.It Li USER_TZNAME_MAX 604The minimum maximum number of types supported for the name of a 605timezone. 606.El 607.Sh CTL_VM 608The string and integer information available for the CTL_VM level 609is detailed below. 610The changeable column shows whether a process with appropriate 611privilege may change the value. 612.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent 613.It Sy Pa Second level name Type Changeable 614.It VM\_LOADAVG struct loadavg no 615.It VM\_METER struct vmtotal no 616.El 617.Pp 618.Bl -tag -width "123456" 619.It Li VM_LOADAVG 620Return the load average history. 621The returned data consists of a 622.Va struct loadavg . 623.It Li VM_METER 624Return the system wide virtual memory statistics. 625The returned data consists of a 626.Va struct vmtotal . 627.El 628.Sh RETURN VALUES 629If the call to 630.Fn sysctl 631is successful, the number of bytes copied out is returned. 632Otherwise \-1 is returned and 633.Va errno 634is set appropriately. 635.Sh ERRORS 636The following errors may be reported: 637.Bl -tag -width Er 638.It Bq Er EFAULT 639The buffer 640.Fa name , 641.Fa oldp , 642.Fa newp , 643or length pointer 644.Fa oldlenp 645contains an invalid address. 646.It Bq Er EINVAL 647The 648.Fa name 649array is less than two or greater than CTL_MAXNAME. 650.It Bq Er EINVAL 651A non-null 652.Fa newp 653is given and its specified length in 654.Fa newlen 655is too large or too small. 656.It Bq Er ENOMEM 657The length pointed to by 658.Fa oldlenp 659is too short to hold the requested value. 660.It Bq Er ENOTDIR 661The 662.Fa name 663array specifies an intermediate rather than terminal name. 664.It Bq Er EOPNOTSUPP 665The 666.Fa name 667array specifies a value that is unknown. 668.It Bq Er EPERM 669An attempt is made to set a read-only value. 670.It Bq Er EPERM 671A process without appropriate privilege attempts to set a value. 672.El 673.Sh FILES 674.Bl -tag -width <netinet/icmpXvar.h> -compact 675.It Pa <sys/sysctl.h> 676definitions for top level identifiers, second level kernel and hardware 677identifiers, and user level identifiers 678.It Pa <sys/socket.h> 679definitions for second level network identifiers 680.It Pa <sys/gmon.h> 681definitions for third level profiling identifiers 682.It Pa <vm/vm_param.h> 683definitions for second level virtual memory identifiers 684.It Pa <netinet/in.h> 685definitions for third level Internet identifiers and 686fourth level IP identifiers 687.It Pa <netinet/icmp_var.h> 688definitions for fourth level ICMP identifiers 689.It Pa <netinet/udp_var.h> 690definitions for fourth level UDP identifiers 691.El 692.Sh SEE ALSO 693.Xr sysconf 3 , 694.Xr sysctl 3 695.Sh HISTORY 696The 697.Fn sysctl 698function first appeared in 699.Bx 4.4 . 700