xref: /freebsd/lib/libc/gen/sysctl.3 (revision 6d076ae8f7f14051b42a1689bee2256bf83e805f)
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.\" 4. Neither the name of the University nor the names of its contributors
1358f0484fSRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
1458f0484fSRodney W. Grimes.\"    without specific prior written permission.
1558f0484fSRodney W. Grimes.\"
1658f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1758f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1858f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1958f0484fSRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2058f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2158f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2258f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2358f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2458f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2558f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2658f0484fSRodney W. Grimes.\" SUCH DAMAGE.
2758f0484fSRodney W. Grimes.\"
280014b4c0SPeter Wemm.\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
297f3dea24SPeter Wemm.\" $FreeBSD$
3058f0484fSRodney W. Grimes.\"
31*6d076ae8SBjoern A. Zeeb.Dd February 11, 2012
3258f0484fSRodney W. Grimes.Dt SYSCTL 3
3358f0484fSRodney W. Grimes.Os
3458f0484fSRodney W. Grimes.Sh NAME
35dd1d7d1fSPeter Wemm.Nm sysctl ,
36a9dc3bacSKirk McKusick.Nm sysctlbyname ,
37a9dc3bacSKirk McKusick.Nm sysctlnametomib
3858f0484fSRodney W. Grimes.Nd get or set system information
3925bb73e0SAlexey Zelkin.Sh LIBRARY
4025bb73e0SAlexey Zelkin.Lb libc
4158f0484fSRodney W. Grimes.Sh SYNOPSIS
4232eef9aeSRuslan Ermilov.In sys/types.h
4332eef9aeSRuslan Ermilov.In sys/sysctl.h
4458f0484fSRodney W. Grimes.Ft int
4562399df2SEd Schouten.Fn sysctl "const int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "const void *newp" "size_t newlen"
4604b7c947SBruce Evans.Ft int
4762399df2SEd Schouten.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "const void *newp" "size_t newlen"
48a9dc3bacSKirk McKusick.Ft int
49a9dc3bacSKirk McKusick.Fn sysctlnametomib "const char *name" "int *mibp" "size_t *sizep"
5058f0484fSRodney W. Grimes.Sh DESCRIPTION
5158f0484fSRodney W. GrimesThe
52bf5a138eSMike Pritchard.Fn sysctl
5358f0484fSRodney W. Grimesfunction retrieves system information and allows processes with
5458f0484fSRodney W. Grimesappropriate privileges to set system information.
5558f0484fSRodney W. GrimesThe information available from
56bf5a138eSMike Pritchard.Fn sysctl
5758f0484fSRodney W. Grimesconsists of integers, strings, and tables.
5858f0484fSRodney W. GrimesInformation may be retrieved and set from the command interface
5958f0484fSRodney W. Grimesusing the
60e1f4e80cSMike Pritchard.Xr sysctl 8
6158f0484fSRodney W. Grimesutility.
6258f0484fSRodney W. Grimes.Pp
6358f0484fSRodney W. GrimesUnless explicitly noted below,
64bf5a138eSMike Pritchard.Fn sysctl
6558f0484fSRodney W. Grimesreturns a consistent snapshot of the data requested.
6658f0484fSRodney W. GrimesConsistency is obtained by locking the destination
6758f0484fSRodney W. Grimesbuffer into memory so that the data may be copied out without blocking.
6858f0484fSRodney W. GrimesCalls to
69bf5a138eSMike Pritchard.Fn sysctl
7058f0484fSRodney W. Grimesare serialized to avoid deadlock.
7158f0484fSRodney W. Grimes.Pp
7258f0484fSRodney W. GrimesThe state is described using a ``Management Information Base'' (MIB)
7358f0484fSRodney W. Grimesstyle name, listed in
7458f0484fSRodney W. Grimes.Fa name ,
7558f0484fSRodney W. Grimeswhich is a
7658f0484fSRodney W. Grimes.Fa namelen
7758f0484fSRodney W. Grimeslength array of integers.
7858f0484fSRodney W. Grimes.Pp
79dd1d7d1fSPeter WemmThe
80dd1d7d1fSPeter Wemm.Fn sysctlbyname
81c6d6e772SAlexey Zelkinfunction accepts an ASCII representation of the name and internally
821a0a9345SRuslan Ermilovlooks up the integer name vector.
831a0a9345SRuslan ErmilovApart from that, it behaves the same
84dd1d7d1fSPeter Wemmas the standard
85dd1d7d1fSPeter Wemm.Fn sysctl
86dd1d7d1fSPeter Wemmfunction.
87dd1d7d1fSPeter Wemm.Pp
8858f0484fSRodney W. GrimesThe information is copied into the buffer specified by
8958f0484fSRodney W. Grimes.Fa oldp .
9058f0484fSRodney W. GrimesThe size of the buffer is given by the location specified by
9158f0484fSRodney W. Grimes.Fa oldlenp
9258f0484fSRodney W. Grimesbefore the call,
93b1f6a5fbSBruce Evansand that location gives the amount of data copied after a successful call
94c23155a4SRuslan Ermilovand after a call that returns with the error code
95c23155a4SRuslan Ermilov.Er ENOMEM .
9658f0484fSRodney W. GrimesIf the amount of data available is greater
9758f0484fSRodney W. Grimesthan the size of the buffer supplied,
9858f0484fSRodney W. Grimesthe call supplies as much data as fits in the buffer provided
99c23155a4SRuslan Ermilovand returns with the error code
100c23155a4SRuslan Ermilov.Er ENOMEM .
10158f0484fSRodney W. GrimesIf the old value is not desired,
10258f0484fSRodney W. Grimes.Fa oldp
10358f0484fSRodney W. Grimesand
10458f0484fSRodney W. Grimes.Fa oldlenp
10558f0484fSRodney W. Grimesshould be set to NULL.
10658f0484fSRodney W. Grimes.Pp
10758f0484fSRodney W. GrimesThe size of the available data can be determined by calling
108bf5a138eSMike Pritchard.Fn sysctl
1092efeeba5SRuslan Ermilovwith the
1102efeeba5SRuslan Ermilov.Dv NULL
1112efeeba5SRuslan Ermilovargument for
11258f0484fSRodney W. Grimes.Fa oldp .
11358f0484fSRodney W. GrimesThe size of the available data will be returned in the location pointed to by
11458f0484fSRodney W. Grimes.Fa oldlenp .
11558f0484fSRodney W. GrimesFor some operations, the amount of space may change often.
11658f0484fSRodney W. GrimesFor these operations,
11758f0484fSRodney W. Grimesthe system attempts to round up so that the returned size is
11858f0484fSRodney W. Grimeslarge enough for a call to return the data shortly thereafter.
11958f0484fSRodney W. Grimes.Pp
12058f0484fSRodney W. GrimesTo set a new value,
12158f0484fSRodney W. Grimes.Fa newp
12258f0484fSRodney W. Grimesis set to point to a buffer of length
12358f0484fSRodney W. Grimes.Fa newlen
12458f0484fSRodney W. Grimesfrom which the requested value is to be taken.
12558f0484fSRodney W. GrimesIf a new value is not to be set,
12658f0484fSRodney W. Grimes.Fa newp
12758f0484fSRodney W. Grimesshould be set to NULL and
12858f0484fSRodney W. Grimes.Fa newlen
12958f0484fSRodney W. Grimesset to 0.
13058f0484fSRodney W. Grimes.Pp
131a9dc3bacSKirk McKusickThe
132a9dc3bacSKirk McKusick.Fn sysctlnametomib
133a9dc3bacSKirk McKusickfunction accepts an ASCII representation of the name,
134a9dc3bacSKirk McKusicklooks up the integer name vector,
135a9dc3bacSKirk McKusickand returns the numeric representation in the mib array pointed to by
136a9dc3bacSKirk McKusick.Fa mibp .
137a9dc3bacSKirk McKusickThe number of elements in the mib array is given by the location specified by
138a9dc3bacSKirk McKusick.Fa sizep
139a9dc3bacSKirk McKusickbefore the call,
140a9dc3bacSKirk McKusickand that location gives the number of entries copied after a successful call.
141a9dc3bacSKirk McKusickThe resulting
142a9dc3bacSKirk McKusick.Fa mib
143a9dc3bacSKirk McKusickand
144a9dc3bacSKirk McKusick.Fa size
145a9dc3bacSKirk McKusickmay be used in subsequent
146a9dc3bacSKirk McKusick.Fn sysctl
147a9dc3bacSKirk McKusickcalls to get the data associated with the requested ASCII name.
148a9dc3bacSKirk McKusickThis interface is intended for use by applications that want to
149a9dc3bacSKirk McKusickrepeatedly request the same variable (the
150a9dc3bacSKirk McKusick.Fn sysctl
151a9dc3bacSKirk McKusickfunction runs in about a third the time as the same request made via the
152a9dc3bacSKirk McKusick.Fn sysctlbyname
153a9dc3bacSKirk McKusickfunction).
154a9dc3bacSKirk McKusickThe
1553afe2c78SDima Dorfman.Fn sysctlnametomib
156a9dc3bacSKirk McKusickfunction is also useful for fetching mib prefixes and then adding
157a9dc3bacSKirk McKusicka final component.
158a9dc3bacSKirk McKusickFor example, to fetch process information
159a9dc3bacSKirk McKusickfor processes with pid's less than 100:
1609715c87bSRuslan Ermilov.Pp
161a9dc3bacSKirk McKusick.Bd -literal -offset indent -compact
162a9dc3bacSKirk McKusickint i, mib[4];
163a9dc3bacSKirk McKusicksize_t len;
164a9dc3bacSKirk McKusickstruct kinfo_proc kp;
165a9dc3bacSKirk McKusick
166a9dc3bacSKirk McKusick/* Fill out the first three components of the mib */
167a9dc3bacSKirk McKusicklen = 4;
168a9dc3bacSKirk McKusicksysctlnametomib("kern.proc.pid", mib, &len);
169a9dc3bacSKirk McKusick
170a9dc3bacSKirk McKusick/* Fetch and print entries for pid's < 100 */
171a9dc3bacSKirk McKusickfor (i = 0; i < 100; i++) {
172a9dc3bacSKirk McKusick	mib[3] = i;
173a9dc3bacSKirk McKusick	len = sizeof(kp);
174a9dc3bacSKirk McKusick	if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1)
175a9dc3bacSKirk McKusick		perror("sysctl");
176a9dc3bacSKirk McKusick	else if (len > 0)
177a9dc3bacSKirk McKusick		printkproc(&kp);
178a9dc3bacSKirk McKusick}
179a9dc3bacSKirk McKusick.Ed
180a9dc3bacSKirk McKusick.Pp
18158f0484fSRodney W. GrimesThe top level names are defined with a CTL_ prefix in
182fe08efe6SRuslan Ermilov.In sys/sysctl.h ,
18358f0484fSRodney W. Grimesand are as follows.
18458f0484fSRodney W. GrimesThe next and subsequent levels down are found in the include files
18558f0484fSRodney W. Grimeslisted here, and described in separate sections below.
18658f0484fSRodney W. Grimes.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
187d0353b83SRuslan Ermilov.It Sy "Name	Next level names	Description"
188f8a89f62SRuslan Ermilov.It "CTL_DEBUG	sys/sysctl.h	Debugging"
189f8a89f62SRuslan Ermilov.It "CTL_VFS	sys/mount.h	File system"
190f8a89f62SRuslan Ermilov.It "CTL_HW	sys/sysctl.h	Generic CPU, I/O"
191f8a89f62SRuslan Ermilov.It "CTL_KERN	sys/sysctl.h	High kernel limits"
192f8a89f62SRuslan Ermilov.It "CTL_MACHDEP	sys/sysctl.h	Machine dependent"
193f8a89f62SRuslan Ermilov.It "CTL_NET	sys/socket.h	Networking"
194f8a89f62SRuslan Ermilov.It "CTL_USER	sys/sysctl.h	User-level"
195f8a89f62SRuslan Ermilov.It "CTL_VM	vm/vm_param.h	Virtual memory"
19658f0484fSRodney W. Grimes.El
19758f0484fSRodney W. Grimes.Pp
19858f0484fSRodney W. GrimesFor example, the following retrieves the maximum number of processes allowed
19958f0484fSRodney W. Grimesin the system:
200c492ccdbSMike Pritchard.Pp
20158f0484fSRodney W. Grimes.Bd -literal -offset indent -compact
20258f0484fSRodney W. Grimesint mib[2], maxproc;
20358f0484fSRodney W. Grimessize_t len;
204c492ccdbSMike Pritchard
20558f0484fSRodney W. Grimesmib[0] = CTL_KERN;
20658f0484fSRodney W. Grimesmib[1] = KERN_MAXPROC;
20758f0484fSRodney W. Grimeslen = sizeof(maxproc);
20858f0484fSRodney W. Grimessysctl(mib, 2, &maxproc, &len, NULL, 0);
20958f0484fSRodney W. Grimes.Ed
210c492ccdbSMike Pritchard.Pp
21158f0484fSRodney W. GrimesTo retrieve the standard search path for the system utilities:
212c492ccdbSMike Pritchard.Pp
21358f0484fSRodney W. Grimes.Bd -literal -offset indent -compact
21458f0484fSRodney W. Grimesint mib[2];
21558f0484fSRodney W. Grimessize_t len;
21658f0484fSRodney W. Grimeschar *p;
217c492ccdbSMike Pritchard
21858f0484fSRodney W. Grimesmib[0] = CTL_USER;
21958f0484fSRodney W. Grimesmib[1] = USER_CS_PATH;
22058f0484fSRodney W. Grimessysctl(mib, 2, NULL, &len, NULL, 0);
22158f0484fSRodney W. Grimesp = malloc(len);
22258f0484fSRodney W. Grimessysctl(mib, 2, p, &len, NULL, 0);
22358f0484fSRodney W. Grimes.Ed
22496e430a4SAlexey Zelkin.Ss CTL_DEBUG
22558f0484fSRodney W. GrimesThe debugging variables vary from system to system.
22658f0484fSRodney W. GrimesA debugging variable may be added or deleted without need to recompile
227bf5a138eSMike Pritchard.Fn sysctl
22858f0484fSRodney W. Grimesto know about it.
22958f0484fSRodney W. GrimesEach time it runs,
230bf5a138eSMike Pritchard.Fn sysctl
23158f0484fSRodney W. Grimesgets the list of debugging variables from the kernel and
23258f0484fSRodney W. Grimesdisplays their current values.
23358f0484fSRodney W. GrimesThe system defines twenty
23495f4226bSRuslan Ermilov.Pq Vt "struct ctldebug"
23558f0484fSRodney W. Grimesvariables named
23695f4226bSRuslan Ermilov.Va debug0
23758f0484fSRodney W. Grimesthrough
23895f4226bSRuslan Ermilov.Va debug19 .
23958f0484fSRodney W. GrimesThey are declared as separate variables so that they can be
24058f0484fSRodney W. Grimesindividually initialized at the location of their associated variable.
24158f0484fSRodney W. GrimesThe loader prevents multiple use of the same variable by issuing errors
24258f0484fSRodney W. Grimesif a variable is initialized in more than one place.
24358f0484fSRodney W. GrimesFor example, to export the variable
24495f4226bSRuslan Ermilov.Va dospecialcheck
24558f0484fSRodney W. Grimesas a debugging variable, the following declaration would be used:
24695f4226bSRuslan Ermilov.Pp
24758f0484fSRodney W. Grimes.Bd -literal -offset indent -compact
24858f0484fSRodney W. Grimesint dospecialcheck = 1;
24958f0484fSRodney W. Grimesstruct ctldebug debug5 = { "dospecialcheck", &dospecialcheck };
25058f0484fSRodney W. Grimes.Ed
25196e430a4SAlexey Zelkin.Ss CTL_VFS
2520014b4c0SPeter WemmA distinguished second level name, VFS_GENERIC,
2530014b4c0SPeter Wemmis used to get general information about all file systems.
2540014b4c0SPeter WemmOne of its third level identifiers is VFS_MAXTYPENUM
2550014b4c0SPeter Wemmthat gives the highest valid file system type number.
2560014b4c0SPeter WemmIts other third level identifier is VFS_CONF that
2570014b4c0SPeter Wemmreturns configuration information about the file system
2580014b4c0SPeter Wemmtype given as a fourth level identifier (see
2590014b4c0SPeter Wemm.Xr getvfsbyname 3
2600014b4c0SPeter Wemmas an example of its use).
2610014b4c0SPeter WemmThe remaining second level identifiers are the
2620014b4c0SPeter Wemmfile system type number returned by a
2630014b4c0SPeter Wemm.Xr statfs 2
2640014b4c0SPeter Wemmcall or from VFS_CONF.
2650014b4c0SPeter WemmThe third level identifiers available for each file system
2660014b4c0SPeter Wemmare given in the header file that defines the mount
2670014b4c0SPeter Wemmargument structure for that file system.
26896e430a4SAlexey Zelkin.Ss CTL_HW
26958f0484fSRodney W. GrimesThe string and integer information available for the CTL_HW level
27058f0484fSRodney W. Grimesis detailed below.
27158f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
27258f0484fSRodney W. Grimesprivilege may change the value.
27358f0484fSRodney W. Grimes.Bl -column "Second level nameXXXXXX" integerXXX -offset indent
274d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
275f8a89f62SRuslan Ermilov.It "HW_MACHINE	string	no"
276f8a89f62SRuslan Ermilov.It "HW_MODEL	string	no"
277f8a89f62SRuslan Ermilov.It "HW_NCPU	integer	no"
278f8a89f62SRuslan Ermilov.It "HW_BYTEORDER	integer	no"
279f8a89f62SRuslan Ermilov.It "HW_PHYSMEM	integer	no"
280f8a89f62SRuslan Ermilov.It "HW_USERMEM	integer	no"
281f8a89f62SRuslan Ermilov.It "HW_PAGESIZE	integer	no"
2829f05d312SAlexander Leidinger.\".It "HW_DISKNAMES	integer	no"
2839f05d312SAlexander Leidinger.\".It "HW_DISKSTATS	integer	no"
284bef19503SRuslan Ermilov.It "HW_FLOATINGPT	integer	no"
285bef19503SRuslan Ermilov.It "HW_MACHINE_ARCH	string	no"
286bef19503SRuslan Ermilov.It "HW_REALMEM	integer	no"
28758f0484fSRodney W. Grimes.El
28842635956SRuslan Ermilov.Bl -tag -width 6n
28958f0484fSRodney W. Grimes.It Li HW_MACHINE
29058f0484fSRodney W. GrimesThe machine class.
29158f0484fSRodney W. Grimes.It Li HW_MODEL
29258f0484fSRodney W. GrimesThe machine model
29358f0484fSRodney W. Grimes.It Li HW_NCPU
29458f0484fSRodney W. GrimesThe number of cpus.
29558f0484fSRodney W. Grimes.It Li HW_BYTEORDER
29658f0484fSRodney W. GrimesThe byteorder (4,321, or 1,234).
29758f0484fSRodney W. Grimes.It Li HW_PHYSMEM
29858f0484fSRodney W. GrimesThe bytes of physical memory.
29958f0484fSRodney W. Grimes.It Li HW_USERMEM
30058f0484fSRodney W. GrimesThe bytes of non-kernel memory.
30158f0484fSRodney W. Grimes.It Li HW_PAGESIZE
30258f0484fSRodney W. GrimesThe software page size.
303bef19503SRuslan Ermilov.\".It Fa HW_DISKNAMES
304bef19503SRuslan Ermilov.\".It Fa HW_DISKSTATS
305bef19503SRuslan Ermilov.It Li HW_FLOATINGPT
30638c429d5SBruce EvansNonzero if the floating point support is in hardware.
30701f770e8SKATO Takenori.It Li HW_MACHINE_ARCH
30801f770e8SKATO TakenoriThe machine dependent architecture type.
309bef19503SRuslan Ermilov.It Li HW_REALMEM
310bef19503SRuslan ErmilovThe bytes of real memory.
31158f0484fSRodney W. Grimes.El
31296e430a4SAlexey Zelkin.Ss CTL_KERN
31358f0484fSRodney W. GrimesThe string and integer information available for the CTL_KERN level
31458f0484fSRodney W. Grimesis detailed below.
31558f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
31658f0484fSRodney W. Grimesprivilege may change the value.
31758f0484fSRodney W. GrimesThe types of data currently available are process information,
31858f0484fSRodney W. Grimessystem vnodes, the open file entries, routing table entries,
31958f0484fSRodney W. Grimesvirtual memory statistics, load average history, and clock rate
32058f0484fSRodney W. Grimesinformation.
32138c429d5SBruce Evans.Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent
322d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
323f8a89f62SRuslan Ermilov.It "KERN_ARGMAX	integer	no"
324f8a89f62SRuslan Ermilov.It "KERN_BOOTFILE	string	yes"
325f8a89f62SRuslan Ermilov.It "KERN_BOOTTIME	struct timeval	no"
326f8a89f62SRuslan Ermilov.It "KERN_CLOCKRATE	struct clockinfo	no"
32767c8bc1bSJilles Tjoelker.It "KERN_FILE	struct xfile	no"
328f8a89f62SRuslan Ermilov.It "KERN_HOSTID	integer	yes"
3291f13edbeSPawel Jakub Dawidek.It "KERN_HOSTUUID	string	yes"
330f8a89f62SRuslan Ermilov.It "KERN_HOSTNAME	string	yes"
331f8a89f62SRuslan Ermilov.It "KERN_JOB_CONTROL	integer	no"
332f8a89f62SRuslan Ermilov.It "KERN_MAXFILES	integer	yes"
333f8a89f62SRuslan Ermilov.It "KERN_MAXFILESPERPROC	integer	yes"
334f8a89f62SRuslan Ermilov.It "KERN_MAXPROC	integer	no"
335f8a89f62SRuslan Ermilov.It "KERN_MAXPROCPERUID	integer	yes"
336f8a89f62SRuslan Ermilov.It "KERN_MAXVNODES	integer	yes"
337f8a89f62SRuslan Ermilov.It "KERN_NGROUPS	integer	no"
338f8a89f62SRuslan Ermilov.It "KERN_NISDOMAINNAME	string	yes"
339f8a89f62SRuslan Ermilov.It "KERN_OSRELDATE	integer	no"
340f8a89f62SRuslan Ermilov.It "KERN_OSRELEASE	string	no"
341f8a89f62SRuslan Ermilov.It "KERN_OSREV	integer	no"
342f8a89f62SRuslan Ermilov.It "KERN_OSTYPE	string	no"
343f8a89f62SRuslan Ermilov.It "KERN_POSIX1	integer	no"
34467c8bc1bSJilles Tjoelker.It "KERN_PROC	node	not applicable"
345f8a89f62SRuslan Ermilov.It "KERN_PROF	node	not applicable"
346f8a89f62SRuslan Ermilov.It "KERN_QUANTUM	integer	yes"
347f8a89f62SRuslan Ermilov.It "KERN_SAVED_IDS	integer	no"
348f8a89f62SRuslan Ermilov.It "KERN_SECURELVL	integer	raise only"
349f8a89f62SRuslan Ermilov.It "KERN_UPDATEINTERVAL	integer	no"
350f8a89f62SRuslan Ermilov.It "KERN_VERSION	string	no"
35167c8bc1bSJilles Tjoelker.It "KERN_VNODE	struct xvnode	no"
35258f0484fSRodney W. Grimes.El
35342635956SRuslan Ermilov.Bl -tag -width 6n
35458f0484fSRodney W. Grimes.It Li KERN_ARGMAX
35558f0484fSRodney W. GrimesThe maximum bytes of argument to
356e1f4e80cSMike Pritchard.Xr execve 2 .
35738c429d5SBruce Evans.It Li KERN_BOOTFILE
35838c429d5SBruce EvansThe full pathname of the file from which the kernel was loaded.
35958f0484fSRodney W. Grimes.It Li KERN_BOOTTIME
36058f0484fSRodney W. GrimesA
36158f0484fSRodney W. Grimes.Va struct timeval
36258f0484fSRodney W. Grimesstructure is returned.
36358f0484fSRodney W. GrimesThis structure contains the time that the system was booted.
36458f0484fSRodney W. Grimes.It Li KERN_CLOCKRATE
36558f0484fSRodney W. GrimesA
36658f0484fSRodney W. Grimes.Va struct clockinfo
36758f0484fSRodney W. Grimesstructure is returned.
36858f0484fSRodney W. GrimesThis structure contains the clock, statistics clock and profiling clock
369127feebeSJohn Hayfrequencies, the number of micro-seconds per hz tick and the skew rate.
37058f0484fSRodney W. Grimes.It Li KERN_FILE
37158f0484fSRodney W. GrimesReturn the entire file table.
37267c8bc1bSJilles TjoelkerThe returned data consists of an array of
37367c8bc1bSJilles Tjoelker.Va struct xfile ,
37458f0484fSRodney W. Grimeswhose size depends on the current number of such objects in the system.
37558f0484fSRodney W. Grimes.It Li KERN_HOSTID
376204542ddSRuslan ErmilovGet or set the host ID.
3771f13edbeSPawel Jakub Dawidek.It Li KERN_HOSTUUID
378204542ddSRuslan ErmilovGet or set the host's universally unique identifier (UUID).
37958f0484fSRodney W. Grimes.It Li KERN_HOSTNAME
38058f0484fSRodney W. GrimesGet or set the hostname.
38158f0484fSRodney W. Grimes.It Li KERN_JOB_CONTROL
38258f0484fSRodney W. GrimesReturn 1 if job control is available on this system, otherwise 0.
38358f0484fSRodney W. Grimes.It Li KERN_MAXFILES
38438c429d5SBruce EvansThe maximum number of files that may be open in the system.
38538c429d5SBruce Evans.It Li KERN_MAXFILESPERPROC
38638c429d5SBruce EvansThe maximum number of files that may be open for a single process.
38738c429d5SBruce EvansThis limit only applies to processes with an effective uid of nonzero
38838c429d5SBruce Evansat the time of the open request.
38938c429d5SBruce EvansFiles that have already been opened are not affected if the limit
39038c429d5SBruce Evansor the effective uid is changed.
39158f0484fSRodney W. Grimes.It Li KERN_MAXPROC
39238c429d5SBruce EvansThe maximum number of concurrent processes the system will allow.
39338c429d5SBruce Evans.It Li KERN_MAXPROCPERUID
39438c429d5SBruce EvansThe maximum number of concurrent processes the system will allow
39538c429d5SBruce Evansfor a single effective uid.
39638c429d5SBruce EvansThis limit only applies to processes with an effective uid of nonzero
39738c429d5SBruce Evansat the time of a fork request.
39838c429d5SBruce EvansProcesses that have already been started are not affected if the limit
39938c429d5SBruce Evansis changed.
40058f0484fSRodney W. Grimes.It Li KERN_MAXVNODES
40158f0484fSRodney W. GrimesThe maximum number of vnodes available on the system.
40258f0484fSRodney W. Grimes.It Li KERN_NGROUPS
40358f0484fSRodney W. GrimesThe maximum number of supplemental groups.
40438c429d5SBruce Evans.It Li KERN_NISDOMAINNAME
40538c429d5SBruce EvansThe name of the current YP/NIS domain.
40638c429d5SBruce Evans.It Li KERN_OSRELDATE
40762d6317dSEivind EklundThe kernel release version in the format
40862d6317dSEivind Eklund.Ar M Ns Ar mm Ns Ar R Ns Ar xx ,
40962d6317dSEivind Eklundwhere
41062d6317dSEivind Eklund.Ar M
41162d6317dSEivind Eklundis the major version,
41262d6317dSEivind Eklund.Ar mm
41362d6317dSEivind Eklundis the two digit minor version,
41462d6317dSEivind Eklund.Ar R
41562d6317dSEivind Eklundis 0 if release branch, otherwise 1,
41662d6317dSEivind Eklundand
41762d6317dSEivind Eklund.Ar xx
41862d6317dSEivind Eklundis updated when the available APIs change.
41962d6317dSEivind Eklund.Pp
42062d6317dSEivind EklundThe userland release version is available from
421fe08efe6SRuslan Ermilov.In osreldate.h ;
42262d6317dSEivind Eklundparse this file if you need to get the release version of
42362d6317dSEivind Eklundthe currently installed userland.
42458f0484fSRodney W. Grimes.It Li KERN_OSRELEASE
42558f0484fSRodney W. GrimesThe system release string.
42658f0484fSRodney W. Grimes.It Li KERN_OSREV
42758f0484fSRodney W. GrimesThe system revision string.
42858f0484fSRodney W. Grimes.It Li KERN_OSTYPE
42958f0484fSRodney W. GrimesThe system type string.
43058f0484fSRodney W. Grimes.It Li KERN_POSIX1
431fdc1fef5SRuslan ErmilovThe version of
432fdc1fef5SRuslan Ermilov.St -p1003.1
433fdc1fef5SRuslan Ermilovwith which the system
43458f0484fSRodney W. Grimesattempts to comply.
43558f0484fSRodney W. Grimes.It Li KERN_PROC
436fe769cddSDavid SchultzReturn selected information about specific running processes.
437fe769cddSDavid Schultz.Pp
43848a01c43STom RhodesFor the following names, an array of
43948a01c43STom Rhodes.Va struct kinfo_proc
44058f0484fSRodney W. Grimesstructures is returned,
44158f0484fSRodney W. Grimeswhose size depends on the current number of such objects in the system.
44258f0484fSRodney W. Grimes.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
443d0353b83SRuslan Ermilov.It "Third level name	Fourth level is:"
444f8a89f62SRuslan Ermilov.It "KERN_PROC_ALL	None"
445f8a89f62SRuslan Ermilov.It "KERN_PROC_PID	A process ID"
446f8a89f62SRuslan Ermilov.It "KERN_PROC_PGRP	A process group"
447f8a89f62SRuslan Ermilov.It "KERN_PROC_TTY	A tty device"
448f8a89f62SRuslan Ermilov.It "KERN_PROC_UID	A user ID"
449f8a89f62SRuslan Ermilov.It "KERN_PROC_RUID	A real user ID"
45058f0484fSRodney W. Grimes.El
451d2d9aa87SSheldon Hearn.Pp
452f789cb82SRuslan ErmilovIf the third level name is
453f789cb82SRuslan Ermilov.Dv KERN_PROC_ARGS
454f789cb82SRuslan Ermilovthen the command line argument
4551a0a9345SRuslan Ermilovarray is returned in a flattened form, i.e., zero-terminated arguments
456d2d9aa87SSheldon Hearnfollow each other.
457d2d9aa87SSheldon HearnThe total size of array is returned.
458b03c558bSSheldon HearnIt is also possible for a process to set its own process title this way.
459f789cb82SRuslan ErmilovIf the third level name is
460f789cb82SRuslan Ermilov.Dv KERN_PROC_PATHNAME ,
461f789cb82SRuslan Ermilovthe path of the
462fe769cddSDavid Schultzprocess' text file is stored.
463f789cb82SRuslan ErmilovFor
464f789cb82SRuslan Ermilov.Dv KERN_PROC_PATHNAME ,
465f789cb82SRuslan Ermilova process ID of
466f789cb82SRuslan Ermilov.Li \-1
467fe769cddSDavid Schultzimplies the current process.
4682de021a4SAndrzej Bialecki.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
469d0353b83SRuslan Ermilov.It Sy "Third level name	Fourth level is:"
470f789cb82SRuslan Ermilov.It Dv KERN_PROC_ARGS Ta "A process ID"
471f789cb82SRuslan Ermilov.It Dv KERN_PROC_PATHNAME Ta "A process ID"
4722de021a4SAndrzej Bialecki.El
47358f0484fSRodney W. Grimes.It Li KERN_PROF
47458f0484fSRodney W. GrimesReturn profiling information about the kernel.
47558f0484fSRodney W. GrimesIf the kernel is not compiled for profiling,
47658f0484fSRodney W. Grimesattempts to retrieve any of the KERN_PROF values will
477c23155a4SRuslan Ermilovfail with
478358034bcSRuslan Ermilov.Er ENOENT .
47958f0484fSRodney W. GrimesThe third level names for the string and integer profiling information
48058f0484fSRodney W. Grimesis detailed below.
48158f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
48258f0484fSRodney W. Grimesprivilege may change the value.
48358f0484fSRodney W. Grimes.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent
484d0353b83SRuslan Ermilov.It Sy "Third level name	Type	Changeable"
485f8a89f62SRuslan Ermilov.It "GPROF_STATE	integer	yes"
486f8a89f62SRuslan Ermilov.It "GPROF_COUNT	u_short[\|]	yes"
487f8a89f62SRuslan Ermilov.It "GPROF_FROMS	u_short[\|]	yes"
488f8a89f62SRuslan Ermilov.It "GPROF_TOS	struct tostruct	yes"
489f8a89f62SRuslan Ermilov.It "GPROF_GMONPARAM	struct gmonparam	no"
49058f0484fSRodney W. Grimes.El
49158f0484fSRodney W. Grimes.Pp
49258f0484fSRodney W. GrimesThe variables are as follows:
49342635956SRuslan Ermilov.Bl -tag -width 6n
49458f0484fSRodney W. Grimes.It Li GPROF_STATE
49558f0484fSRodney W. GrimesReturns GMON_PROF_ON or GMON_PROF_OFF to show that profiling
49658f0484fSRodney W. Grimesis running or stopped.
49758f0484fSRodney W. Grimes.It Li GPROF_COUNT
49858f0484fSRodney W. GrimesArray of statistical program counter counts.
49958f0484fSRodney W. Grimes.It Li GPROF_FROMS
50058f0484fSRodney W. GrimesArray indexed by program counter of call-from points.
50158f0484fSRodney W. Grimes.It Li GPROF_TOS
50258f0484fSRodney W. GrimesArray of
50358f0484fSRodney W. Grimes.Va struct tostruct
50458f0484fSRodney W. Grimesdescribing destination of calls and their counts.
50558f0484fSRodney W. Grimes.It Li GPROF_GMONPARAM
50658f0484fSRodney W. GrimesStructure giving the sizes of the above arrays.
50758f0484fSRodney W. Grimes.El
508443cb51fSChris Costello.It Li KERN_QUANTUM
50911400c9aSChris CostelloThe maximum period of time, in microseconds, for which a process is allowed
51011400c9aSChris Costelloto run without being preempted if other processes are in the run queue.
51158f0484fSRodney W. Grimes.It Li KERN_SAVED_IDS
51258f0484fSRodney W. GrimesReturns 1 if saved set-group and saved set-user ID is available.
51358f0484fSRodney W. Grimes.It Li KERN_SECURELVL
51458f0484fSRodney W. GrimesThe system security level.
51558f0484fSRodney W. GrimesThis level may be raised by processes with appropriate privilege.
516b697833cSGuy HelmerIt may not be lowered.
51758f0484fSRodney W. Grimes.It Li KERN_VERSION
51858f0484fSRodney W. GrimesThe system version string.
51958f0484fSRodney W. Grimes.It Li KERN_VNODE
52058f0484fSRodney W. GrimesReturn the entire vnode table.
52158f0484fSRodney W. GrimesNote, the vnode table is not necessarily a consistent snapshot of
52258f0484fSRodney W. Grimesthe system.
52358f0484fSRodney W. GrimesThe returned data consists of an array whose size depends on the
52458f0484fSRodney W. Grimescurrent number of such objects in the system.
52567c8bc1bSJilles TjoelkerEach element of the array consists of a
52667c8bc1bSJilles Tjoelker.Va struct xvnode .
52758f0484fSRodney W. Grimes.El
52896e430a4SAlexey Zelkin.Ss CTL_NET
52958f0484fSRodney W. GrimesThe string and integer information available for the CTL_NET level
53058f0484fSRodney W. Grimesis detailed below.
53158f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
53258f0484fSRodney W. Grimesprivilege may change the value.
53358f0484fSRodney W. Grimes.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
534d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
535f8a89f62SRuslan Ermilov.It "PF_ROUTE	routing messages	no"
536f8a89f62SRuslan Ermilov.It "PF_INET	IPv4 values	yes"
537f8a89f62SRuslan Ermilov.It "PF_INET6	IPv6 values	yes"
53858f0484fSRodney W. Grimes.El
53942635956SRuslan Ermilov.Bl -tag -width 6n
54058f0484fSRodney W. Grimes.It Li PF_ROUTE
54158f0484fSRodney W. GrimesReturn the entire routing table or a subset of it.
54258f0484fSRodney W. GrimesThe data is returned as a sequence of routing messages (see
54358f0484fSRodney W. Grimes.Xr route 4
54458f0484fSRodney W. Grimesfor the header file, format and meaning).
54558f0484fSRodney W. GrimesThe length of each message is contained in the message header.
54658f0484fSRodney W. Grimes.Pp
54758f0484fSRodney W. GrimesThe third level name is a protocol number, which is currently always 0.
54858f0484fSRodney W. GrimesThe fourth level name is an address family, which may be set to 0 to
54958f0484fSRodney W. Grimesselect all address families.
55058f0484fSRodney W. GrimesThe fifth and sixth level names are as follows:
55158f0484fSRodney W. Grimes.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent
552d0353b83SRuslan Ermilov.It Sy "Fifth level name	Sixth level is:"
553f8a89f62SRuslan Ermilov.It "NET_RT_FLAGS	rtflags"
554f8a89f62SRuslan Ermilov.It "NET_RT_DUMP	None"
555f8a89f62SRuslan Ermilov.It "NET_RT_IFLIST	0 or if_index"
5563b367e99SBruce M Simpson.It "NET_RT_IFMALIST	0 or if_index"
557*6d076ae8SBjoern A. Zeeb.It "NET_RT_IFLISTL	0 or if_index"
55858f0484fSRodney W. Grimes.El
5593b367e99SBruce M Simpson.Pp
5603b367e99SBruce M SimpsonThe
5613b367e99SBruce M Simpson.Dv NET_RT_IFMALIST
5623b367e99SBruce M Simpsonname returns information about multicast group memberships on all interfaces
5633b367e99SBruce M Simpsonif 0 is specified, or for the interface specified by
5643b367e99SBruce M Simpson.Va if_index .
565*6d076ae8SBjoern A. Zeeb.Pp
566*6d076ae8SBjoern A. ZeebThe
567*6d076ae8SBjoern A. Zeeb.Dv NET_RT_IFLISTL
568*6d076ae8SBjoern A. Zeebis like
569*6d076ae8SBjoern A. Zeeb.Dv NET_RT_IFLIST ,
570*6d076ae8SBjoern A. Zeebjust returning message header structs with additional fields allowing the
571*6d076ae8SBjoern A. Zeebinterface to be extended without breaking binary compatibility.
572*6d076ae8SBjoern A. ZeebThe
573*6d076ae8SBjoern A. Zeeb.Dv NET_RT_IFLISTL
574*6d076ae8SBjoern A. Zeebuses 'l' versions of the message header structures:
575*6d076ae8SBjoern A. Zeeb.Va struct if_msghdrl
576*6d076ae8SBjoern A. Zeeband
577*6d076ae8SBjoern A. Zeeb.Va struct ifa_msghdrl .
57858f0484fSRodney W. Grimes.It Li PF_INET
5791522ff5bSJun-ichiro itojun HaginoGet or set various global information about the IPv4
580c4d9468eSRuslan Ermilov(Internet Protocol version 4).
58158f0484fSRodney W. GrimesThe third level name is the protocol.
58258f0484fSRodney W. GrimesThe fourth level name is the variable name.
58358f0484fSRodney W. GrimesThe currently defined protocols and names are:
58461a4defdSJoseph Koshy.Bl -column ProtocolXX VariableXX TypeXX ChangeableXX
585d0353b83SRuslan Ermilov.It Sy "Protocol	Variable	Type	Changeable"
58642635956SRuslan Ermilov.It "icmp	bmcastecho	integer	yes"
58742635956SRuslan Ermilov.It "icmp	maskrepl	integer	yes"
58842635956SRuslan Ermilov.It "ip	forwarding	integer	yes"
58942635956SRuslan Ermilov.It "ip	redirect	integer	yes"
59042635956SRuslan Ermilov.It "ip	ttl	integer	yes"
59142635956SRuslan Ermilov.It "udp	checksum	integer	yes"
59258f0484fSRodney W. Grimes.El
59358f0484fSRodney W. Grimes.Pp
59458f0484fSRodney W. GrimesThe variables are as follows:
59542635956SRuslan Ermilov.Bl -tag -width 6n
5960a843f2aSJoseph Koshy.It Li icmp.bmcastecho
5970a843f2aSJoseph KoshyReturns 1 if an ICMP echo request to a broadcast or multicast address is
5980a843f2aSJoseph Koshyto be answered.
5990a843f2aSJoseph Koshy.It Li icmp.maskrepl
6000a843f2aSJoseph KoshyReturns 1 if ICMP network mask requests are to be answered.
60158f0484fSRodney W. Grimes.It Li ip.forwarding
60258f0484fSRodney W. GrimesReturns 1 when IP forwarding is enabled for the host,
60358f0484fSRodney W. Grimesmeaning that the host is acting as a router.
60458f0484fSRodney W. Grimes.It Li ip.redirect
60558f0484fSRodney W. GrimesReturns 1 when ICMP redirects may be sent by the host.
60658f0484fSRodney W. GrimesThis option is ignored unless the host is routing IP packets,
60758f0484fSRodney W. Grimesand should normally be enabled on all systems.
60858f0484fSRodney W. Grimes.It Li ip.ttl
60958f0484fSRodney W. GrimesThe maximum time-to-live (hop count) value for an IP packet sourced by
61058f0484fSRodney W. Grimesthe system.
61158f0484fSRodney W. GrimesThis value applies to normal transport protocols, not to ICMP.
61258f0484fSRodney W. Grimes.It Li udp.checksum
61358f0484fSRodney W. GrimesReturns 1 when UDP checksums are being computed and checked.
61458f0484fSRodney W. GrimesDisabling UDP checksums is strongly discouraged.
6151522ff5bSJun-ichiro itojun Hagino.Pp
6168a3c1270SJun-ichiro itojun HaginoFor variables net.inet.*.ipsec, please refer to
6171522ff5bSJun-ichiro itojun Hagino.Xr ipsec 4 .
6181522ff5bSJun-ichiro itojun Hagino.El
6191522ff5bSJun-ichiro itojun Hagino.It Li PF_INET6
6201522ff5bSJun-ichiro itojun HaginoGet or set various global information about the IPv6
621c4d9468eSRuslan Ermilov(Internet Protocol version 6).
6221522ff5bSJun-ichiro itojun HaginoThe third level name is the protocol.
6231522ff5bSJun-ichiro itojun HaginoThe fourth level name is the variable name.
6241522ff5bSJun-ichiro itojun Hagino.Pp
6258a3c1270SJun-ichiro itojun HaginoFor variables net.inet6.* please refer to
6268a3c1270SJun-ichiro itojun Hagino.Xr inet6 4 .
6278a3c1270SJun-ichiro itojun HaginoFor variables net.inet6.*.ipsec6, please refer to
6281522ff5bSJun-ichiro itojun Hagino.Xr ipsec 4 .
62958f0484fSRodney W. Grimes.El
63096e430a4SAlexey Zelkin.Ss CTL_USER
63158f0484fSRodney W. GrimesThe string and integer information available for the CTL_USER level
63258f0484fSRodney W. Grimesis detailed below.
63358f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
63458f0484fSRodney W. Grimesprivilege may change the value.
63558f0484fSRodney W. Grimes.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent
636d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
637f8a89f62SRuslan Ermilov.It "USER_BC_BASE_MAX	integer	no"
638f8a89f62SRuslan Ermilov.It "USER_BC_DIM_MAX	integer	no"
639f8a89f62SRuslan Ermilov.It "USER_BC_SCALE_MAX	integer	no"
640f8a89f62SRuslan Ermilov.It "USER_BC_STRING_MAX	integer	no"
641f8a89f62SRuslan Ermilov.It "USER_COLL_WEIGHTS_MAX	integer	no"
642f8a89f62SRuslan Ermilov.It "USER_CS_PATH	string	no"
643f8a89f62SRuslan Ermilov.It "USER_EXPR_NEST_MAX	integer	no"
644f8a89f62SRuslan Ermilov.It "USER_LINE_MAX	integer	no"
645f8a89f62SRuslan Ermilov.It "USER_POSIX2_CHAR_TERM	integer	no"
646f8a89f62SRuslan Ermilov.It "USER_POSIX2_C_BIND	integer	no"
647f8a89f62SRuslan Ermilov.It "USER_POSIX2_C_DEV	integer	no"
648f8a89f62SRuslan Ermilov.It "USER_POSIX2_FORT_DEV	integer	no"
649f8a89f62SRuslan Ermilov.It "USER_POSIX2_FORT_RUN	integer	no"
650f8a89f62SRuslan Ermilov.It "USER_POSIX2_LOCALEDEF	integer	no"
651f8a89f62SRuslan Ermilov.It "USER_POSIX2_SW_DEV	integer	no"
652f8a89f62SRuslan Ermilov.It "USER_POSIX2_UPE	integer	no"
653f8a89f62SRuslan Ermilov.It "USER_POSIX2_VERSION	integer	no"
654f8a89f62SRuslan Ermilov.It "USER_RE_DUP_MAX	integer	no"
655f8a89f62SRuslan Ermilov.It "USER_STREAM_MAX	integer	no"
656f8a89f62SRuslan Ermilov.It "USER_TZNAME_MAX	integer	no"
65758f0484fSRodney W. Grimes.El
65842635956SRuslan Ermilov.Bl -tag -width 6n
65958f0484fSRodney W. Grimes.It Li USER_BC_BASE_MAX
66058f0484fSRodney W. GrimesThe maximum ibase/obase values in the
66158f0484fSRodney W. Grimes.Xr bc 1
66258f0484fSRodney W. Grimesutility.
66358f0484fSRodney W. Grimes.It Li USER_BC_DIM_MAX
66458f0484fSRodney W. GrimesThe maximum array size in the
66558f0484fSRodney W. Grimes.Xr bc 1
66658f0484fSRodney W. Grimesutility.
66758f0484fSRodney W. Grimes.It Li USER_BC_SCALE_MAX
66858f0484fSRodney W. GrimesThe maximum scale value in the
66958f0484fSRodney W. Grimes.Xr bc 1
67058f0484fSRodney W. Grimesutility.
67158f0484fSRodney W. Grimes.It Li USER_BC_STRING_MAX
67258f0484fSRodney W. GrimesThe maximum string length in the
67358f0484fSRodney W. Grimes.Xr bc 1
67458f0484fSRodney W. Grimesutility.
67558f0484fSRodney W. Grimes.It Li USER_COLL_WEIGHTS_MAX
67658f0484fSRodney W. GrimesThe maximum number of weights that can be assigned to any entry of
67758f0484fSRodney W. Grimesthe LC_COLLATE order keyword in the locale definition file.
67858f0484fSRodney W. Grimes.It Li USER_CS_PATH
67958f0484fSRodney W. GrimesReturn a value for the
68058f0484fSRodney W. Grimes.Ev PATH
68158f0484fSRodney W. Grimesenvironment variable that finds all the standard utilities.
68258f0484fSRodney W. Grimes.It Li USER_EXPR_NEST_MAX
68358f0484fSRodney W. GrimesThe maximum number of expressions that can be nested within
68458f0484fSRodney W. Grimesparenthesis by the
68558f0484fSRodney W. Grimes.Xr expr 1
68658f0484fSRodney W. Grimesutility.
68758f0484fSRodney W. Grimes.It Li USER_LINE_MAX
68858f0484fSRodney W. GrimesThe maximum length in bytes of a text-processing utility's input
68958f0484fSRodney W. Grimesline.
69058f0484fSRodney W. Grimes.It Li USER_POSIX2_CHAR_TERM
69158f0484fSRodney W. GrimesReturn 1 if the system supports at least one terminal type capable of
692fdc1fef5SRuslan Ermilovall operations described in
693fdc1fef5SRuslan Ermilov.St -p1003.2 ,
694fdc1fef5SRuslan Ermilovotherwise 0.
69558f0484fSRodney W. Grimes.It Li USER_POSIX2_C_BIND
69658f0484fSRodney W. GrimesReturn 1 if the system's C-language development facilities support the
69758f0484fSRodney W. GrimesC-Language Bindings Option, otherwise 0.
69858f0484fSRodney W. Grimes.It Li USER_POSIX2_C_DEV
69958f0484fSRodney W. GrimesReturn 1 if the system supports the C-Language Development Utilities Option,
70058f0484fSRodney W. Grimesotherwise 0.
70158f0484fSRodney W. Grimes.It Li USER_POSIX2_FORT_DEV
70258f0484fSRodney W. GrimesReturn 1 if the system supports the FORTRAN Development Utilities Option,
70358f0484fSRodney W. Grimesotherwise 0.
70458f0484fSRodney W. Grimes.It Li USER_POSIX2_FORT_RUN
70558f0484fSRodney W. GrimesReturn 1 if the system supports the FORTRAN Runtime Utilities Option,
70658f0484fSRodney W. Grimesotherwise 0.
70758f0484fSRodney W. Grimes.It Li USER_POSIX2_LOCALEDEF
70858f0484fSRodney W. GrimesReturn 1 if the system supports the creation of locales, otherwise 0.
70958f0484fSRodney W. Grimes.It Li USER_POSIX2_SW_DEV
71058f0484fSRodney W. GrimesReturn 1 if the system supports the Software Development Utilities Option,
71158f0484fSRodney W. Grimesotherwise 0.
71258f0484fSRodney W. Grimes.It Li USER_POSIX2_UPE
71358f0484fSRodney W. GrimesReturn 1 if the system supports the User Portability Utilities Option,
71458f0484fSRodney W. Grimesotherwise 0.
71558f0484fSRodney W. Grimes.It Li USER_POSIX2_VERSION
716fdc1fef5SRuslan ErmilovThe version of
717fdc1fef5SRuslan Ermilov.St -p1003.2
718fdc1fef5SRuslan Ermilovwith which the system attempts to comply.
71958f0484fSRodney W. Grimes.It Li USER_RE_DUP_MAX
72058f0484fSRodney W. GrimesThe maximum number of repeated occurrences of a regular expression
72158f0484fSRodney W. Grimespermitted when using interval notation.
72258f0484fSRodney W. Grimes.It Li USER_STREAM_MAX
72358f0484fSRodney W. GrimesThe minimum maximum number of streams that a process may have open
72458f0484fSRodney W. Grimesat any one time.
72558f0484fSRodney W. Grimes.It Li USER_TZNAME_MAX
72658f0484fSRodney W. GrimesThe minimum maximum number of types supported for the name of a
72758f0484fSRodney W. Grimestimezone.
72858f0484fSRodney W. Grimes.El
72996e430a4SAlexey Zelkin.Ss CTL_VM
73058f0484fSRodney W. GrimesThe string and integer information available for the CTL_VM level
73158f0484fSRodney W. Grimesis detailed below.
73258f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
73358f0484fSRodney W. Grimesprivilege may change the value.
73458f0484fSRodney W. Grimes.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
735d0353b83SRuslan Ermilov.It Sy "Second level name	Type	Changeable"
736f8a89f62SRuslan Ermilov.It "VM_LOADAVG	struct loadavg	no"
7373be18423SRuslan Ermilov.It "VM_TOTAL	struct vmtotal	no"
738f8a89f62SRuslan Ermilov.It "VM_PAGEOUT_ALGORITHM	integer	yes"
739f8a89f62SRuslan Ermilov.It "VM_SWAPPING_ENABLED	integer	maybe"
740f8a89f62SRuslan Ermilov.It "VM_V_CACHE_MAX	integer	yes"
741f8a89f62SRuslan Ermilov.It "VM_V_CACHE_MIN	integer	yes"
742f8a89f62SRuslan Ermilov.It "VM_V_FREE_MIN	integer	yes"
743f8a89f62SRuslan Ermilov.It "VM_V_FREE_RESERVED	integer	yes"
744f8a89f62SRuslan Ermilov.It "VM_V_FREE_TARGET	integer	yes"
745f8a89f62SRuslan Ermilov.It "VM_V_INACTIVE_TARGET	integer	yes"
746f8a89f62SRuslan Ermilov.It "VM_V_PAGEOUT_FREE_MIN	integer	yes"
74758f0484fSRodney W. Grimes.El
74842635956SRuslan Ermilov.Bl -tag -width 6n
74958f0484fSRodney W. Grimes.It Li VM_LOADAVG
75058f0484fSRodney W. GrimesReturn the load average history.
75158f0484fSRodney W. GrimesThe returned data consists of a
75258f0484fSRodney W. Grimes.Va struct loadavg .
7533be18423SRuslan Ermilov.It Li VM_TOTAL
75458f0484fSRodney W. GrimesReturn the system wide virtual memory statistics.
75558f0484fSRodney W. GrimesThe returned data consists of a
75658f0484fSRodney W. Grimes.Va struct vmtotal .
757b697833cSGuy Helmer.It Li VM_PAGEOUT_ALGORITHM
758b697833cSGuy Helmer0 if the statistics-based page management algorithm is in use
759b697833cSGuy Helmeror 1 if the near-LRU algorithm is in use.
760b697833cSGuy Helmer.It Li VM_SWAPPING_ENABLED
7611a0a9345SRuslan Ermilov1 if process swapping is enabled or 0 if disabled.
7621a0a9345SRuslan ErmilovThis variable is
763b697833cSGuy Helmerpermanently set to 0 if the kernel was built with swapping disabled.
764b697833cSGuy Helmer.It Li VM_V_CACHE_MAX
765b697833cSGuy HelmerMaximum desired size of the cache queue.
766b697833cSGuy Helmer.It Li VM_V_CACHE_MIN
7671a0a9345SRuslan ErmilovMinimum desired size of the cache queue.
7681a0a9345SRuslan ErmilovIf the cache queue size
769b697833cSGuy Helmerfalls very far below this value, the pageout daemon is awakened.
770b697833cSGuy Helmer.It Li VM_V_FREE_MIN
771b697833cSGuy HelmerMinimum amount of memory (cache memory plus free memory)
772b697833cSGuy Helmerrequired to be available before a process waiting on memory will be
773b697833cSGuy Helmerawakened.
774b697833cSGuy Helmer.It Li VM_V_FREE_RESERVED
775b697833cSGuy HelmerProcesses will awaken the pageout daemon and wait for memory if the
776b697833cSGuy Helmernumber of free and cached pages drops below this value.
777b697833cSGuy Helmer.It Li VM_V_FREE_TARGET
778b697833cSGuy HelmerThe total amount of free memory (including cache memory) that the
779b697833cSGuy Helmerpageout daemon tries to maintain.
780b697833cSGuy Helmer.It Li VM_V_INACTIVE_TARGET
781b697833cSGuy HelmerThe desired number of inactive pages that the pageout daemon should
7821a0a9345SRuslan Ermilovachieve when it runs.
7831a0a9345SRuslan ErmilovInactive pages can be quickly inserted into
784b697833cSGuy Helmerprocess address space when needed.
785b697833cSGuy Helmer.It Li VM_V_PAGEOUT_FREE_MIN
786b697833cSGuy HelmerIf the amount of free and cache memory falls below this value, the
787b697833cSGuy Helmerpageout daemon will enter "memory conserving mode" to avoid deadlock.
78858f0484fSRodney W. Grimes.El
78958f0484fSRodney W. Grimes.Sh RETURN VALUES
790d6002fefSRuslan Ermilov.Rv -std
79124a0682cSRuslan Ermilov.Sh FILES
79224a0682cSRuslan Ermilov.Bl -tag -width <netinet/icmpXvar.h> -compact
79324a0682cSRuslan Ermilov.It In sys/sysctl.h
79424a0682cSRuslan Ermilovdefinitions for top level identifiers, second level kernel and hardware
79524a0682cSRuslan Ermilovidentifiers, and user level identifiers
79624a0682cSRuslan Ermilov.It In sys/socket.h
79724a0682cSRuslan Ermilovdefinitions for second level network identifiers
79824a0682cSRuslan Ermilov.It In sys/gmon.h
79924a0682cSRuslan Ermilovdefinitions for third level profiling identifiers
80024a0682cSRuslan Ermilov.It In vm/vm_param.h
80124a0682cSRuslan Ermilovdefinitions for second level virtual memory identifiers
80224a0682cSRuslan Ermilov.It In netinet/in.h
80324a0682cSRuslan Ermilovdefinitions for third level IPv4/IPv6 identifiers and
80424a0682cSRuslan Ermilovfourth level IPv4/v6 identifiers
80524a0682cSRuslan Ermilov.It In netinet/icmp_var.h
80624a0682cSRuslan Ermilovdefinitions for fourth level ICMP identifiers
80724a0682cSRuslan Ermilov.It In netinet/icmp6.h
80824a0682cSRuslan Ermilovdefinitions for fourth level ICMPv6 identifiers
80924a0682cSRuslan Ermilov.It In netinet/udp_var.h
81024a0682cSRuslan Ermilovdefinitions for fourth level UDP identifiers
81124a0682cSRuslan Ermilov.El
81258f0484fSRodney W. Grimes.Sh ERRORS
81358f0484fSRodney W. GrimesThe following errors may be reported:
81458f0484fSRodney W. Grimes.Bl -tag -width Er
81558f0484fSRodney W. Grimes.It Bq Er EFAULT
81658f0484fSRodney W. GrimesThe buffer
81758f0484fSRodney W. Grimes.Fa name ,
81858f0484fSRodney W. Grimes.Fa oldp ,
81958f0484fSRodney W. Grimes.Fa newp ,
82058f0484fSRodney W. Grimesor length pointer
82158f0484fSRodney W. Grimes.Fa oldlenp
82258f0484fSRodney W. Grimescontains an invalid address.
82358f0484fSRodney W. Grimes.It Bq Er EINVAL
82458f0484fSRodney W. GrimesThe
82558f0484fSRodney W. Grimes.Fa name
82658f0484fSRodney W. Grimesarray is less than two or greater than CTL_MAXNAME.
82758f0484fSRodney W. Grimes.It Bq Er EINVAL
82858f0484fSRodney W. GrimesA non-null
82958f0484fSRodney W. Grimes.Fa newp
83058f0484fSRodney W. Grimesis given and its specified length in
83158f0484fSRodney W. Grimes.Fa newlen
83258f0484fSRodney W. Grimesis too large or too small.
83358f0484fSRodney W. Grimes.It Bq Er ENOMEM
83458f0484fSRodney W. GrimesThe length pointed to by
83558f0484fSRodney W. Grimes.Fa oldlenp
83658f0484fSRodney W. Grimesis too short to hold the requested value.
837c947dc05SDon Lewis.It Bq Er ENOMEM
838c947dc05SDon LewisThe smaller of either the length pointed to by
839c947dc05SDon Lewis.Fa oldlenp
840c947dc05SDon Lewisor the estimated size of the returned data exceeds the
841c947dc05SDon Lewissystem limit on locked memory.
842c947dc05SDon Lewis.It Bq Er ENOMEM
843c947dc05SDon LewisLocking the buffer
844c947dc05SDon Lewis.Fa oldp ,
845c947dc05SDon Lewisor a portion of the buffer if the estimated size of the data
846c947dc05SDon Lewisto be returned is smaller,
847c947dc05SDon Lewiswould cause the process to exceed its per-process locked memory limit.
84858f0484fSRodney W. Grimes.It Bq Er ENOTDIR
84958f0484fSRodney W. GrimesThe
85058f0484fSRodney W. Grimes.Fa name
85158f0484fSRodney W. Grimesarray specifies an intermediate rather than terminal name.
852226420a4SBrian Feldman.It Bq Er EISDIR
853226420a4SBrian FeldmanThe
854226420a4SBrian Feldman.Fa name
855226420a4SBrian Feldmanarray specifies a terminal name, but the actual name is not terminal.
856358034bcSRuslan Ermilov.It Bq Er ENOENT
85758f0484fSRodney W. GrimesThe
85858f0484fSRodney W. Grimes.Fa name
85958f0484fSRodney W. Grimesarray specifies a value that is unknown.
86058f0484fSRodney W. Grimes.It Bq Er EPERM
86158f0484fSRodney W. GrimesAn attempt is made to set a read-only value.
86258f0484fSRodney W. Grimes.It Bq Er EPERM
86358f0484fSRodney W. GrimesA process without appropriate privilege attempts to set a value.
86458f0484fSRodney W. Grimes.El
86558f0484fSRodney W. Grimes.Sh SEE ALSO
86667c8bc1bSJilles Tjoelker.Xr confstr 3 ,
86767c8bc1bSJilles Tjoelker.Xr kvm 3 ,
86838cf6319SEivind Eklund.Xr sysconf 3 ,
869f5a78334SJoseph Koshy.Xr sysctl 8
87058f0484fSRodney W. Grimes.Sh HISTORY
87158f0484fSRodney W. GrimesThe
872bf5a138eSMike Pritchard.Fn sysctl
8737bdf80e5SMike Pritchardfunction first appeared in
8747bdf80e5SMike Pritchard.Bx 4.4 .
875