xref: /netbsd-src/lib/libc/gen/sysctl.3 (revision 001c68bd94f75ce9270b69227c4199fbf34ee396)
1.\"	$NetBSD: sysctl.3,v 1.118 2003/06/27 17:59:33 wiz 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 April 11, 2003
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.In sys/param.h
46.In 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
93.Dv NULL .
94.Pp
95The size of the available data can be determined by calling
96.Nm
97with a
98.Dv NULL
99parameter for
100.Fa oldp .
101The size of the available data will be returned in the location pointed to by
102.Fa oldlenp .
103For some operations, the amount of space may change often.
104For these operations,
105the system attempts to round up so that the returned size is
106large enough for a call to return the data shortly thereafter.
107.Pp
108To set a new value,
109.Fa newp
110is set to point to a buffer of length
111.Fa newlen
112from which the requested value is to be taken.
113If a new value is not to be set,
114.Fa newp
115should be set to
116.Dv NULL
117and
118.Fa newlen
119set to 0.
120.Pp
121The top level names are defined with a CTL_ prefix in
122.Aq Pa sys/sysctl.h ,
123and are as follows.
124The next and subsequent levels down are found in the include files
125listed here, and described in separate sections below.
126.Pp
127.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
128.It Sy Name	Next level names	Description
129.It CTL\_KERN	sys/sysctl.h	High kernel limits
130.It CTL\_VM	uvm/uvm_param.h	Virtual memory
131.It CTL\_VFS	sys/mount.h	Filesystem
132.It CTL\_NET	sys/socket.h	Networking
133.It CTL\_DEBUG	sys/sysctl.h	Debugging
134.It CTL\_HW	sys/sysctl.h	Generic CPU, I/O
135.It CTL\_MACHDEP	sys/sysctl.h	Machine dependent
136.It CTL\_USER	sys/sysctl.h	User-level
137.It CTL\_DDB	sys/sysctl.h	In-kernel debugger
138.It CTL\_PROC	sys/sysctl.h	Per-process
139.It CTL\_VENDOR	?	Vendor specific
140.El
141.Pp
142For example, the following retrieves the maximum number of processes allowed
143in the system:
144.Bd -literal -offset indent -compact
145int mib[2], maxproc;
146size_t len;
147.sp
148mib[0] = CTL_KERN;
149mib[1] = KERN_MAXPROC;
150len = sizeof(maxproc);
151sysctl(mib, 2, \*[Am]maxproc, \*[Am]len, NULL, 0);
152.Ed
153.sp
154To retrieve the standard search path for the system utilities:
155.Bd -literal -offset indent -compact
156int mib[2];
157size_t len;
158char *p;
159.sp
160mib[0] = CTL_USER;
161mib[1] = USER_CS_PATH;
162sysctl(mib, 2, NULL, \*[Am]len, NULL, 0);
163p = malloc(len);
164sysctl(mib, 2, p, \*[Am]len, NULL, 0);
165.Ed
166.Sh CTL_DEBUG
167The debugging variables vary from system to system.
168A debugging variable may be added or deleted without need to recompile
169.Nm
170to know about it.
171Each time it runs,
172.Nm
173gets the list of debugging variables from the kernel and
174displays their current values.
175The system defines twenty
176.Va ( struct ctldebug )
177variables named
178.Dv debug0
179through
180.Dv debug19 .
181They are declared as separate variables so that they can be
182individually initialized at the location of their associated variable.
183The loader prevents multiple use of the same variable by issuing errors
184if a variable is initialized in more than one place.
185For example, to export the variable
186.Dv dospecialcheck
187as a debugging variable, the following declaration would be used:
188.Bd -literal -offset indent -compact
189int dospecialcheck = 1;
190struct ctldebug debug5 = { "dospecialcheck", \*[Am]dospecialcheck };
191.Ed
192.Sh CTL_VFS
193A distinguished second level name, VFS_GENERIC,
194is used to get general information about all filesystems.
195One of its third level identifiers is VFS_MAXTYPENUM
196that gives the highest valid filesystem type number.
197Its other third level identifier is VFS_CONF that
198returns configuration information about the filesystem
199type given as a fourth level identifier.
200The remaining second level identifiers are the
201filesystem type number returned by a
202.Xr statfs 2
203call or from VFS_CONF.
204The third level identifiers available for each filesystem
205are given in the header file that defines the mount
206argument structure for that filesystem.
207.Sh CTL_HW
208The string and integer information available for the CTL_HW level
209is detailed below.
210The changeable column shows whether a process with appropriate
211privilege may change the value.
212.Bl -column "Second level nameXXXXXX" "struct disk_sysctlXXX" -offset indent
213.It Sy Second level name	Type	Changeable
214.It HW\_MACHINE	string	no
215.It HW\_MODEL	string	no
216.It HW\_NCPU	integer	no
217.It HW\_BYTEORDER	integer	no
218.It HW\_PHYSMEM	integer	no
219.It HW\_PHYSMEM64	quad	no
220.It HW\_USERMEM	integer	no
221.It HW\_USERMEM64	quad	no
222.It HW\_PAGESIZE	integer	no
223.\".It HW\_DISKNAMES	struct	no
224.\".It HW\_DISKSTATS	struct	no
225.It HW\_MACHINE\_ARCH	string	no
226.It HW\_ALIGNBYTES	integer	no
227.It HW\_DISKNAMES	string	no
228.It HW\_DISKSTATS	struct disk_sysctl	no
229.It HW\_CNMAGIC	string	yes
230.El
231.Pp
232.Bl -tag -width "123456"
233.It Li HW_MACHINE
234The machine class.
235.It Li HW_MODEL
236The machine model.
237.It Li HW_NCPU
238The number of CPUs.
239.ne 1i
240.It Li HW_BYTEORDER
241The byteorder (4,321, or 1,234).
242.It Li HW_PHYSMEM
243The bytes of physical memory as a 32-bit integer.
244.It Li HW_PHYSMEM64
245The bytes of physical memory as a 64-bit integer.
246.It Li HW_USERMEM
247The bytes of non-kernel memory as a 32-bit integer.
248.It Li HW_USERMEM64
249The bytes of non-kernel memory as a 64-bit integer.
250.It Li HW_PAGESIZE
251The software page size.
252.It Li HW_MACHINE_ARCH
253The machine cpu class.
254.It Li HW_ALIGNBYTES
255Alignment constraint for all possible data types.
256This shows the value
257.Dv ALIGNBYTES
258in
259.Pa /usr/include/machine/param.h ,
260at the kernel compilation time.
261.It Li HW_DISKNAMES
262The list of (space separated) disk device names on the system.
263.It Li HW_DISKSTATS
264Return statistical information on the disk devices on the system.
265An array of
266.Va struct disk_sysctl
267structures is returned,
268whose size depends on the current number of such objects in the system.
269The third level name is the size of the
270.Va struct disk_sysctl .
271.It Li HW_CNMAGIC
272The console magic key sequence.
273.El
274.Sh CTL_KERN
275The string and integer information available for the CTL_KERN level
276is detailed below.
277The changeable column shows whether a process with appropriate
278privilege may change the value.
279The types of data currently available are process information,
280system vnodes, the open file entries, routing table entries,
281virtual memory statistics, load average history, and clock rate
282information.
283.Bl -column "KERNXCHOWNXRESTRICTEDXXXXXX" "struct clockrateXXX" -offset indent
284.It Sy Second level name	Type	Changeable
285.It KERN\_ARGMAX	integer	no
286.It KERN\_AUTONICETIME	integer	yes
287.It KERN\_AUTONICEVAL	integer	yes
288.It KERN\_BOOTTIME	struct timeval	no
289.It KERN\_CCPU	integer	no
290.It KERN\_CLOCKRATE	struct clockinfo	no
291.It KERN\_CP\_TIME	long[\|]	no
292.It KERN\_DEFCORENAME	string	yes
293.It KERN\_DOMAINNAME	string	yes
294.It KERN\_FILE	struct file	no
295.It KERN\_FORKFSLEEP	integer	yes
296.It KERN\_FSCALE	integer	no
297.It KERN\_FSYNC	integer	no
298.It KERN\_HOSTID	integer	yes
299.It KERN\_HOSTNAME	string	yes
300.It KERN\_IOV\_MAX	integer	no
301.It KERN\_JOB\_CONTROL	integer	no
302.It KERN\_LABELOFFSET	integer	no
303.It KERN\_LABELSECTOR	integer	no
304.It KERN\_LOGIN\_NAME\_MAX	integer	no
305.It KERN\_LOGSIGEXIT	integer	yes
306.It KERN\_MAPPED\_FILES	integer	no
307.It KERN\_MAXFILES	integer	yes
308.It KERN\_MAXPARTITIONS	integer	no
309.It KERN\_MAXPROC	integer	yes
310.It KERN\_MAXPTYS	integer	yes
311.It KERN\_MAXVNODES	integer	yes
312.It KERN\_MBUF	node	not applicable
313.It KERN\_MEMLOCK	integer	no
314.It KERN\_MEMLOCK\_RANGE	integer	no
315.It KERN\_MEMORY\_PROTECTION	integer	no
316.It KERN\_MONOTONIC\_CLOCK	integer	no
317.It KERN\_MSGBUF	char[\|]	no
318.It KERN\_MSGBUFSIZE	integer	no
319.It KERN\_NGROUPS	integer	no
320.It KERN\_NTPTIME	struct ntptimeval	no
321.It KERN\_OSRELEASE	string	no
322.It KERN\_OSREV	integer	no
323.It KERN\_OSTYPE	string	no
324.It KERN\_POSIX1	integer	no
325.It KERN\_POSIX\_BARRIERS	integer	no
326.It KERN\_POSIX\_READER\_WRITER\_LOCKS	integer	no
327.It KERN\_POSIX\_SEMAPHORES	integer	no
328.It KERN\_POSIX\_SPIN\_LOCKS	integer	no
329.It KERN\_POSIX\_THREADS	integer	no
330.It KERN\_POSIX\_TIMERS	integer	no
331.It KERN\_PROC	struct kinfo_proc	no
332.It KERN\_PROC2	struct kinfo_proc2	no
333.It KERN\_PROC\_ARGS	string	no
334.It KERN\_PROF	node	not applicable
335.It KERN\_RAWPARTITION	integer	no
336.It KERN\_ROOT\_DEVICE	string	no
337.It KERN\_RTC\_OFFSET	integer	no
338.It KERN\_SAVED\_IDS	integer	no
339.It KERN\_SECURELVL	integer	raise only
340.It KERN\_SYNCHRONIZED\_IO	integer	no
341.It KERN\_SYSVIPC\_INFO	node	not applicable
342.It KERN\_SYSVMSG	integer	no
343.It KERN\_SYSVSEM	integer	no
344.It KERN\_SYSVSHM	integer	no
345.It KERN\_TKSTAT	node	not applicable
346.It KERN\_VERSION	string	no
347.It KERN\_VNODE	struct vnode	no
348.El
349.ne 1i
350.Pp
351.Bl -tag -width "123456"
352.It Li KERN_ARGMAX
353The maximum bytes of argument to
354.Xr execve 2 .
355.It Li KERN_AUTONICETIME
356The number of seconds of cpu-time a non-root process may accumulate before
357having its priority lowered from the default to the value of KERN_AUTONICEVAL.
358If set to 0, automatic lowering of priority is not performed, and if set to \-1
359all non-root processes are immediately lowered.
360.It Li KERN_AUTONICEVAL
361The priority assigned for automatically niced processes.
362.It Li KERN_BOOTTIME
363A
364.Va struct timeval
365structure is returned.
366This structure contains the time that the system was booted.
367.It Li KERN_CCPU
368The scheduler exponential decay value.
369.It Li KERN_CLOCKRATE
370A
371.Va struct clockinfo
372structure is returned.
373This structure contains the clock, statistics clock and profiling clock
374frequencies, the number of micro-seconds per hz tick, and the clock
375skew rate.
376.It Li KERN_CP_TIME
377Return an array if CPUSTATES longs is returned.
378This array contains the
379number of clock ticks spent in different CPU states.
380.It Li KERN_DEFCORENAME
381Default template for the name of core dump files (see also PROC_PID_CORENAME
382in the per-process variables CTL_PROC, and
383.Xr core 5
384for format of this template).
385The default value is
386.Nm %n.core
387and can be changed with the kernel configuration option
388.Cd options DEFCORENAME
389(see
390.Xr options 4
391).
392.It Li KERN_DOMAINNAME
393Get or set the YP domain name.
394.It Li KERN_FILE
395Return the entire file table.
396The returned data consists of a single
397.Va struct filehead
398followed by an array of
399.Va struct file ,
400whose size depends on the current number of such objects in the system.
401.It Li KERN_FSCALE
402The kernel fixed-point scale factor.
403.It Li KERN_FORKFSLEEP
404If
405.Xr fork 2
406system call fails due to limit on number of processes (either
407the global maxproc limit or user's one), wait for this many
408miliseconds before returning
409.Er EAGAIN
410error to process.
411Useful to keep heavily forking runaway processes in bay.
412Default zero (no sleep).
413Maximum is 20 seconds.
414.It Li KERN_FSYNC
415Return 1 if the POSIX 1003.1b File Synchronization Option is available
416on this system,
417otherwise 0.
418.It Li KERN_HOSTID
419Get or set the host id.
420.It Li KERN_HOSTNAME
421Get or set the hostname.
422.It Li KERN_IOV_MAX
423Return the maximum number of
424.Va iovec
425structures that a process has available for use with
426.Xr preadv 2 ,
427.Xr pwritev 2 ,
428.Xr readv 2 ,
429.Xr recvmsg 2 ,
430.Xr sendmsg 2
431and
432.Xr writev 2 .
433.It Li KERN_JOB_CONTROL
434Return 1 if job control is available on this system, otherwise 0.
435.It Li KERN_LABELOFFSET
436The offset within the sector specified by KERN_LABELSECTOR of the
437.Xr disklabel 5 .
438.It Li KERN_LABELSECTOR
439The sector number containing the
440.Xr disklabel 5 .
441.It Li KERN_LOGIN_NAME_MAX
442The size of the storage required for a login name, in bytes,
443including the terminating NUL.
444.It Li KERN_LOGSIGEXIT
445If this flag is non-zero, the kernel will
446.Xr log 9
447all process exits due to signals which create a
448.Xr core 5
449file, and whether the coredump was created.
450.It Li KERN_MAPPED_FILES
451Returns 1 if the POSIX 1003.1b Memory Mapped Files Option is available
452on this system,
453otherwise 0.
454.It Li KERN_MAXFILES
455The maximum number of open files that may be open in the system.
456.It Li KERN_MAXPARTITIONS
457The maximum number of partitions allowed per disk.
458.It Li KERN_MAXPROC
459The maximum number of simultaneous processes the system will allow.
460.It Li KERN_MAXPTYS
461The maximum number of pseudo terminals.
462This value can be both raised and lowered, though it cannot
463be set lower than number of currently used ptys.
464See also
465.Xr pty 4 .
466.It Li KERN_MAXVNODES
467The maximum number of vnodes available on the system.
468This can only be raised.
469.It Li KERN_MBUF
470Return information about the mbuf control variables.
471the third level names for the mbuf variables are detailed below.
472The changeable column shows whether a process with appropriate
473privilege may change the value.
474.Bl -column "MBUFXNMBCLUSTERSXXX" "struct integerXXX" -offset indent
475.It Sy Third level name	Type	Changeable
476.It MBUF\_MSIZE	integer	yes
477.It MBUF\_MCLBYTES	integer	yes
478.It MBUF\_NMBCLUSTERS	integer	yes
479.It MBUF\_MBLOWAT	integer	yes
480.It MBUF\_MCLLOWAT	integer	yes
481.El
482.Pp
483The variables are as follows:
484.Bl -tag -width "123456"
485.It Li MBUF_MSIZE
486The mbuf base size.
487.It Li MBUF_MCLBYTES
488The mbuf cluster size.
489.It Li MBUF_NMBCLUSTERS
490The limit on the number of mbuf clusters.
491The variable can only be increased, and only increased on machines with
492direct-mapped pool pages
493.It Li MBUF_MBLOWAT
494The mbuf low water mark.
495.It Li MBUF_MCLLOWAT
496The mbuf cluster low water mark.
497.El
498.It Li KERN_MEMLOCK
499Returns 1 if the POSIX 1003.1b Process Memory Locking Option is available
500on this system,
501otherwise 0.
502.It Li KERN_MEMLOCK_RANGE
503Returns 1 if the POSIX 1003.1b Range Memory Locking Option is available
504on this system,
505otherwise 0.
506.It Li KERN_MEMORY_PROTECTION
507Returns 1 if the POSIX 1003.1b Memory Protection Option is available
508on this system,
509otherwise 0.
510.It Li KERN_MONOTONIC_CLOCK
511Returns the standard version the implementation of the POSIX 1003.1b
512Monotonic Clock Option conforms to,
513otherwise 0.
514.It Li KERN_MSGBUF
515The kernel message buffer, rotated so that the head of the circular kernel
516message buffer is returned at the start of the buffer specified by
517.Fa oldp .
518The returned data may contain NUL bytes.
519.It Li KERN_MSGBUFSIZE
520The maximum number of characters that the kernel message buffer can hold.
521.It Li KERN_NGROUPS
522The maximum number of supplemental groups.
523.It Li KERN_NO_TRUNC
524Return 1 if file names longer than KERN_NAME_MAX are truncated.
525.It Li KERN_NTPTIME
526A
527.Va struct ntptimeval
528structure is returned.
529This structure contains data used by the
530.Xr ntpd 8
531program.
532.It Li KERN_OSRELEASE
533The system release string.
534.It Li KERN_OSREV
535The system revision string.
536.It Li KERN_OSTYPE
537The system type string.
538.It Li KERN_PATH_MAX
539The maximum number of bytes in a pathname.
540.It Li KERN_POSIX1
541The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
542attempts to comply.
543.It Li KERN_POSIX_BARRIERS
544The version of
545.St -p1003.1
546and its
547Barriers
548option to which the system attempts to conform,
549otherwise 0.
550.It Li KERN_POSIX_READER_WRITER_LOCKS
551The version of
552.St -p1003.1
553and its
554Read-Write Locks
555option to which the system attempts to conform,
556otherwise 0.
557.It Li KERN_POSIX_SEMAPHORES
558The version of
559.St -p1003.1
560and its
561Semaphores
562option to which the system attempts to conform,
563otherwise 0.
564.It Li KERN_POSIX_SPIN_LOCKS
565The version of
566.St -p1003.1
567and its
568Spin Locks
569option to which the system attempts to conform,
570otherwise 0.
571.It Li KERN_POSIX_THREADS
572The version of
573.St -p1003.1
574and its
575Threads
576option to which the system attempts to conform,
577otherwise 0.
578.It Li KERN_POSIX_TIMERS
579The version of
580.St -p1003.1
581and its
582Timers
583option to which the system attempts to conform,
584otherwise 0.
585.It Li KERN_PROC
586Return the entire process table, or a subset of it.
587An array of
588.Va struct kinfo_proc
589structures is returned,
590whose size depends on the current number of such objects in the system.
591The third and fourth level names are as follows:
592.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
593.It Sy Third level name	Fourth level is:
594.It KERN\_PROC\_ALL	None
595.It KERN\_PROC\_PID	A process ID
596.It KERN\_PROC\_PGRP	A process group
597.It KERN\_PROC\_SESSION	A session ID
598.It KERN\_PROC\_TTY	A tty device
599.It KERN\_PROC\_UID	A user ID
600.It KERN\_PROC\_RUID	A real user ID
601.It KERN\_PROC\_GID	A group ID
602.It KERN\_PROC\_RGID	A real group ID
603.El
604.It Li KERN_PROC2
605As for KERN_PROC, but an array of
606.Va struct kinfo_proc2
607structures are returned.
608The fifth level name is the size of the
609.Va struct kinfo_proc2
610and the sixth level name is the number of structures to return.
611.It Li KERN_PROC_ARGS
612Return the argv or environment strings (or the number thereof)
613of a process.
614Multiple strings are returned separated by NUL characters.
615The third level name is the process ID.
616The fourth level name is as follows:
617.Bl -column "Third level nameXXXXXX" -offset indent
618.It KERN\_PROC\_ARGV	The argv strings
619.It KERN\_PROC\_NARGV	The number of argv strings
620.It KERN\_PROC\_ENV	The environ strings
621.It KERN\_PROC\_NENV	The number of environ strings
622.El
623.It Li KERN_PROF
624Return profiling information about the kernel.
625If the kernel is not compiled for profiling,
626attempts to retrieve any of the KERN_PROF values will
627fail with EOPNOTSUPP.
628The third level names for the string and integer profiling information
629is detailed below.
630The changeable column shows whether a process with appropriate
631privilege may change the value.
632.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent
633.It Sy Third level name	Type	Changeable
634.It GPROF\_STATE	integer	yes
635.It GPROF\_COUNT	u_short[\|]	yes
636.It GPROF\_FROMS	u_short[\|]	yes
637.It GPROF\_TOS	struct tostruct	yes
638.It GPROF\_GMONPARAM	struct gmonparam	no
639.El
640.Pp
641The variables are as follows:
642.Bl -tag -width "123456"
643.It Li GPROF_STATE
644Returns GMON_PROF_ON or GMON_PROF_OFF to show that profiling
645is running or stopped.
646.It Li GPROF_COUNT
647Array of statistical program counter counts.
648.It Li GPROF_FROMS
649Array indexed by program counter of call-from points.
650.It Li GPROF_TOS
651Array of
652.Va struct tostruct
653describing destination of calls and their counts.
654.It Li GPROF_GMONPARAM
655Structure giving the sizes of the above arrays.
656.El
657.It Li KERN_RAWPARTITION
658The raw partition of a disk (a == 0).
659.It Li KERN_ROOT_DEVICE
660The name of the root device.
661.It Li KERN_RTC_OFFSET
662Return the offset of real time clock from UTC in minutes.
663.It Li KERN_SAVED_IDS
664Returns 1 if saved set-group and saved set-user ID is available.
665.It Li KERN_SECURELVL
666The system security level.
667This level may be raised by processes with appropriate privilege.
668It may only be lowered by process 1.
669.It Li KERN_SYNCHRONIZED_IO
670Returns 1 if the POSIX 1003.1b Synchronized I/O Option is available
671on this system,
672otherwise 0.
673.It Li KERN_SYSVIPC_INFO
674Return System V style IPC configuration and run-time information.
675The third level name selects the System V style IPC facility.
676.Bl -column "KERN_SYSVIPC_MSG_INFOXXX" "struct shm_sysctl_infoXXX" -offset indent
677.It Sy Third level name	Type
678.It KERN\_SYSVIPC\_MSG\_INFO	struct msg_sysctl_info
679.It KERN\_SYSVIPC\_SEM\_INFO	struct sem_sysctl_info
680.It KERN\_SYSVIPC\_SHM\_INFO	struct shm_sysctl_info
681.El
682.Pp
683.Bl -tag -width "123456"
684.It Li KERN_SYSVIPC_MSG_INFO
685Return information on the System V style message facility.
686The
687.Sy msg_sysctl_info
688structure is defined in
689.Aq Pa sys/msg.h .
690.It Li KERN_SYSVIPC_SEM_INFO
691Return information on the System V style semaphore facility.
692The
693.Sy sem_sysctl_info
694structure is defined in
695.Aq Pa sys/sem.h .
696.It Li KERN_SYSVIPC_SHM_INFO
697Return information on the System V style shared memory facility.
698The
699.Sy shm_sysctl_info
700structure is defined in
701.Aq Pa sys/shm.h .
702.El
703.It Li KERN_SYSVMSG
704Returns 1 if System V style message queue functionality is available
705on this system,
706otherwise 0.
707.It Li KERN_SYSVSEM
708Returns 1 if System V style semaphore functionality is available
709on this system,
710otherwise 0.
711.It Li KERN_SYSVSHM
712Returns 1 if System V style share memory functionality is available
713on this system,
714otherwise 0.
715.It Li KERN_TKSTAT
716Return information about the number of characters sent and received
717on ttys.
718The third level names for the tty statistic variables are detailed below.
719The changeable column shows whether a process
720with appropriate privilege may change the value.
721.Bl -column "KERNXTKSTATXRAWCCXXX" "struct integerXXX" -offset indent
722.It Sy Third level name	Type	Changeable
723.It KERN\_TKSTAT\_NIN	quad	no
724.It KERN\_TKSTAT\_NOUT	quad	no
725.It KERN\_TKSTAT\_CANCC	quad	no
726.It KERN\_TKSTAT\_RAWCC	quad	no
727.El
728.Pp
729The variables are as follows:
730.Bl -tag -width "123456"
731.It Li KERN_TKSTAT_NIN
732The total number of input characters.
733.It Li KERN_TKSTAT_NOUT
734The total number of output characters.
735.It Li KERN_TKSTAT_CANCC
736The number of canonical input characters.
737.It Li KERN_TKSTAT_RAWCC
738The number of raw input characters.
739.El
740.It Li KERN_VERSION
741The system version string.
742.It Li KERN_VNODE
743Return the entire vnode table.
744Note, the vnode table is not necessarily a consistent snapshot of
745the system.
746The returned data consists of an array whose size depends on the
747current number of such objects in the system.
748Each element of the array contains the kernel address of a vnode
749.Va struct vnode *
750followed by the vnode itself
751.Va struct vnode .
752.El
753.Sh CTL_MACHDEP
754The set of variables defined is architecture dependent.
755Most architectures define at least the following variables.
756.Bl -column "CONSOLE_DEVICEXXX" "integerXXX" -offset indent
757.It Sy Second level name	Type	Changeable
758.It Li CPU_CONSDEV	dev_t	no
759.El
760.Sh CTL_NET
761The string and integer information available for the CTL_NET level
762is detailed below.
763The changeable column shows whether a process with appropriate
764privilege may change the value.
765.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
766.It Sy Second level name	Type	Changeable
767.It PF\_ROUTE	routing messages	no
768.It PF\_INET	IPv4 values	yes
769.It PF\_INET6	IPv6 values	yes
770.It PF\_KEY	IPsec key management values	yes
771.El
772.Pp
773.Bl -tag -width "123456"
774.It Li PF_ROUTE
775Return the entire routing table or a subset of it.
776The data is returned as a sequence of routing messages (see
777.Xr route 4
778for the header file, format and meaning).
779The length of each message is contained in the message header.
780.Pp
781The third level name is a protocol number, which is currently always 0.
782The fourth level name is an address family, which may be set to 0 to
783select all address families.
784The fifth and sixth level names are as follows:
785.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent
786.It Sy Fifth level name	Sixth level is:
787.It NET\_RT\_FLAGS	rtflags
788.It NET\_RT\_DUMP	None
789.It NET\_RT\_IFLIST	None
790.El
791.It Li PF_INET
792Get or set various global information about the IPv4
793.Pq Internet Protocol version 4 .
794The third level name is the protocol.
795The fourth level name is the variable name.
796The currently defined protocols and names are:
797.Bl -column "Protocol name" "Variable nameXX" "integer" "yes" -offset indent
798.It Sy Protocol name	Variable name	Type	Changeable
799.It ip	forwarding	integer	yes
800.It ip	redirect	integer	yes
801.It ip	ttl	integer	yes
802.It ip	forwsrcrt	integer	yes
803.It ip	directed-broadcast	integer	yes
804.It ip	allowsrcrt	integer	yes
805.It ip	subnetsarelocal	integer	yes
806.It ip	mtudisc	integer	yes
807.It ip	anonportmin	integer	yes
808.It ip	anonportmax	integer	yes
809.It ip	mtudisctimeout	integer	yes
810.It ip	gifttl	integer	yes
811.It ip	grettl	integer	yes
812.It ip	lowportmin	integer	yes
813.It ip	lowportmax	integer	yes
814.It ip	maxfragpacket	integer	yes
815.It ip	checkinterface	integer	yes
816.It icmp	maskrepl	integer	yes
817.It icmp	errppslimit	integer	yes
818.It icmp	rediraccept	integer	yes
819.It icmp	redirtimeout	integer	yes
820.It tcp	rfc1323	integer	yes
821.It tcp	sendspace	integer	yes
822.It tcp	recvspace	integer	yes
823.It tcp	mssdflt	integer	yes
824.It tcp	syn_cache_limit	integer	yes
825.It tcp	syn_bucket_limit	integer	yes
826.It tcp	syn_cache_interval	integer	yes
827.It tcp	init_win	integer	yes
828.It tcp	init_win_local	integer	yes
829.It tcp	mss_ifmtu	integer	yes
830.It tcp	sack	integer	yes
831.It tcp	win_scale	integer	yes
832.It tcp	timestamps	integer	yes
833.It tcp	compat_42	integer	yes
834.It tcp	cwm	integer	yes
835.It tcp	cwm_burstsize	integer	yes
836.It tcp	ack_on_push	integer	yes
837.It tcp	keepidle	integer	yes
838.It tcp	keepintvl	integer	yes
839.It tcp	keepcnt	integer	yes
840.It tcp	slowhz	integer	no
841.It tcp	newreno	integer	yes
842.It tcp	log_refused	integer	yes
843.It tcp	rstppslimit	integer	yes
844.It tcp	ident	struct	no
845.It udp	checksum	integer	yes
846.It udp	sendspace	integer	yes
847.It udp	recvspace	integer	yes
848.El
849.Pp
850The variables are as follows:
851.Bl -tag -width "123456"
852.It Li ip.forwarding
853Returns 1 when IP forwarding is enabled for the host,
854meaning that the host is acting as a router.
855.It Li ip.redirect
856Returns 1 when ICMP redirects may be sent by the host.
857This option is ignored unless the host is routing IP packets,
858and should normally be enabled on all systems.
859.It Li ip.ttl
860The maximum time-to-live (hop count) value for an IP packet sourced by
861the system.
862This value applies to normal transport protocols, not to ICMP.
863.It Li ip.forwsrcrt
864Returns 1 when forwarding of source-routed packets is enabled for
865the host.
866This value may only be changed if the kernel security level is less than 1.
867.It Li ip.directed-broadcast
868Returns 1 if directed broadcast behavior is enabled for the host.
869.It Li ip.allowsrcrt
870Returns 1 if the host accepts source routed packets.
871.It Li ip.subnetsarelocal
872Returns 1 if subnets are to be considered local addresses.
873.It Li ip.mtudisc
874Returns 1 if Path MTU Discovery is enabled.
875.It Li ip.anonportmin
876The lowest port number to use for TCP and UDP ephemeral port allocation.
877This cannot be set to less than 1024 or greater than 65535.
878.It Li ip.anonportmax
879The highest port number to use for TCP and UDP ephemeral port allocation.
880This cannot be set to less than 1024 or greater than 65535, and must
881be greater than
882.Li ip.anonportmin .
883.It Li ip.mtudisctimeout
884Returns the number of seconds in which a route added by the Path MTU
885Discovery engine will time out.
886When the route times out, the Path
887MTU Discovery engine will attempt to probe a larger path MTU.
888.It Li ip.gifttl
889The maximum time-to-live (hop count) value for an IPv4 packet generated by
890.Xr gif 4
891tunnel interface.
892.It Li ip.grettl
893The maximum time-to-live (hop count) value for an IPv4 packet generated by
894.Xr gre 4
895tunnel interface.
896.It Li ip.lowportmin
897The lowest port number to use for TCP and UDP reserved port allocation.
898This cannot be set to less than 0 or greater than 1024, and must
899be smaller than
900.Li ip.lowportmax .
901.It Li ip.lowportmax
902The highest port number to use for TCP and UDP reserved port allocation.
903This cannot be set to less than 0 or greater than 1024, and must
904be greater than
905.Li ip.lowportmin .
906.It Li ip.maxfragpackets
907The maximum number of fragmented packets the node will accept.
9080 means that the node will not accept any fragmented packets.
909\-1 means that the node will accept as many fragmented packets as it receives.
910The flag is provided basically for avoiding possible DoS attacks.
911.It Li ip.checkinterface
912If set to non-zero, the host will reject packets addressed to it that arrive
913on an interface not bound to that address. Currently, this must be disabled
914if ipnat is used to translate the destination address to another local
915interface, or if addresses are added to the loopback interface instead of
916the interface where the packets for those packets are received.
917.It Li icmp.maskrepl
918Returns 1 if ICMP network mask requests are to be answered.
919.It Li icmp.errppslimit
920The variable specifies the maximum number of outgoing ICMP error messages,
921per second.
922ICMP error messages that exceeded the value are subject to rate limitation
923and will not go out from the node.
924Negative value disables rate limitation.
925.It Li icmp.rediraccept
926If set to non-zero, the host will accept ICMP redirect packets.
927Note that routers will never accept ICMP redirect packets,
928and the variable is meaningful on IP hosts only.
929.It Li icmp.redirtimeout
930The variable specifies lifetime of routing entries generated by incoming
931ICMP redirect.
932This defaults to 600 seconds.
933.It Li tcp.rfc1323
934Returns 1 if RFC1323 extensions to TCP are enabled.
935.It Li tcp.sendspace
936Returns the default TCP send buffer size.
937.It Li tcp.recvspace
938Returns the default TCP receive buffer size.
939.It Li tcp.mssdflt
940Returns the default maximum segment size both advertized to the peer
941and to use when the peer does not advertize a maximum segment size to
942us during connection setup.
943Do not change this value unless you really know what you are doing.
944.It Li tcp.syn_cache_limit
945Returns the maximum number of entries allowed in the TCP compressed state
946engine.
947.It Li tcp.syn_bucket_limit
948Returns the maximum number of entries allowed per hash bucket in the TCP
949compressed state engine.
950.It Li tcp.syn_cache_interval
951Returns the TCP compressed state engine's timer interval.
952.It Li tcp.init_win
953Returns a value indicating the TCP initial congestion window.
954If this value is 0, an auto-tuning algorithm designed to use an initial
955window of approximately 4K bytes is in use.
956Otherwise, this value indicates a fixed number of packets.
957.It Li tcp.init_win_local
958Like
959.Li tcp.init_win ,
960but used when communicating with hosts on a local network.
961.It Li tcp.mss_ifmtu
962Returns 1 if TCP calculates the outgoing maximum segment size based on
963the MTU of the appropriate interface.
964Otherwise, it is calculated based on the greater of the MTU of the
965interface, and the largest (non-loopback) interface MTU on the system.
966.It Li tcp.sack
967TCP Selective ACKnowledgement (RFC 2018) is not implemented in
968.Nx
969at this time.
970Changing this value will have no effect.
971.It Li tcp.win_scale
972If rfc1323 is enabled, a value of 1 indicates RFC1323 window scale options,
973for increasing the TCP window size, are enabled.
974.It Li tcp.timestamps
975If rfc1323 is enabled, a value of 1 indicates RFC1323 time stamp options,
976used for measuring TCP round trip times, are enabled.
977.It Li tcp.compat_42
978Returns 1 if work-arounds for bugs in the 4.2BSD TCP implementation are
979enabled.
980Use of this option is not recommended, although it may be
981required in order to communicate with extremely old TCP implementations.
982.It Li tcp.cwm
983Returns 1 if use of the Hughes/Touch/Heidemann Congestion Window Monitoring
984algorithm is enabled.
985This algorithm prevents line-rate bursts of packets that could
986otherwise occur when data begins flowing on an idle TCP connection.
987These line-rate bursts can contribute to network and router congestion.
988This can be particularly useful on World Wide Web servers
989which support HTTP/1.1, which has lingering connections.
990.It Li tcp.cwm_burstsize
991Returns the Congestion Window Monitoring allowed burst size, in terms
992of packet count.
993.It Li tcp.ack_on_push
994Returns 1 if TCP is to immediately transmit an ACK upon reception of
995a packet with PUSH set.
996This can avoid losing a round trip time in some rare situations,
997but has the caveat of potentially defeating TCP's delayed ACK algorithm.
998Use of this option is generally not recommended, but
999the variable exists in case your configuration really needs it.
1000.It Li tcp.keepidle
1001Time a connection must be idle before keepalives are sent (if keepalives
1002are enabled for the connection).
1003See also tcp.slowhz.
1004.It Li tcp.keepintvl
1005Time after a keepalive probe is sent until, in the absence of any response,
1006another probe is sent.
1007See also tcp.slowhz.
1008.It Li tcp.keepcnt
1009Number of keepalive probes sent before declaring a connection dead.
1010If set to zero, there is no limit;
1011keepalives will be sent until some kind of
1012response is received from the peer.
1013.It Li tcp.slowhz
1014The units for tcp.keepidle and tcp.keepintvl; those variables are in ticks
1015of a clock that ticks tcp.slowhz times per second.
1016(That is, their values
1017must be divided by the tcp.slowhz value to get times in seconds.)
1018.It Li tcp.newreno
1019Returns 1 if the use of J.
1020Hoe's NewReno congestion control algorithm is enabled.
1021This algorithm improves the start-up behavior of TCP connections.
1022.It Li tcp.log_refused
1023Returns 1 if refused TCP connections to the host will be logged.
1024.It Li tcp.rstppslimit
1025The variable specifies the maximum number of outgoing TCP RST packets,
1026per second.
1027TCP RST packet that exceeded the value are subject to rate limitation
1028and will not go out from the node.
1029Negative value disables rate limitation.
1030.It Li udp.checksum
1031Returns 1 when UDP checksums are being computed and checked.
1032Disabling UDP checksums is strongly discouraged.
1033.It Li udp.sendspace
1034Returns the default UDP send buffer size.
1035.It Li udp.recvspace
1036Returns the default UDP receive buffer size.
1037.El
1038.Pp
1039For variables net.*.ipsec, please refer to
1040.Xr ipsec 4 .
1041.It Li PF_INET6
1042Get or set various global information about the IPv6
1043.Pq Internet Protocol version 6 .
1044The third level name is the protocol.
1045The fourth level name is the variable name.
1046The currently defined protocols and names are:
1047.Bl -column "Protocol name" "Variable nameXX" "integer" "yes" -offset indent
1048.It Sy Protocol name	Variable name	Type	Changeable
1049.It ip6	forwarding	integer	yes
1050.It ip6	redirect	integer	yes
1051.It ip6	hlim	integer	yes
1052.It ip6	maxfragpackets	integer	yes
1053.It ip6	accept_rtadv	integer	yes
1054.It ip6	keepfaith	integer	yes
1055.It ip6	log_interval	integer	yes
1056.It ip6	hdrnestlimit	integer	yes
1057.It ip6	dad_count	integer	yes
1058.It ip6	auto_flowlabel	integer	yes
1059.It ip6	defmcasthlim	integer	yes
1060.It ip6	gif_hlim	integer	yes
1061.It ip6	kame_version	string	no
1062.It ip6	use_deprecated	integer	yes
1063.It ip6	rr_prune	integer	yes
1064.It ip6	v6only	integer	yes
1065.It ip6	anonportmin	integer	yes
1066.It ip6	anonportmax	integer	yes
1067.It ip6	lowportmin	integer	yes
1068.It ip6	lowportmax	integer	yes
1069.It ip6	maxfrags	integer	yes
1070.It icmp6	rediraccept	integer	yes
1071.It icmp6	redirtimeout	integer	yes
1072.It icmp6	nd6_prune	integer	yes
1073.It icmp6	nd6_delay	integer	yes
1074.It icmp6	nd6_umaxtries	integer	yes
1075.It icmp6	nd6_mmaxtries	integer	yes
1076.It icmp6	nd6_useloopback	integer	yes
1077.It icmp6	nodeinfo	integer	yes
1078.It icmp6	errppslimit	integer	yes
1079.It icmp6	nd6_maxnudhint	integer	yes
1080.It icmp6	mtudisc_hiwat	integer	yes
1081.It icmp6	mtudisc_lowat	integer	yes
1082.It icmp6	nd6_debug	integer	yes
1083.It udp6	sendspace	integer	yes
1084.It udp6	recvspace	integer	yes
1085.El
1086.Pp
1087The variables are as follows:
1088.Bl -tag -width "123456"
1089.It Li ip6.forwarding
1090Returns 1 when IPv6 forwarding is enabled for the node,
1091meaning that the node is acting as a router.
1092Returns 0 when IPv6 forwarding is disabled for the node,
1093meaning that the node is acting as a host.
1094IPv6 specification defines node behavior for
1095.Dq router
1096case and
1097.Dq host
1098case quite differently, and changing this variable during operation
1099may cause serious trouble.
1100It is recommended to configure the variable at bootstrap time,
1101and bootstrap time only.
1102.It Li ip6.redirect
1103Returns 1 when ICMPv6 redirects may be sent by the node.
1104This option is ignored unless the node is routing IP packets,
1105and should normally be enabled on all systems.
1106.It Li ip6.hlim
1107The default hop limit value for an IPv6 unicast packet sourced by the node.
1108This value applies to all the transport protocols on top of IPv6.
1109There are APIs to override the value, as documented in
1110.Xr ip6 4 .
1111.It Li ip6.maxfragpackets
1112The maximum number of fragmented packets the node will accept.
11130 means that the node will not accept any fragmented packets.
1114\-1 means that the node will accept as many fragmented packets as it receives.
1115The flag is provided basically for avoiding possible DoS attacks.
1116.It Li ip6.accept_rtadv
1117If set to non-zero, the node will accept ICMPv6 router advertisement packets
1118and autoconfigures address prefixes and default routers.
1119The node must be a host
1120.Pq not a router
1121for the option to be meaningful.
1122.It Li ip6.keepfaith
1123If set to non-zero, it enables
1124.Dq FAITH
1125TCP relay IPv6-to-IPv4 translator code in the kernel.
1126Refer
1127.Xr faith 4
1128and
1129.Xr faithd 8
1130for detail.
1131.It Li ip6.log_interval
1132The variable controls amount of logs generated by IPv6 packet
1133forwarding engine, by setting interval between log output
1134.Pq in seconds .
1135.It Li ip6.hdrnestlimit
1136The number of IPv6 extension headers permitted on incoming IPv6 packets.
1137If set to 0, the node will accept as many extension headers as possible.
1138.It Li ip6.dad_count
1139The variable configures number of IPv6 DAD
1140.Pq duplicated address detection
1141probe packets.
1142The packets will be generated when IPv6 interface addresses are configured.
1143.It Li ip6.auto_flowlabel
1144On connected transport protocol packets,
1145fill IPv6 flowlabel field to help intermediate routers to identify packet flows.
1146.It Li ip6.defmcasthlim
1147The default hop limit value for an IPv6 multicast packet sourced by the node.
1148This value applies to all the transport protocols on top of IPv6.
1149There are APIs to override the value, as documented in
1150.Xr ip6 4 .
1151.It Li ip6.gif_hlim
1152The maximum hop limit value for an IPv6 packet generated by
1153.Xr gif 4
1154tunnel interface.
1155.It Li ip6.kame_version
1156The string identifies the version of KAME IPv6 stack implemented in the kernel.
1157.It Li ip6.use_deprecated
1158The variable controls use of deprecated address, specified in RFC2462 5.5.4.
1159.It Li ip6.rr_prune
1160The variable specifies interval between IPv6 router renumbering prefix
1161babysitting, in seconds.
1162.It Li ip6.v6only
1163The variable specifies initial value for
1164.Dv IPV6_V6ONLY
1165socket option for
1166.Dv AF_INET6
1167socket.
1168Please refer to
1169.Xr ip6 4
1170for detail.
1171.It Li ip6.anonportmin
1172The lowest port number to use for TCP and UDP ephemeral port allocation.
1173This cannot be set to less than 1024 or greater than 65535.
1174.It Li ip6.anonportmax
1175The highest port number to use for TCP and UDP ephemeral port allocation.
1176This cannot be set to less than 1024 or greater than 65535, and must
1177be greater than
1178.Li ip6.anonportmin .
1179.It Li ip6.lowportmin
1180The lowest port number to use for TCP and UDP reserved port allocation.
1181This cannot be set to less than 0 or greater than 1024, and must
1182be smaller than
1183.Li ip6.lowportmax .
1184.It Li ip6.lowportmax
1185The highest port number to use for TCP and UDP reserved port allocation.
1186This cannot be set to less than 0 or greater than 1024, and must
1187be greater than
1188.Li ip6.lowportmin .
1189.It Li ip6.maxfrags
1190The maximum number of fragments the node will accept.
11910 means that the node will not accept any fragments.
1192\-1 means that the node will accept as many fragments as it receives.
1193The flag is provided basically for avoiding possible DoS attacks.
1194.It Li icmp6.rediraccept
1195If set to non-zero, the host will accept ICMPv6 redirect packets.
1196Note that IPv6 routers will never accept ICMPv6 redirect packets,
1197and the variable is meaningful on IPv6 hosts
1198.Pq non-router
1199only.
1200.It Li icmp6.redirtimeout
1201The variable specifies lifetime of routing entries generated by incoming
1202ICMPv6 redirect.
1203.It Li icmp6.nd6_prune
1204The variable specifies interval between IPv6 neighbor cache babysitting,
1205in seconds.
1206.It Li icmp6.nd6_delay
1207The variable specifies
1208.Dv DELAY_FIRST_PROBE_TIME
1209timing constant in IPv6 neighbor discovery specification
1210.Pq RFC2461 ,
1211in seconds.
1212.It Li icmp6.nd6_umaxtries
1213The variable specifies
1214.Dv MAX_UNICAST_SOLICIT
1215constant in IPv6 neighbor discovery specification
1216.Pq RFC2461 .
1217.It Li icmp6.nd6_mmaxtries
1218The variable specifies
1219.Dv MAX_MULTICAST_SOLICIT
1220constant in IPv6 neighbor discovery specification
1221.Pq RFC2461 .
1222.It Li icmp6.nd6_useloopback
1223If set to non-zero, kernel IPv6 stack will use loopback interface for
1224local traffic.
1225.It Li icmp6.nodeinfo
1226The variable enables responses to ICMPv6 node information queries.
1227If you set the variable to 0, responses will not be generated for
1228ICMPv6 node information queries.
1229Since node information queries can have a security impact, it is
1230possible to fine tune which responses should be answered.
1231Two separate bits can be set.
1232.Bl -tag -width "12345"
1233.It 1
1234Respond to ICMPv6 FQDN queries, e.g.
1235.Li ping6 -w .
1236.It 2
1237Respond to ICMPv6 node addresses queries, e.g.
1238.Li ping6 -a .
1239.El
1240.It Li icmp6.errppslimit
1241The variable specifies the maximum number of outgoing ICMPv6 error messages,
1242per second.
1243ICMPv6 error messages that exceeded the value are subject to rate limitation
1244and will not go out from the node.
1245Negative value disables rate limitation.
1246.It Li icmp6.nd6_maxnudhint
1247IPv6 neighbor discovery permits upper layer protocols to supply reachability
1248hints, to avoid unnecessary neighbor discovery exchanges.
1249The variable defines the number of consecutive hints the neighbor discovery
1250layer will take.
1251For example, by setting the variable to 3, neighbor discovery layer
1252will take 3 consecutive hints in maximum.
1253After receiving 3 hints, neighbor discovery layer will perform
1254normal neighbor discovery process.
1255.It Li icmp6.mtudisc_hiwat
1256.It Li icmp6.mtudisc_lowat
1257The variables define the maximum number of routing table entries,
1258created due to path MTU discovery
1259.Pq prevents denial-of-service attacks with ICMPv6 too big messages .
1260When IPv6 path MTU discovery happens, we keep path MTU information into
1261the routing table.
1262If the number of routing table entries exceed the value,
1263the kernel will not attempt to keep the path MTU information.
1264.Li icmp6.mtudisc_hiwat
1265is used when we have verified ICMPv6 too big messages.
1266.Li icmp6.mtudisc_lowat
1267is used when we have unverified ICMPv6 too big messages.
1268Verification is performed by using address/port pairs kept in connected pcbs.
1269Negative value disables the upper limit.
1270.It Li icmp6.nd6_debug
1271If set to non-zero, kernel IPv6 neighbor discovery code will generate
1272debugging messages.
1273The debug outputs are useful to diagnose IPv6 interoperability issues.
1274The flag must be set to 0 for normal operation.
1275.El
1276.Pp
1277We reuse net.*.tcp for
1278.Tn TCP
1279over
1280.Tn IPv6 ,
1281and therefore we do not have variables net.*.tcp6.
1282Variables net.inet6.udp6 have identical meaning to net.inet.udp.
1283Please refer to
1284.Li PF_INET
1285section above.
1286For variables net.*.ipsec6, please refer to
1287.Xr ipsec 4 .
1288.It Li PF_KEY
1289Get or set various global information about the IPsec key management.
1290The third level name is the variable name.
1291The currently defined variable and names are:
1292.Bl -column "blockacq_lifetime" "integer" "yes" -offset indent
1293.It Sy Variable name	Type	Changeable
1294.It debug	integer	yes
1295.It spi_try	integer	yes
1296.It spi_min_value	integer	yes
1297.It spi_max_value	integer	yes
1298.It random_int	integer	yes
1299.It larval_lifetime	integer	yes
1300.It blockacq_count	integer	yes
1301.It blockacq_lifetime	integer	yes
1302.It esp_keymin	integer	yes
1303.It esp_auth	integer	yes
1304.It ah_keymin	integer	yes
1305.El
1306The variables are as follows:
1307.Bl -tag -width "123456"
1308.It Li debug
1309Turn on debugging message from within the kernel.
1310The value is a bitmap, as defined in
1311.Pa /usr/include/netkey/key_debug.h .
1312.It Li spi_try
1313The number of times the kernel will try to obtain an unique SPI
1314when it generates it from random number generator.
1315.It Li spi_min_value
1316Minimum SPI value when generating it within the kernel.
1317.It Li spi_max_value
1318Maximum SPI value when generating it within the kernel.
1319.It Li random_int
1320Interval to stir pseudo-random number generator, in seconds.
1321Pseudo-random number generator is used only as a last resort when
1322random number source
1323.Pq Pa /dev/urandom
1324is not available.
1325It should not really be used, and if it were used,
1326kernel will warn about it.
1327.It Li larval_lifetime
1328Lifetime for LARVAL SAD entries, in seconds.
1329.It Li blockacq_count
1330Number of ACQUIRE PF_KEY messages to be blocked after an ACQUIRE message.
1331It avoids flood of ACQUIRE PF_KEY from being sent from the kernel to the
1332key management daemon.
1333.It Li blockacq_lifetime
1334Lifetime of ACQUIRE PF_KEY message.
1335.It Li esp_keymin
1336Minimum ESP key length, in bits.
1337The value is used when the kernel creates proposal payload
1338on ACQUIRE PF_KEY message.
1339.It Li esp_auth
1340Whether ESP authentication should be used or not.
1341Non-zero value indicates that ESP authentication should be used.
1342The value is used when the kernel creates proposal payload
1343on ACQUIRE PF_KEY message.
1344.It Li ah_keymin
1345Minimum AH key length, in bits,
1346The value is used when the kernel creates proposal payload
1347on ACQUIRE PF_KEY message.
1348.El
1349.El
1350.Sh CTL_PROC
1351The string and integer information available for the CTL_PROC
1352is detailed below.
1353The changeable column shows whether a process with appropriate
1354privilege may change the value.
1355These values are per-process,
1356and as such may change from one process to another.
1357When a process is created,
1358the default values are inherited from its parent.
1359When a set-user-ID or set-group-ID binary is executed, the
1360value of PROC_PID_CORENAME is reset to the system default value.
1361The second level name is either the magic value PROC_CURPROC, which
1362points to the current process, or the PID of the target process.
1363.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" "yes" -offset indent
1364.It Sy Third level name	Type	Changeable
1365.It PROC\_PID\_CORENAME	string	yes
1366.It PROC\_STOPEXEC	int	yes
1367.It PROC\_STOPFORK	int	yes
1368.It PROC\_PID\_LIMIT	node	not applicable
1369.El
1370.Bl -tag -width "123456"
1371.Pp
1372.It Li PROC_PID_CORENAME
1373The template used for the core dump file name (see
1374.Xr core 5
1375for details).
1376The base name must either be
1377.Nm core
1378or end with the suffix ``.core'' (the super-user may set arbitrary names).
1379By default it points to KERN_DEFCORENAME.
1380.It Li PROC_PID_LIMIT
1381Return resources limits, as defined for the
1382.Xr getrlimit 2
1383and
1384.Xr setrlimit 2
1385system calls.
1386The fourth level name is one of:
1387.Bl -tag -width PROC_PID_LIMIT_MEMLOCKAA
1388.It Li PROC_PID_LIMIT_CPU
1389The maximum amount of cpu time (in seconds) to be used by each process.
1390.It Li PROC_PID_LIMIT_FSIZE
1391The largest size (in bytes) file that may be created.
1392.It Li PROC_PID_LIMIT_DATA
1393The maximum size (in bytes) of the data segment for a process;
1394this defines how far a program may extend its break with the
1395.Xr sbrk 2
1396system call.
1397.It Li PROC_PID_LIMIT_STACK
1398The maximum size (in bytes) of the stack segment for a process;
1399this defines how far a program's stack segment may be extended.
1400Stack extension is performed automatically by the system.
1401.It Li PROC_PID_LIMIT_CORE
1402The largest size (in bytes)
1403.Pa core
1404file that may be created.
1405.It Li PROC_PID_LIMIT_RSS
1406The maximum size (in bytes) to which a process's resident set size may
1407grow.
1408This imposes a limit on the amount of physical memory to be given to
1409a process; if memory is tight, the system will prefer to take memory
1410from processes that are exceeding their declared resident set size.
1411.It Li PROC_PID_LIMIT_MEMLOCK
1412The maximum size (in bytes) which a process may lock into memory
1413using the
1414.Xr mlock 2
1415function.
1416.It Li PROC_PID_LIMIT_NPROC
1417The maximum number of simultaneous processes for this user id.
1418.It Li PROC_PID_LIMIT_NOFILE
1419The maximum number of open files for this process.
1420.El
1421.Pp
1422The fifth level name is one of PROC_PID_LIMIT_TYPE_SOFT or
1423PROC_PID_LIMIT_TYPE_HARD, to select respectively the soft or hard limit.
1424Both are of type integer.
1425.It Li PROC_STOPEXEC
1426If non zero, the process will be stopped on next
1427.Xr exec 3
1428call.
1429The process created by
1430.Xr exec 3
1431is created in the SSTOP state and is never scheduled for running
1432before being stopped.
1433This feature helps attaching a process with a debugger such as
1434.Xr gdb 1
1435before it had the opportunity to actually do anything.
1436.Pp
1437This value is inherited by the process's children.
1438.It Li PROC_STOPFORK
1439If non zero, the process' children will be stopped after
1440.Xr fork 2
1441calls.
1442The children is created in the SSTOP state and is never scheduled
1443for running before being stopped.
1444This feature helps attaching a process with a debugger such as
1445.Xr gdb 1
1446before it had the opportunity to actually do anything.
1447.Pp
1448This value is inherited by the process's children, and it also
1449apply to emulation specific system calls that fork a new process, such as
1450.Fn sproc
1451or
1452.Fn clone .
1453.El
1454.Sh CTL_USER
1455The string and integer information available for the CTL_USER level
1456is detailed below.
1457The changeable column shows whether a process with appropriate
1458privilege may change the value.
1459.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent
1460.It Sy Second level name	Type	Changeable
1461.It USER\_BC\_BASE\_MAX	integer	no
1462.It USER\_BC\_DIM\_MAX	integer	no
1463.It USER\_BC\_SCALE\_MAX	integer	no
1464.It USER\_BC\_STRING\_MAX	integer	no
1465.It USER\_COLL\_WEIGHTS\_MAX	integer	no
1466.It USER\_CS\_PATH	string	no
1467.It USER\_EXPR\_NEST\_MAX	integer	no
1468.It USER\_LINE\_MAX	integer	no
1469.It USER\_POSIX2\_CHAR\_TERM	integer	no
1470.It USER\_POSIX2\_C\_BIND	integer	no
1471.It USER\_POSIX2\_C\_DEV	integer	no
1472.It USER\_POSIX2\_FORT\_DEV	integer	no
1473.It USER\_POSIX2\_FORT\_RUN	integer	no
1474.It USER\_POSIX2\_LOCALEDEF	integer	no
1475.It USER\_POSIX2\_SW\_DEV	integer	no
1476.It USER\_POSIX2\_UPE	integer	no
1477.It USER\_POSIX2\_VERSION	integer	no
1478.It USER\_RE\_DUP\_MAX	integer	no
1479.It USER\_STREAM\_MAX	integer	no
1480.It USER\_TZNAME\_MAX	integer	no
1481.It USER\_ATEXIT\_MAX	integer	no
1482.El
1483.Bl -tag -width "123456"
1484.Pp
1485.It Li USER_BC_BASE_MAX
1486The maximum ibase/obase values in the
1487.Xr bc 1
1488utility.
1489.It Li USER_BC_DIM_MAX
1490The maximum array size in the
1491.Xr bc 1
1492utility.
1493.It Li USER_BC_SCALE_MAX
1494The maximum scale value in the
1495.Xr bc 1
1496utility.
1497.It Li USER_BC_STRING_MAX
1498The maximum string length in the
1499.Xr bc 1
1500utility.
1501.It Li USER_COLL_WEIGHTS_MAX
1502The maximum number of weights that can be assigned to any entry of
1503the LC_COLLATE order keyword in the locale definition file.
1504.It Li USER_CS_PATH
1505Return a value for the
1506.Ev PATH
1507environment variable that finds all the standard utilities.
1508.It Li USER_EXPR_NEST_MAX
1509The maximum number of expressions that can be nested within
1510parenthesis by the
1511.Xr expr 1
1512utility.
1513.It Li USER_LINE_MAX
1514The maximum length in bytes of a text-processing utility's input
1515line.
1516.It Li USER_POSIX2_CHAR_TERM
1517Return 1 if the system supports at least one terminal type capable of
1518all operations described in POSIX 1003.2, otherwise 0.
1519.It Li USER_POSIX2_C_BIND
1520Return 1 if the system's C-language development facilities support the
1521C-Language Bindings Option, otherwise 0.
1522.It Li USER_POSIX2_C_DEV
1523Return 1 if the system supports the C-Language Development Utilities Option,
1524otherwise 0.
1525.It Li USER_POSIX2_FORT_DEV
1526Return 1 if the system supports the FORTRAN Development Utilities Option,
1527otherwise 0.
1528.It Li USER_POSIX2_FORT_RUN
1529Return 1 if the system supports the FORTRAN Runtime Utilities Option,
1530otherwise 0.
1531.It Li USER_POSIX2_LOCALEDEF
1532Return 1 if the system supports the creation of locales, otherwise 0.
1533.It Li USER_POSIX2_SW_DEV
1534Return 1 if the system supports the Software Development Utilities Option,
1535otherwise 0.
1536.It Li USER_POSIX2_UPE
1537Return 1 if the system supports the User Portability Utilities Option,
1538otherwise 0.
1539.It Li USER_POSIX2_VERSION
1540The version of POSIX 1003.2 with which the system attempts to comply.
1541.It Li USER_RE_DUP_MAX
1542The maximum number of repeated occurrences of a regular expression
1543permitted when using interval notation.
1544.ne 1i
1545.It Li USER_STREAM_MAX
1546The minimum maximum number of streams that a process may have open
1547at any one time.
1548.It Li USER_TZNAME_MAX
1549The minimum maximum number of types supported for the name of a
1550timezone.
1551.It Li USER_ATEXIT_MAX
1552The maximum namber of functions that may be registered with
1553.Xr atexit 3 .
1554.El
1555.Sh CTL_VM
1556The string and integer information available for the CTL_VM level
1557is detailed below.
1558The changeable column shows whether a process with appropriate
1559privilege may change the value.
1560.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
1561.It Sy Second level name	Type	Changeable
1562.It VM\_ANONMAX	int	yes
1563.It VM\_ANONMIN	int	yes
1564.It VM\_EXECMAX	int	yes
1565.It VM\_EXECMIN	int	yes
1566.It VM\_FILEMAX	int	yes
1567.It VM\_FILEMIN	int	yes
1568.It VM\_LOADAVG	struct loadavg	no
1569.It VM\_MAXSLP	int	no
1570.It VM\_METER	struct vmtotal	no
1571.It VM\_NKMEMPAGES	int	no
1572.It VM\_USPACE	int	no
1573.It VM\_UVMEXP	struct uvmexp	no
1574.It VM\_UVMEXP2	struct uvmexp_sysctl	no
1575.El
1576.Pp
1577.Bl -tag -width "123456"
1578.It Li VM_ANONMAX
1579The percentage of physical memory which will be reclaimed
1580from other types of memory usage to store anonymous application data.
1581.It Li VM_ANONMIN
1582The percentage of physical memory which will be always be available for
1583anonymous application data.
1584.It Li VM_EXECMAX
1585The percentage of physical memory which will be reclaimed
1586from other types of memory usage to store cached executable data.
1587.It Li VM_EXECMIN
1588The percentage of physical memory which will be always be available for
1589cached executable data.
1590.It Li VM_FILEMAX
1591The percentage of physical memory which will be reclaimed
1592from other types of memory usage to store cached file data.
1593.It Li VM_FILEMIN
1594The percentage of physical memory which will be always be available for
1595cached file data.
1596.It Li VM_LOADAVG
1597Return the load average history.
1598The returned data consists of a
1599.Va struct loadavg .
1600.It Li VM_MAXSLP
1601The value of the maxslp kernel global variable.
1602.It Li VM_METER
1603Return system wide virtual memory statistics.
1604The returned data consists of a
1605.Va struct vmtotal .
1606.It Li VM_USPACE
1607The number of bytes allocated for each kernel stack.
1608.It Li VM_UVMEXP
1609Return system wide virtual memory statistics.
1610The returned data consists of a
1611.Va struct uvmexp .
1612.It Li VM_UVMEXP2
1613Return system wide virtual memory statistics.
1614The returned data consists of a
1615.Va struct uvmexp_sysctl .
1616.El
1617.Sh CTL_DDB
1618The integer information available for the CTL_DDB level is detailed below.
1619The changeable column shows whether a process with appropriate
1620privilege may change the value.
1621.Bl -column "DBCTL_TABSTOPSXXX" "integerXXX" -offset indent
1622.It Sy Second level name	Type	Changeable
1623.It DBCTL\_RADIX	integer	yes
1624.It DBCTL\_MAXOFF	integer	yes
1625.It DBCTL\_LINES	integer	yes
1626.It DBCTL\_TABSTOPS	integer	yes
1627.It DBCTL\_ONPANIC	integer	yes
1628.It DBCTL\_FROMCONSOLE	integer	yes
1629.El
1630.Pp
1631.Bl -tag -width "123456"
1632.It Li DBCTL_RADIX
1633The input and output radix.
1634.It Li DBCTL_MAXOFF
1635The maximum symbol offset.
1636.It Li DBCTL_LINES
1637Number of display lines.
1638.It Li DBCTL_TABSTOPS
1639Tab width.
1640.It Li DBCTL_ONPANIC
1641If non-zero, DDB will be entered when the kernel panics.
1642.It Li DBCTL_FROMCONSOLE
1643If not zero, DDB may be entered by sending a break on a serial
1644console or by a special key sequence on a graphics console.
1645.El
1646.Pp
1647These MIB nodes are also available as variables from within the DDB.
1648See
1649.Xr ddb 4
1650for more details.
1651.Sh CTL_VENDOR
1652The "vendor" toplevel name is reserved to be used by vendors who wish to
1653have their own private MIB tree.
1654Intended use is to store values under
1655.Dq vendor.\*[Lt]yourname\*[Gt].* .
1656.Sh RETURN VALUES
1657If the call to
1658.Nm
1659is successful, the number of bytes copied out is returned.
1660Otherwise \-1 is returned and
1661.Va errno
1662is set appropriately.
1663.Sh FILES
1664.Bl -tag -width \*[Lt]netinet6/udp6Xvar.h\*[Gt] -compact
1665.It Aq Pa sys/sysctl.h
1666definitions for top level identifiers, second level kernel and hardware
1667identifiers, and user level identifiers
1668.It Aq Pa sys/socket.h
1669definitions for second level network identifiers
1670.It Aq Pa sys/gmon.h
1671definitions for third level profiling identifiers
1672.It Aq Pa uvm/uvm_param.h
1673definitions for second level virtual memory identifiers
1674.It Aq Pa netinet/in.h
1675definitions for third level IPv4/v6 identifiers and
1676fourth level IPv4/v6 identifiers
1677.It Aq Pa netinet/icmp_var.h
1678definitions for fourth level ICMP identifiers
1679.It Aq Pa netinet/icmp6.h
1680definitions for fourth level ICMPv6 identifiers
1681.It Aq Pa netinet/tcp_var.h
1682definitions for fourth level TCP identifiers
1683.It Aq Pa netinet/udp_var.h
1684definitions for fourth level UDP identifiers
1685.It Aq Pa netinet6/udp6_var.h
1686definitions for fourth level IPv6 UDP identifiers
1687.It Aq Pa netinet6/ipsec.h
1688definitions for fourth level IPsec identifiers
1689.It Aq Pa netkey/key_var.h
1690definitions for third level PF_KEY identifiers
1691.El
1692.Sh ERRORS
1693The following errors may be reported:
1694.Bl -tag -width Er
1695.It Bq Er EFAULT
1696The buffer
1697.Fa name ,
1698.Fa oldp ,
1699.Fa newp ,
1700or length pointer
1701.Fa oldlenp
1702contains an invalid address.
1703.It Bq Er EINVAL
1704The
1705.Fa name
1706array is less than two or greater than CTL_MAXNAME.
1707.It Bq Er EINVAL
1708A non-null
1709.Fa newp
1710is given and its specified length in
1711.Fa newlen
1712is too large or too small.
1713.It Bq Er ENOMEM
1714The length pointed to by
1715.Fa oldlenp
1716is too short to hold the requested value.
1717.It Bq Er ENOTDIR
1718The
1719.Fa name
1720array specifies an intermediate rather than terminal name.
1721.It Bq Er EOPNOTSUPP
1722The
1723.Fa name
1724array specifies a value that is unknown.
1725.It Bq Er EPERM
1726An attempt is made to set a read-only value.
1727.It Bq Er EPERM
1728A process without appropriate privilege attempts to set a value.
1729.It Bq Er EPERM
1730An attempt to change a value protected by the current kernel security
1731level is made.
1732.El
1733.Sh SEE ALSO
1734.Xr ipsec 4 ,
1735.Xr sysctl 8
1736.Sh HISTORY
1737The
1738.Nm
1739function first appeared in
1740.Bx 4.4 .
1741