xref: /freebsd/lib/libc/gen/sysctl.3 (revision 4cf6cae879f93856fd3d932574b4f154e8dc5367)
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.
12fbbd9655SWarner Losh.\" 3. 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.\"
2862a573d9SMateusz Guzik.Dd March 16, 2023
2958f0484fSRodney W. Grimes.Dt SYSCTL 3
3058f0484fSRodney W. Grimes.Os
3158f0484fSRodney W. Grimes.Sh NAME
32dd1d7d1fSPeter Wemm.Nm sysctl ,
33a9dc3bacSKirk McKusick.Nm sysctlbyname ,
34a9dc3bacSKirk McKusick.Nm sysctlnametomib
3558f0484fSRodney W. Grimes.Nd get or set system information
3625bb73e0SAlexey Zelkin.Sh LIBRARY
3725bb73e0SAlexey Zelkin.Lb libc
3858f0484fSRodney W. Grimes.Sh SYNOPSIS
3932eef9aeSRuslan Ermilov.In sys/sysctl.h
4058f0484fSRodney W. Grimes.Ft int
4162399df2SEd Schouten.Fn sysctl "const int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "const void *newp" "size_t newlen"
4204b7c947SBruce Evans.Ft int
4362399df2SEd Schouten.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "const void *newp" "size_t newlen"
44a9dc3bacSKirk McKusick.Ft int
45a9dc3bacSKirk McKusick.Fn sysctlnametomib "const char *name" "int *mibp" "size_t *sizep"
4658f0484fSRodney W. Grimes.Sh DESCRIPTION
4758f0484fSRodney W. GrimesThe
48bf5a138eSMike Pritchard.Fn sysctl
4958f0484fSRodney W. Grimesfunction retrieves system information and allows processes with
5058f0484fSRodney W. Grimesappropriate privileges to set system information.
5158f0484fSRodney W. GrimesThe information available from
52bf5a138eSMike Pritchard.Fn sysctl
5358f0484fSRodney W. Grimesconsists of integers, strings, and tables.
5458f0484fSRodney W. GrimesInformation may be retrieved and set from the command interface
5558f0484fSRodney W. Grimesusing the
56e1f4e80cSMike Pritchard.Xr sysctl 8
5758f0484fSRodney W. Grimesutility.
5858f0484fSRodney W. Grimes.Pp
5958f0484fSRodney W. GrimesUnless explicitly noted below,
60bf5a138eSMike Pritchard.Fn sysctl
6158f0484fSRodney W. Grimesreturns a consistent snapshot of the data requested.
6258f0484fSRodney W. GrimesConsistency is obtained by locking the destination
6358f0484fSRodney W. Grimesbuffer into memory so that the data may be copied out without blocking.
6458f0484fSRodney W. GrimesCalls to
65bf5a138eSMike Pritchard.Fn sysctl
6658f0484fSRodney W. Grimesare serialized to avoid deadlock.
6758f0484fSRodney W. Grimes.Pp
6858f0484fSRodney W. GrimesThe state is described using a ``Management Information Base'' (MIB)
6958f0484fSRodney W. Grimesstyle name, listed in
7058f0484fSRodney W. Grimes.Fa name ,
7158f0484fSRodney W. Grimeswhich is a
7258f0484fSRodney W. Grimes.Fa namelen
7358f0484fSRodney W. Grimeslength array of integers.
7458f0484fSRodney W. Grimes.Pp
75dd1d7d1fSPeter WemmThe
76dd1d7d1fSPeter Wemm.Fn sysctlbyname
77c6d6e772SAlexey Zelkinfunction accepts an ASCII representation of the name and internally
781a0a9345SRuslan Ermilovlooks up the integer name vector.
791a0a9345SRuslan ErmilovApart from that, it behaves the same
80dd1d7d1fSPeter Wemmas the standard
81dd1d7d1fSPeter Wemm.Fn sysctl
82dd1d7d1fSPeter Wemmfunction.
83dd1d7d1fSPeter Wemm.Pp
8458f0484fSRodney W. GrimesThe information is copied into the buffer specified by
8558f0484fSRodney W. Grimes.Fa oldp .
8658f0484fSRodney W. GrimesThe size of the buffer is given by the location specified by
8758f0484fSRodney W. Grimes.Fa oldlenp
8858f0484fSRodney W. Grimesbefore the call,
89b1f6a5fbSBruce Evansand that location gives the amount of data copied after a successful call
90c23155a4SRuslan Ermilovand after a call that returns with the error code
91c23155a4SRuslan Ermilov.Er ENOMEM .
9258f0484fSRodney W. GrimesIf the amount of data available is greater
9358f0484fSRodney W. Grimesthan the size of the buffer supplied,
9458f0484fSRodney W. Grimesthe call supplies as much data as fits in the buffer provided
95c23155a4SRuslan Ermilovand returns with the error code
96c23155a4SRuslan Ermilov.Er ENOMEM .
9758f0484fSRodney W. GrimesIf the old value is not desired,
9858f0484fSRodney W. Grimes.Fa oldp
9958f0484fSRodney W. Grimesand
10058f0484fSRodney W. Grimes.Fa oldlenp
10158f0484fSRodney W. Grimesshould be set to NULL.
10258f0484fSRodney W. Grimes.Pp
10358f0484fSRodney W. GrimesThe size of the available data can be determined by calling
104bf5a138eSMike Pritchard.Fn sysctl
1052efeeba5SRuslan Ermilovwith the
1062efeeba5SRuslan Ermilov.Dv NULL
1072efeeba5SRuslan Ermilovargument for
10858f0484fSRodney W. Grimes.Fa oldp .
10958f0484fSRodney W. GrimesThe size of the available data will be returned in the location pointed to by
11058f0484fSRodney W. Grimes.Fa oldlenp .
11158f0484fSRodney W. GrimesFor some operations, the amount of space may change often.
11258f0484fSRodney W. GrimesFor these operations,
11358f0484fSRodney W. Grimesthe system attempts to round up so that the returned size is
11458f0484fSRodney W. Grimeslarge enough for a call to return the data shortly thereafter.
11558f0484fSRodney W. Grimes.Pp
11658f0484fSRodney W. GrimesTo set a new value,
11758f0484fSRodney W. Grimes.Fa newp
11858f0484fSRodney W. Grimesis set to point to a buffer of length
11958f0484fSRodney W. Grimes.Fa newlen
12058f0484fSRodney W. Grimesfrom which the requested value is to be taken.
12158f0484fSRodney W. GrimesIf a new value is not to be set,
12258f0484fSRodney W. Grimes.Fa newp
12358f0484fSRodney W. Grimesshould be set to NULL and
12458f0484fSRodney W. Grimes.Fa newlen
12558f0484fSRodney W. Grimesset to 0.
12658f0484fSRodney W. Grimes.Pp
127a9dc3bacSKirk McKusickThe
128a9dc3bacSKirk McKusick.Fn sysctlnametomib
129a9dc3bacSKirk McKusickfunction accepts an ASCII representation of the name,
130a9dc3bacSKirk McKusicklooks up the integer name vector,
131a9dc3bacSKirk McKusickand returns the numeric representation in the mib array pointed to by
132a9dc3bacSKirk McKusick.Fa mibp .
133a9dc3bacSKirk McKusickThe number of elements in the mib array is given by the location specified by
134a9dc3bacSKirk McKusick.Fa sizep
135a9dc3bacSKirk McKusickbefore the call,
136a9dc3bacSKirk McKusickand that location gives the number of entries copied after a successful call.
137a9dc3bacSKirk McKusickThe resulting
138a9dc3bacSKirk McKusick.Fa mib
139a9dc3bacSKirk McKusickand
140a9dc3bacSKirk McKusick.Fa size
141a9dc3bacSKirk McKusickmay be used in subsequent
142a9dc3bacSKirk McKusick.Fn sysctl
143a9dc3bacSKirk McKusickcalls to get the data associated with the requested ASCII name.
144a9dc3bacSKirk McKusickThis interface is intended for use by applications that want to
145a9dc3bacSKirk McKusickrepeatedly request the same variable (the
146a9dc3bacSKirk McKusick.Fn sysctl
147a9dc3bacSKirk McKusickfunction runs in about a third the time as the same request made via the
148a9dc3bacSKirk McKusick.Fn sysctlbyname
149a9dc3bacSKirk McKusickfunction).
150a9dc3bacSKirk McKusickThe
1513afe2c78SDima Dorfman.Fn sysctlnametomib
152a9dc3bacSKirk McKusickfunction is also useful for fetching mib prefixes and then adding
153a9dc3bacSKirk McKusicka final component.
154a9dc3bacSKirk McKusickFor example, to fetch process information
155a9dc3bacSKirk McKusickfor processes with pid's less than 100:
1569715c87bSRuslan Ermilov.Pp
157a9dc3bacSKirk McKusick.Bd -literal -offset indent -compact
158a9dc3bacSKirk McKusickint i, mib[4];
159a9dc3bacSKirk McKusicksize_t len;
160a9dc3bacSKirk McKusickstruct kinfo_proc kp;
161a9dc3bacSKirk McKusick
162a9dc3bacSKirk McKusick/* Fill out the first three components of the mib */
163a9dc3bacSKirk McKusicklen = 4;
164a9dc3bacSKirk McKusicksysctlnametomib("kern.proc.pid", mib, &len);
165a9dc3bacSKirk McKusick
166a9dc3bacSKirk McKusick/* Fetch and print entries for pid's < 100 */
167a9dc3bacSKirk McKusickfor (i = 0; i < 100; i++) {
168a9dc3bacSKirk McKusick	mib[3] = i;
169a9dc3bacSKirk McKusick	len = sizeof(kp);
170a9dc3bacSKirk McKusick	if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1)
171a9dc3bacSKirk McKusick		perror("sysctl");
172a9dc3bacSKirk McKusick	else if (len > 0)
173a9dc3bacSKirk McKusick		printkproc(&kp);
174a9dc3bacSKirk McKusick}
175a9dc3bacSKirk McKusick.Ed
176a9dc3bacSKirk McKusick.Pp
17758f0484fSRodney W. GrimesThe top level names are defined with a CTL_ prefix in
178fe08efe6SRuslan Ermilov.In sys/sysctl.h ,
17958f0484fSRodney W. Grimesand are as follows.
18058f0484fSRodney W. GrimesThe next and subsequent levels down are found in the include files
18158f0484fSRodney W. Grimeslisted here, and described in separate sections below.
182ab1b41edSJohn Baldwin.Bl -column CTLXMACHDEPXXX "Next Level NamesXXXXXX" -offset indent
183ab1b41edSJohn Baldwin.It Sy Name Ta Sy Next Level Names Ta Sy Description
184ab1b41edSJohn Baldwin.It Dv CTL_DEBUG Ta In sys/sysctl.h Ta Debugging
185ab1b41edSJohn Baldwin.It Dv CTL_VFS Ta In sys/mount.h Ta File system
186ab1b41edSJohn Baldwin.It Dv CTL_HW Ta In sys/sysctl.h Ta Generic CPU, I/O
187ab1b41edSJohn Baldwin.It Dv CTL_KERN Ta In sys/sysctl.h Ta High kernel limits
188ab1b41edSJohn Baldwin.It Dv CTL_MACHDEP Ta In sys/sysctl.h Ta Machine dependent
189ab1b41edSJohn Baldwin.It Dv CTL_NET Ta In sys/socket.h Ta Networking
190ab1b41edSJohn Baldwin.It Dv CTL_USER Ta In sys/sysctl.h Ta User-level
191ab1b41edSJohn Baldwin.It Dv CTL_VM Ta In vm/vm_param.h Ta Virtual memory
19258f0484fSRodney W. Grimes.El
19358f0484fSRodney W. Grimes.Pp
19458f0484fSRodney W. GrimesFor example, the following retrieves the maximum number of processes allowed
19558f0484fSRodney W. Grimesin the system:
196c492ccdbSMike Pritchard.Pp
19758f0484fSRodney W. Grimes.Bd -literal -offset indent -compact
19858f0484fSRodney W. Grimesint mib[2], maxproc;
19958f0484fSRodney W. Grimessize_t len;
200c492ccdbSMike Pritchard
20158f0484fSRodney W. Grimesmib[0] = CTL_KERN;
20258f0484fSRodney W. Grimesmib[1] = KERN_MAXPROC;
20358f0484fSRodney W. Grimeslen = sizeof(maxproc);
20458f0484fSRodney W. Grimessysctl(mib, 2, &maxproc, &len, NULL, 0);
20558f0484fSRodney W. Grimes.Ed
206c492ccdbSMike Pritchard.Pp
20758f0484fSRodney W. GrimesTo retrieve the standard search path for the system utilities:
208c492ccdbSMike Pritchard.Pp
20958f0484fSRodney W. Grimes.Bd -literal -offset indent -compact
21058f0484fSRodney W. Grimesint mib[2];
21158f0484fSRodney W. Grimessize_t len;
21258f0484fSRodney W. Grimeschar *p;
213c492ccdbSMike Pritchard
21458f0484fSRodney W. Grimesmib[0] = CTL_USER;
21558f0484fSRodney W. Grimesmib[1] = USER_CS_PATH;
21658f0484fSRodney W. Grimessysctl(mib, 2, NULL, &len, NULL, 0);
21758f0484fSRodney W. Grimesp = malloc(len);
21858f0484fSRodney W. Grimessysctl(mib, 2, p, &len, NULL, 0);
21958f0484fSRodney W. Grimes.Ed
22096e430a4SAlexey Zelkin.Ss CTL_DEBUG
22158f0484fSRodney W. GrimesThe debugging variables vary from system to system.
22258f0484fSRodney W. GrimesA debugging variable may be added or deleted without need to recompile
223bf5a138eSMike Pritchard.Fn sysctl
22458f0484fSRodney W. Grimesto know about it.
22558f0484fSRodney W. GrimesEach time it runs,
226bf5a138eSMike Pritchard.Fn sysctl
22758f0484fSRodney W. Grimesgets the list of debugging variables from the kernel and
22858f0484fSRodney W. Grimesdisplays their current values.
22958f0484fSRodney W. GrimesThe system defines twenty
23095f4226bSRuslan Ermilov.Pq Vt "struct ctldebug"
23158f0484fSRodney W. Grimesvariables named
23295f4226bSRuslan Ermilov.Va debug0
23358f0484fSRodney W. Grimesthrough
23495f4226bSRuslan Ermilov.Va debug19 .
23558f0484fSRodney W. GrimesThey are declared as separate variables so that they can be
23658f0484fSRodney W. Grimesindividually initialized at the location of their associated variable.
23758f0484fSRodney W. GrimesThe loader prevents multiple use of the same variable by issuing errors
23858f0484fSRodney W. Grimesif a variable is initialized in more than one place.
23958f0484fSRodney W. GrimesFor example, to export the variable
24095f4226bSRuslan Ermilov.Va dospecialcheck
24158f0484fSRodney W. Grimesas a debugging variable, the following declaration would be used:
24295f4226bSRuslan Ermilov.Pp
24358f0484fSRodney W. Grimes.Bd -literal -offset indent -compact
24458f0484fSRodney W. Grimesint dospecialcheck = 1;
24558f0484fSRodney W. Grimesstruct ctldebug debug5 = { "dospecialcheck", &dospecialcheck };
24658f0484fSRodney W. Grimes.Ed
24796e430a4SAlexey Zelkin.Ss CTL_VFS
2480014b4c0SPeter WemmA distinguished second level name, VFS_GENERIC,
2490014b4c0SPeter Wemmis used to get general information about all file systems.
2500014b4c0SPeter WemmOne of its third level identifiers is VFS_MAXTYPENUM
2510014b4c0SPeter Wemmthat gives the highest valid file system type number.
2520014b4c0SPeter WemmIts other third level identifier is VFS_CONF that
2530014b4c0SPeter Wemmreturns configuration information about the file system
2540014b4c0SPeter Wemmtype given as a fourth level identifier (see
2550014b4c0SPeter Wemm.Xr getvfsbyname 3
2560014b4c0SPeter Wemmas an example of its use).
2570014b4c0SPeter WemmThe remaining second level identifiers are the
2580014b4c0SPeter Wemmfile system type number returned by a
2590014b4c0SPeter Wemm.Xr statfs 2
2600014b4c0SPeter Wemmcall or from VFS_CONF.
2610014b4c0SPeter WemmThe third level identifiers available for each file system
2620014b4c0SPeter Wemmare given in the header file that defines the mount
2630014b4c0SPeter Wemmargument structure for that file system.
26496e430a4SAlexey Zelkin.Ss CTL_HW
26558f0484fSRodney W. GrimesThe string and integer information available for the CTL_HW level
26658f0484fSRodney W. Grimesis detailed below.
26758f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
26858f0484fSRodney W. Grimesprivilege may change the value.
269ab1b41edSJohn Baldwin.Bl -column "Second Level Name" integerXXX Changeable -offset indent
270ab1b41edSJohn Baldwin.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
271ab1b41edSJohn Baldwin.It Dv HW_MACHINE Ta string Ta no
272ab1b41edSJohn Baldwin.It Dv HW_MODEL Ta string Ta no
273ab1b41edSJohn Baldwin.It Dv HW_NCPU Ta integer Ta no
274ab1b41edSJohn Baldwin.It Dv HW_BYTEORDER Ta integer Ta no
275ab1b41edSJohn Baldwin.It Dv HW_PHYSMEM Ta integer Ta no
276ab1b41edSJohn Baldwin.It Dv HW_USERMEM Ta integer Ta no
277ab1b41edSJohn Baldwin.It Dv HW_PAGESIZE Ta integer Ta no
278ab1b41edSJohn Baldwin.\".It Dv HW_DISKNAMES Ta integer Ta no
279ab1b41edSJohn Baldwin.\".It Dv HW_DISKSTATS Ta integer Ta no
280ab1b41edSJohn Baldwin.It Dv HW_FLOATINGPT Ta integer Ta no
281ab1b41edSJohn Baldwin.It Dv HW_MACHINE_ARCH Ta string Ta no
282ab1b41edSJohn Baldwin.It Dv HW_REALMEM Ta integer Ta no
283557e162fSRavi Pokala.It Dv HW_AVAILPAGES Ta integer Ta no
28458f0484fSRodney W. Grimes.El
28542635956SRuslan Ermilov.Bl -tag -width 6n
28658f0484fSRodney W. Grimes.It Li HW_MACHINE
28758f0484fSRodney W. GrimesThe machine class.
28858f0484fSRodney W. Grimes.It Li HW_MODEL
28958f0484fSRodney W. GrimesThe machine model
29058f0484fSRodney W. Grimes.It Li HW_NCPU
29158f0484fSRodney W. GrimesThe number of cpus.
29258f0484fSRodney W. Grimes.It Li HW_BYTEORDER
293ab1b41edSJohn BaldwinThe byteorder (4321 or 1234).
29458f0484fSRodney W. Grimes.It Li HW_PHYSMEM
295557e162fSRavi PokalaAmount of physical memory (in bytes), minus the amount used by the kernel,
296557e162fSRavi Pokalapre-loaded modules, and (on x86) the dcons buffer.
29758f0484fSRodney W. Grimes.It Li HW_USERMEM
298557e162fSRavi PokalaAmount of memory (in bytes) which is not wired.
29958f0484fSRodney W. Grimes.It Li HW_PAGESIZE
30058f0484fSRodney W. GrimesThe software page size.
301bef19503SRuslan Ermilov.\".It Fa HW_DISKNAMES
302bef19503SRuslan Ermilov.\".It Fa HW_DISKSTATS
303bef19503SRuslan Ermilov.It Li HW_FLOATINGPT
30438c429d5SBruce EvansNonzero if the floating point support is in hardware.
30501f770e8SKATO Takenori.It Li HW_MACHINE_ARCH
30601f770e8SKATO TakenoriThe machine dependent architecture type.
307bef19503SRuslan Ermilov.It Li HW_REALMEM
308557e162fSRavi PokalaAmount of memory (in bytes) reported by the firmware.
309557e162fSRavi PokalaThat value is sometimes not sane; in that case, the kernel reports the max
310557e162fSRavi Pokalamemory address instead.
311557e162fSRavi Pokala.It Li HW_AVAILPAGES
312557e162fSRavi PokalaThe same value as
313557e162fSRavi Pokala.Li HW_PHYSMEM ,
314557e162fSRavi Pokalameasured in pages rather than bytes.
31558f0484fSRodney W. Grimes.El
31696e430a4SAlexey Zelkin.Ss CTL_KERN
31758f0484fSRodney W. GrimesThe string and integer information available for the CTL_KERN level
31858f0484fSRodney W. Grimesis detailed below.
31958f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
32058f0484fSRodney W. Grimesprivilege may change the value.
32158f0484fSRodney W. GrimesThe types of data currently available are process information,
32258f0484fSRodney W. Grimessystem vnodes, the open file entries, routing table entries,
32358f0484fSRodney W. Grimesvirtual memory statistics, load average history, and clock rate
32458f0484fSRodney W. Grimesinformation.
32538c429d5SBruce Evans.Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent
326ab1b41edSJohn Baldwin.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
327ab1b41edSJohn Baldwin.It Dv KERN_ARGMAX Ta integer Ta no
3284e280387SKonstantin Belousov.It Dv KERN_ARND Ta integer Ta no
329ab1b41edSJohn Baldwin.It Dv KERN_BOOTFILE Ta string Ta yes
330ab1b41edSJohn Baldwin.It Dv KERN_BOOTTIME Ta struct timeval Ta no
331ab1b41edSJohn Baldwin.It Dv KERN_CLOCKRATE Ta struct clockinfo Ta no
332ab1b41edSJohn Baldwin.It Dv KERN_FILE Ta struct xfile Ta no
333ab1b41edSJohn Baldwin.It Dv KERN_HOSTID Ta integer Ta yes
334ab1b41edSJohn Baldwin.It Dv KERN_HOSTUUID Ta string Ta yes
335ab1b41edSJohn Baldwin.It Dv KERN_HOSTNAME Ta string Ta yes
3364e280387SKonstantin Belousov.It Dv KERN_IOV_MAX Ta integer Ta yes
337ab1b41edSJohn Baldwin.It Dv KERN_JOB_CONTROL Ta integer Ta no
3384e280387SKonstantin Belousov.It Dv KERN_LOCKF Ta struct kinfo_lockf Ta no
3394e280387SKonstantin Belousov.It Dv KERN_LOGSIGEXIT Ta integer Ta yes
340ab1b41edSJohn Baldwin.It Dv KERN_MAXFILES Ta integer Ta yes
341ab1b41edSJohn Baldwin.It Dv KERN_MAXFILESPERPROC Ta integer Ta yes
3424e280387SKonstantin Belousov.It Dv KERN_MAXPHYS Ta integer Ta no
343ab1b41edSJohn Baldwin.It Dv KERN_MAXPROC Ta integer Ta no
344ab1b41edSJohn Baldwin.It Dv KERN_MAXPROCPERUID Ta integer Ta yes
345ab1b41edSJohn Baldwin.It Dv KERN_MAXVNODES Ta integer Ta yes
346ab1b41edSJohn Baldwin.It Dv KERN_NGROUPS Ta integer Ta no
347ab1b41edSJohn Baldwin.It Dv KERN_NISDOMAINNAME Ta string Ta yes
348ab1b41edSJohn Baldwin.It Dv KERN_OSRELDATE Ta integer Ta no
349ab1b41edSJohn Baldwin.It Dv KERN_OSRELEASE Ta string Ta no
350ab1b41edSJohn Baldwin.It Dv KERN_OSREV Ta integer Ta no
351ab1b41edSJohn Baldwin.It Dv KERN_OSTYPE Ta string Ta no
352ab1b41edSJohn Baldwin.It Dv KERN_POSIX1 Ta integer Ta no
353ab1b41edSJohn Baldwin.It Dv KERN_PROC Ta node Ta not applicable
3544e280387SKonstantin Belousov.It Dv KERN_PS_STRINGS Ta integer Ta no
355ab1b41edSJohn Baldwin.It Dv KERN_SAVED_IDS Ta integer Ta no
356ab1b41edSJohn Baldwin.It Dv KERN_SECURELVL Ta integer Ta raise only
357ab1b41edSJohn Baldwin.It Dv KERN_UPDATEINTERVAL Ta integer Ta no
3584e280387SKonstantin Belousov.It Dv KERN_USRSTACK Ta integer Ta no
359ab1b41edSJohn Baldwin.It Dv KERN_VERSION Ta string Ta no
36058f0484fSRodney W. Grimes.El
36142635956SRuslan Ermilov.Bl -tag -width 6n
36258f0484fSRodney W. Grimes.It Li KERN_ARGMAX
36358f0484fSRodney W. GrimesThe maximum bytes of argument to
364e1f4e80cSMike Pritchard.Xr execve 2 .
3654e280387SKonstantin Belousov.It Li KERN_ARND
3664e280387SKonstantin Belousov.Xr arc4rand 9
3674e280387SKonstantin BelousovFills the buffer with random bytes from in-kernel random data generator.
3684e280387SKonstantin BelousovThis is an alternative interface for
3694e280387SKonstantin Belousov.Xr read 2
3704e280387SKonstantin Belousovof
3714e280387SKonstantin Belousov.Xr random 4
3724e280387SKonstantin Belousovdevice, which does not depend on accessibility and correct mounting options
3734e280387SKonstantin Belousovof the
3744e280387SKonstantin Belousov.Xr devfs 4
3754e280387SKonstantin Belousovnode.
37638c429d5SBruce Evans.It Li KERN_BOOTFILE
37738c429d5SBruce EvansThe full pathname of the file from which the kernel was loaded.
37858f0484fSRodney W. Grimes.It Li KERN_BOOTTIME
37958f0484fSRodney W. GrimesA
38058f0484fSRodney W. Grimes.Va struct timeval
38158f0484fSRodney W. Grimesstructure is returned.
38258f0484fSRodney W. GrimesThis structure contains the time that the system was booted.
38358f0484fSRodney W. Grimes.It Li KERN_CLOCKRATE
38458f0484fSRodney W. GrimesA
38558f0484fSRodney W. Grimes.Va struct clockinfo
38658f0484fSRodney W. Grimesstructure is returned.
38758f0484fSRodney W. GrimesThis structure contains the clock, statistics clock and profiling clock
388127feebeSJohn Hayfrequencies, the number of micro-seconds per hz tick and the skew rate.
38958f0484fSRodney W. Grimes.It Li KERN_FILE
39058f0484fSRodney W. GrimesReturn the entire file table.
39167c8bc1bSJilles TjoelkerThe returned data consists of an array of
39267c8bc1bSJilles Tjoelker.Va struct xfile ,
39358f0484fSRodney W. Grimeswhose size depends on the current number of such objects in the system.
39458f0484fSRodney W. Grimes.It Li KERN_HOSTID
395204542ddSRuslan ErmilovGet or set the host ID.
3961f13edbeSPawel Jakub Dawidek.It Li KERN_HOSTUUID
397204542ddSRuslan ErmilovGet or set the host's universally unique identifier (UUID).
39858f0484fSRodney W. Grimes.It Li KERN_HOSTNAME
39958f0484fSRodney W. GrimesGet or set the hostname.
4004e280387SKonstantin Belousov.It Li KERN_IOV_MAX
4014e280387SKonstantin BelousovThe maximum accepted number of elements in an input-output vector (iovec),
4024e280387SKonstantin Belousovsee
4034e280387SKonstantin Belousov.Xr readv 2
4044e280387SKonstantin Belousovand
4054e280387SKonstantin Belousov.Xr writev 2 .
40658f0484fSRodney W. Grimes.It Li KERN_JOB_CONTROL
40758f0484fSRodney W. GrimesReturn 1 if job control is available on this system, otherwise 0.
4084e280387SKonstantin Belousov.It Li KERN_LOCKF
4094e280387SKonstantin BelousovReturns the list of the file advisory locks currently known to kernel.
4104e280387SKonstantin Belousov.It Li KERN_LOGSIGEXIT
4114e280387SKonstantin BelousovControls logging of process exit due to untrapped signals.
41258f0484fSRodney W. Grimes.It Li KERN_MAXFILES
41338c429d5SBruce EvansThe maximum number of files that may be open in the system.
41438c429d5SBruce Evans.It Li KERN_MAXFILESPERPROC
41538c429d5SBruce EvansThe maximum number of files that may be open for a single process.
41638c429d5SBruce EvansThis limit only applies to processes with an effective uid of nonzero
41738c429d5SBruce Evansat the time of the open request.
41838c429d5SBruce EvansFiles that have already been opened are not affected if the limit
41938c429d5SBruce Evansor the effective uid is changed.
4204e280387SKonstantin Belousov.It Li KERN_MAXPHYS
4214e280387SKonstantin BelousovSpecifies the maximum block I/O size.
4224e280387SKonstantin BelousovCan be changed by the tunable
4234e280387SKonstantin Belousov.Ev kern.maxphys .
42458f0484fSRodney W. Grimes.It Li KERN_MAXPROC
42538c429d5SBruce EvansThe maximum number of concurrent processes the system will allow.
42638c429d5SBruce Evans.It Li KERN_MAXPROCPERUID
42738c429d5SBruce EvansThe maximum number of concurrent processes the system will allow
42838c429d5SBruce Evansfor a single effective uid.
42938c429d5SBruce EvansThis limit only applies to processes with an effective uid of nonzero
43038c429d5SBruce Evansat the time of a fork request.
43138c429d5SBruce EvansProcesses that have already been started are not affected if the limit
43238c429d5SBruce Evansis changed.
43358f0484fSRodney W. Grimes.It Li KERN_MAXVNODES
43458f0484fSRodney W. GrimesThe maximum number of vnodes available on the system.
43558f0484fSRodney W. Grimes.It Li KERN_NGROUPS
43658f0484fSRodney W. GrimesThe maximum number of supplemental groups.
43738c429d5SBruce Evans.It Li KERN_NISDOMAINNAME
43838c429d5SBruce EvansThe name of the current YP/NIS domain.
43938c429d5SBruce Evans.It Li KERN_OSRELDATE
44062d6317dSEivind EklundThe kernel release version in the format
44162d6317dSEivind Eklund.Ar M Ns Ar mm Ns Ar R Ns Ar xx ,
44262d6317dSEivind Eklundwhere
44362d6317dSEivind Eklund.Ar M
44462d6317dSEivind Eklundis the major version,
44562d6317dSEivind Eklund.Ar mm
44662d6317dSEivind Eklundis the two digit minor version,
44762d6317dSEivind Eklund.Ar R
44862d6317dSEivind Eklundis 0 if release branch, otherwise 1,
44962d6317dSEivind Eklundand
45062d6317dSEivind Eklund.Ar xx
45162d6317dSEivind Eklundis updated when the available APIs change.
45262d6317dSEivind Eklund.Pp
45362d6317dSEivind EklundThe userland release version is available from
454fe08efe6SRuslan Ermilov.In osreldate.h ;
45562d6317dSEivind Eklundparse this file if you need to get the release version of
45662d6317dSEivind Eklundthe currently installed userland.
45758f0484fSRodney W. Grimes.It Li KERN_OSRELEASE
45858f0484fSRodney W. GrimesThe system release string.
45958f0484fSRodney W. Grimes.It Li KERN_OSREV
46058f0484fSRodney W. GrimesThe system revision string.
46158f0484fSRodney W. Grimes.It Li KERN_OSTYPE
46258f0484fSRodney W. GrimesThe system type string.
46358f0484fSRodney W. Grimes.It Li KERN_POSIX1
464fdc1fef5SRuslan ErmilovThe version of
465fdc1fef5SRuslan Ermilov.St -p1003.1
466fdc1fef5SRuslan Ermilovwith which the system
46758f0484fSRodney W. Grimesattempts to comply.
46858f0484fSRodney W. Grimes.It Li KERN_PROC
469fe769cddSDavid SchultzReturn selected information about specific running processes.
470fe769cddSDavid Schultz.Pp
47148a01c43STom RhodesFor the following names, an array of
47248a01c43STom Rhodes.Va struct kinfo_proc
47358f0484fSRodney W. Grimesstructures is returned,
47458f0484fSRodney W. Grimeswhose size depends on the current number of such objects in the system.
475ab1b41edSJohn Baldwin.Bl -column "Third Level NameXXXXXX" "Fourth LevelXXXXXX" -offset indent
476ab1b41edSJohn Baldwin.It Sy Third Level Name Ta Sy Fourth Level
477ab1b41edSJohn Baldwin.It Dv KERN_PROC_ALL Ta None
478ab1b41edSJohn Baldwin.It Dv KERN_PROC_PID Ta A process ID
479ab1b41edSJohn Baldwin.It Dv KERN_PROC_PGRP Ta A process group
480cdd96299SKonstantin Belousov.It Dv KERN_PROC_SESSION Ta A session
481ab1b41edSJohn Baldwin.It Dv KERN_PROC_TTY Ta A tty device
482cdd96299SKonstantin Belousov.It Dv KERN_PROC_UID Ta An effective user ID
483ab1b41edSJohn Baldwin.It Dv KERN_PROC_RUID Ta A real user ID
484cdd96299SKonstantin Belousov.It Dv KERN_PROC_GID Ta An effective group ID
485cdd96299SKonstantin Belousov.It Dv KERN_PROC_RGID Ta A real group ID
48658f0484fSRodney W. Grimes.El
487d2d9aa87SSheldon Hearn.Pp
488cdd96299SKonstantin BelousovFor the following names, the miscellaneous information about the target
489cdd96299SKonstantin Belousovprocess, which is specified by the fourth level of the oid name,
490cdd96299SKonstantin Belousovis returned.
491cdd96299SKonstantin BelousovA process ID of
492cdd96299SKonstantin Belousov.Li \-1
493cdd96299SKonstantin Belousovspecifies the current process.
494cdd96299SKonstantin Belousov.Bl -column "Third Level NameXXXXXX" "TypeXXXXXX" -offset indent
495cdd96299SKonstantin Belousov.It Sy Third Level Name Ta Sy Fourth Level
496cdd96299SKonstantin Belousov.It Dv KERN_PROC_ARGS Ta "Set of strings"
497cdd96299SKonstantin Belousov.It Dv KERN_PROC_PATHNAME Ta "String"
498cdd96299SKonstantin Belousov.It Dv KERN_PROC_KSTACK Ta "struct kinfo_stack []"
499cdd96299SKonstantin Belousov.It Dv KERN_PROC_VMMAP Ta "struct kinfo_vmentry []"
500cdd96299SKonstantin Belousov.It Dv KERN_PROC_FILEDESC Ta "struct kinfo_file []"
501cdd96299SKonstantin Belousov.It Dv KERN_PROC_GROUPS Ta "gid_t []"
502cdd96299SKonstantin Belousov.It Dv KERN_PROC_ENV Ta "Set of strings"
503cdd96299SKonstantin Belousov.It Dv KERN_PROC_AUXV Ta "Elf_Auxinfo []"
504cdd96299SKonstantin Belousov.It Dv KERN_PROC_RLIMIT Ta "Integer"
505cdd96299SKonstantin Belousov.It Dv KERN_PROC_RLIMIT_USAGE Ta "rlim_t []"
506cdd96299SKonstantin Belousov.It Dv KERN_PROC_PS_STRINGS Ta "Integer"
507cdd96299SKonstantin Belousov.It Dv KERN_PROC_UMASK Ta "Integer/short"
508cdd96299SKonstantin Belousov.It Dv KERN_PROC_OSREL Ta "Integer"
509cdd96299SKonstantin Belousov.It Dv KERN_PROC_SIGTRAMP Ta "Integer"
510cdd96299SKonstantin Belousov.It Dv KERN_PROC_CWD Ta "String"
511cdd96299SKonstantin Belousov.It Dv KERN_PROC_NFDS Ta "Integer"
512cdd96299SKonstantin Belousov.It Dv KERN_PROC_SIGFASTBLK Ta "Integer"
513cdd96299SKonstantin Belousov.It Dv KERN_PROC_VM_LAYOUT Ta "struct kinfo_vm_layout"
514*4cf6cae8SKonstantin Belousov.It Dv KERN_PROC_KQUEUE Ta "struct kinfo_knote []"
515cdd96299SKonstantin Belousov.El
516cdd96299SKonstantin Belousov.Pp
517cdd96299SKonstantin Belousov.Bl -tag -compact
518cdd96299SKonstantin Belousov.It Dv KERN_PROC_ARGS
519cdd96299SKonstantin BelousovThe command line argument
5201a0a9345SRuslan Ermilovarray is returned in a flattened form, i.e., zero-terminated arguments
521d2d9aa87SSheldon Hearnfollow each other.
522d2d9aa87SSheldon HearnThe total size of array is returned.
523b03c558bSSheldon HearnIt is also possible for a process to set its own process title this way.
524cdd96299SKonstantin Belousov.It Dv KERN_PROC_PATHNAME
525cdd96299SKonstantin BelousovThe path of the process' text file is returned.
526cdd96299SKonstantin Belousov.It Dv KERN_PROC_KSTACK
527cdd96299SKonstantin BelousovThe in-kernel call stacks for the threads of the specified process.
528cdd96299SKonstantin Belousov.It Dv KERN_PROC_VMMAP
529cdd96299SKonstantin BelousovThe description of the map entries for the process.
530cdd96299SKonstantin Belousov.It Dv KERN_PROC_FILEDESC
531cdd96299SKonstantin BelousovThe file descriptors for files opened in the specified process.
532cdd96299SKonstantin Belousov.It Dv KERN_PROC_GROUPS
533cdd96299SKonstantin BelousovGroups associated with the process.
534cdd96299SKonstantin Belousov.It Dv KERN_PROC_ENV
535cdd96299SKonstantin BelousovThe set of strings representing the environment of the specified process.
536cdd96299SKonstantin Belousov.Pp
537cdd96299SKonstantin BelousovNote that from the kernel point of view, environment exists only at the
538cdd96299SKonstantin Belousovtime of
539cdd96299SKonstantin Belousov.Xr execve 2
540cdd96299SKonstantin Belousovsystem call.
541cdd96299SKonstantin BelousovThis node method tries to reconstruct the environment from the known
542cdd96299SKonstantin Belousovbreadcrumbs left in the process address space, but it is not guaranteed
543cdd96299SKonstantin Belousovto succeed or to represent the current value as maintained by the program.
544cdd96299SKonstantin Belousov.It Dv KERN_PROC_AUXV
545cdd96299SKonstantin BelousovThe set of ELF auxv entries.
546cdd96299SKonstantin BelousovSee the note above about environment, which is also applicable to auxv.
547cdd96299SKonstantin Belousov.It Dv KERN_PROC_RLIMIT
548cdd96299SKonstantin BelousovAdditinal OID name element must be supplied, specifiing the resource name
549cdd96299SKonstantin Belousovas in
550cdd96299SKonstantin Belousov.Xr getrlimit 2 .
551cdd96299SKonstantin BelousovThe call returns the given resource limit for the process.
552cdd96299SKonstantin Belousov.It Dv KERN_PROC_RLIMIT_USAGE
553cdd96299SKonstantin BelousovLike
554cdd96299SKonstantin Belousov.Dv KERN_PROC_RLIMIT ,
555cdd96299SKonstantin Belousovbut instead of the limit, returns the accounted resource usage.
556cdd96299SKonstantin BelousovFor resources which do not have a meaningful current value,
557f789cb82SRuslan Ermilov.Li \-1
558cdd96299SKonstantin Belousovis returned.
559cdd96299SKonstantin Belousov.It Dv KERN_PROC_PS_STRINGS
560cdd96299SKonstantin BelousovReturns the location of the
561cdd96299SKonstantin Belousov.Vt ps_strings
562cdd96299SKonstantin Belousovstructure at the time of the last call to
563cdd96299SKonstantin Belousov.Xr execve 2
564cdd96299SKonstantin Belousovin the specified process.
565cdd96299SKonstantin Belousov.It Dv KERN_PROC_UMASK
566cdd96299SKonstantin BelousovThe current umask value, see
567cdd96299SKonstantin Belousov.Xr umask 2 .
568cdd96299SKonstantin Belousov.It Dv KERN_PROC_OSREL
569cdd96299SKonstantin BelousovThe value of osrel for the process, that is the osrel the currently executed
570cdd96299SKonstantin Belousovimage was compiled for.
571cdd96299SKonstantin BelousovRead from the note of the elf executable at
572cdd96299SKonstantin Belousov.Xr execve 2
573cdd96299SKonstantin Belousovtime.
574cdd96299SKonstantin BelousovMight be modified by the process.
575cdd96299SKonstantin Belousov.It Dv KERN_PROC_SIGTRAMP
576cdd96299SKonstantin BelousovAddress of the signal trampoline in the process address space,
577cdd96299SKonstantin Belousovwhere, simplifying, the kernel passes control for signal delivery.
578cdd96299SKonstantin Belousov.It Dv KERN_PROC_CWD
579cdd96299SKonstantin BelousovReturns the current working directory for the process.
580cdd96299SKonstantin Belousov.It Dv KERN_PROC_NFDS
581cdd96299SKonstantin BelousovReturns the total number of opened file descriptors for the process.
582cdd96299SKonstantin Belousov.It Dv KERN_PROC_SIGFASTBLK
583cdd96299SKonstantin BelousovReturns the address of the
584cdd96299SKonstantin Belousov.Xr sigfastblock 2
585cdd96299SKonstantin Belousovlocation, if active.
586cdd96299SKonstantin Belousov.It Dv KERN_PROC_VM_LAYOUT
587cdd96299SKonstantin BelousovFills a structure describing process virtual address space layout.
588*4cf6cae8SKonstantin Belousov.It Dv KERN_PROC_KQUEUE
589*4cf6cae8SKonstantin BelousovFills an array of structures describing events registered with
590*4cf6cae8SKonstantin Belousovthe specified kqueue.
591*4cf6cae8SKonstantin BelousovThe next two node's values are the
592*4cf6cae8SKonstantin Belousov.Va pid
593*4cf6cae8SKonstantin Belousovand
594*4cf6cae8SKonstantin Belousov.Va kqfd ,
595*4cf6cae8SKonstantin Belousovthe process ID of the process, and the file descriptor of the kqueue
596*4cf6cae8SKonstantin Belousovin that process, to query.
5972de021a4SAndrzej Bialecki.El
5984e280387SKonstantin Belousov.It Li KERN_PS_STRINGS
5994e280387SKonstantin BelousovReports the location of the process
6004e280387SKonstantin Belousov.Vt ps_strings
6014e280387SKonstantin Belousovstructure after exec, for the ABI of the querying process.
60258f0484fSRodney W. Grimes.It Li KERN_SAVED_IDS
60358f0484fSRodney W. GrimesReturns 1 if saved set-group and saved set-user ID is available.
60458f0484fSRodney W. Grimes.It Li KERN_SECURELVL
60558f0484fSRodney W. GrimesThe system security level.
60658f0484fSRodney W. GrimesThis level may be raised by processes with appropriate privilege.
607b697833cSGuy HelmerIt may not be lowered.
6084e280387SKonstantin Belousov.It Li KERN_USRSTACK
6094e280387SKonstantin BelousovReports the top of the main thread user stack for the current process.
61058f0484fSRodney W. Grimes.It Li KERN_VERSION
61158f0484fSRodney W. GrimesThe system version string.
61258f0484fSRodney W. Grimes.El
61396e430a4SAlexey Zelkin.Ss CTL_NET
61458f0484fSRodney W. GrimesThe string and integer information available for the CTL_NET level
61558f0484fSRodney W. Grimesis detailed below.
61658f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
61758f0484fSRodney W. Grimesprivilege may change the value.
618ab1b41edSJohn Baldwin.Bl -column "Second Level NameXXXXXX" "routing messagesXXX" -offset indent
619ab1b41edSJohn Baldwin.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
620ab1b41edSJohn Baldwin.It Dv PF_ROUTE Ta routing messages Ta no
621ab1b41edSJohn Baldwin.It Dv PF_INET Ta IPv4 values Ta yes
622ab1b41edSJohn Baldwin.It Dv PF_INET6 Ta IPv6 values Ta yes
62358f0484fSRodney W. Grimes.El
62442635956SRuslan Ermilov.Bl -tag -width 6n
62558f0484fSRodney W. Grimes.It Li PF_ROUTE
62658f0484fSRodney W. GrimesReturn the entire routing table or a subset of it.
62758f0484fSRodney W. GrimesThe data is returned as a sequence of routing messages (see
62858f0484fSRodney W. Grimes.Xr route 4
62958f0484fSRodney W. Grimesfor the header file, format and meaning).
63058f0484fSRodney W. GrimesThe length of each message is contained in the message header.
63158f0484fSRodney W. Grimes.Pp
63258f0484fSRodney W. GrimesThe third level name is a protocol number, which is currently always 0.
63358f0484fSRodney W. GrimesThe fourth level name is an address family, which may be set to 0 to
63458f0484fSRodney W. Grimesselect all address families.
6354825b1e0SHiroki SatoThe fifth, sixth, and seventh level names are as follows:
636ab1b41edSJohn Baldwin.Bl -column -offset indent "Fifth Level" "Sixth Level" "Seventh Level"
637ab1b41edSJohn Baldwin.It Sy Fifth level Ta Sy Sixth Level Ta Sy Seventh Level
638ab1b41edSJohn Baldwin.It Dv NET_RT_FLAGS Ta rtflags Ta None
639ab1b41edSJohn Baldwin.It Dv NET_RT_DUMP Ta None Ta None or fib number
640ab1b41edSJohn Baldwin.It Dv NET_RT_IFLIST Ta 0 or if_index Ta None
641ab1b41edSJohn Baldwin.It Dv NET_RT_IFMALIST Ta 0 or if_index Ta None
642ab1b41edSJohn Baldwin.It Dv NET_RT_IFLISTL Ta 0 or if_index Ta None
643a6663252SAlexander V. Chernikov.It Dv NET_RT_NHOPS Ta None Ta fib number
64458f0484fSRodney W. Grimes.El
6453b367e99SBruce M Simpson.Pp
6463b367e99SBruce M SimpsonThe
6473b367e99SBruce M Simpson.Dv NET_RT_IFMALIST
6483b367e99SBruce M Simpsonname returns information about multicast group memberships on all interfaces
6493b367e99SBruce M Simpsonif 0 is specified, or for the interface specified by
6503b367e99SBruce M Simpson.Va if_index .
6516d076ae8SBjoern A. Zeeb.Pp
6526d076ae8SBjoern A. ZeebThe
6536d076ae8SBjoern A. Zeeb.Dv NET_RT_IFLISTL
6546d076ae8SBjoern A. Zeebis like
6556d076ae8SBjoern A. Zeeb.Dv NET_RT_IFLIST ,
6566d076ae8SBjoern A. Zeebjust returning message header structs with additional fields allowing the
6576d076ae8SBjoern A. Zeebinterface to be extended without breaking binary compatibility.
6586d076ae8SBjoern A. ZeebThe
6596d076ae8SBjoern A. Zeeb.Dv NET_RT_IFLISTL
6606d076ae8SBjoern A. Zeebuses 'l' versions of the message header structures:
6616d076ae8SBjoern A. Zeeb.Va struct if_msghdrl
6626d076ae8SBjoern A. Zeeband
6636d076ae8SBjoern A. Zeeb.Va struct ifa_msghdrl .
664a6663252SAlexander V. Chernikov.Pp
665a6663252SAlexander V. Chernikov.Dv NET_RT_NHOPS
666a6663252SAlexander V. Chernikovreturns all nexthops for specified address family in given fib.
66758f0484fSRodney W. Grimes.It Li PF_INET
6681522ff5bSJun-ichiro itojun HaginoGet or set various global information about the IPv4
669c4d9468eSRuslan Ermilov(Internet Protocol version 4).
67058f0484fSRodney W. GrimesThe third level name is the protocol.
67158f0484fSRodney W. GrimesThe fourth level name is the variable name.
67258f0484fSRodney W. GrimesThe currently defined protocols and names are:
67361a4defdSJoseph Koshy.Bl -column ProtocolXX VariableXX TypeXX ChangeableXX
674ab1b41edSJohn Baldwin.It Sy Protocol Ta Sy Variable Ta Sy Type Ta Sy Changeable
675ab1b41edSJohn Baldwin.It icmp Ta bmcastecho Ta integer Ta yes
676ab1b41edSJohn Baldwin.It icmp Ta maskrepl Ta integer Ta yes
677ab1b41edSJohn Baldwin.It ip Ta forwarding Ta integer Ta yes
678ab1b41edSJohn Baldwin.It ip Ta redirect Ta integer Ta yes
679ab1b41edSJohn Baldwin.It ip Ta ttl Ta integer Ta yes
680ab1b41edSJohn Baldwin.It udp Ta checksum Ta integer Ta yes
68158f0484fSRodney W. Grimes.El
68258f0484fSRodney W. Grimes.Pp
68358f0484fSRodney W. GrimesThe variables are as follows:
68442635956SRuslan Ermilov.Bl -tag -width 6n
6850a843f2aSJoseph Koshy.It Li icmp.bmcastecho
6860a843f2aSJoseph KoshyReturns 1 if an ICMP echo request to a broadcast or multicast address is
6870a843f2aSJoseph Koshyto be answered.
6880a843f2aSJoseph Koshy.It Li icmp.maskrepl
6890a843f2aSJoseph KoshyReturns 1 if ICMP network mask requests are to be answered.
69058f0484fSRodney W. Grimes.It Li ip.forwarding
69158f0484fSRodney W. GrimesReturns 1 when IP forwarding is enabled for the host,
69258f0484fSRodney W. Grimesmeaning that the host is acting as a router.
69358f0484fSRodney W. Grimes.It Li ip.redirect
69458f0484fSRodney W. GrimesReturns 1 when ICMP redirects may be sent by the host.
69558f0484fSRodney W. GrimesThis option is ignored unless the host is routing IP packets,
69658f0484fSRodney W. Grimesand should normally be enabled on all systems.
69758f0484fSRodney W. Grimes.It Li ip.ttl
69858f0484fSRodney W. GrimesThe maximum time-to-live (hop count) value for an IP packet sourced by
69958f0484fSRodney W. Grimesthe system.
70058f0484fSRodney W. GrimesThis value applies to normal transport protocols, not to ICMP.
70158f0484fSRodney W. Grimes.It Li udp.checksum
70258f0484fSRodney W. GrimesReturns 1 when UDP checksums are being computed and checked.
70358f0484fSRodney W. GrimesDisabling UDP checksums is strongly discouraged.
7041522ff5bSJun-ichiro itojun Hagino.Pp
7058a3c1270SJun-ichiro itojun HaginoFor variables net.inet.*.ipsec, please refer to
7061522ff5bSJun-ichiro itojun Hagino.Xr ipsec 4 .
7071522ff5bSJun-ichiro itojun Hagino.El
7081522ff5bSJun-ichiro itojun Hagino.It Li PF_INET6
7091522ff5bSJun-ichiro itojun HaginoGet or set various global information about the IPv6
710c4d9468eSRuslan Ermilov(Internet Protocol version 6).
7111522ff5bSJun-ichiro itojun HaginoThe third level name is the protocol.
7121522ff5bSJun-ichiro itojun HaginoThe fourth level name is the variable name.
7131522ff5bSJun-ichiro itojun Hagino.Pp
7148a3c1270SJun-ichiro itojun HaginoFor variables net.inet6.* please refer to
7158a3c1270SJun-ichiro itojun Hagino.Xr inet6 4 .
7168a3c1270SJun-ichiro itojun HaginoFor variables net.inet6.*.ipsec6, please refer to
7171522ff5bSJun-ichiro itojun Hagino.Xr ipsec 4 .
71858f0484fSRodney W. Grimes.El
71996e430a4SAlexey Zelkin.Ss CTL_USER
72058f0484fSRodney W. GrimesThe string and integer information available for the CTL_USER level
72158f0484fSRodney W. Grimesis detailed below.
72258f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
72358f0484fSRodney W. Grimesprivilege may change the value.
72458f0484fSRodney W. Grimes.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent
725ab1b41edSJohn Baldwin.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
726ab1b41edSJohn Baldwin.It Dv USER_BC_BASE_MAX Ta integer Ta no
727ab1b41edSJohn Baldwin.It Dv USER_BC_DIM_MAX Ta integer Ta no
728ab1b41edSJohn Baldwin.It Dv USER_BC_SCALE_MAX Ta integer Ta no
729ab1b41edSJohn Baldwin.It Dv USER_BC_STRING_MAX Ta integer Ta no
730ab1b41edSJohn Baldwin.It Dv USER_COLL_WEIGHTS_MAX Ta integer Ta no
731ab1b41edSJohn Baldwin.It Dv USER_CS_PATH Ta string Ta no
732ab1b41edSJohn Baldwin.It Dv USER_EXPR_NEST_MAX Ta integer Ta no
733ab1b41edSJohn Baldwin.It Dv USER_LINE_MAX Ta integer Ta no
73477b793c4SStefan Eßer.It Dv USER_LOCALBASE Ta string Ta no
735ab1b41edSJohn Baldwin.It Dv USER_POSIX2_CHAR_TERM Ta integer Ta no
736ab1b41edSJohn Baldwin.It Dv USER_POSIX2_C_BIND Ta integer Ta no
737ab1b41edSJohn Baldwin.It Dv USER_POSIX2_C_DEV Ta integer Ta no
738ab1b41edSJohn Baldwin.It Dv USER_POSIX2_FORT_DEV Ta integer Ta no
739ab1b41edSJohn Baldwin.It Dv USER_POSIX2_FORT_RUN Ta integer Ta no
740ab1b41edSJohn Baldwin.It Dv USER_POSIX2_LOCALEDEF Ta integer Ta no
741ab1b41edSJohn Baldwin.It Dv USER_POSIX2_SW_DEV Ta integer Ta no
742ab1b41edSJohn Baldwin.It Dv USER_POSIX2_UPE Ta integer Ta no
743ab1b41edSJohn Baldwin.It Dv USER_POSIX2_VERSION Ta integer Ta no
744ab1b41edSJohn Baldwin.It Dv USER_RE_DUP_MAX Ta integer Ta no
745ab1b41edSJohn Baldwin.It Dv USER_STREAM_MAX Ta integer Ta no
746ab1b41edSJohn Baldwin.It Dv USER_TZNAME_MAX Ta integer Ta no
74758f0484fSRodney W. Grimes.El
74842635956SRuslan Ermilov.Bl -tag -width 6n
74958f0484fSRodney W. Grimes.It Li USER_BC_BASE_MAX
75058f0484fSRodney W. GrimesThe maximum ibase/obase values in the
75158f0484fSRodney W. Grimes.Xr bc 1
75258f0484fSRodney W. Grimesutility.
75358f0484fSRodney W. Grimes.It Li USER_BC_DIM_MAX
75458f0484fSRodney W. GrimesThe maximum array size in the
75558f0484fSRodney W. Grimes.Xr bc 1
75658f0484fSRodney W. Grimesutility.
75758f0484fSRodney W. Grimes.It Li USER_BC_SCALE_MAX
75858f0484fSRodney W. GrimesThe maximum scale value in the
75958f0484fSRodney W. Grimes.Xr bc 1
76058f0484fSRodney W. Grimesutility.
76158f0484fSRodney W. Grimes.It Li USER_BC_STRING_MAX
76258f0484fSRodney W. GrimesThe maximum string length in the
76358f0484fSRodney W. Grimes.Xr bc 1
76458f0484fSRodney W. Grimesutility.
76558f0484fSRodney W. Grimes.It Li USER_COLL_WEIGHTS_MAX
76658f0484fSRodney W. GrimesThe maximum number of weights that can be assigned to any entry of
76758f0484fSRodney W. Grimesthe LC_COLLATE order keyword in the locale definition file.
76858f0484fSRodney W. Grimes.It Li USER_CS_PATH
76958f0484fSRodney W. GrimesReturn a value for the
77058f0484fSRodney W. Grimes.Ev PATH
77158f0484fSRodney W. Grimesenvironment variable that finds all the standard utilities.
77258f0484fSRodney W. Grimes.It Li USER_EXPR_NEST_MAX
77358f0484fSRodney W. GrimesThe maximum number of expressions that can be nested within
77458f0484fSRodney W. Grimesparenthesis by the
77558f0484fSRodney W. Grimes.Xr expr 1
77658f0484fSRodney W. Grimesutility.
77758f0484fSRodney W. Grimes.It Li USER_LINE_MAX
77858f0484fSRodney W. GrimesThe maximum length in bytes of a text-processing utility's input
77958f0484fSRodney W. Grimesline.
78077b793c4SStefan Eßer.It Li USER_LOCALBASE
78177b793c4SStefan EßerReturn the value of localbase that has been compiled into system utilities
78277b793c4SStefan Eßerthat need to have access to resources provided by a port or package.
78358f0484fSRodney W. Grimes.It Li USER_POSIX2_CHAR_TERM
78458f0484fSRodney W. GrimesReturn 1 if the system supports at least one terminal type capable of
785fdc1fef5SRuslan Ermilovall operations described in
786fdc1fef5SRuslan Ermilov.St -p1003.2 ,
787fdc1fef5SRuslan Ermilovotherwise 0.
78858f0484fSRodney W. Grimes.It Li USER_POSIX2_C_BIND
78958f0484fSRodney W. GrimesReturn 1 if the system's C-language development facilities support the
79058f0484fSRodney W. GrimesC-Language Bindings Option, otherwise 0.
79158f0484fSRodney W. Grimes.It Li USER_POSIX2_C_DEV
79258f0484fSRodney W. GrimesReturn 1 if the system supports the C-Language Development Utilities Option,
79358f0484fSRodney W. Grimesotherwise 0.
79458f0484fSRodney W. Grimes.It Li USER_POSIX2_FORT_DEV
79558f0484fSRodney W. GrimesReturn 1 if the system supports the FORTRAN Development Utilities Option,
79658f0484fSRodney W. Grimesotherwise 0.
79758f0484fSRodney W. Grimes.It Li USER_POSIX2_FORT_RUN
79858f0484fSRodney W. GrimesReturn 1 if the system supports the FORTRAN Runtime Utilities Option,
79958f0484fSRodney W. Grimesotherwise 0.
80058f0484fSRodney W. Grimes.It Li USER_POSIX2_LOCALEDEF
80158f0484fSRodney W. GrimesReturn 1 if the system supports the creation of locales, otherwise 0.
80258f0484fSRodney W. Grimes.It Li USER_POSIX2_SW_DEV
80358f0484fSRodney W. GrimesReturn 1 if the system supports the Software Development Utilities Option,
80458f0484fSRodney W. Grimesotherwise 0.
80558f0484fSRodney W. Grimes.It Li USER_POSIX2_UPE
80658f0484fSRodney W. GrimesReturn 1 if the system supports the User Portability Utilities Option,
80758f0484fSRodney W. Grimesotherwise 0.
80858f0484fSRodney W. Grimes.It Li USER_POSIX2_VERSION
809fdc1fef5SRuslan ErmilovThe version of
810fdc1fef5SRuslan Ermilov.St -p1003.2
811fdc1fef5SRuslan Ermilovwith which the system attempts to comply.
81258f0484fSRodney W. Grimes.It Li USER_RE_DUP_MAX
81358f0484fSRodney W. GrimesThe maximum number of repeated occurrences of a regular expression
81458f0484fSRodney W. Grimespermitted when using interval notation.
81558f0484fSRodney W. Grimes.It Li USER_STREAM_MAX
81658f0484fSRodney W. GrimesThe minimum maximum number of streams that a process may have open
81758f0484fSRodney W. Grimesat any one time.
81858f0484fSRodney W. Grimes.It Li USER_TZNAME_MAX
81958f0484fSRodney W. GrimesThe minimum maximum number of types supported for the name of a
82058f0484fSRodney W. Grimestimezone.
82158f0484fSRodney W. Grimes.El
82296e430a4SAlexey Zelkin.Ss CTL_VM
82358f0484fSRodney W. GrimesThe string and integer information available for the CTL_VM level
82458f0484fSRodney W. Grimesis detailed below.
82558f0484fSRodney W. GrimesThe changeable column shows whether a process with appropriate
82658f0484fSRodney W. Grimesprivilege may change the value.
827ab1b41edSJohn Baldwin.Bl -column "Second Level NameXXXXXX" "struct loadavgXXX" -offset indent
828ab1b41edSJohn Baldwin.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
829ab1b41edSJohn Baldwin.It Dv VM_LOADAVG Ta struct loadavg Ta no
830ab1b41edSJohn Baldwin.It Dv VM_TOTAL Ta struct vmtotal Ta no
831ab1b41edSJohn Baldwin.It Dv VM_SWAPPING_ENABLED Ta integer Ta maybe
832ab1b41edSJohn Baldwin.It Dv VM_V_FREE_MIN Ta integer Ta yes
833ab1b41edSJohn Baldwin.It Dv VM_V_FREE_RESERVED Ta integer Ta yes
834ab1b41edSJohn Baldwin.It Dv VM_V_FREE_TARGET Ta integer Ta yes
835ab1b41edSJohn Baldwin.It Dv VM_V_INACTIVE_TARGET Ta integer Ta yes
836ab1b41edSJohn Baldwin.It Dv VM_V_PAGEOUT_FREE_MIN Ta integer Ta yes
837be7d4ac5SEdward Tomasz Napierala.It Dv VM_OVERCOMMIT Ta integer Ta yes
83858f0484fSRodney W. Grimes.El
83942635956SRuslan Ermilov.Bl -tag -width 6n
84058f0484fSRodney W. Grimes.It Li VM_LOADAVG
84158f0484fSRodney W. GrimesReturn the load average history.
84258f0484fSRodney W. GrimesThe returned data consists of a
84358f0484fSRodney W. Grimes.Va struct loadavg .
8443be18423SRuslan Ermilov.It Li VM_TOTAL
84558f0484fSRodney W. GrimesReturn the system wide virtual memory statistics.
84658f0484fSRodney W. GrimesThe returned data consists of a
84758f0484fSRodney W. Grimes.Va struct vmtotal .
848b697833cSGuy Helmer.It Li VM_SWAPPING_ENABLED
8491a0a9345SRuslan Ermilov1 if process swapping is enabled or 0 if disabled.
8501a0a9345SRuslan ErmilovThis variable is
851b697833cSGuy Helmerpermanently set to 0 if the kernel was built with swapping disabled.
852b697833cSGuy Helmer.It Li VM_V_FREE_MIN
853b697833cSGuy HelmerMinimum amount of memory (cache memory plus free memory)
854b697833cSGuy Helmerrequired to be available before a process waiting on memory will be
855b697833cSGuy Helmerawakened.
856b697833cSGuy Helmer.It Li VM_V_FREE_RESERVED
857b697833cSGuy HelmerProcesses will awaken the pageout daemon and wait for memory if the
858b697833cSGuy Helmernumber of free and cached pages drops below this value.
859b697833cSGuy Helmer.It Li VM_V_FREE_TARGET
860b697833cSGuy HelmerThe total amount of free memory (including cache memory) that the
861b697833cSGuy Helmerpageout daemon tries to maintain.
862b697833cSGuy Helmer.It Li VM_V_INACTIVE_TARGET
863b697833cSGuy HelmerThe desired number of inactive pages that the pageout daemon should
8641a0a9345SRuslan Ermilovachieve when it runs.
8651a0a9345SRuslan ErmilovInactive pages can be quickly inserted into
866b697833cSGuy Helmerprocess address space when needed.
867b697833cSGuy Helmer.It Li VM_V_PAGEOUT_FREE_MIN
868b697833cSGuy HelmerIf the amount of free and cache memory falls below this value, the
869b697833cSGuy Helmerpageout daemon will enter "memory conserving mode" to avoid deadlock.
870be7d4ac5SEdward Tomasz Napierala.It Li VM_OVERCOMMIT
871be7d4ac5SEdward Tomasz NapieralaOvercommit behaviour, as described in
872be7d4ac5SEdward Tomasz Napierala.Xr tuning 7 .
87358f0484fSRodney W. Grimes.El
87458f0484fSRodney W. Grimes.Sh RETURN VALUES
875d6002fefSRuslan Ermilov.Rv -std
87624a0682cSRuslan Ermilov.Sh FILES
87724a0682cSRuslan Ermilov.Bl -tag -width <netinet/icmpXvar.h> -compact
87824a0682cSRuslan Ermilov.It In sys/sysctl.h
87924a0682cSRuslan Ermilovdefinitions for top level identifiers, second level kernel and hardware
88024a0682cSRuslan Ermilovidentifiers, and user level identifiers
88124a0682cSRuslan Ermilov.It In sys/socket.h
88224a0682cSRuslan Ermilovdefinitions for second level network identifiers
88324a0682cSRuslan Ermilov.It In sys/gmon.h
88424a0682cSRuslan Ermilovdefinitions for third level profiling identifiers
88524a0682cSRuslan Ermilov.It In vm/vm_param.h
88624a0682cSRuslan Ermilovdefinitions for second level virtual memory identifiers
88724a0682cSRuslan Ermilov.It In netinet/in.h
88824a0682cSRuslan Ermilovdefinitions for third level IPv4/IPv6 identifiers and
88924a0682cSRuslan Ermilovfourth level IPv4/v6 identifiers
89024a0682cSRuslan Ermilov.It In netinet/icmp_var.h
89124a0682cSRuslan Ermilovdefinitions for fourth level ICMP identifiers
89224a0682cSRuslan Ermilov.It In netinet/icmp6.h
89324a0682cSRuslan Ermilovdefinitions for fourth level ICMPv6 identifiers
89424a0682cSRuslan Ermilov.It In netinet/udp_var.h
89524a0682cSRuslan Ermilovdefinitions for fourth level UDP identifiers
89624a0682cSRuslan Ermilov.El
89758f0484fSRodney W. Grimes.Sh ERRORS
89858f0484fSRodney W. GrimesThe following errors may be reported:
89958f0484fSRodney W. Grimes.Bl -tag -width Er
90058f0484fSRodney W. Grimes.It Bq Er EFAULT
90158f0484fSRodney W. GrimesThe buffer
90258f0484fSRodney W. Grimes.Fa name ,
90358f0484fSRodney W. Grimes.Fa oldp ,
90458f0484fSRodney W. Grimes.Fa newp ,
90558f0484fSRodney W. Grimesor length pointer
90658f0484fSRodney W. Grimes.Fa oldlenp
90758f0484fSRodney W. Grimescontains an invalid address.
90858f0484fSRodney W. Grimes.It Bq Er EINVAL
90958f0484fSRodney W. GrimesThe
91058f0484fSRodney W. Grimes.Fa name
91158f0484fSRodney W. Grimesarray is less than two or greater than CTL_MAXNAME.
91258f0484fSRodney W. Grimes.It Bq Er EINVAL
91358f0484fSRodney W. GrimesA non-null
91458f0484fSRodney W. Grimes.Fa newp
91558f0484fSRodney W. Grimesis given and its specified length in
91658f0484fSRodney W. Grimes.Fa newlen
91758f0484fSRodney W. Grimesis too large or too small.
91858f0484fSRodney W. Grimes.It Bq Er ENOMEM
91958f0484fSRodney W. GrimesThe length pointed to by
92058f0484fSRodney W. Grimes.Fa oldlenp
92158f0484fSRodney W. Grimesis too short to hold the requested value.
922c947dc05SDon Lewis.It Bq Er ENOMEM
923c947dc05SDon LewisThe smaller of either the length pointed to by
924c947dc05SDon Lewis.Fa oldlenp
925c947dc05SDon Lewisor the estimated size of the returned data exceeds the
926c947dc05SDon Lewissystem limit on locked memory.
927c947dc05SDon Lewis.It Bq Er ENOMEM
928c947dc05SDon LewisLocking the buffer
929c947dc05SDon Lewis.Fa oldp ,
930c947dc05SDon Lewisor a portion of the buffer if the estimated size of the data
931c947dc05SDon Lewisto be returned is smaller,
932c947dc05SDon Lewiswould cause the process to exceed its per-process locked memory limit.
93358f0484fSRodney W. Grimes.It Bq Er ENOTDIR
93458f0484fSRodney W. GrimesThe
93558f0484fSRodney W. Grimes.Fa name
93658f0484fSRodney W. Grimesarray specifies an intermediate rather than terminal name.
937226420a4SBrian Feldman.It Bq Er EISDIR
938226420a4SBrian FeldmanThe
939226420a4SBrian Feldman.Fa name
940226420a4SBrian Feldmanarray specifies a terminal name, but the actual name is not terminal.
941358034bcSRuslan Ermilov.It Bq Er ENOENT
94258f0484fSRodney W. GrimesThe
94358f0484fSRodney W. Grimes.Fa name
94458f0484fSRodney W. Grimesarray specifies a value that is unknown.
94558f0484fSRodney W. Grimes.It Bq Er EPERM
94658f0484fSRodney W. GrimesAn attempt is made to set a read-only value.
94758f0484fSRodney W. Grimes.It Bq Er EPERM
94858f0484fSRodney W. GrimesA process without appropriate privilege attempts to set a value.
94958f0484fSRodney W. Grimes.El
95058f0484fSRodney W. Grimes.Sh SEE ALSO
95167c8bc1bSJilles Tjoelker.Xr confstr 3 ,
95267c8bc1bSJilles Tjoelker.Xr kvm 3 ,
95338cf6319SEivind Eklund.Xr sysconf 3 ,
954f5a78334SJoseph Koshy.Xr sysctl 8
95558f0484fSRodney W. Grimes.Sh HISTORY
95658f0484fSRodney W. GrimesThe
957bf5a138eSMike Pritchard.Fn sysctl
9587bdf80e5SMike Pritchardfunction first appeared in
9597bdf80e5SMike Pritchard.Bx 4.4 .
960