xref: /netbsd-src/lib/libc/gen/sysctl.3 (revision 7cc2f76925f078d01ddc9e640a98f4ccfc9f8c3b)
1.\"	$NetBSD: sysctl.3,v 1.70 2000/10/26 07:24:00 jdolecek Exp $
2.\"
3.\" Copyright (c) 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
35.\"
36.Dd June 24, 1999
37.Dt SYSCTL 3
38.Os
39.Sh NAME
40.Nm sysctl
41.Nd get or set system information
42.Sh LIBRARY
43.Lb libc
44.Sh SYNOPSIS
45.Fd #include <sys/param.h>
46.Fd #include <sys/sysctl.h>
47.Ft int
48.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
49.Sh DESCRIPTION
50The
51.Nm
52function retrieves system information and allows processes with
53appropriate privileges to set system information.
54The information available from
55.Nm
56consists of integers, strings, and tables.
57Information may be retrieved and set from the command interface
58using the
59.Xr sysctl 8
60utility.
61.Pp
62Unless explicitly noted below,
63.Nm
64returns a consistent snapshot of the data requested.
65Consistency is obtained by locking the destination
66buffer into memory so that the data may be copied out without blocking.
67Calls to
68.Nm
69are serialized to avoid deadlock.
70.Pp
71The state is described using a ``Management Information Base'' (MIB)
72style name, listed in
73.Fa name ,
74which is a
75.Fa namelen
76length array of integers.
77.Pp
78The information is copied into the buffer specified by
79.Fa oldp .
80The size of the buffer is given by the location specified by
81.Fa oldlenp
82before the call,
83and that location gives the amount of data copied after a successful call.
84If the amount of data available is greater
85than the size of the buffer supplied,
86the call supplies as much data as fits in the buffer provided
87and returns with the error code ENOMEM.
88If the old value is not desired,
89.Fa oldp
90and
91.Fa oldlenp
92should be set to NULL.
93.Pp
94The size of the available data can be determined by calling
95.Nm
96with a NULL parameter for
97.Fa oldp .
98The size of the available data will be returned in the location pointed to by
99.Fa oldlenp .
100For some operations, the amount of space may change often.
101For these operations,
102the system attempts to round up so that the returned size is
103large enough for a call to return the data shortly thereafter.
104.Pp
105To set a new value,
106.Fa newp
107is set to point to a buffer of length
108.Fa newlen
109from which the requested value is to be taken.
110If a new value is not to be set,
111.Fa newp
112should be set to NULL and
113.Fa newlen
114set to 0.
115.Pp
116The top level names are defined with a CTL_ prefix in
117.Pa <sys/sysctl.h> ,
118and are as follows.
119The next and subsequent levels down are found in the include files
120listed here, and described in separate sections below.
121.Pp
122.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
123.It Sy Pa Name	Next level names	Description
124.It CTL\_DEBUG	sys/sysctl.h	Debugging
125.It CTL\_VFS	sys/mount.h	Filesystem
126.It CTL\_HW	sys/sysctl.h	Generic CPU, I/O
127.It CTL\_KERN	sys/sysctl.h	High kernel limits
128.It CTL\_MACHDEP	sys/sysctl.h	Machine dependent
129.It CTL\_NET	sys/socket.h	Networking
130.It CTL\_PROC	sys/sysctl.h	Per-process
131.It CTL\_USER	sys/sysctl.h	User-level
132.It CTL\_VM	uvm/uvm_param.h	Virtual memory
133.El
134.Pp
135For example, the following retrieves the maximum number of processes allowed
136in the system:
137.Bd -literal -offset indent -compact
138int mib[2], maxproc;
139size_t len;
140.sp
141mib[0] = CTL_KERN;
142mib[1] = KERN_MAXPROC;
143len = sizeof(maxproc);
144sysctl(mib, 2, &maxproc, &len, NULL, 0);
145.Ed
146.sp
147To retrieve the standard search path for the system utilities:
148.Bd -literal -offset indent -compact
149int mib[2];
150size_t len;
151char *p;
152.sp
153mib[0] = CTL_USER;
154mib[1] = USER_CS_PATH;
155sysctl(mib, 2, NULL, &len, NULL, 0);
156p = malloc(len);
157sysctl(mib, 2, p, &len, NULL, 0);
158.Ed
159.Sh CTL_DEBUG
160The debugging variables vary from system to system.
161A debugging variable may be added or deleted without need to recompile
162.Nm
163to know about it.
164Each time it runs,
165.Nm
166gets the list of debugging variables from the kernel and
167displays their current values.
168The system defines twenty
169.Ns ( Va struct ctldebug )
170variables named
171.Dv debug0
172through
173.Dv debug19 .
174They are declared as separate variables so that they can be
175individually initialized at the location of their associated variable.
176The loader prevents multiple use of the same variable by issuing errors
177if a variable is initialized in more than one place.
178For example, to export the variable
179.Dv dospecialcheck
180as a debugging variable, the following declaration would be used:
181.Bd -literal -offset indent -compact
182int dospecialcheck = 1;
183struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck };
184.Ed
185.Sh CTL_VFS
186A distinguished second level name, VFS_GENERIC,
187is used to get general information about all filesystems.
188One of its third level identifiers is VFS_MAXTYPENUM
189that gives the highest valid filesystem type number.
190Its other third level identifier is VFS_CONF that
191returns configuration information about the filesystem
192type given as a fourth level identifier.
193The remaining second level identifiers are the
194filesystem type number returned by a
195.Xr statfs 2
196call or from VFS_CONF.
197The third level identifiers available for each filesystem
198are given in the header file that defines the mount
199argument structure for that filesystem.
200.Sh CTL_HW
201The string and integer information available for the CTL_HW level
202is detailed below.
203The changeable column shows whether a process with appropriate
204privilege may change the value.
205.Bl -column "Second level nameXXXXXX" integerXXX -offset indent
206.It Sy Pa Second level name	Type	Changeable
207.It HW\_MACHINE	string	no
208.It HW\_MODEL	string	no
209.It HW\_NCPU	integer	no
210.It HW\_BYTEORDER	integer	no
211.It HW\_PHYSMEM	integer	no
212.It HW\_USERMEM	integer	no
213.It HW\_PAGESIZE	integer	no
214.\".It HW\_DISKNAMES	struct	no
215.\".It HW\_DISKSTATS	struct	no
216.It HW\_MACHINE\_ARCH	string	no
217.It HW\_ALIGNBYTES	integer	no
218.El
219.Pp
220.Bl -tag -width "123456"
221.It Li HW_MACHINE
222The machine class.
223.It Li HW_MODEL
224The machine model
225.It Li HW_NCPU
226The number of cpus.
227.ne 1i
228.It Li HW_BYTEORDER
229The byteorder (4,321, or 1,234).
230.It Li HW_PHYSMEM
231The bytes of physical memory.
232.It Li HW_USERMEM
233The bytes of non-kernel memory.
234.It Li HW_PAGESIZE
235The software page size.
236.\".It Fa HW_DISKNAMES
237.\".It Fa HW_DISKSTATS
238.It Li HW_MACHINE_ARCH
239The machine cpu class.
240.It Li HW_ALIGNBYTES
241Alignment constraint for all possible data types.
242This shows the value
243.Dv ALIGNBYTES
244in
245.Pa /usr/include/machine/param.h ,
246at the kernel compilation time.
247.El
248.Sh CTL_KERN
249The string and integer information available for the CTL_KERN level
250is detailed below.
251The changeable column shows whether a process with appropriate
252privilege may change the value.
253The types of data currently available are process information,
254system vnodes, the open file entries, routing table entries,
255virtual memory statistics, load average history, and clock rate
256information.
257.Bl -column "KERNXCHOWNXRESTRICTEDXXX" "struct clockrateXXX" -offset indent
258.It Sy Pa Second level name	Type	Changeable
259.It KERN\_ARGMAX	integer	no
260.It KERN\_AUTONICETIME	integer	yes
261.It KERN\_AUTONICEVAL	integer	yes
262.It KERN\_BOOTTIME	struct timeval	no
263.It KERN\_CCPU	integer	no
264.It KERN\_CLOCKRATE	struct clockinfo	no
265.It KERN\_CP\_TIME	long[\|]	no
266.It KERN\_DEFCORENAME	string	yes
267.It KERN\_DOMAINNAME	string	yes
268.It KERN\_FILE	struct file	no
269.It KERN\_FSCALE	integer	no
270.It KERN\_FSYNC	integer	no
271.It KERN\_HOSTID	integer	yes
272.It KERN\_HOSTNAME	string	yes
273.It KERN\_IOV\_MAX	integer	no
274.It KERN\_JOB\_CONTROL	integer	no
275.It KERN\_LOGIN\_NAME\_MAX	integer	no
276.It KERN\_LOGSIGEXIT	integer	yes
277.It KERN\_MAPPED\_FILES	integer	no
278.It KERN\_MAXFILES	integer	yes
279.It KERN\_MAXPARTITIONS	integer	no
280.It KERN\_MAXPROC	integer	yes
281.It KERN\_MAXPTYS	integer	yes
282.It KERN\_MAXVNODES	integer	yes
283.It KERN\_MBUF	node	not applicable
284.It KERN\_MEMLOCK	integer	no
285.It KERN\_MEMLOCK\_RANGE	integer	no
286.It KERN\_MEMORY\_PROTECTION	integer	no
287.It KERN\_MSGBUF	char[\|]	no
288.It KERN\_MSGBUFSIZE	integer	no
289.It KERN\_NGROUPS	integer	no
290.It KERN\_NTPTIME	struct ntptimeval	no
291.It KERN\_OSRELEASE	string	no
292.It KERN\_OSREV	integer	no
293.It KERN\_OSTYPE	string	no
294.It KERN\_POSIX1	integer	no
295.It KERN\_PROC	struct kinfo_proc	no
296.It KERN\_PROC2	struct kinfo_proc2	no
297.It KERN\_PROC\_ARGS	string	no
298.It KERN\_PROF	node	not applicable
299.It KERN\_RAWPARTITION	integer	no
300.It KERN\_ROOT\_DEVICE	string	no
301.It KERN\_RTC\_OFFSET	integer	yes
302.It KERN\_SAVED\_IDS	integer	no
303.It KERN\_SECURELVL	integer	raise only
304.It KERN\_SYNCHRONIZED\_IO	integer	no
305.It KERN\_SYSVIPC\_INFO	node	not applicable
306.It KERN\_SYSVMSG	integer	no
307.It KERN\_SYSVSEM	integer	no
308.It KERN\_SYSVSHM	integer	no
309.It KERN\_VERSION	string	no
310.It KERN\_VNODE	struct vnode	no
311.El
312.ne 1i
313.Pp
314.Bl -tag -width "123456"
315.It Li KERN_ARGMAX
316The maximum bytes of argument to
317.Xr execve 2 .
318.It Li KERN_AUTONICETIME
319The number of seconds of cpu-time a non-root process may accumulate before
320having its priority lowered from the default to the value of KERN_AUTONICEVAL.
321If set to 0, automatic lowering of priority is not performed, and if set to -1
322all non-root processes are immediately lowered.
323.It Li KERN_AUTONICEVAL
324The priority assigned for automatically niced processes.
325.It Li KERN_BOOTTIME
326A
327.Va struct timeval
328structure is returned.
329This structure contains the time that the system was booted.
330.It Li KERN_CCPU
331The scheduler exponential decay value.
332.It Li KERN_CLOCKRATE
333A
334.Va struct clockinfo
335structure is returned.
336This structure contains the clock, statistics clock and profiling clock
337frequencies, the number of micro-seconds per hz tick, and the clock
338skew rate.
339.It Li KERN_CP_TIME
340Return an array if CPUSTATES longs is returned.  This array contains the
341number of clock ticks spent in different CPU states.
342.It Li KERN_DEFCORENAME
343Default template for the name of core dump files (see also PROC_PID_CORENAME
344in the per-process variables CTL_PROC, and
345.Xr core 5
346for format of this template).  The default value is
347.Nm %n.core
348and can be changed with the kernel configuration option
349.Cd options DEFCORENAME
350(see
351.Xr options 4
352).
353.It Li KERN_DOMAINNAME
354Get or set the YP domain name.
355.It Li KERN_FILE
356Return the entire file table.
357The returned data consists of a single
358.Va struct filehead
359followed by an array of
360.Va struct file ,
361whose size depends on the current number of such objects in the system.
362.It Li KERN_FSCALE
363The kernel fixed-point scale factor.
364.It Li KERN_FSYNC
365Return 1 if the POSIX 1003.1b File Synchronization Option is available
366on this system,
367otherwise 0.
368.It Li KERN_HOSTID
369Get or set the host id.
370.It Li KERN_HOSTNAME
371Get or set the hostname.
372.It Li KERN_IOV_MAX
373Return the maximum number of
374.Va iovec
375structures that a process has available for use with
376.Xr preadv 2 ,
377.Xr pwritev 2 ,
378.Xr readv 2 ,
379.Xr recvmsg 2 ,
380.Xr sendmsg 2
381and
382.Xr writev 2 .
383.It Li KERN_JOB_CONTROL
384Return 1 if job control is available on this system, otherwise 0.
385.It Li KERN_LOGIN_NAME_MAX
386The size of the storage required for a login name, in bytes,
387including the terminating NUL.
388.It Li KERN_LOGSIGEXIT
389If this flag is non-zero, the kernel will
390.Xr log 9
391all process exits due to signals which create a
392.Xr core 5
393file, and whether the coredump was created.
394.It Li KERN_MAPPED_FILES
395Returns 1 if the POSIX 1003.1b Memory Mapped Files Option is available
396on this system,
397otherwise 0.
398.It Li KERN_MAXFILES
399The maximum number of open files that may be open in the system.
400.It Li KERN_MAXPARTITIONS
401The maximum number of partitions allowed per disk.
402.It Li KERN_MAXPROC
403The maximum number of simultaneous processes the system will allow.
404.It Li KERN_MAXPTYS
405The maximum number of pseudo terminals. This value can be both
406raised and lowered, though it cannot
407be set lower than number of currently used ptys.  See also
408.Xr pty 4 .
409.It Li KERN_MAXVNODES
410The maximum number of vnodes available on the system. This can only
411be raised.
412.It Li KERN_MBUF
413Return information about the mbuf control variables.
414the third level names for the mbuf variables are detailed below.
415The changeable column shows whether a process with appropriate
416privilege may change the value.
417.Bl -column "MBUFXNMBCLUSTERSXXX" "struct integerXXX" -offset indent
418.It MBUF\_MSIZE	integer	yes
419.It MBUF\_MCLBYTES	integer	yes
420.It MBUF\_NMBCLUSTERS	integer	yes
421.It MBUF\_MBLOWAT	integer	yes
422.It MBUF\_MCLLOWAT	integer	yes
423.El
424.Pp
425The variables are as follows:
426.Bl -tag -width "123456"
427.It Li MBUF_MSIZE
428The mbuf base size.
429.It Li MBUF_MCLBYTES
430The mbuf cluster size.
431.It Li MBUF_NMBCLUSTERS
432The limit on the number of mbuf clusters.
433The variable can only be increased, and only increased on machines with
434direct-mapped pool pages
435.It Li MBUF_MBLOWAT
436The mbuf low water mark.
437.It Li MBUF_MCLLOWAT
438The mbuf cluster low water mark.
439.El
440.It Li KERN_MEMLOCK
441Returns 1 if the POSIX 1003.1b Process Memory Locking Option is available
442on this system,
443otherwise 0.
444.It Li KERN_MEMLOCK_RANGE
445Returns 1 if the POSIX 1003.1b Range Memory Locking Option is available
446on this system,
447otherwise 0.
448.It Li KERN_MEMORY_PROTECTION
449Returns 1 if the POSIX 1003.1b Memory Protection Option is available
450on this system,
451otherwise 0.
452.It Li KERN_MSGBUF
453The kernel message buffer, rotated so that the head of the circular kernel
454message buffer is returned at the start of the buffer specified by
455.Fa oldp .
456The returned data may contain NUL bytes.
457.It Li KERN_MSGBUFSIZE
458The maximum number of characters that the kernel message buffer can hold.
459.It Li KERN_NGROUPS
460The maximum number of supplemental groups.
461.It Li KERN_NO_TRUNC
462Return 1 if file names longer than KERN_NAME_MAX are truncated.
463.It Li KERN_NTPTIME
464A
465.Va struct ntptimeval
466structure is returned.
467This structure contains data used by the
468.Xr ntpd 8
469program.
470.It Li KERN_OSRELEASE
471The system release string.
472.It Li KERN_OSREV
473The system revision string.
474.It Li KERN_OSTYPE
475The system type string.
476.It Li KERN_PATH_MAX
477The maximum number of bytes in a pathname.
478.It Li KERN_POSIX1
479The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
480attempts to comply.
481.It Li KERN_PROC
482Return the entire process table, or a subset of it.
483An array of
484.Va struct kinfo_proc
485structures is returned,
486whose size depends on the current number of such objects in the system.
487The third and fourth level names are as follows:
488.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
489.It Pa Third level name	Fourth level is:
490.It KERN\_PROC\_ALL	None
491.It KERN\_PROC\_PID	A process ID
492.It KERN\_PROC\_PGRP	A process group
493.It KERN\_PROC\_SESSION	A session ID
494.It KERN\_PROC\_TTY	A tty device
495.It KERN\_PROC\_UID	A user ID
496.It KERN\_PROC\_RUID	A real user ID
497.It KERN\_PROC\_GID	A group ID
498.It KERN\_PROC\_RGID	A real group ID
499.El
500.It Li KERN_PROC2
501As for KERN_PROC, but an array of
502.Va struct kinfo_proc2
503structures are returned.  The fifth level name is the size of the
504.Va struct kinfo_proc2
505and the sixth level name is the number of structures to return.
506.It Li KERN_PROC_ARGS
507Return the argv or environment strings (or the number thereof)
508of a process.  Multiple strings are returned separated by NUL
509characters.  The third level name is the process ID.  The fourth
510level name is as follows:
511.Bl -column "Third level nameXXXXXX" -offset indent
512.It KERN\_PROC\_ARGV	The argv strings
513.It KERN\_PROC\_NARGV	The number of argv strings
514.It KERN\_PROC\_ENV	The environ strings
515.It KERN\_PROC\_NENV	The number of environ strings
516.El
517.It Li KERN_PROF
518Return profiling information about the kernel.
519If the kernel is not compiled for profiling,
520attempts to retrieve any of the KERN_PROF values will
521fail with EOPNOTSUPP.
522The third level names for the string and integer profiling information
523is detailed below.
524The changeable column shows whether a process with appropriate
525privilege may change the value.
526.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent
527.It Sy Pa Third level name	Type	Changeable
528.It GPROF\_STATE	integer	yes
529.It GPROF\_COUNT	u_short[\|]	yes
530.It GPROF\_FROMS	u_short[\|]	yes
531.It GPROF\_TOS	struct tostruct	yes
532.It GPROF\_GMONPARAM	struct gmonparam	no
533.El
534.Pp
535The variables are as follows:
536.Bl -tag -width "123456"
537.It Li GPROF_STATE
538Returns GMON_PROF_ON or GMON_PROF_OFF to show that profiling
539is running or stopped.
540.It Li GPROF_COUNT
541Array of statistical program counter counts.
542.It Li GPROF_FROMS
543Array indexed by program counter of call-from points.
544.It Li GPROF_TOS
545Array of
546.Va struct tostruct
547describing destination of calls and their counts.
548.It Li GPROF_GMONPARAM
549Structure giving the sizes of the above arrays.
550.El
551.It Li KERN_RAWPARTITION
552The raw partition of a disk (a == 0).
553.It Li KERN_ROOT_DEVICE
554The name of the root device.
555.It Li KERN_RTC_OFFSET
556Return the offset of real time clock from UTC in minutes.
557.It Li KERN_SAVED_IDS
558Returns 1 if saved set-group and saved set-user ID is available.
559.It Li KERN_SECURELVL
560The system security level.
561This level may be raised by processes with appropriate privilege.
562It may only be lowered by process 1.
563.It Li KERN_SYNCHRONIZED_IO
564Returns 1 if the POSIX 1003.1b Synchronized I/O Option is available
565on this system,
566otherwise 0.
567.It Li KERN_SYSVIPC_INFO
568Return System V style IPC configuration and run-time information.
569The third level name selects the System V style IPC facility.
570.Bl -column "KERN_SYSVIPC_MSG_INFOXXX" "struct shm_sysctl_infoXXX" -offset indent
571.It Sy Pa Third level name	Type
572.It KERN\_SYSVIPC\_MSG\_INFO	struct msg_sysctl_info
573.It KERN\_SYSVIPC\_SEM\_INFO	struct sem_sysctl_info
574.It KERN\_SYSVIPC\_SHM\_INFO	struct shm_sysctl_info
575.El
576.Pp
577.Bl -tag -width "123456"
578.It Li KERN_SYSVIPC_MSG_INFO
579Return information on the System V style message facility.  The
580.Sy msg_sysctl_info
581structure is defined in
582.Aq Pa sys/msg.h .
583.It Li KERN_SYSVIPC_SEM_INFO
584Return information on the System V style semaphore facility.  The
585.Sy sem_sysctl_info
586structure is defined in
587.Aq Pa sys/sem.h .
588.It Li KERN_SYSVIPC_SHM_INFO
589Return information on the System V style shared memory facility.  The
590.Sy shm_sysctl_info
591structure is defined in
592.Aq Pa sys/shm.h .
593.El
594.It Li KERN_SYSVMSG
595Returns 1 if System V style message queue functionality is available
596on this system,
597otherwise 0.
598.It Li KERN_SYSVSEM
599Returns 1 if System V style semaphore functionality is available
600on this system,
601otherwise 0.
602.It Li KERN_SYSVSHM
603Returns 1 if System V style share memory functionality is available
604on this system,
605otherwise 0.
606.It Li KERN_VERSION
607The system version string.
608.It Li KERN_VNODE
609Return the entire vnode table.
610Note, the vnode table is not necessarily a consistent snapshot of
611the system.
612The returned data consists of an array whose size depends on the
613current number of such objects in the system.
614Each element of the array contains the kernel address of a vnode
615.Va struct vnode *
616followed by the vnode itself
617.Va struct vnode .
618.El
619.Sh CTL_MACHDEP
620The set of variables defined is architecture dependent.
621Most architectures define at least the following variables.
622.Bl -column "CONSOLE_DEVICEXXX" "integerXXX" -offset indent
623.It Sy Pa Second level name	Type	Changeable
624.It Li CPU_CONSDEV	dev_t	no
625.El
626.Sh CTL_NET
627The string and integer information available for the CTL_NET level
628is detailed below.
629The changeable column shows whether a process with appropriate
630privilege may change the value.
631.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
632.It Sy Pa Second level name	Type	Changeable
633.It PF\_ROUTE	routing messages	no
634.It PF\_INET	IPv4 values	yes
635.It PF\_INET6	IPv6 values	yes
636.El
637.Pp
638.Bl -tag -width "123456"
639.It Li PF_ROUTE
640Return the entire routing table or a subset of it.
641The data is returned as a sequence of routing messages (see
642.Xr route 4
643for the header file, format and meaning).
644The length of each message is contained in the message header.
645.Pp
646The third level name is a protocol number, which is currently always 0.
647The fourth level name is an address family, which may be set to 0 to
648select all address families.
649The fifth and sixth level names are as follows:
650.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent
651.It Pa Fifth level name	Sixth level is:
652.It NET\_RT\_FLAGS	rtflags
653.It NET\_RT\_DUMP	None
654.It NET\_RT\_IFLIST	None
655.El
656.It Li PF_INET
657Get or set various global information about the IPv4
658.Pq Internet Protocol version 4 .
659The third level name is the protocol.
660The fourth level name is the variable name.
661The currently defined protocols and names are:
662.Bl -column "Protocol name" "Variable nameXX" "integer" "yes" -offset indent
663.It Pa Protocol name	Variable name	Type	Changeable
664.It ip	forwarding	integer	yes
665.It ip	redirect	integer	yes
666.It ip	ttl	integer	yes
667.It ip	forwsrcrt	integer	yes
668.It ip	directed-broadcast	integer	yes
669.It ip	allowsrcrt	integer	yes
670.It ip	subnetsarelocal	integer	yes
671.It ip	mtudisc	integer	yes
672.It ip	anonportmin	integer	yes
673.It ip	anonportmax	integer	yes
674.It ip	mtudisctimeout	integer	yes
675.It ip	gifttl	integer	yes
676.It ip	lowportmin	integer	yes
677.It ip	lowportmax	integer	yes
678.It icmp	maskrepl	integer	yes
679.It icmp	errppslimit	integer	yes
680.It tcp	rfc1323	integer	yes
681.It tcp	sendspace	integer	yes
682.It tcp	recvspace	integer	yes
683.It tcp	mssdflt	integer	yes
684.It tcp	syn_cache_limit	integer	yes
685.It tcp	syn_bucket_limit	integer	yes
686.It tcp	syn_cache_interval	integer	yes
687.It tcp	init_win	integer	yes
688.It tcp	mss_ifmtu	integer	yes
689.It tcp	sack	integer	yes
690.It tcp	win_scale	integer	yes
691.It tcp	timestamps	integer	yes
692.It tcp	compat_42	integer	yes
693.It tcp	cwm	integer	yes
694.It tcp	cwm_burstsize	integer	yes
695.It tcp	ack_on_push	integer	yes
696.It tcp	keepidle	integer	yes
697.It tcp	keepintvl	integer	yes
698.It tcp	keepcnt	integer	yes
699.It tcp	slowhz	integer	no
700.It tcp	newreno	integer	yes
701.It tcp	log_refused	integer	yes
702.It tcp	rstppslimit	integer	yes
703.It udp	checksum	integer	yes
704.It udp	sendspace	integer	yes
705.It udp	recvspace	integer	yes
706.El
707.Pp
708The variables are as follows:
709.Bl -tag -width "123456"
710.It Li ip.forwarding
711Returns 1 when IP forwarding is enabled for the host,
712meaning that the host is acting as a router.
713.It Li ip.redirect
714Returns 1 when ICMP redirects may be sent by the host.
715This option is ignored unless the host is routing IP packets,
716and should normally be enabled on all systems.
717.It Li ip.ttl
718The maximum time-to-live (hop count) value for an IP packet sourced by
719the system.
720This value applies to normal transport protocols, not to ICMP.
721.It Li ip.forwsrcrt
722Returns 1 when forwarding of source-routed packets is enabled for
723the host.  This value may only be changed if the kernel security
724level is less than 1.
725.It Li ip.directed-broadcast
726Returns 1 if directed broadcast behavior is enabled for the host.
727.It Li ip.allowsrcrt
728Returns 1 if the host accepts source routed packets.
729.It Li ip.subnetsarelocal
730Returns 1 if subnets are to be considered local addresses.
731.It Li ip.mtudisc
732Returns 1 if Path MTU Discovery is enabled.
733.It Li ip.anonportmin
734The lowest port number to use for TCP and UDP ephemeral port allocation.
735This cannot be set to less than 1024 or greater than 65535.
736.It Li ip.anonportmax
737The highest port number to use for TCP and UDP ephemeral port allocation.
738This cannot be set to less than 1024 or greater than 65535, and must
739be greater than
740.Li ip.anonportmin .
741.It Li ip.mtudisctimeout
742Returns the number of seconds in which a route added by the Path MTU
743Discovery engine will time out.  When the route times out, the Path
744MTU Discovery engine will attempt to probe a larger path MTU.
745.It Li ip.gifttl
746The maximum time-to-live (hop count) value for an IPv4 packet generated by
747.Xr gif 4
748tunnel interface.
749.It Li ip.lowportmin
750The lowest port number to use for TCP and UDP reserved port allocation.
751This cannot be set to less than 0 or greater than 1024, and must
752be smaller than
753.Li ip.lowportmax .
754.It Li ip.lowportmax
755The highest port number to use for TCP and UDP reserved port allocation.
756This cannot be set to less than 0 or greater than 1024, and must
757be greater than
758.Li ip.lowportmin .
759.It Li icmp.maskrepl
760Returns 1 if ICMP network mask requests are to be answered.
761.It Li icmp.errppslimit
762The variable specifies the maximum number of outgoing ICMP error messages,
763per second.
764ICMP error messages that exceeded the value are subject to rate limitation
765and will not go out from the node.
766Negative value disables rate limitation.
767.It Li tcp.rfc1323
768Returns 1 if RFC1323 extensions to TCP are enabled.
769.It Li tcp.sendspace
770Returns the default TCP send buffer size.
771.It Li tcp.recvspace
772Returns the default TCP receive buffer size.
773.It Li tcp.mssdflt
774Returns the default maximum segment size both advertsized to the peer
775and to use when the peer does not advertize a maximum segment size to
776us during connection setup.  Do not change this value unless you really
777know what you are doing.
778.It Li tcp.syn_cache_limit
779Returns the maximum number of entries allowed in the TCP compressed state
780engine.
781.It Li tcp.syn_bucket_limit
782Returns the maximum number of entries allowed per hash bucket in the TCP
783compressed state engine.
784.It Li tcp.syn_cache_interval
785Returns the TCP compressed state engine's timer interval.
786.It Li tcp.init_win
787Returns a value indicating the TCP initial congestion window.  If this
788value is 0, an auto-tuning algorithm designed to use an initial window
789of approximately 4K bytes is in use.  Otherwise, this value indicates
790a fixed number of packets.
791.It Li tcp.mss_ifmtu
792Returns 1 if TCP calculates the outgoing maximum segment size based on
793the MTU of the appropriate interface.  Otherwise, it is calculated based on
794the greater of the MTU of the interface, and the largest (non-loopback)
795interface MTU on the system.
796.It Li tcp.sack
797TCP Selective ACKnowledgement (RFC 2018) is not implemented in
798.Nx
799at this time.
800Changing this value will have no effect.
801.It Li tcp.win_scale
802If rfc1323 is enabled, a value of 1 indicates RFC1323 window scale options,
803for increasing the TCP window size, are enabled.
804.It Li tcp.timestamps
805If rfc1323 is enabled, a value of 1 indicates RFC1323 time stamp options,
806used for measuring TCP round trip times, are enabled.
807.It Li tcp.compat_42
808Returns 1 if work-arounds for bugs in the 4.2BSD TCP implementation are
809enabled.  Use of this option is not recommended, although it may be
810required in order to communicate with extremely old TCP implementations.
811.It Li tcp.cwm
812Returns 1 if use of the Hughes/Touch/Heidemann Congestion Window Monitoring
813algorithm is enabled.  This algorithm prevents line-rate bursts of packets
814that could otherwise occur when data begins flowing on an idle TCP
815connection.  These line-rate bursts can contribute to network and router
816congestion.  This can be particularly useful on World Wide Web servers
817which support HTTP/1.1, which has lingering connections.
818.It Li tcp.cwm_burstsize
819Returns the Congestion Window Monitoring allowed burst size, in terms
820of packet count.
821.It Li tcp.ack_on_push
822Returns 1 if TCP is to immediately transmit an ACK upon reception of
823a packet with PUSH set.  This can avoid losing a round trip time in some
824rare situations, but has the caveat of potentially defeating TCP's delayed
825ACK algorithm.  Use of this option is generally not recommended, but
826the variable exists in case your configuration really needs it.
827.It Li tcp.keepidle
828Time a connection must be idle before keepalives are sent (if keepalives
829are enabled for the connection).  See also tcp.slowhz.
830.It Li tcp.keepintvl
831Time after a keepalive probe is sent until, in the absence of any response,
832another probe is sent.  See also tcp.slowhz.
833.It Li tcp.keepcnt
834Number of keepalive probes sent before declaring a connection dead.  If
835set to zero, there is no limit; keepalives will be sent until some kind of
836response is received from the peer.
837.It Li tcp.slowhz
838The units for tcp.keepidle and tcp.keepintvl; those variables are in ticks
839of a clock that ticks tcp.slowhz times per second.  (That is, their values
840must be divided by the tcp.slowhz value to get times in seconds.)
841.It Li tcp.newreno
842Returns 1 if the use of J. Hoe's NewReno congestion control algorithm is
843enabled.  This algorithm improves the start-up behavior of TCP connections.
844.It Li tcp.log_refused
845Returns 1 if refused TCP connections to the host will be logged.
846.It Li tcp.rstppslimit
847The variable specifies the maximum number of outgoing TCP RST packets,
848per second.
849TCP RST packet that exceeded the value are subject to rate limitation
850and will not go out from the node.
851Negative value disables rate limitation.
852.It Li udp.checksum
853Returns 1 when UDP checksums are being computed and checked.
854Disabling UDP checksums is strongly discouraged.
855.It Li udp.sendspace
856Returns the default UDP send buffer size.
857.It Li udp.recvspace
858Returns the default UDP receive buffer size.
859.El
860.Pp
861For variables net.*.ipsec, please refer to
862.Xr ipsec 4 .
863.It Li PF_INET6
864Get or set various global information about the IPv6
865.Pq Internet Protocol version 6 .
866The third level name is the protocol.
867The fourth level name is the variable name.
868The currently defined protocols and names are:
869.Bl -column "Protocol name" "Variable nameXX" "integer" "yes" -offset indent
870.It Pa Protocol name	Variable name	Type	Changeable
871.It ip6	forwarding	integer	yes
872.It ip6	redirect	integer	yes
873.It ip6	hlim	integer	yes
874.It ip6	maxfragpackets	integer	yes
875.It ip6	accept_rtadv	integer	yes
876.It ip6	keepfaith	integer	yes
877.It ip6	log_interval	integer	yes
878.It ip6	hdrnestlimit	integer	yes
879.It ip6	dad_count	integer	yes
880.It ip6	auto_flowlabel	integer	yes
881.It ip6	defmcasthlim	integer	yes
882.It ip6	gif_hlim	integer	yes
883.It ip6	kame_version	string	no
884.It ip6	use_deprecated	integer	yes
885.It ip6	rr_prune	integer	yes
886.It ip6	bindv6only	integer	yes
887.It ip6	anonportmin	integer	yes
888.It ip6	anonportmax	integer	yes
889.It ip6	lowportmin	integer	yes
890.It ip6	lowportmax	integer	yes
891.It icmp6	rediraccept	integer	yes
892.It icmp6	redirtimeout	integer	yes
893.It icmp6	nd6_prune	integer	yes
894.It icmp6	nd6_delay	integer	yes
895.It icmp6	nd6_umaxtries	integer	yes
896.It icmp6	nd6_mmaxtries	integer	yes
897.It icmp6	nd6_useloopback	integer	yes
898.It icmp6	nodeinfo	integer	yes
899.It icmp6	errppslimit	integer	yes
900.It icmp6	nd6_maxnudhint	integer	yes
901.It udp6	sendspace	integer	yes
902.It udp6	recvspace	integer	yes
903.El
904.Pp
905The variables are as follows:
906.Bl -tag -width "123456"
907.It Li ip6.forwarding
908Returns 1 when IPv6 forwarding is enabled for the node,
909meaning that the node is acting as a router.
910Returns 0 when IPv6 forwarding is disabled for the node,
911meaning that the node is acting as a host.
912IPv6 specification defines node behavior for
913.Dq router
914case and
915.Dq host
916case quite differently, and changing this variable during operation
917may cause serious trouble.
918It is recommended to configure the variable at bootstrap time,
919and bootstrap time only.
920.It Li ip6.redirect
921Returns 1 when ICMPv6 redirects may be sent by the node.
922This option is ignored unless the node is routing IP packets,
923and should normally be enabled on all systems.
924.It Li ip6.hlim
925The default hop limit value for an IPv6 unicast packet sourced by the node.
926This value applies to all the transport protocols on top of IPv6.
927There are APIs to override the value, as documented in
928.Xr ip6 4 .
929.It Li ip6.maxfragpackets
930The maximum number of fragmented packets the node will accept.
9310 means that the node will not accept any fragmented packets.
932-1 means that the node will accept as many fragmented packets as it receives.
933The flag is provided basically for avoiding possible DoS attacks.
934.It Li ip6.accept_rtadv
935If set to non-zero, the node will accept ICMPv6 router advertisement packets
936and autoconfigures address prefixes and default routers.
937The node must be a host
938.Pq not a router
939for the option to be meaningful.
940.It Li ip6.keepfaith
941If set to non-zero, it enables
942.Dq FAITH
943TCP relay IPv6-to-IPv4 translator code in the kernel.
944Refer
945.Xr faith 4
946and
947.Xr faithd 8
948for detail.
949.It Li ip6.log_interval
950The variable controls amount of logs generated by IPv6 packet
951forwarding engine, by seting interval between log output
952.Pq in seconds .
953.It Li ip6.hdrnestlimit
954The number of IPv6 extension headers permitted on incoming IPv6 packets.
955If set to 0, the node will accept as many extension headers as possible.
956.It Li ip6.dad_count
957The variable cofigures number of IPv6 DAD
958.Pq duplicated address detection
959probe packets.
960The packets will be generated when IPv6 interface addresses are configured.
961.It Li ip6.auto_flowlabel
962On connected transport protocol packets,
963fill IPv6 flowlabel field to help intermediate routers to identify packet flows.
964.It Li ip6.defmcasthlim
965The default hop limit value for an IPv6 multicast packet sourced by the node.
966This value applies to all the transport protocols on top of IPv6.
967There are APIs to override the value, as documented in
968.Xr ip6 4 .
969.It Li ip6.gif_hlim
970The maximum hop limit value for an IPv6 packet generated by
971.Xr gif 4
972tunnel interface.
973.It Li ip6.kame_version
974The string identifies the version of KAME IPv6 stack implemented in the kernel.
975.It Li ip6.use_deprecated
976The variable controls use of deprecated address, specified in RFC2462 5.5.4.
977.It Li ip6.rr_prune
978The variable specifies interval between IPv6 router renumbering prefix
979babysitting, in seconds.
980.It Li ip6.bindv6only
981The variable specifies initial value for
982.Dv IPV6_BINDV6ONLY
983socket option for
984.Dv AF_INET6
985socket.
986Please refer to
987.Xr ip6 4
988for detail.
989.It Li ip6.anonportmin
990The lowest port number to use for TCP and UDP ephemeral port allocation.
991This cannot be set to less than 1024 or greater than 65535.
992.It Li ip6.anonportmax
993The highest port number to use for TCP and UDP ephemeral port allocation.
994This cannot be set to less than 1024 or greater than 65535, and must
995be greater than
996.Li ip6.anonportmin .
997.It Li ip6.lowportmin
998The lowest port number to use for TCP and UDP reserved port allocation.
999This cannot be set to less than 0 or greater than 1024, and must
1000be smaller than
1001.Li ip6.lowportmax .
1002.It Li ip6.lowportmax
1003The highest port number to use for TCP and UDP reserved port allocation.
1004This cannot be set to less than 0 or greater than 1024, and must
1005be greater than
1006.Li ip6.lowportmin .
1007.It Li icmp6.rediraccept
1008If set to non-zero, the host will accept ICMPv6 redirect packets.
1009Note that IPv6 routers will never accept ICMPv6 redirect packets,
1010and the variable is meaningful on IPv6 hosts
1011.Pq non-router
1012only.
1013.It Li icmp6.redirtimeout
1014The variable specifies lifetime of routing entries generated by incoming
1015ICMPv6 redirect.
1016.It Li icmp6.nd6_prune
1017The variable specifies interval between IPv6 neighbor cache babysitting,
1018in seconds.
1019.It Li icmp6.nd6_delay
1020The variable specifies
1021.Dv DELAY_FIRST_PROBE_TIME
1022timing constant in IPv6 neighbor discovery specification
1023.Pq RFC2461 ,
1024in seconds.
1025.It Li icmp6.nd6_umaxtries
1026The variable specifies
1027.Dv MAX_UNICAST_SOLICIT
1028constant in IPv6 neighbor discovery specification
1029.Pq RFC2461 .
1030.It Li icmp6.nd6_mmaxtries
1031The variable specifies
1032.Dv MAX_MULTICAST_SOLICIT
1033constant in IPv6 neighbor discovery specification
1034.Pq RFC2461 .
1035.It Li icmp6.nd6_useloopback
1036If set to non-zero, kernel IPv6 stack will use loopback interface for
1037local traffic.
1038.It Li icmp6.nodeinfo
1039The variable enables, or disables, kernel support for
1040ICMPv6 node information query/reply.
1041.It Li icmp6.errppslimit
1042The variable specifies the maximum number of outgoing ICMPv6 error messages,
1043per second.
1044ICMPv6 error messages that exceeded the value are subject to rate limitation
1045and will not go out from the node.
1046Negative value disables rate limitation.
1047.It Li icmp6.nd6_maxnudhint
1048IPv6 neighbor discovery permits upper layer protocols to supply reachability
1049hints, to avoid unnecessary neighbor discovery exchanges.
1050The variable defines the number of consecutive hints the neighbor discovery
1051layer will take.
1052For example, by setting the variable to 3, neighbor discovery layer
1053will take 3 consecutive hints in maximum.
1054After receiving 3 hints, neighbor discovery layer will perform
1055normal neighbor discovery process.
1056.El
1057.Pp
1058We reuse net.*.tcp for
1059.Tn TCP
1060over
1061.Tn IPv6 ,
1062and therefore we do not have variables net.*.tcp6.
1063Variables net.inet6.udp6 have identical meaning to net.inet.udp.
1064Please refer to
1065.Li PF_INET
1066section above.
1067For variables net.*.ipsec6, please refer to
1068.Xr ipsec 4 .
1069.El
1070.Sh CTL_PROC
1071The string and integer information available for the CTL_PROC
1072is detailed below.
1073The changeable column shows whether a process with appropriate
1074privilege may change the value.
1075These values are per-process, and as such may change from one process
1076to another. When a process is created, the default values are inherited from
1077its parent. When a set-user-ID or set-group-ID binary is executed, the
1078value of PROC_PID_CORENAME is reset to the system default value.
1079The second level name is either the magic value PROC_CURPROC, which
1080points to the current process, or the PID of the target process.
1081.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" "yes" -offset indent
1082.It Sy Pa Third level name	Type	Changeable
1083.It PROC\_PID\_CORENAME	string	yes
1084.It PROC\_PID\_LIMIT	node	not applicable
1085.El
1086.Bl -tag -width "123456"
1087.Pp
1088.It Li PROC_PID_CORENAME
1089The template used for the core dump file name (see
1090.Xr core 5
1091for details). The base name must either be
1092.Nm core
1093or end with the suffix ``.core'' (the super-user may set arbitrary names). By
1094default it points to KERN_DEFCORENAME.
1095.It Li PROC_PID_LIMIT
1096Return resources limits, as defined for the
1097.Xr getrlimit 2
1098and
1099.Xr setrlimit 2
1100system calls.
1101The fourth level name is one of:
1102.Bl -tag -width PROC_PID_LIMIT_MEMLOCKAA
1103.It Li PROC_PID_LIMIT_CPU
1104The maximum amount of cpu time (in seconds) to be used by each process.
1105.It Li PROC_PID_LIMIT_FSIZE
1106The largest size (in bytes) file that may be created.
1107.It Li PROC_PID_LIMIT_DATA
1108The maximum size (in bytes) of the data segment for a process;
1109this defines how far a program may extend its break with the
1110.Xr sbrk 2
1111system call.
1112.It Li PROC_PID_LIMIT_STACK
1113The maximum size (in bytes) of the stack segment for a process;
1114this defines how far a program's stack segment may be extended.
1115Stack extension is performed automatically by the system.
1116.It Li PROC_PID_LIMIT_CORE
1117The largest size (in bytes)
1118.Pa core
1119file that may be created.
1120.It Li PROC_PID_LIMIT_RSS
1121The maximum size (in bytes) to which a process's resident set size may
1122grow.
1123This imposes a limit on the amount of physical memory to be given to
1124a process; if memory is tight, the system will prefer to take memory
1125from processes that are exceeding their declared resident set size.
1126.It Li PROC_PID_LIMIT_MEMLOCK
1127The maximum size (in bytes) which a process may lock into memory
1128using the
1129.Xr mlock 2
1130function.
1131.It Li PROC_PID_LIMIT_NPROC
1132The maximum number of simultaneous processes for this user id.
1133.It Li PROC_PID_LIMIT_NOFILE
1134The maximum number of open files for this process.
1135.El
1136.Pp
1137The fifth level name is one of PROC_PID_LIMIT_TYPE_SOFT or
1138PROC_PID_LIMIT_TYPE_HARD, to select respectively the soft or hard limit.
1139Both are of type integer.
1140.El
1141.Pp
1142
1143.Sh CTL_USER
1144The string and integer information available for the CTL_USER level
1145is detailed below.
1146The changeable column shows whether a process with appropriate
1147privilege may change the value.
1148.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent
1149.It Sy Pa Second level name	Type	Changeable
1150.It USER\_BC\_BASE\_MAX	integer	no
1151.It USER\_BC\_DIM\_MAX	integer	no
1152.It USER\_BC\_SCALE\_MAX	integer	no
1153.It USER\_BC\_STRING\_MAX	integer	no
1154.It USER\_COLL\_WEIGHTS\_MAX	integer	no
1155.It USER\_CS\_PATH	string	no
1156.It USER\_EXPR\_NEST\_MAX	integer	no
1157.It USER\_LINE\_MAX	integer	no
1158.It USER\_POSIX2\_CHAR\_TERM	integer	no
1159.It USER\_POSIX2\_C\_BIND	integer	no
1160.It USER\_POSIX2\_C\_DEV	integer	no
1161.It USER\_POSIX2\_FORT\_DEV	integer	no
1162.It USER\_POSIX2\_FORT\_RUN	integer	no
1163.It USER\_POSIX2\_LOCALEDEF	integer	no
1164.It USER\_POSIX2\_SW\_DEV	integer	no
1165.It USER\_POSIX2\_UPE	integer	no
1166.It USER\_POSIX2\_VERSION	integer	no
1167.It USER\_RE\_DUP\_MAX	integer	no
1168.It USER\_STREAM\_MAX	integer	no
1169.It USER\_TZNAME\_MAX	integer	no
1170.El
1171.Bl -tag -width "123456"
1172.Pp
1173.It Li USER_BC_BASE_MAX
1174The maximum ibase/obase values in the
1175.Xr bc 1
1176utility.
1177.It Li USER_BC_DIM_MAX
1178The maximum array size in the
1179.Xr bc 1
1180utility.
1181.It Li USER_BC_SCALE_MAX
1182The maximum scale value in the
1183.Xr bc 1
1184utility.
1185.It Li USER_BC_STRING_MAX
1186The maximum string length in the
1187.Xr bc 1
1188utility.
1189.It Li USER_COLL_WEIGHTS_MAX
1190The maximum number of weights that can be assigned to any entry of
1191the LC_COLLATE order keyword in the locale definition file.
1192.It Li USER_CS_PATH
1193Return a value for the
1194.Ev PATH
1195environment variable that finds all the standard utilities.
1196.It Li USER_EXPR_NEST_MAX
1197The maximum number of expressions that can be nested within
1198parenthesis by the
1199.Xr expr 1
1200utility.
1201.It Li USER_LINE_MAX
1202The maximum length in bytes of a text-processing utility's input
1203line.
1204.It Li USER_POSIX2_CHAR_TERM
1205Return 1 if the system supports at least one terminal type capable of
1206all operations described in POSIX 1003.2, otherwise 0.
1207.It Li USER_POSIX2_C_BIND
1208Return 1 if the system's C-language development facilities support the
1209C-Language Bindings Option, otherwise 0.
1210.It Li USER_POSIX2_C_DEV
1211Return 1 if the system supports the C-Language Development Utilities Option,
1212otherwise 0.
1213.It Li USER_POSIX2_FORT_DEV
1214Return 1 if the system supports the FORTRAN Development Utilities Option,
1215otherwise 0.
1216.It Li USER_POSIX2_FORT_RUN
1217Return 1 if the system supports the FORTRAN Runtime Utilities Option,
1218otherwise 0.
1219.It Li USER_POSIX2_LOCALEDEF
1220Return 1 if the system supports the creation of locales, otherwise 0.
1221.It Li USER_POSIX2_SW_DEV
1222Return 1 if the system supports the Software Development Utilities Option,
1223otherwise 0.
1224.It Li USER_POSIX2_UPE
1225Return 1 if the system supports the User Portability Utilities Option,
1226otherwise 0.
1227.It Li USER_POSIX2_VERSION
1228The version of POSIX 1003.2 with which the system attempts to comply.
1229.It Li USER_RE_DUP_MAX
1230The maximum number of repeated occurrences of a regular expression
1231permitted when using interval notation.
1232.ne 1i
1233.It Li USER_STREAM_MAX
1234The minimum maximum number of streams that a process may have open
1235at any one time.
1236.It Li USER_TZNAME_MAX
1237The minimum maximum number of types supported for the name of a
1238timezone.
1239.El
1240.Sh CTL_VM
1241The string and integer information available for the CTL_VM level
1242is detailed below.
1243The changeable column shows whether a process with appropriate
1244privilege may change the value.
1245.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
1246.It Sy Pa Second level name	Type	Changeable
1247.It VM\_LOADAVG	struct loadavg	no
1248.It VM\_METER	struct vmtotal	no
1249.El
1250.Pp
1251.Bl -tag -width "123456"
1252.It Li VM_LOADAVG
1253Return the load average history.
1254The returned data consists of a
1255.Va struct loadavg .
1256.It Li VM_METER
1257Return the system wide virtual memory statistics.
1258The returned data consists of a
1259.Va struct vmtotal .
1260.El
1261.Sh CTL_DDB
1262The integer information available for the CTL_DDB level is detailed below.
1263The changeable column shows whether a process with appropriate
1264privilege may change the value.
1265.Bl -column "DBCTL_TABSTOPSXXX" "integerXXX" -offset indent
1266.It Sy Pa Second level name	Type	Changeable
1267.It DBCTL\_RADIX	integer	yes
1268.It DBCTL\_MAXOFF	integer	yes
1269.It DBCTL\_LINES	integer	yes
1270.It DBCTL\_TABSTOPS	integer	yes
1271.It DBCTL\_ONPANIC	integer	yes
1272.It DBCTL\_FROMCONSOLE	integer	yes
1273.El
1274.Pp
1275.Bl -tag -width "123456"
1276.It Li DBCTL_RADIX
1277The input and output radix.
1278.It Li DBCTL_MAXOFF
1279The maximum symbol offset.
1280.It Li DBCTL_LINES
1281Number of display lines.
1282.It Li DBCTL_TABSTOPS
1283Tab width.
1284.It Li DBCTL_ONPANIC
1285If non-zero, DDB will be entered when the kernel panics.
1286.It Li DBCTL_FROMCONSOLE
1287If not zero, DDB may be entered by sending a break on a serial
1288console or by a special key sequence on a graphics console.
1289.El
1290.Pp
1291These MIB nodes are also available as variables from within the
1292DDB.  See
1293.Xr ddb 4
1294for more details.
1295.Sh RETURN VALUES
1296If the call to
1297.Nm
1298is successful, the number of bytes copied out is returned.
1299Otherwise \-1 is returned and
1300.Va errno
1301is set appropriately.
1302.Sh ERRORS
1303The following errors may be reported:
1304.Bl -tag -width Er
1305.It Bq Er EFAULT
1306The buffer
1307.Fa name ,
1308.Fa oldp ,
1309.Fa newp ,
1310or length pointer
1311.Fa oldlenp
1312contains an invalid address.
1313.It Bq Er EINVAL
1314The
1315.Fa name
1316array is less than two or greater than CTL_MAXNAME.
1317.It Bq Er EINVAL
1318A non-null
1319.Fa newp
1320is given and its specified length in
1321.Fa newlen
1322is too large or too small.
1323.It Bq Er ENOMEM
1324The length pointed to by
1325.Fa oldlenp
1326is too short to hold the requested value.
1327.It Bq Er ENOTDIR
1328The
1329.Fa name
1330array specifies an intermediate rather than terminal name.
1331.It Bq Er EOPNOTSUPP
1332The
1333.Fa name
1334array specifies a value that is unknown.
1335.It Bq Er EPERM
1336An attempt is made to set a read-only value.
1337.It Bq Er EPERM
1338A process without appropriate privilege attempts to set a value.
1339.It Bq Er EPERM
1340An attempt to change a value protected by the current kernel security
1341level is made.
1342.El
1343.Sh FILES
1344.Bl -tag -width <netinet6/udp6Xvar.h> -compact
1345.It Pa <sys/sysctl.h>
1346definitions for top level identifiers, second level kernel and hardware
1347identifiers, and user level identifiers
1348.It Pa <sys/socket.h>
1349definitions for second level network identifiers
1350.It Pa <sys/gmon.h>
1351definitions for third level profiling identifiers
1352.It Pa <uvm/uvm_param.h>
1353definitions for second level virtual memory identifiers
1354.It Pa <netinet/in.h>
1355definitions for third level IPv4/v6 identifiers and
1356fourth level IPv4/v6 identifiers
1357.It Pa <netinet/icmp_var.h>
1358definitions for fourth level ICMP identifiers
1359.It Pa <netinet/icmp6.h>
1360definitions for fourth level ICMPv6 identifiers
1361.It Pa <netinet/tcp_var.h>
1362definitions for fourth level TCP identifiers
1363.It Pa <netinet/udp_var.h>
1364definitions for fourth level UDP identifiers
1365.It Pa <netinet6/udp6_var.h>
1366definitions for fourth level IPv6 UDP identifiers
1367.It Pa <netinet6/ipsec.h>
1368definitions for fourth level IPsec identifiers
1369.El
1370.Sh SEE ALSO
1371.Xr ipsec 4 ,
1372.Xr sysctl 8
1373.Sh HISTORY
1374The
1375.Nm
1376function first appeared in
1377.Bx 4.4 .
1378