.\" SUCH DAMAGE.
.\"
.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95
-.\" $FreeBSD: src/lib/libc/gen/sysctl.3,v 1.57 2002/12/19 09:40:21 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/sysctl.3,v 1.63 2004/07/02 23:52:10 ru Exp $
.\"
.Dd January 23, 2001
.Dt SYSCTL 3
The
.Fn sysctlbyname
function accepts an ASCII representation of the name and internally
-looks up the integer name vector. Apart from that, it behaves the same
+looks up the integer name vector.
+Apart from that, it behaves the same
as the standard
.Fn sysctl
function.
.Ed
.Pp
The top level names are defined with a CTL_ prefix in
-.Aq Pa sys/sysctl.h ,
+.In sys/sysctl.h ,
and are as follows.
The next and subsequent levels down are found in the include files
listed here, and described in separate sections below.
.Pp
.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
.It Sy "Name Next level names Description"
-.It "CTL\_DEBUG sys/sysctl.h Debugging"
-.It "CTL\_VFS sys/mount.h File system"
-.It "CTL\_HW sys/sysctl.h Generic CPU, I/O"
-.It "CTL\_KERN sys/sysctl.h High kernel limits"
-.It "CTL\_MACHDEP sys/sysctl.h Machine dependent"
-.It "CTL\_NET sys/socket.h Networking"
-.It "CTL\_USER sys/sysctl.h User-level"
-.It "CTL\_VM vm/vm_param.h Virtual memory"
+.It "CTL_DEBUG sys/sysctl.h Debugging"
+.It "CTL_VFS sys/mount.h File system"
+.It "CTL_HW sys/sysctl.h Generic CPU, I/O"
+.It "CTL_KERN sys/sysctl.h High kernel limits"
+.It "CTL_MACHDEP sys/sysctl.h Machine dependent"
+.It "CTL_NET sys/socket.h Networking"
+.It "CTL_USER sys/sysctl.h User-level"
+.It "CTL_VM vm/vm_param.h Virtual memory"
.El
.Pp
For example, the following retrieves the maximum number of processes allowed
privilege may change the value.
.Bl -column "Second level nameXXXXXX" integerXXX -offset indent
.It Sy "Second level name Type Changeable"
-.It "HW\_MACHINE string no"
-.It "HW\_MODEL string no"
-.It "HW\_NCPU integer no"
-.It "HW\_BYTEORDER integer no"
-.It "HW\_PHYSMEM integer no"
-.It "HW\_USERMEM integer no"
-.It "HW\_PAGESIZE integer no"
-.It "HW\_FLOATINGPOINT integer no"
-.It "HW\_MACHINE\_ARCH string no"
-.\".It "HW\_DISKNAMES integer no"
-.\".It "HW\_DISKSTATS integer no"
+.It "HW_MACHINE string no"
+.It "HW_MODEL string no"
+.It "HW_NCPU integer no"
+.It "HW_BYTEORDER integer no"
+.It "HW_PHYSMEM integer no"
+.It "HW_USERMEM integer no"
+.It "HW_PAGESIZE integer no"
+.It "HW_FLOATINGPOINT integer no"
+.It "HW_MACHINE_ARCH string no"
+.\".It "HW_DISKNAMES integer no"
+.\".It "HW_DISKSTATS integer no"
.El
.Pp
.Bl -tag -width 6n
information.
.Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent
.It Sy "Second level name Type Changeable"
-.It "KERN\_ARGMAX integer no"
-.It "KERN\_BOOTFILE string yes"
-.It "KERN\_BOOTTIME struct timeval no"
-.It "KERN\_CLOCKRATE struct clockinfo no"
-.It "KERN\_FILE struct file no"
-.It "KERN\_HOSTID integer yes"
-.It "KERN\_HOSTNAME string yes"
-.It "KERN\_JOB\_CONTROL integer no"
-.It "KERN\_MAXFILES integer yes"
-.It "KERN\_MAXFILESPERPROC integer yes"
-.It "KERN\_MAXPROC integer no"
-.It "KERN\_MAXPROCPERUID integer yes"
-.It "KERN\_MAXVNODES integer yes"
-.It "KERN\_NGROUPS integer no"
-.It "KERN\_NISDOMAINNAME string yes"
-.It "KERN\_OSRELDATE integer no"
-.It "KERN\_OSRELEASE string no"
-.It "KERN\_OSREV integer no"
-.It "KERN\_OSTYPE string no"
-.It "KERN\_POSIX1 integer no"
-.It "KERN\_PROC struct proc no"
-.It "KERN\_PROF node not applicable"
-.It "KERN\_QUANTUM integer yes"
-.It "KERN\_SAVED\_IDS integer no"
-.It "KERN\_SECURELVL integer raise only"
-.It "KERN\_UPDATEINTERVAL integer no"
-.It "KERN\_VERSION string no"
-.It "KERN\_VNODE struct vnode no"
+.It "KERN_ARGMAX integer no"
+.It "KERN_BOOTFILE string yes"
+.It "KERN_BOOTTIME struct timeval no"
+.It "KERN_CLOCKRATE struct clockinfo no"
+.It "KERN_FILE struct file no"
+.It "KERN_HOSTID integer yes"
+.It "KERN_HOSTNAME string yes"
+.It "KERN_JOB_CONTROL integer no"
+.It "KERN_MAXFILES integer yes"
+.It "KERN_MAXFILESPERPROC integer yes"
+.It "KERN_MAXPROC integer no"
+.It "KERN_MAXPROCPERUID integer yes"
+.It "KERN_MAXVNODES integer yes"
+.It "KERN_NGROUPS integer no"
+.It "KERN_NISDOMAINNAME string yes"
+.It "KERN_OSRELDATE integer no"
+.It "KERN_OSRELEASE string no"
+.It "KERN_OSREV integer no"
+.It "KERN_OSTYPE string no"
+.It "KERN_POSIX1 integer no"
+.It "KERN_PROC struct proc no"
+.It "KERN_PROF node not applicable"
+.It "KERN_QUANTUM integer yes"
+.It "KERN_SAVED_IDS integer no"
+.It "KERN_SECURELVL integer raise only"
+.It "KERN_UPDATEINTERVAL integer no"
+.It "KERN_VERSION string no"
+.It "KERN_VNODE struct vnode no"
.El
.Pp
.Bl -tag -width 6n
.It Li KERN_NISDOMAINNAME
The name of the current YP/NIS domain.
.It Li KERN_OSRELDATE
-The system release date in YYYYMM format
-(January 1996 is encoded as 199601).
+The kernel release version in the format
+.Ar M Ns Ar mm Ns Ar R Ns Ar xx ,
+where
+.Ar M
+is the major version,
+.Ar mm
+is the two digit minor version,
+.Ar R
+is 0 if release branch, otherwise 1,
+and
+.Ar xx
+is updated when the available APIs change.
+.Pp
+The userland release version is available from
+.In osreldate.h ;
+parse this file if you need to get the release version of
+the currently installed userland.
.It Li KERN_OSRELEASE
The system release string.
.It Li KERN_OSREV
The third and fourth level names are as follows:
.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
.It "Third level name Fourth level is:"
-.It "KERN\_PROC\_ALL None"
-.It "KERN\_PROC\_PID A process ID"
-.It "KERN\_PROC\_PGRP A process group"
-.It "KERN\_PROC\_TTY A tty device"
-.It "KERN\_PROC\_UID A user ID"
-.It "KERN\_PROC\_RUID A real user ID"
+.It "KERN_PROC_ALL None"
+.It "KERN_PROC_PID A process ID"
+.It "KERN_PROC_PGRP A process group"
+.It "KERN_PROC_TTY A tty device"
+.It "KERN_PROC_UID A user ID"
+.It "KERN_PROC_RUID A real user ID"
.El
.Pp
If the third level name is KERN_PROC_ARGS then the command line argument
-array is returned in a flattened form, i.e. zero-terminated arguments
+array is returned in a flattened form, i.e., zero-terminated arguments
follow each other.
The total size of array is returned.
It is also possible for a process to set its own process title this way.
.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
.It Sy "Third level name Fourth level is:"
-.It "KERN\_PROC\_ARGS A process ID"
+.It "KERN_PROC_ARGS A process ID"
.El
.It Li KERN_PROF
Return profiling information about the kernel.
privilege may change the value.
.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent
.It Sy "Third level name Type Changeable"
-.It "GPROF\_STATE integer yes"
-.It "GPROF\_COUNT u_short[\|] yes"
-.It "GPROF\_FROMS u_short[\|] yes"
-.It "GPROF\_TOS struct tostruct yes"
-.It "GPROF\_GMONPARAM struct gmonparam no"
+.It "GPROF_STATE integer yes"
+.It "GPROF_COUNT u_short[\|] yes"
+.It "GPROF_FROMS u_short[\|] yes"
+.It "GPROF_TOS struct tostruct yes"
+.It "GPROF_GMONPARAM struct gmonparam no"
.El
.Pp
The variables are as follows:
privilege may change the value.
.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
.It Sy "Second level name Type Changeable"
-.It "PF\_ROUTE routing messages no"
-.It "PF\_INET IPv4 values yes"
-.It "PF\_INET6 IPv6 values yes"
+.It "PF_ROUTE routing messages no"
+.It "PF_INET IPv4 values yes"
+.It "PF_INET6 IPv6 values yes"
.El
.Pp
.Bl -tag -width 6n
The fifth and sixth level names are as follows:
.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent
.It Sy "Fifth level name Sixth level is:"
-.It "NET\_RT\_FLAGS rtflags"
-.It "NET\_RT\_DUMP None"
-.It "NET\_RT\_IFLIST 0 or if_index"
+.It "NET_RT_FLAGS rtflags"
+.It "NET_RT_DUMP None"
+.It "NET_RT_IFLIST 0 or if_index"
+.It "NET_RT_IFMALIST 0 or if_index"
.El
+.Pp
+The
+.Dv NET_RT_IFMALIST
+name returns information about multicast group memberships on all interfaces
+if 0 is specified, or for the interface specified by
+.Va if_index .
.It Li PF_INET
Get or set various global information about the IPv4
(Internet Protocol version 4).
privilege may change the value.
.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent
.It Sy "Second level name Type Changeable"
-.It "USER\_BC\_BASE\_MAX integer no"
-.It "USER\_BC\_DIM\_MAX integer no"
-.It "USER\_BC\_SCALE\_MAX integer no"
-.It "USER\_BC\_STRING\_MAX integer no"
-.It "USER\_COLL\_WEIGHTS\_MAX integer no"
-.It "USER\_CS\_PATH string no"
-.It "USER\_EXPR\_NEST\_MAX integer no"
-.It "USER\_LINE\_MAX integer no"
-.It "USER\_POSIX2\_CHAR\_TERM integer no"
-.It "USER\_POSIX2\_C\_BIND integer no"
-.It "USER\_POSIX2\_C\_DEV integer no"
-.It "USER\_POSIX2\_FORT\_DEV integer no"
-.It "USER\_POSIX2\_FORT\_RUN integer no"
-.It "USER\_POSIX2\_LOCALEDEF integer no"
-.It "USER\_POSIX2\_SW\_DEV integer no"
-.It "USER\_POSIX2\_UPE integer no"
-.It "USER\_POSIX2\_VERSION integer no"
-.It "USER\_RE\_DUP\_MAX integer no"
-.It "USER\_STREAM\_MAX integer no"
-.It "USER\_TZNAME\_MAX integer no"
+.It "USER_BC_BASE_MAX integer no"
+.It "USER_BC_DIM_MAX integer no"
+.It "USER_BC_SCALE_MAX integer no"
+.It "USER_BC_STRING_MAX integer no"
+.It "USER_COLL_WEIGHTS_MAX integer no"
+.It "USER_CS_PATH string no"
+.It "USER_EXPR_NEST_MAX integer no"
+.It "USER_LINE_MAX integer no"
+.It "USER_POSIX2_CHAR_TERM integer no"
+.It "USER_POSIX2_C_BIND integer no"
+.It "USER_POSIX2_C_DEV integer no"
+.It "USER_POSIX2_FORT_DEV integer no"
+.It "USER_POSIX2_FORT_RUN integer no"
+.It "USER_POSIX2_LOCALEDEF integer no"
+.It "USER_POSIX2_SW_DEV integer no"
+.It "USER_POSIX2_UPE integer no"
+.It "USER_POSIX2_VERSION integer no"
+.It "USER_RE_DUP_MAX integer no"
+.It "USER_STREAM_MAX integer no"
+.It "USER_TZNAME_MAX integer no"
.El
.Bl -tag -width 6n
.Pp
privilege may change the value.
.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
.It Sy "Second level name Type Changeable"
-.It "VM\_LOADAVG struct loadavg no"
-.It "VM\_METER struct vmtotal no"
-.It "VM\_PAGEOUT\_ALGORITHM integer yes"
-.It "VM\_SWAPPING\_ENABLED integer maybe"
-.It "VM\_V\_CACHE\_MAX integer yes"
-.It "VM\_V\_CACHE\_MIN integer yes"
-.It "VM\_V\_FREE\_MIN integer yes"
-.It "VM\_V\_FREE\_RESERVED integer yes"
-.It "VM\_V\_FREE\_TARGET integer yes"
-.It "VM\_V\_INACTIVE\_TARGET integer yes"
-.It "VM\_V\_PAGEOUT\_FREE\_MIN integer yes"
+.It "VM_LOADAVG struct loadavg no"
+.It "VM_METER struct vmtotal no"
+.It "VM_PAGEOUT_ALGORITHM integer yes"
+.It "VM_SWAPPING_ENABLED integer maybe"
+.It "VM_V_CACHE_MAX integer yes"
+.It "VM_V_CACHE_MIN integer yes"
+.It "VM_V_FREE_MIN integer yes"
+.It "VM_V_FREE_RESERVED integer yes"
+.It "VM_V_FREE_TARGET integer yes"
+.It "VM_V_INACTIVE_TARGET integer yes"
+.It "VM_V_PAGEOUT_FREE_MIN integer yes"
.El
.Pp
.Bl -tag -width 6n
0 if the statistics-based page management algorithm is in use
or 1 if the near-LRU algorithm is in use.
.It Li VM_SWAPPING_ENABLED
-1 if process swapping is enabled or 0 if disabled. This variable is
+1 if process swapping is enabled or 0 if disabled.
+This variable is
permanently set to 0 if the kernel was built with swapping disabled.
.It Li VM_V_CACHE_MAX
Maximum desired size of the cache queue.
.It Li VM_V_CACHE_MIN
-Minimum desired size of the cache queue. If the cache queue size
+Minimum desired size of the cache queue.
+If the cache queue size
falls very far below this value, the pageout daemon is awakened.
.It Li VM_V_FREE_MIN
Minimum amount of memory (cache memory plus free memory)
pageout daemon tries to maintain.
.It Li VM_V_INACTIVE_TARGET
The desired number of inactive pages that the pageout daemon should
-achieve when it runs. Inactive pages can be quickly inserted into
+achieve when it runs.
+Inactive pages can be quickly inserted into
process address space when needed.
.It Li VM_V_PAGEOUT_FREE_MIN
If the amount of free and cache memory falls below this value, the
The length pointed to by
.Fa oldlenp
is too short to hold the requested value.
+.It Bq Er ENOMEM
+The smaller of either the length pointed to by
+.Fa oldlenp
+or the estimated size of the returned data exceeds the
+system limit on locked memory.
+.It Bq Er ENOMEM
+Locking the buffer
+.Fa oldp ,
+or a portion of the buffer if the estimated size of the data
+to be returned is smaller,
+would cause the process to exceed its per-process locked memory limit.
.It Bq Er ENOTDIR
The
.Fa name
.El
.Sh FILES
.Bl -tag -width <netinet/icmpXvar.h> -compact
-.It Aq Pa sys/sysctl.h
+.It In sys/sysctl.h
definitions for top level identifiers, second level kernel and hardware
identifiers, and user level identifiers
-.It Aq Pa sys/socket.h
+.It In sys/socket.h
definitions for second level network identifiers
-.It Aq Pa sys/gmon.h
+.It In sys/gmon.h
definitions for third level profiling identifiers
-.It Aq Pa vm/vm_param.h
+.It In vm/vm_param.h
definitions for second level virtual memory identifiers
-.It Aq Pa netinet/in.h
+.It In netinet/in.h
definitions for third level IPv4/IPv6 identifiers and
fourth level IPv4/v6 identifiers
-.It Aq Pa netinet/icmp_var.h
+.It In netinet/icmp_var.h
definitions for fourth level ICMP identifiers
-.It Aq Pa netinet/icmp6.h
+.It In netinet/icmp6.h
definitions for fourth level ICMPv6 identifiers
-.It Aq Pa netinet/udp_var.h
+.It In netinet/udp_var.h
definitions for fourth level UDP identifiers
.El
.Sh SEE ALSO