xref: /freebsd/lib/libc/gen/sysctl.3 (revision c947dc059b40b84fb44362f33805e05cdfb1ffa1)
158f0484fSRodney W. Grimes.\" Copyright (c) 1993
258f0484fSRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
358f0484fSRodney W. Grimes.\"
458f0484fSRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
558f0484fSRodney W. Grimes.\" modification, are permitted provided that the following conditions
658f0484fSRodney W. Grimes.\" are met:
758f0484fSRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
858f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
958f0484fSRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
1058f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
1158f0484fSRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
1258f0484fSRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
1358f0484fSRodney W. Grimes.\"    must display the following acknowledgement:
1458f0484fSRodney W. Grimes.\"	This product includes software developed by the University of
1558f0484fSRodney W. Grimes.\"	California, Berkeley and its contributors.
1658f0484fSRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
1758f0484fSRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
1858f0484fSRodney W. Grimes.\"    without specific prior written permission.
1958f0484fSRodney W. Grimes.\"
2058f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2158f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2258f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2358f0484fSRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2458f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2558f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2658f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2758f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2858f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2958f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3058f0484fSRodney W. Grimes.\" SUCH DAMAGE.
3158f0484fSRodney W. Grimes.\"
320014b4c0SPeter Wemm.\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
337f3dea24SPeter Wemm.\" $FreeBSD$
3458f0484fSRodney W. Grimes.\"
359715c87bSRuslan Ermilov.Dd January 23, 2001
3658f0484fSRodney W. Grimes.Dt SYSCTL 3
3758f0484fSRodney W. Grimes.Os
3858f0484fSRodney W. Grimes.Sh NAME
39dd1d7d1fSPeter Wemm.Nm sysctl ,
40a9dc3bacSKirk McKusick.Nm sysctlbyname ,
41a9dc3bacSKirk McKusick.Nm sysctlnametomib
4258f0484fSRodney W. Grimes.Nd get or set system information
4325bb73e0SAlexey Zelkin.Sh LIBRARY
4425bb73e0SAlexey Zelkin.Lb libc
4558f0484fSRodney W. Grimes.Sh SYNOPSIS
4632eef9aeSRuslan Ermilov.In sys/types.h
4732eef9aeSRuslan Ermilov.In sys/sysctl.h
4858f0484fSRodney W. Grimes.Ft int
4958f0484fSRodney W. Grimes.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
5004b7c947SBruce Evans.Ft int
51dd1d7d1fSPeter Wemm.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
52a9dc3bacSKirk McKusick.Ft int
53a9dc3bacSKirk McKusick.Fn sysctlnametomib "const char *name" "int *mibp" "size_t *sizep"
5458f0484fSRodney W. Grimes.Sh DESCRIPTION
5558f0484fSRodney W. GrimesThe
56bf5a138eSMike Pritchard.Fn sysctl
5758f0484fSRodney W. Grimesfunction retrieves system information and allows processes with
5858f0484fSRodney W. Grimesappropriate privileges to set system information.
5958f0484fSRodney W. GrimesThe information available from
60bf5a138eSMike Pritchard.Fn sysctl
6158f0484fSRodney W. Grimesconsists of integers, strings, and tables.
6258f0484fSRodney W. GrimesInformation may be retrieved and set from the command interface
6358f0484fSRodney W. Grimesusing the
64e1f4e80cSMike Pritchard.Xr sysctl 8
6558f0484fSRodney W. Grimesutility.
6658f0484fSRodney W. Grimes.Pp
6758f0484fSRodney W. GrimesUnless explicitly noted below,
68bf5a138eSMike Pritchard.Fn sysctl
6958f0484fSRodney W. Grimesreturns a consistent snapshot of the data requested.
7058f0484fSRodney W. GrimesConsistency is obtained by locking the destination
7158f0484fSRodney W. Grimesbuffer into memory so that the data may be copied out without blocking.
7258f0484fSRodney W. GrimesCalls to
73bf5a138eSMike Pritchard.Fn sysctl
7458f0484fSRodney W. Grimesare serialized to avoid deadlock.
7558f0484fSRodney W. Grimes.Pp
7658f0484fSRodney W. GrimesThe state is described using a ``Management Information Base'' (MIB)
7758f0484fSRodney W. Grimesstyle name, listed in
7858f0484fSRodney W. Grimes.Fa name ,
7958f0484fSRodney W. Grimeswhich is a
8058f0484fSRodney W. Grimes.Fa namelen
8158f0484fSRodney W. Grimeslength array of integers.
8258f0484fSRodney W. Grimes.Pp
83dd1d7d1fSPeter WemmThe
84dd1d7d1fSPeter Wemm.Fn sysctlbyname
85c6d6e772SAlexey Zelkinfunction accepts an ASCII representation of the name and internally
86dd1d7d1fSPeter Wemmlooks up the integer name vector.  Apart from that, it behaves the same
87dd1d7d1fSPeter Wemmas the standard
88dd1d7d1fSPeter Wemm.Fn sysctl
89dd1d7d1fSPeter Wemmfunction.
90dd1d7d1fSPeter Wemm.Pp
9158f0484fSRodney W. GrimesThe information is copied into the buffer specified by
9258f0484fSRodney W. Grimes.Fa oldp .
9358f0484fSRodney W. GrimesThe size of the buffer is given by the location specified by
9458f0484fSRodney W. Grimes.Fa oldlenp
9558f0484fSRodney W. Grimesbefore the call,
96b1f6a5fbSBruce Evansand that location gives the amount of data copied after a successful call
97c23155a4SRuslan Ermilovand after a call that returns with the error code
98c23155a4SRuslan Ermilov.Er ENOMEM .
9958f0484fSRodney W. GrimesIf the amount of data available is greater
10058f0484fSRodney W. Grimesthan the size of the buffer supplied,
10158f0484fSRodney W. Grimesthe call supplies as much data as fits in the buffer provided
102c23155a4SRuslan Ermilovand returns with the error code
103c23155a4SRuslan Ermilov.Er ENOMEM .
10458f0484fSRodney W. GrimesIf the old value is not desired,
10558f0484fSRodney W. Grimes.Fa oldp
10658f0484fSRodney W. Grimesand
10758f0484fSRodney W. Grimes.Fa oldlenp
10858f0484fSRodney W. Grimesshould be set to NULL.
10958f0484fSRodney W. Grimes.Pp
11058f0484fSRodney W. GrimesThe size of the available data can be determined by calling
111bf5a138eSMike Pritchard.Fn sysctl
1122efeeba5SRuslan Ermilovwith the
1132efeeba5SRuslan Ermilov.Dv NULL
1142efeeba5SRuslan Ermilovargument for
11558f0484fSRodney W. Grimes.Fa oldp .
11658f0484fSRodney W. GrimesThe size of the available data will be returned in the location pointed to by
11758f0484fSRodney W. Grimes.Fa oldlenp .
11858f0484fSRodney W. GrimesFor some operations, the amount of space may change often.
11958f0484fSRodney W. GrimesFor these operations,
12058f0484fSRodney W. Grimesthe system attempts to round up so that the returned size is
12158f0484fSRodney W. Grimeslarge enough for a call to return the data shortly thereafter.
12258f0484fSRodney W. Grimes.Pp
12358f0484fSRodney W. GrimesTo set a new value,
12458f0484fSRodney W. Grimes.Fa newp
12558f0484fSRodney W. Grimesis set to point to a buffer of length
12658f0484fSRodney W. Grimes.Fa newlen
12758f0484fSRodney W. Grimesfrom which the requested value is to be taken.
12858f0484fSRodney W. GrimesIf a new value is not to be set,
12958f0484fSRodney W. Grimes.Fa newp
13058f0484fSRodney W. Grimesshould be set to NULL and
13158f0484fSRodney W. Grimes.Fa newlen
13258f0484fSRodney W. Grimesset to 0.
13358f0484fSRodney W. Grimes.Pp
134a9dc3bacSKirk McKusickThe
135a9dc3bacSKirk McKusick.Fn sysctlnametomib
136a9dc3bacSKirk McKusickfunction accepts an ASCII representation of the name,
137a9dc3bacSKirk McKusicklooks up the integer name vector,
138a9dc3bacSKirk McKusickand returns the numeric representation in the mib array pointed to by
139a9dc3bacSKirk McKusick.Fa mibp .
140a9dc3bacSKirk McKusickThe number of elements in the mib array is given by the location specified by
141a9dc3bacSKirk McKusick.Fa sizep
142a9dc3bacSKirk McKusickbefore the call,
143a9dc3bacSKirk McKusickand that location gives the number of entries copied after a successful call.
144a9dc3bacSKirk McKusickThe resulting
145a9dc3bacSKirk McKusick.Fa mib
146a9dc3bacSKirk McKusickand
147a9dc3bacSKirk McKusick.Fa size
148a9dc3bacSKirk McKusickmay be used in subsequent
149a9dc3bacSKirk McKusick.Fn sysctl
150a9dc3bacSKirk McKusickcalls to get the data associated with the requested ASCII name.
151a9dc3bacSKirk McKusickThis interface is intended for use by applications that want to
152a9dc3bacSKirk McKusickrepeatedly request the same variable (the
153a9dc3bacSKirk McKusick.Fn sysctl
154a9dc3bacSKirk McKusickfunction runs in about a third the time as the same request made via the
155a9dc3bacSKirk McKusick.Fn sysctlbyname
156a9dc3bacSKirk McKusickfunction).
157a9dc3bacSKirk McKusickThe
1583afe2c78SDima Dorfman.Fn sysctlnametomib
159a9dc3bacSKirk McKusickfunction is also useful for fetching mib prefixes and then adding
160a9dc3bacSKirk McKusicka final component.
161a9dc3bacSKirk McKusickFor example, to fetch process information
162a9dc3bacSKirk McKusickfor processes with pid's less than 100:
1639715c87bSRuslan Ermilov.Pp
164a9dc3bacSKirk McKusick.Bd -literal -offset indent -compact
165a9dc3bacSKirk McKusickint i, mib[4];
166a9dc3bacSKirk McKusicksize_t len;
167a9dc3bacSKirk McKusickstruct kinfo_proc kp;
168a9dc3bacSKirk McKusick
169a9dc3bacSKirk McKusick/* Fill out the first three components of the mib */
170a9dc3bacSKirk McKusicklen = 4;
171a9dc3bacSKirk McKusicksysctlnametomib("kern.proc.pid", mib, &len);
172a9dc3bacSKirk McKusick
173a9dc3bacSKirk McKusick/* Fetch and print entries for pid's < 100 */
174a9dc3bacSKirk McKusickfor (i = 0; i < 100; i++) {
175a9dc3bacSKirk McKusick	mib[3] = i;
176a9dc3bacSKirk McKusick	len = sizeof(kp);
177a9dc3bacSKirk McKusick	if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1)
178a9dc3bacSKirk McKusick		perror("sysctl");
179a9dc3bacSKirk McKusick	else if (len > 0)
180a9dc3bacSKirk McKusick		printkproc(&kp);
181a9dc3bacSKirk McKusick}
182a9dc3bacSKirk McKusick.Ed
183a9dc3bacSKirk McKusick.Pp
18458f0484fSRodney W. GrimesThe top level names are defined with a CTL_ prefix in
185fe08efe6SRuslan Ermilov.In sys/sysctl.h ,
18658f0484fSRodney W. Grimesand are as follows.
18758f0484fSRodney W. GrimesThe next and subsequent levels down are found in the include files
18858f0484fSRodney W. Grimeslisted here, and described in separate sections below.
18958f0484fSRodney W. Grimes.Pp
19058f0484fSRodney W. Grimes.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
191d0353b83SRuslan Ermilov.It Sy "Name	Next level names	Description"
19242635956SRuslan Ermilov.It "CTL\_DEBUG	sys/sysctl.h	Debugging"
19342635956SRuslan Ermilov.It "CTL\_VFS	sys/mount.h	File system"
19442635956SRuslan Ermilov.It "CTL\_HW	sys/sysctl.h	Generic CPU, I/O"
19542635956SRuslan Ermilov.It "CTL\_KERN	sys/sysctl.h	High kernel limits"
19642635956SRuslan Ermilov.It "CTL\_MACHDEP	sys/sysctl.h	Machine dependent"
19742635956SRuslan Ermilov.It "CTL\_NET	sys/socket.h	Networking"
19842635956SRuslan Ermilov.It "CTL\_USER	sys/sysctl.h	User-level"
19942635956SRuslan Ermilov.It "CTL\_VM	vm/vm_param.h	Virtual memory"
20058f0484fSRodney W. Grimes.El
20158f0484fSRodney W. Grimes.Pp
20258f0484fSRodney W. GrimesFor example, the following retrieves the maximum number of processes allowed
20358f0484fSRodney W. Grimesin the system:
204c492ccdbSMike Pritchard.Pp
20558f0484fSRodney W. Grimes.Bd -literal -offset indent -compact
20658f0484fSRodney W. Grimesint mib[2], maxproc;
20758f0484fSRodney W. Grimessize_t len;
208c492ccdbSMike Pritchard
20958f0484fSRodney W. Grimesmib[0] = CTL_KERN;
21058f0484fSRodney W. Grimesmib[1] = KERN_MAXPROC;
21158f0484fSRodney W. Grimeslen = sizeof(maxproc);
21258f0484fSRodney W. Grimessysctl(mib, 2, &maxproc, &len, NULL, 0);
21358f0484fSRodney W. Grimes.Ed
214c492ccdbSMike Pritchard.Pp
21558f0484fSRodney W. GrimesTo retrieve the standard search path for the system utilities:
216c492ccdbSMike Pritchard.Pp
21758f0484fSRodney W. Grimes.Bd -literal -offset indent -compact
21858f0484fSRodney W. Grimesint mib[2];
21958f0484fSRodney W. Grimessize_t len;
22058f0484fSRodney W. Grimeschar *p;
221c492ccdbSMike Pritchard
22258f0484fSRodney W. Grimesmib[0] = CTL_USER;
22358f0484fSRodney W. Grimesmib[1] = USER_CS_PATH;
22458f0484fSRodney W. Grimessysctl(mib, 2, NULL, &len, NULL, 0);
22558f0484fSRodney W. Grimesp = malloc(len);
22658f0484fSRodney W. Grimessysctl(mib, 2, p, &len, NULL, 0);
22758f0484fSRodney W. Grimes.Ed
22896e430a4SAlexey Zelkin.Ss CTL_DEBUG
22958f0484fSRodney W. GrimesThe debugging variables vary from system to system.
23058f0484fSRodney W. GrimesA debugging variable may be added or deleted without need to recompile
231bf5a138eSMike Pritchard.Fn sysctl
23258f0484fSRodney W. Grimesto know about it.
23358f0484fSRodney W. GrimesEach time it runs,
234bf5a138eSMike Pritchard.Fn sysctl
23558f0484fSRodney W. Grimesgets the list of debugging variables from the kernel and
23658f0484fSRodney W. Grimesdisplays their current values.
23758f0484fSRodney W. GrimesThe system defines twenty
23895f4226bSRuslan Ermilov.Pq Vt "struct ctldebug"
23958f0484fSRodney W. Grimesvariables named
24095f4226bSRuslan Ermilov.Va debug0
24158f0484fSRodney W. Grimesthrough
24295f4226bSRuslan Ermilov.Va debug19 .
24358f0484fSRodney W. GrimesThey are declared as separate variables so that they can be
24458f0484fSRodney W. Grimesindividually initialized at the location of their associated variable.
24558f0484fSRodney W. GrimesThe loader prevents multiple use of the same variable by issuing errors
24658f0484fSRodney W. Grimesif a variable is initialized in more than one place.
24758f0484fSRodney W. GrimesFor example, to export the variable
24895f4226bSRuslan Ermilov.Va dospecialcheck
24958f0484fSRodney W. Grimesas a debugging variable, the following declaration would be used:
25095f4226bSRuslan Ermilov.Pp
25158f0484fSRodney W. Grimes.Bd -literal -offset indent -compact
25258f0484fSRodney W. Grimesint dospecialcheck = 1;
25358f0484fSRodney W. Grimesstruct ctldebug debug5 = { "dospecialcheck", &dospecialcheck };
25458f0484fSRodney W. Grimes.Ed
25596e430a4SAlexey Zelkin.Ss CTL_VFS
2560014b4c0SPeter WemmA distinguished second level name, VFS_GENERIC,
2570014b4c0SPeter Wemmis used to get general information about all file systems.
2580014b4c0SPeter WemmOne of its third level identifiers is VFS_MAXTYPENUM
2590014b4c0SPeter Wemmthat gives the highest valid file system type number.
2600014b4c0SPeter WemmIts other third level identifier is VFS_CONF that
2610014b4c0SPeter Wemmreturns configuration information about the file system
2620014b4c0SPeter Wemmtype given as a fourth level identifier (see
2630014b4c0SPeter Wemm.Xr getvfsbyname 3
2640014b4c0SPeter Wemmas an example of its use).
2650014b4c0SPeter WemmThe remaining second level identifiers are the
2660014b4c0SPeter Wemmfile system type number returned by a
2670014b4c0SPeter Wemm.Xr statfs 2
2680014b4c0SPeter Wemmcall or from VFS_CONF.
2690014b4c0SPeter WemmThe third level identifiers available for each file system
2700014b4c0SPeter Wemmare given in the header file that defines the mount
2710014b4c0SPeter Wemmargument structure for that file system.
27296e430a4SAlexey Zelkin.Ss CTL_HW
27358f0484fSRodney W. GrimesThe string and integer information available for the CTL_HW level
27458f0484fSRodney W. Grimesis detailed below.
27558f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
27658f0484fSRodney W. Grimesprivilege may change the value.
27758f0484fSRodney W. Grimes.Bl -column "Second level nameXXXXXX" integerXXX -offset indent
278d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
27942635956SRuslan Ermilov.It "HW\_MACHINE	string	no"
28042635956SRuslan Ermilov.It "HW\_MODEL	string	no"
28142635956SRuslan Ermilov.It "HW\_NCPU	integer	no"
28242635956SRuslan Ermilov.It "HW\_BYTEORDER	integer	no"
28342635956SRuslan Ermilov.It "HW\_PHYSMEM	integer	no"
28442635956SRuslan Ermilov.It "HW\_USERMEM	integer	no"
28542635956SRuslan Ermilov.It "HW\_PAGESIZE	integer	no"
28642635956SRuslan Ermilov.It "HW\_FLOATINGPOINT	integer	no"
28742635956SRuslan Ermilov.It "HW\_MACHINE\_ARCH	string	no"
28842635956SRuslan Ermilov.\".It "HW\_DISKNAMES	integer	no"
28942635956SRuslan Ermilov.\".It "HW\_DISKSTATS	integer	no"
29058f0484fSRodney W. Grimes.El
29158f0484fSRodney W. Grimes.Pp
29242635956SRuslan Ermilov.Bl -tag -width 6n
29358f0484fSRodney W. Grimes.It Li HW_MACHINE
29458f0484fSRodney W. GrimesThe machine class.
29558f0484fSRodney W. Grimes.It Li HW_MODEL
29658f0484fSRodney W. GrimesThe machine model
29758f0484fSRodney W. Grimes.It Li HW_NCPU
29858f0484fSRodney W. GrimesThe number of cpus.
29958f0484fSRodney W. Grimes.It Li HW_BYTEORDER
30058f0484fSRodney W. GrimesThe byteorder (4,321, or 1,234).
30158f0484fSRodney W. Grimes.It Li HW_PHYSMEM
30258f0484fSRodney W. GrimesThe bytes of physical memory.
30358f0484fSRodney W. Grimes.It Li HW_USERMEM
30458f0484fSRodney W. GrimesThe bytes of non-kernel memory.
30558f0484fSRodney W. Grimes.It Li HW_PAGESIZE
30658f0484fSRodney W. GrimesThe software page size.
30738c429d5SBruce Evans.It Li HW_FLOATINGPOINT
30838c429d5SBruce EvansNonzero if the floating point support is in hardware.
30901f770e8SKATO Takenori.It Li HW_MACHINE_ARCH
31001f770e8SKATO TakenoriThe machine dependent architecture type.
31158f0484fSRodney W. Grimes.\".It Fa HW_DISKNAMES
31258f0484fSRodney W. Grimes.\".It Fa HW_DISKSTATS
31358f0484fSRodney W. Grimes.El
31496e430a4SAlexey Zelkin.Ss CTL_KERN
31558f0484fSRodney W. GrimesThe string and integer information available for the CTL_KERN level
31658f0484fSRodney W. Grimesis detailed below.
31758f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
31858f0484fSRodney W. Grimesprivilege may change the value.
31958f0484fSRodney W. GrimesThe types of data currently available are process information,
32058f0484fSRodney W. Grimessystem vnodes, the open file entries, routing table entries,
32158f0484fSRodney W. Grimesvirtual memory statistics, load average history, and clock rate
32258f0484fSRodney W. Grimesinformation.
32338c429d5SBruce Evans.Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent
324d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
32542635956SRuslan Ermilov.It "KERN\_ARGMAX	integer	no"
32642635956SRuslan Ermilov.It "KERN\_BOOTFILE	string	yes"
32742635956SRuslan Ermilov.It "KERN\_BOOTTIME	struct timeval	no"
32842635956SRuslan Ermilov.It "KERN\_CLOCKRATE	struct clockinfo	no"
32942635956SRuslan Ermilov.It "KERN\_FILE	struct file	no"
33042635956SRuslan Ermilov.It "KERN\_HOSTID	integer	yes"
33142635956SRuslan Ermilov.It "KERN\_HOSTNAME	string	yes"
33242635956SRuslan Ermilov.It "KERN\_JOB\_CONTROL	integer	no"
33342635956SRuslan Ermilov.It "KERN\_MAXFILES	integer	yes"
33442635956SRuslan Ermilov.It "KERN\_MAXFILESPERPROC	integer	yes"
33542635956SRuslan Ermilov.It "KERN\_MAXPROC	integer	no"
33642635956SRuslan Ermilov.It "KERN\_MAXPROCPERUID	integer	yes"
33742635956SRuslan Ermilov.It "KERN\_MAXVNODES	integer	yes"
33842635956SRuslan Ermilov.It "KERN\_NGROUPS	integer	no"
33942635956SRuslan Ermilov.It "KERN\_NISDOMAINNAME	string	yes"
34042635956SRuslan Ermilov.It "KERN\_OSRELDATE	integer	no"
34142635956SRuslan Ermilov.It "KERN\_OSRELEASE	string	no"
34242635956SRuslan Ermilov.It "KERN\_OSREV	integer	no"
34342635956SRuslan Ermilov.It "KERN\_OSTYPE	string	no"
34442635956SRuslan Ermilov.It "KERN\_POSIX1	integer	no"
34542635956SRuslan Ermilov.It "KERN\_PROC	struct proc	no"
34642635956SRuslan Ermilov.It "KERN\_PROF	node	not applicable"
34742635956SRuslan Ermilov.It "KERN\_QUANTUM	integer	yes"
34842635956SRuslan Ermilov.It "KERN\_SAVED\_IDS	integer	no"
34942635956SRuslan Ermilov.It "KERN\_SECURELVL	integer	raise only"
35042635956SRuslan Ermilov.It "KERN\_UPDATEINTERVAL	integer	no"
35142635956SRuslan Ermilov.It "KERN\_VERSION	string	no"
35242635956SRuslan Ermilov.It "KERN\_VNODE	struct vnode	no"
35358f0484fSRodney W. Grimes.El
35458f0484fSRodney W. Grimes.Pp
35542635956SRuslan Ermilov.Bl -tag -width 6n
35658f0484fSRodney W. Grimes.It Li KERN_ARGMAX
35758f0484fSRodney W. GrimesThe maximum bytes of argument to
358e1f4e80cSMike Pritchard.Xr execve 2 .
35938c429d5SBruce Evans.It Li KERN_BOOTFILE
36038c429d5SBruce EvansThe full pathname of the file from which the kernel was loaded.
36158f0484fSRodney W. Grimes.It Li KERN_BOOTTIME
36258f0484fSRodney W. GrimesA
36358f0484fSRodney W. Grimes.Va struct timeval
36458f0484fSRodney W. Grimesstructure is returned.
36558f0484fSRodney W. GrimesThis structure contains the time that the system was booted.
36658f0484fSRodney W. Grimes.It Li KERN_CLOCKRATE
36758f0484fSRodney W. GrimesA
36858f0484fSRodney W. Grimes.Va struct clockinfo
36958f0484fSRodney W. Grimesstructure is returned.
37058f0484fSRodney W. GrimesThis structure contains the clock, statistics clock and profiling clock
371127feebeSJohn Hayfrequencies, the number of micro-seconds per hz tick and the skew rate.
37258f0484fSRodney W. Grimes.It Li KERN_FILE
37358f0484fSRodney W. GrimesReturn the entire file table.
37458f0484fSRodney W. GrimesThe returned data consists of a single
37558f0484fSRodney W. Grimes.Va struct filehead
37658f0484fSRodney W. Grimesfollowed by an array of
37758f0484fSRodney W. Grimes.Va struct file ,
37858f0484fSRodney W. Grimeswhose size depends on the current number of such objects in the system.
37958f0484fSRodney W. Grimes.It Li KERN_HOSTID
38058f0484fSRodney W. GrimesGet or set the host id.
38158f0484fSRodney W. Grimes.It Li KERN_HOSTNAME
38258f0484fSRodney W. GrimesGet or set the hostname.
38358f0484fSRodney W. Grimes.It Li KERN_JOB_CONTROL
38458f0484fSRodney W. GrimesReturn 1 if job control is available on this system, otherwise 0.
38558f0484fSRodney W. Grimes.It Li KERN_MAXFILES
38638c429d5SBruce EvansThe maximum number of files that may be open in the system.
38738c429d5SBruce Evans.It Li KERN_MAXFILESPERPROC
38838c429d5SBruce EvansThe maximum number of files that may be open for a single process.
38938c429d5SBruce EvansThis limit only applies to processes with an effective uid of nonzero
39038c429d5SBruce Evansat the time of the open request.
39138c429d5SBruce EvansFiles that have already been opened are not affected if the limit
39238c429d5SBruce Evansor the effective uid is changed.
39358f0484fSRodney W. Grimes.It Li KERN_MAXPROC
39438c429d5SBruce EvansThe maximum number of concurrent processes the system will allow.
39538c429d5SBruce Evans.It Li KERN_MAXPROCPERUID
39638c429d5SBruce EvansThe maximum number of concurrent processes the system will allow
39738c429d5SBruce Evansfor a single effective uid.
39838c429d5SBruce EvansThis limit only applies to processes with an effective uid of nonzero
39938c429d5SBruce Evansat the time of a fork request.
40038c429d5SBruce EvansProcesses that have already been started are not affected if the limit
40138c429d5SBruce Evansis changed.
40258f0484fSRodney W. Grimes.It Li KERN_MAXVNODES
40358f0484fSRodney W. GrimesThe maximum number of vnodes available on the system.
40458f0484fSRodney W. Grimes.It Li KERN_NGROUPS
40558f0484fSRodney W. GrimesThe maximum number of supplemental groups.
40638c429d5SBruce Evans.It Li KERN_NISDOMAINNAME
40738c429d5SBruce EvansThe name of the current YP/NIS domain.
40838c429d5SBruce Evans.It Li KERN_OSRELDATE
40962d6317dSEivind EklundThe kernel release version in the format
41062d6317dSEivind Eklund.Ar M Ns Ar mm Ns Ar R Ns Ar xx ,
41162d6317dSEivind Eklundwhere
41262d6317dSEivind Eklund.Ar M
41362d6317dSEivind Eklundis the major version,
41462d6317dSEivind Eklund.Ar mm
41562d6317dSEivind Eklundis the two digit minor version,
41662d6317dSEivind Eklund.Ar R
41762d6317dSEivind Eklundis 0 if release branch, otherwise 1,
41862d6317dSEivind Eklundand
41962d6317dSEivind Eklund.Ar xx
42062d6317dSEivind Eklundis updated when the available APIs change.
42162d6317dSEivind Eklund.Pp
42262d6317dSEivind EklundThe userland release version is available from
423fe08efe6SRuslan Ermilov.In osreldate.h ;
42462d6317dSEivind Eklundparse this file if you need to get the release version of
42562d6317dSEivind Eklundthe currently installed userland.
42658f0484fSRodney W. Grimes.It Li KERN_OSRELEASE
42758f0484fSRodney W. GrimesThe system release string.
42858f0484fSRodney W. Grimes.It Li KERN_OSREV
42958f0484fSRodney W. GrimesThe system revision string.
43058f0484fSRodney W. Grimes.It Li KERN_OSTYPE
43158f0484fSRodney W. GrimesThe system type string.
43258f0484fSRodney W. Grimes.It Li KERN_POSIX1
433fdc1fef5SRuslan ErmilovThe version of
434fdc1fef5SRuslan Ermilov.St -p1003.1
435fdc1fef5SRuslan Ermilovwith which the system
43658f0484fSRodney W. Grimesattempts to comply.
43758f0484fSRodney W. Grimes.It Li KERN_PROC
43858f0484fSRodney W. GrimesReturn the entire process table, or a subset of it.
4392de021a4SAndrzej BialeckiAn array of pairs of
4402de021a4SAndrzej Bialecki.Va struct proc
4412de021a4SAndrzej Bialeckifollowed by corresponding
4422de021a4SAndrzej Bialecki.Va struct eproc
44358f0484fSRodney W. Grimesstructures is returned,
44458f0484fSRodney W. Grimeswhose size depends on the current number of such objects in the system.
44558f0484fSRodney W. GrimesThe third and fourth level names are as follows:
44658f0484fSRodney W. Grimes.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
447d0353b83SRuslan Ermilov.It "Third level name	Fourth level is:"
44842635956SRuslan Ermilov.It "KERN\_PROC\_ALL	None"
44942635956SRuslan Ermilov.It "KERN\_PROC\_PID	A process ID"
45042635956SRuslan Ermilov.It "KERN\_PROC\_PGRP	A process group"
45142635956SRuslan Ermilov.It "KERN\_PROC\_TTY	A tty device"
45242635956SRuslan Ermilov.It "KERN\_PROC\_UID	A user ID"
45342635956SRuslan Ermilov.It "KERN\_PROC\_RUID	A real user ID"
45458f0484fSRodney W. Grimes.El
455d2d9aa87SSheldon Hearn.Pp
4562de021a4SAndrzej BialeckiIf the third level name is KERN_PROC_ARGS then the command line argument
4572de021a4SAndrzej Bialeckiarray is returned in a flattened form, i.e. zero-terminated arguments
458d2d9aa87SSheldon Hearnfollow each other.
459d2d9aa87SSheldon HearnThe total size of array is returned.
460b03c558bSSheldon HearnIt is also possible for a process to set its own process title this way.
4612de021a4SAndrzej Bialecki.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
462d0353b83SRuslan Ermilov.It Sy "Third level name	Fourth level is:"
46342635956SRuslan Ermilov.It "KERN\_PROC\_ARGS	A process ID"
4642de021a4SAndrzej Bialecki.El
46558f0484fSRodney W. Grimes.It Li KERN_PROF
46658f0484fSRodney W. GrimesReturn profiling information about the kernel.
46758f0484fSRodney W. GrimesIf the kernel is not compiled for profiling,
46858f0484fSRodney W. Grimesattempts to retrieve any of the KERN_PROF values will
469c23155a4SRuslan Ermilovfail with
470358034bcSRuslan Ermilov.Er ENOENT .
47158f0484fSRodney W. GrimesThe third level names for the string and integer profiling information
47258f0484fSRodney W. Grimesis detailed below.
47358f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
47458f0484fSRodney W. Grimesprivilege may change the value.
47558f0484fSRodney W. Grimes.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent
476d0353b83SRuslan Ermilov.It Sy "Third level name	Type	Changeable"
47742635956SRuslan Ermilov.It "GPROF\_STATE	integer	yes"
47842635956SRuslan Ermilov.It "GPROF\_COUNT	u_short[\|]	yes"
47942635956SRuslan Ermilov.It "GPROF\_FROMS	u_short[\|]	yes"
48042635956SRuslan Ermilov.It "GPROF\_TOS	struct tostruct	yes"
48142635956SRuslan Ermilov.It "GPROF\_GMONPARAM	struct gmonparam	no"
48258f0484fSRodney W. Grimes.El
48358f0484fSRodney W. Grimes.Pp
48458f0484fSRodney W. GrimesThe variables are as follows:
48542635956SRuslan Ermilov.Bl -tag -width 6n
48658f0484fSRodney W. Grimes.It Li GPROF_STATE
48758f0484fSRodney W. GrimesReturns GMON_PROF_ON or GMON_PROF_OFF to show that profiling
48858f0484fSRodney W. Grimesis running or stopped.
48958f0484fSRodney W. Grimes.It Li GPROF_COUNT
49058f0484fSRodney W. GrimesArray of statistical program counter counts.
49158f0484fSRodney W. Grimes.It Li GPROF_FROMS
49258f0484fSRodney W. GrimesArray indexed by program counter of call-from points.
49358f0484fSRodney W. Grimes.It Li GPROF_TOS
49458f0484fSRodney W. GrimesArray of
49558f0484fSRodney W. Grimes.Va struct tostruct
49658f0484fSRodney W. Grimesdescribing destination of calls and their counts.
49758f0484fSRodney W. Grimes.It Li GPROF_GMONPARAM
49858f0484fSRodney W. GrimesStructure giving the sizes of the above arrays.
49958f0484fSRodney W. Grimes.El
500443cb51fSChris Costello.It Li KERN_QUANTUM
50111400c9aSChris CostelloThe maximum period of time, in microseconds, for which a process is allowed
50211400c9aSChris Costelloto run without being preempted if other processes are in the run queue.
50358f0484fSRodney W. Grimes.It Li KERN_SAVED_IDS
50458f0484fSRodney W. GrimesReturns 1 if saved set-group and saved set-user ID is available.
50558f0484fSRodney W. Grimes.It Li KERN_SECURELVL
50658f0484fSRodney W. GrimesThe system security level.
50758f0484fSRodney W. GrimesThis level may be raised by processes with appropriate privilege.
508b697833cSGuy HelmerIt may not be lowered.
50958f0484fSRodney W. Grimes.It Li KERN_VERSION
51058f0484fSRodney W. GrimesThe system version string.
51158f0484fSRodney W. Grimes.It Li KERN_VNODE
51258f0484fSRodney W. GrimesReturn the entire vnode table.
51358f0484fSRodney W. GrimesNote, the vnode table is not necessarily a consistent snapshot of
51458f0484fSRodney W. Grimesthe system.
51558f0484fSRodney W. GrimesThe returned data consists of an array whose size depends on the
51658f0484fSRodney W. Grimescurrent number of such objects in the system.
51758f0484fSRodney W. GrimesEach element of the array contains the kernel address of a vnode
51858f0484fSRodney W. Grimes.Va struct vnode *
51958f0484fSRodney W. Grimesfollowed by the vnode itself
52058f0484fSRodney W. Grimes.Va struct vnode .
52158f0484fSRodney W. Grimes.El
52296e430a4SAlexey Zelkin.Ss CTL_MACHDEP
52358f0484fSRodney W. GrimesThe set of variables defined is architecture dependent.
52438c429d5SBruce EvansThe following variables are defined for the i386 architecture.
52538c429d5SBruce Evans.Bl -column "CONSOLE_DEVICEXXX" "struct bootinfoXXX" -offset indent
526d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
52742635956SRuslan Ermilov.It Li "CPU_CONSDEV	dev_t	no"
52842635956SRuslan Ermilov.It Li "CPU_ADJKERNTZ	int	yes"
52942635956SRuslan Ermilov.It Li "CPU_DISRTCSET	int	yes"
53042635956SRuslan Ermilov.It Li "CPU_BOOTINFO	struct bootinfo	no"
53142635956SRuslan Ermilov.It Li "CPU_WALLCLOCK	int	yes"
53258f0484fSRodney W. Grimes.El
53396e430a4SAlexey Zelkin.Ss CTL_NET
53458f0484fSRodney W. GrimesThe string and integer information available for the CTL_NET level
53558f0484fSRodney W. Grimesis detailed below.
53658f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
53758f0484fSRodney W. Grimesprivilege may change the value.
53858f0484fSRodney W. Grimes.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
539d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
54042635956SRuslan Ermilov.It "PF\_ROUTE	routing messages	no"
54142635956SRuslan Ermilov.It "PF\_INET	IPv4 values	yes"
54242635956SRuslan Ermilov.It "PF\_INET6	IPv6 values	yes"
54358f0484fSRodney W. Grimes.El
54458f0484fSRodney W. Grimes.Pp
54542635956SRuslan Ermilov.Bl -tag -width 6n
54658f0484fSRodney W. Grimes.It Li PF_ROUTE
54758f0484fSRodney W. GrimesReturn the entire routing table or a subset of it.
54858f0484fSRodney W. GrimesThe data is returned as a sequence of routing messages (see
54958f0484fSRodney W. Grimes.Xr route 4
55058f0484fSRodney W. Grimesfor the header file, format and meaning).
55158f0484fSRodney W. GrimesThe length of each message is contained in the message header.
55258f0484fSRodney W. Grimes.Pp
55358f0484fSRodney W. GrimesThe third level name is a protocol number, which is currently always 0.
55458f0484fSRodney W. GrimesThe fourth level name is an address family, which may be set to 0 to
55558f0484fSRodney W. Grimesselect all address families.
55658f0484fSRodney W. GrimesThe fifth and sixth level names are as follows:
55758f0484fSRodney W. Grimes.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent
558d0353b83SRuslan Ermilov.It Sy "Fifth level name	Sixth level is:"
55942635956SRuslan Ermilov.It "NET\_RT\_FLAGS	rtflags"
56042635956SRuslan Ermilov.It "NET\_RT\_DUMP	None"
5610e65089bSRuslan Ermilov.It "NET\_RT\_IFLIST	0 or if_index"
56258f0484fSRodney W. Grimes.El
56358f0484fSRodney W. Grimes.It Li PF_INET
5641522ff5bSJun-ichiro itojun HaginoGet or set various global information about the IPv4
565c4d9468eSRuslan Ermilov(Internet Protocol version 4).
56658f0484fSRodney W. GrimesThe third level name is the protocol.
56758f0484fSRodney W. GrimesThe fourth level name is the variable name.
56858f0484fSRodney W. GrimesThe currently defined protocols and names are:
56961a4defdSJoseph Koshy.Bl -column ProtocolXX VariableXX TypeXX ChangeableXX
570d0353b83SRuslan Ermilov.It Sy "Protocol	Variable	Type	Changeable"
57142635956SRuslan Ermilov.It "icmp	bmcastecho	integer	yes"
57242635956SRuslan Ermilov.It "icmp	maskrepl	integer	yes"
57342635956SRuslan Ermilov.It "ip	forwarding	integer	yes"
57442635956SRuslan Ermilov.It "ip	redirect	integer	yes"
57542635956SRuslan Ermilov.It "ip	ttl	integer	yes"
57642635956SRuslan Ermilov.It "udp	checksum	integer	yes"
57758f0484fSRodney W. Grimes.El
57858f0484fSRodney W. Grimes.Pp
57958f0484fSRodney W. GrimesThe variables are as follows:
58042635956SRuslan Ermilov.Bl -tag -width 6n
5810a843f2aSJoseph Koshy.It Li icmp.bmcastecho
5820a843f2aSJoseph KoshyReturns 1 if an ICMP echo request to a broadcast or multicast address is
5830a843f2aSJoseph Koshyto be answered.
5840a843f2aSJoseph Koshy.It Li icmp.maskrepl
5850a843f2aSJoseph KoshyReturns 1 if ICMP network mask requests are to be answered.
58658f0484fSRodney W. Grimes.It Li ip.forwarding
58758f0484fSRodney W. GrimesReturns 1 when IP forwarding is enabled for the host,
58858f0484fSRodney W. Grimesmeaning that the host is acting as a router.
58958f0484fSRodney W. Grimes.It Li ip.redirect
59058f0484fSRodney W. GrimesReturns 1 when ICMP redirects may be sent by the host.
59158f0484fSRodney W. GrimesThis option is ignored unless the host is routing IP packets,
59258f0484fSRodney W. Grimesand should normally be enabled on all systems.
59358f0484fSRodney W. Grimes.It Li ip.ttl
59458f0484fSRodney W. GrimesThe maximum time-to-live (hop count) value for an IP packet sourced by
59558f0484fSRodney W. Grimesthe system.
59658f0484fSRodney W. GrimesThis value applies to normal transport protocols, not to ICMP.
59758f0484fSRodney W. Grimes.It Li udp.checksum
59858f0484fSRodney W. GrimesReturns 1 when UDP checksums are being computed and checked.
59958f0484fSRodney W. GrimesDisabling UDP checksums is strongly discouraged.
6001522ff5bSJun-ichiro itojun Hagino.Pp
6018a3c1270SJun-ichiro itojun HaginoFor variables net.inet.*.ipsec, please refer to
6021522ff5bSJun-ichiro itojun Hagino.Xr ipsec 4 .
6031522ff5bSJun-ichiro itojun Hagino.El
6041522ff5bSJun-ichiro itojun Hagino.It Li PF_INET6
6051522ff5bSJun-ichiro itojun HaginoGet or set various global information about the IPv6
606c4d9468eSRuslan Ermilov(Internet Protocol version 6).
6071522ff5bSJun-ichiro itojun HaginoThe third level name is the protocol.
6081522ff5bSJun-ichiro itojun HaginoThe fourth level name is the variable name.
6091522ff5bSJun-ichiro itojun Hagino.Pp
6108a3c1270SJun-ichiro itojun HaginoFor variables net.inet6.* please refer to
6118a3c1270SJun-ichiro itojun Hagino.Xr inet6 4 .
6128a3c1270SJun-ichiro itojun HaginoFor variables net.inet6.*.ipsec6, please refer to
6131522ff5bSJun-ichiro itojun Hagino.Xr ipsec 4 .
61458f0484fSRodney W. Grimes.El
61596e430a4SAlexey Zelkin.Ss CTL_USER
61658f0484fSRodney W. GrimesThe string and integer information available for the CTL_USER level
61758f0484fSRodney W. Grimesis detailed below.
61858f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
61958f0484fSRodney W. Grimesprivilege may change the value.
62058f0484fSRodney W. Grimes.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent
621d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
62242635956SRuslan Ermilov.It "USER\_BC\_BASE\_MAX	integer	no"
62342635956SRuslan Ermilov.It "USER\_BC\_DIM\_MAX	integer	no"
62442635956SRuslan Ermilov.It "USER\_BC\_SCALE\_MAX	integer	no"
62542635956SRuslan Ermilov.It "USER\_BC\_STRING\_MAX	integer	no"
62642635956SRuslan Ermilov.It "USER\_COLL\_WEIGHTS\_MAX	integer	no"
62742635956SRuslan Ermilov.It "USER\_CS\_PATH	string	no"
62842635956SRuslan Ermilov.It "USER\_EXPR\_NEST\_MAX	integer	no"
62942635956SRuslan Ermilov.It "USER\_LINE\_MAX	integer	no"
63042635956SRuslan Ermilov.It "USER\_POSIX2\_CHAR\_TERM	integer	no"
63142635956SRuslan Ermilov.It "USER\_POSIX2\_C\_BIND	integer	no"
63242635956SRuslan Ermilov.It "USER\_POSIX2\_C\_DEV	integer	no"
63342635956SRuslan Ermilov.It "USER\_POSIX2\_FORT\_DEV	integer	no"
63442635956SRuslan Ermilov.It "USER\_POSIX2\_FORT\_RUN	integer	no"
63542635956SRuslan Ermilov.It "USER\_POSIX2\_LOCALEDEF	integer	no"
63642635956SRuslan Ermilov.It "USER\_POSIX2\_SW\_DEV	integer	no"
63742635956SRuslan Ermilov.It "USER\_POSIX2\_UPE	integer	no"
63842635956SRuslan Ermilov.It "USER\_POSIX2\_VERSION	integer	no"
63942635956SRuslan Ermilov.It "USER\_RE\_DUP\_MAX	integer	no"
64042635956SRuslan Ermilov.It "USER\_STREAM\_MAX	integer	no"
64142635956SRuslan Ermilov.It "USER\_TZNAME\_MAX	integer	no"
64258f0484fSRodney W. Grimes.El
64342635956SRuslan Ermilov.Bl -tag -width 6n
64458f0484fSRodney W. Grimes.Pp
64558f0484fSRodney W. Grimes.It Li USER_BC_BASE_MAX
64658f0484fSRodney W. GrimesThe maximum ibase/obase values in the
64758f0484fSRodney W. Grimes.Xr bc 1
64858f0484fSRodney W. Grimesutility.
64958f0484fSRodney W. Grimes.It Li USER_BC_DIM_MAX
65058f0484fSRodney W. GrimesThe maximum array size in the
65158f0484fSRodney W. Grimes.Xr bc 1
65258f0484fSRodney W. Grimesutility.
65358f0484fSRodney W. Grimes.It Li USER_BC_SCALE_MAX
65458f0484fSRodney W. GrimesThe maximum scale value in the
65558f0484fSRodney W. Grimes.Xr bc 1
65658f0484fSRodney W. Grimesutility.
65758f0484fSRodney W. Grimes.It Li USER_BC_STRING_MAX
65858f0484fSRodney W. GrimesThe maximum string length in the
65958f0484fSRodney W. Grimes.Xr bc 1
66058f0484fSRodney W. Grimesutility.
66158f0484fSRodney W. Grimes.It Li USER_COLL_WEIGHTS_MAX
66258f0484fSRodney W. GrimesThe maximum number of weights that can be assigned to any entry of
66358f0484fSRodney W. Grimesthe LC_COLLATE order keyword in the locale definition file.
66458f0484fSRodney W. Grimes.It Li USER_CS_PATH
66558f0484fSRodney W. GrimesReturn a value for the
66658f0484fSRodney W. Grimes.Ev PATH
66758f0484fSRodney W. Grimesenvironment variable that finds all the standard utilities.
66858f0484fSRodney W. Grimes.It Li USER_EXPR_NEST_MAX
66958f0484fSRodney W. GrimesThe maximum number of expressions that can be nested within
67058f0484fSRodney W. Grimesparenthesis by the
67158f0484fSRodney W. Grimes.Xr expr 1
67258f0484fSRodney W. Grimesutility.
67358f0484fSRodney W. Grimes.It Li USER_LINE_MAX
67458f0484fSRodney W. GrimesThe maximum length in bytes of a text-processing utility's input
67558f0484fSRodney W. Grimesline.
67658f0484fSRodney W. Grimes.It Li USER_POSIX2_CHAR_TERM
67758f0484fSRodney W. GrimesReturn 1 if the system supports at least one terminal type capable of
678fdc1fef5SRuslan Ermilovall operations described in
679fdc1fef5SRuslan Ermilov.St -p1003.2 ,
680fdc1fef5SRuslan Ermilovotherwise 0.
68158f0484fSRodney W. Grimes.It Li USER_POSIX2_C_BIND
68258f0484fSRodney W. GrimesReturn 1 if the system's C-language development facilities support the
68358f0484fSRodney W. GrimesC-Language Bindings Option, otherwise 0.
68458f0484fSRodney W. Grimes.It Li USER_POSIX2_C_DEV
68558f0484fSRodney W. GrimesReturn 1 if the system supports the C-Language Development Utilities Option,
68658f0484fSRodney W. Grimesotherwise 0.
68758f0484fSRodney W. Grimes.It Li USER_POSIX2_FORT_DEV
68858f0484fSRodney W. GrimesReturn 1 if the system supports the FORTRAN Development Utilities Option,
68958f0484fSRodney W. Grimesotherwise 0.
69058f0484fSRodney W. Grimes.It Li USER_POSIX2_FORT_RUN
69158f0484fSRodney W. GrimesReturn 1 if the system supports the FORTRAN Runtime Utilities Option,
69258f0484fSRodney W. Grimesotherwise 0.
69358f0484fSRodney W. Grimes.It Li USER_POSIX2_LOCALEDEF
69458f0484fSRodney W. GrimesReturn 1 if the system supports the creation of locales, otherwise 0.
69558f0484fSRodney W. Grimes.It Li USER_POSIX2_SW_DEV
69658f0484fSRodney W. GrimesReturn 1 if the system supports the Software Development Utilities Option,
69758f0484fSRodney W. Grimesotherwise 0.
69858f0484fSRodney W. Grimes.It Li USER_POSIX2_UPE
69958f0484fSRodney W. GrimesReturn 1 if the system supports the User Portability Utilities Option,
70058f0484fSRodney W. Grimesotherwise 0.
70158f0484fSRodney W. Grimes.It Li USER_POSIX2_VERSION
702fdc1fef5SRuslan ErmilovThe version of
703fdc1fef5SRuslan Ermilov.St -p1003.2
704fdc1fef5SRuslan Ermilovwith which the system attempts to comply.
70558f0484fSRodney W. Grimes.It Li USER_RE_DUP_MAX
70658f0484fSRodney W. GrimesThe maximum number of repeated occurrences of a regular expression
70758f0484fSRodney W. Grimespermitted when using interval notation.
70858f0484fSRodney W. Grimes.It Li USER_STREAM_MAX
70958f0484fSRodney W. GrimesThe minimum maximum number of streams that a process may have open
71058f0484fSRodney W. Grimesat any one time.
71158f0484fSRodney W. Grimes.It Li USER_TZNAME_MAX
71258f0484fSRodney W. GrimesThe minimum maximum number of types supported for the name of a
71358f0484fSRodney W. Grimestimezone.
71458f0484fSRodney W. Grimes.El
71596e430a4SAlexey Zelkin.Ss CTL_VM
71658f0484fSRodney W. GrimesThe string and integer information available for the CTL_VM level
71758f0484fSRodney W. Grimesis detailed below.
71858f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
71958f0484fSRodney W. Grimesprivilege may change the value.
72058f0484fSRodney W. Grimes.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
721d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
72242635956SRuslan Ermilov.It "VM\_LOADAVG	struct loadavg	no"
72342635956SRuslan Ermilov.It "VM\_METER	struct vmtotal	no"
72442635956SRuslan Ermilov.It "VM\_PAGEOUT\_ALGORITHM	integer	yes"
72542635956SRuslan Ermilov.It "VM\_SWAPPING\_ENABLED	integer	maybe"
72642635956SRuslan Ermilov.It "VM\_V\_CACHE\_MAX	integer	yes"
72742635956SRuslan Ermilov.It "VM\_V\_CACHE\_MIN	integer	yes"
72842635956SRuslan Ermilov.It "VM\_V\_FREE\_MIN	integer	yes"
72942635956SRuslan Ermilov.It "VM\_V\_FREE\_RESERVED	integer	yes"
73042635956SRuslan Ermilov.It "VM\_V\_FREE\_TARGET	integer	yes"
73142635956SRuslan Ermilov.It "VM\_V\_INACTIVE\_TARGET	integer	yes"
73242635956SRuslan Ermilov.It "VM\_V\_PAGEOUT\_FREE\_MIN	integer	yes"
73358f0484fSRodney W. Grimes.El
73458f0484fSRodney W. Grimes.Pp
73542635956SRuslan Ermilov.Bl -tag -width 6n
73658f0484fSRodney W. Grimes.It Li VM_LOADAVG
73758f0484fSRodney W. GrimesReturn the load average history.
73858f0484fSRodney W. GrimesThe returned data consists of a
73958f0484fSRodney W. Grimes.Va struct loadavg .
74058f0484fSRodney W. Grimes.It Li VM_METER
74158f0484fSRodney W. GrimesReturn the system wide virtual memory statistics.
74258f0484fSRodney W. GrimesThe returned data consists of a
74358f0484fSRodney W. Grimes.Va struct vmtotal .
744b697833cSGuy Helmer.It Li VM_PAGEOUT_ALGORITHM
745b697833cSGuy Helmer0 if the statistics-based page management algorithm is in use
746b697833cSGuy Helmeror 1 if the near-LRU algorithm is in use.
747b697833cSGuy Helmer.It Li VM_SWAPPING_ENABLED
748b697833cSGuy Helmer1 if process swapping is enabled or 0 if disabled.  This variable is
749b697833cSGuy Helmerpermanently set to 0 if the kernel was built with swapping disabled.
750b697833cSGuy Helmer.It Li VM_V_CACHE_MAX
751b697833cSGuy HelmerMaximum desired size of the cache queue.
752b697833cSGuy Helmer.It Li VM_V_CACHE_MIN
753b697833cSGuy HelmerMinimum desired size of the cache queue.  If the cache queue size
754b697833cSGuy Helmerfalls very far below this value, the pageout daemon is awakened.
755b697833cSGuy Helmer.It Li VM_V_FREE_MIN
756b697833cSGuy HelmerMinimum amount of memory (cache memory plus free memory)
757b697833cSGuy Helmerrequired to be available before a process waiting on memory will be
758b697833cSGuy Helmerawakened.
759b697833cSGuy Helmer.It Li VM_V_FREE_RESERVED
760b697833cSGuy HelmerProcesses will awaken the pageout daemon and wait for memory if the
761b697833cSGuy Helmernumber of free and cached pages drops below this value.
762b697833cSGuy Helmer.It Li VM_V_FREE_TARGET
763b697833cSGuy HelmerThe total amount of free memory (including cache memory) that the
764b697833cSGuy Helmerpageout daemon tries to maintain.
765b697833cSGuy Helmer.It Li VM_V_INACTIVE_TARGET
766b697833cSGuy HelmerThe desired number of inactive pages that the pageout daemon should
767b697833cSGuy Helmerachieve when it runs.  Inactive pages can be quickly inserted into
768b697833cSGuy Helmerprocess address space when needed.
769b697833cSGuy Helmer.It Li VM_V_PAGEOUT_FREE_MIN
770b697833cSGuy HelmerIf the amount of free and cache memory falls below this value, the
771b697833cSGuy Helmerpageout daemon will enter "memory conserving mode" to avoid deadlock.
77258f0484fSRodney W. Grimes.El
77358f0484fSRodney W. Grimes.Sh RETURN VALUES
774d6002fefSRuslan Ermilov.Rv -std
77558f0484fSRodney W. Grimes.Sh ERRORS
77658f0484fSRodney W. GrimesThe following errors may be reported:
77758f0484fSRodney W. Grimes.Bl -tag -width Er
77858f0484fSRodney W. Grimes.It Bq Er EFAULT
77958f0484fSRodney W. GrimesThe buffer
78058f0484fSRodney W. Grimes.Fa name ,
78158f0484fSRodney W. Grimes.Fa oldp ,
78258f0484fSRodney W. Grimes.Fa newp ,
78358f0484fSRodney W. Grimesor length pointer
78458f0484fSRodney W. Grimes.Fa oldlenp
78558f0484fSRodney W. Grimescontains an invalid address.
78658f0484fSRodney W. Grimes.It Bq Er EINVAL
78758f0484fSRodney W. GrimesThe
78858f0484fSRodney W. Grimes.Fa name
78958f0484fSRodney W. Grimesarray is less than two or greater than CTL_MAXNAME.
79058f0484fSRodney W. Grimes.It Bq Er EINVAL
79158f0484fSRodney W. GrimesA non-null
79258f0484fSRodney W. Grimes.Fa newp
79358f0484fSRodney W. Grimesis given and its specified length in
79458f0484fSRodney W. Grimes.Fa newlen
79558f0484fSRodney W. Grimesis too large or too small.
79658f0484fSRodney W. Grimes.It Bq Er ENOMEM
79758f0484fSRodney W. GrimesThe length pointed to by
79858f0484fSRodney W. Grimes.Fa oldlenp
79958f0484fSRodney W. Grimesis too short to hold the requested value.
800c947dc05SDon Lewis.It Bq Er ENOMEM
801c947dc05SDon LewisThe smaller of either the length pointed to by
802c947dc05SDon Lewis.Fa oldlenp
803c947dc05SDon Lewisor the estimated size of the returned data exceeds the
804c947dc05SDon Lewissystem limit on locked memory.
805c947dc05SDon Lewis.It Bq Er ENOMEM
806c947dc05SDon LewisLocking the buffer
807c947dc05SDon Lewis.Fa oldp ,
808c947dc05SDon Lewisor a portion of the buffer if the estimated size of the data
809c947dc05SDon Lewisto be returned is smaller,
810c947dc05SDon Lewiswould cause the process to exceed its per-process locked memory limit.
81158f0484fSRodney W. Grimes.It Bq Er ENOTDIR
81258f0484fSRodney W. GrimesThe
81358f0484fSRodney W. Grimes.Fa name
81458f0484fSRodney W. Grimesarray specifies an intermediate rather than terminal name.
815226420a4SBrian Feldman.It Bq Er EISDIR
816226420a4SBrian FeldmanThe
817226420a4SBrian Feldman.Fa name
818226420a4SBrian Feldmanarray specifies a terminal name, but the actual name is not terminal.
819358034bcSRuslan Ermilov.It Bq Er ENOENT
82058f0484fSRodney W. GrimesThe
82158f0484fSRodney W. Grimes.Fa name
82258f0484fSRodney W. Grimesarray specifies a value that is unknown.
82358f0484fSRodney W. Grimes.It Bq Er EPERM
82458f0484fSRodney W. GrimesAn attempt is made to set a read-only value.
82558f0484fSRodney W. Grimes.It Bq Er EPERM
82658f0484fSRodney W. GrimesA process without appropriate privilege attempts to set a value.
82758f0484fSRodney W. Grimes.El
82858f0484fSRodney W. Grimes.Sh FILES
82958f0484fSRodney W. Grimes.Bl -tag -width <netinet/icmpXvar.h> -compact
830fe08efe6SRuslan Ermilov.It In sys/sysctl.h
83158f0484fSRodney W. Grimesdefinitions for top level identifiers, second level kernel and hardware
83258f0484fSRodney W. Grimesidentifiers, and user level identifiers
833fe08efe6SRuslan Ermilov.It In sys/socket.h
83458f0484fSRodney W. Grimesdefinitions for second level network identifiers
835fe08efe6SRuslan Ermilov.It In sys/gmon.h
83658f0484fSRodney W. Grimesdefinitions for third level profiling identifiers
837fe08efe6SRuslan Ermilov.It In vm/vm_param.h
83858f0484fSRodney W. Grimesdefinitions for second level virtual memory identifiers
839fe08efe6SRuslan Ermilov.It In netinet/in.h
8401522ff5bSJun-ichiro itojun Haginodefinitions for third level IPv4/IPv6 identifiers and
8411522ff5bSJun-ichiro itojun Haginofourth level IPv4/v6 identifiers
842fe08efe6SRuslan Ermilov.It In netinet/icmp_var.h
84358f0484fSRodney W. Grimesdefinitions for fourth level ICMP identifiers
844fe08efe6SRuslan Ermilov.It In netinet/icmp6.h
8451522ff5bSJun-ichiro itojun Haginodefinitions for fourth level ICMPv6 identifiers
846fe08efe6SRuslan Ermilov.It In netinet/udp_var.h
84758f0484fSRodney W. Grimesdefinitions for fourth level UDP identifiers
84858f0484fSRodney W. Grimes.El
84958f0484fSRodney W. Grimes.Sh SEE ALSO
85038cf6319SEivind Eklund.Xr sysconf 3 ,
851f5a78334SJoseph Koshy.Xr sysctl 8
85258f0484fSRodney W. Grimes.Sh HISTORY
85358f0484fSRodney W. GrimesThe
854bf5a138eSMike Pritchard.Fn sysctl
8557bdf80e5SMike Pritchardfunction first appeared in
8567bdf80e5SMike Pritchard.Bx 4.4 .
857