xref: /openbsd-src/lib/libc/sys/sysctl.2 (revision 897fc685943471cf985a0fe38ba076ea6fe74fa5)
1.\"	$OpenBSD: sysctl.2,v 1.4 2018/03/05 13:35:09 otto 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. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.Dd $Mdocdate: March 5 2018 $
31.Dt SYSCTL 2
32.Os
33.Sh NAME
34.Nm sysctl
35.Nd get or set system information
36.Sh SYNOPSIS
37.In sys/types.h
38.In sys/sysctl.h
39.Ft int
40.Fn sysctl "const int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
41.Sh DESCRIPTION
42The
43.Fn sysctl
44function retrieves system information and allows processes with
45appropriate privileges to set system information.
46The information available from
47.Fn sysctl
48consists of integers, strings, and tables.
49Information may be retrieved and set using the
50.Xr sysctl 8
51utility;
52the variable names used by this utility are given here in parentheses.
53.Pp
54Unless explicitly noted below,
55.Fn sysctl
56returns a consistent snapshot of the data requested.
57Consistency is obtained by locking the destination
58buffer into memory so that the data may be copied out without blocking.
59Calls to
60.Fn sysctl
61are serialized to avoid deadlock.
62.Pp
63The state is described using a
64.Dq Management Information Base (MIB)
65style name, listed in
66.Fa name ,
67which is a
68.Fa namelen
69length array of integers.
70.Pp
71The information is copied into the buffer specified by
72.Fa oldp .
73The size of the buffer is given by the location specified by
74.Fa oldlenp
75before the call,
76and that location gives the amount of data copied after a successful call.
77If the amount of data available is greater
78than the size of the buffer supplied,
79the call supplies as much data as fits in the buffer provided
80and returns with the error code
81.Er ENOMEM .
82If the old value is not desired,
83.Fa oldp
84and
85.Fa oldlenp
86should be set to
87.Dv NULL .
88.Pp
89The size of the available data can be determined by calling
90.Fn sysctl
91with a
92.Dv NULL
93parameter for
94.Fa oldp .
95The size of the available data will be returned in the location pointed to by
96.Fa oldlenp .
97For some operations, the amount of space may change often.
98For these operations,
99the system attempts to round up so that the returned size is
100large enough for a call to return the data shortly thereafter.
101.Pp
102The terminating NUL character is included in the lengths of string values.
103.Pp
104To set a new value,
105.Fa newp
106is set to point to a buffer of length
107.Fa newlen
108from which the requested value is to be taken.
109If a new value is not to be set,
110.Fa newp
111should be set to
112.Dv NULL
113and
114.Fa newlen
115set to 0.
116.Pp
117The top level names are defined with a
118.Dv CTL_
119prefix in
120.In sys/sysctl.h ,
121and are as follows.
122The next and subsequent levels down are found in the include files
123listed here, and described in separate sections below.
124.Bl -column "CTL_MACHDEP" "ufs/ffs/ffs_extern.h" "Description" -offset indent
125.It Sy "Name" Ta Sy "Next level names" Ta Sy "Description"
126.It Dv CTL_DDB Ta "ddb/db_var.h" Ta "Kernel debugger"
127.It Dv CTL_DEBUG Ta "sys/sysctl.h" Ta "Debugging"
128.It Dv CTL_FS Ta "sys/sysctl.h" Ta "File system"
129.It Dv CTL_HW Ta "sys/sysctl.h" Ta "Generic CPU, I/O"
130.It Dv CTL_KERN Ta "sys/sysctl.h" Ta "High kernel limits"
131.It Dv CTL_MACHDEP Ta "sys/sysctl.h" Ta "Machine dependent"
132.It Dv CTL_NET Ta "sys/socket.h" Ta "Networking"
133.It Dv CTL_VFS Ta "ufs/ffs/ffs_extern.h" Ta "Virtual file system"
134.It Dv CTL_VM Ta "uvm/uvm_param.h" Ta "Virtual memory"
135.El
136.Pp
137For example, the following retrieves the maximum number of processes allowed
138in the system:
139.Bd -literal -offset indent
140int mib[2], maxproc;
141size_t len;
142
143mib[0] = CTL_KERN;
144mib[1] = KERN_MAXPROC;
145len = sizeof(maxproc);
146if (sysctl(mib, 2, &maxproc, &len, NULL, 0) == -1)
147	err(1, "sysctl");
148.Ed
149.Ss CTL_DDB
150Integer information and settable variables are available for the
151.Dv CTL_DDB level ,
152as described below.
153More information is also available in
154.Xr ddb 4 .
155.Bl -column "Second level name" "integer" "Changeable" -offset indent
156.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
157.It Dv DBCTL_CONSOLE Ta "integer" Ta "yes"
158.It Dv DBCTL_LOG Ta "integer" Ta "yes"
159.It Dv DBCTL_MAXLINE Ta "integer" Ta "yes"
160.It Dv DBCTL_MAXWIDTH Ta "integer" Ta "yes"
161.It Dv DBCTL_PANIC Ta "integer" Ta "yes"
162.It Dv DBCTL_RADIX Ta "integer" Ta "yes"
163.It Dv DBCTL_TABSTOP Ta "integer" Ta "yes"
164.It Dv DBCTL_TRIGGER Ta "integer" Ta "yes"
165.El
166.Bl -tag -width "123456"
167.It Dv DBCTL_CONSOLE Pq Va ddb.console
168When this variable is set, an architecture dependent magic key sequence
169on the console or a debugger button will permit entry into the kernel debugger.
170When running with a
171.Xr securelevel 7
172greater than 0,
173this variable may not be raised.
174.It Dv DBCTL_LOG Pq Va ddb.log
175When set, ddb output is also logged in the kernel message buffer.
176.It Dv DBCTL_MAXLINE Pq Va ddb.max_line
177Determines the number of lines to page in
178.Xr ddb 4 .
179This variable is also available as the ddb
180.Dv $lines
181variable.
182.It Dv DBCTL_MAXWIDTH Pq Va ddb.max_width
183Determines the maximum width of a line in
184.Xr ddb 4 .
185This variable is also available as the ddb
186.Dv $maxwidth
187variable.
188.It Dv DBCTL_PANIC Pq Va ddb.panic
189When this variable is set, system panics may drop into the kernel debugger.
190When running with a
191.Xr securelevel 7
192greater than 0,
193this variable may not be raised.
194.It Dv DBCTL_RADIX Pq Va ddb.radix
195Determines the default radix or base for non-prefixed numbers
196entered into
197.Xr ddb 4 .
198This variable is also available as the ddb
199.Dv $radix
200variable.
201.It Dv DBCTL_TABSTOP Pq Va ddb.tab_stop_width
202Width of a tab stop in
203.Xr ddb 4 .
204This variable is also available as the ddb
205.Dv $tabstops
206variable.
207.It Dv DBCTL_TRIGGER Pq Va ddb.trigger
208When
209.Dv DBCTL_CONSOLE
210is set,
211writing to
212.Dv DBCTL_TRIGGER
213causes the system to enter
214.Xr ddb 4 .
215When running with a
216.Xr securelevel 7
217greater than 0,
218the process writing to this variable must be running
219on the console in order to enter
220.Xr ddb 4 .
221.El
222.Ss CTL_DEBUG
223The debugging variables vary from system to system.
224A debugging variable may be added or deleted without need to recompile
225.Fn sysctl
226to know about it.
227Each time it runs,
228.Fn sysctl
229gets the list of debugging variables from the kernel and
230displays their current values.
231The system defines twenty
232.Li struct ctldebug
233variables named
234.Va debug0
235through
236.Va debug19 .
237They are declared as separate variables so that they can be
238individually initialized at the location of their associated variable.
239The loader prevents multiple use of the same variable by issuing errors
240if a variable is initialized in more than one place.
241For example, to export the variable
242.Va dospecialcheck
243as a debugging variable, the following declaration would be used:
244.Bd -literal -offset indent
245int dospecialcheck = 1;
246struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck };
247.Ed
248.Ss CTL_FS
249The string and integer information available for the
250.Dv CTL_FS
251level is detailed below.
252The changeable column shows whether a process with appropriate
253privileges may change the value.
254.Bl -column "Second level name" "integer" "Changeable" -offset indent
255.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
256.It Dv FS_POSIX_SETUID Ta "integer" Ta "yes"
257.El
258.Bl -tag -width "123456"
259.It Dv FS_POSIX_SETUID Pq Va fx.posix.setuid
260When this variable is set, ownership changes on a file will cause
261the
262.Va S_ISUID
263and
264.Va S_ISGID
265bits to be cleared.
266When running with a
267.Xr securelevel 7
268greater than 0,
269this variable may not be changed.
270.El
271.Ss CTL_HW
272The string and integer information available for the
273.Dv CTL_HW
274level is detailed below.
275The changeable column shows whether a process with appropriate
276privileges may change the value.
277.Bl -column "Second level name" "integer" "Changeable" -offset indent
278.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
279.It Dv HW_ALLOWPOWERDOWN Ta "integer" Ta "yes"
280.It Dv HW_BYTEORDER Ta "integer" Ta "no"
281.It Dv HW_CPUSPEED Ta "integer" Ta "no"
282.It Dv HW_DISKCOUNT Ta "integer" Ta "no"
283.It Dv HW_DISKNAMES Ta "string" Ta "no"
284.It Dv HW_DISKSTATS Ta "struct" Ta "no"
285.It Dv HW_MACHINE Ta "string" Ta "no"
286.It Dv HW_MODEL Ta "string" Ta "no"
287.It Dv HW_NCPU Ta "integer" Ta "no"
288.It Dv HW_NCPUFOUND Ta "integer" Ta "no"
289.It Dv HW_PAGESIZE Ta "integer" Ta "no"
290.It Dv HW_PERFPOLICY Ta "string" Ta "yes"
291.It Dv HW_PHYSMEM Ta "integer" Ta "no"
292.It Dv HW_PHYSMEM64 Ta "int64_t" Ta "no"
293.It Dv HW_PRODUCT Ta "string" Ta "no"
294.It Dv HW_SENSORS Ta "node" Ta "not applicable"
295.It Dv HW_SETPERF Ta "integer" Ta "yes"
296.It Dv HW_USERMEM Ta "integer" Ta "no"
297.It Dv HW_USERMEM64 Ta "int64_t" Ta "no"
298.It Dv HW_UUID Ta "string" Ta "no"
299.It Dv HW_VENDOR Ta "string" Ta "no"
300.It Dv HW_VERSION Ta "string" Ta "no"
301.El
302.Bl -tag -width "123456"
303.It Dv HW_ALLOWPOWERDOWN Pq Va hw.allowpowerdown
304Some machines generate an interrupt when the power button is pressed
305and a driver can catch that interrupt.
306When this variable is set, such an event will cause the system to
307perform a regular shutdown and power off the machine.
308When running with a
309.Xr securelevel 7
310greater than 0,
311this variable may not be changed.
312.It Dv HW_BYTEORDER Pq Va hw.byteorder
313The byteorder (4321 or 1234).
314.It Dv HW_CPUSPEED Pq Va hw.cpuspeed
315The current CPU frequency
316.Pq in MHz .
317.It Dv HW_DISKCOUNT Pq Va hw.diskcount
318The number of disks currently attached to the system.
319.It Dv HW_DISKNAMES Pq Va hw.disknames
320A comma-separated list of disk names.
321.It Dv HW_DISKSTATS Pq Va hw.diskstats
322An array of
323.Li struct diskstats
324structures containing disk statistics.
325.It Dv HW_MACHINE Pq Va hw.machine
326The machine class.
327.It Dv HW_MODEL Pq Va hw.model
328The machine model.
329.It Dv HW_NCPU Pq Va hw.ncpu
330The number of CPUs being used.
331.It Dv HW_NCPUFOUND Pq Va hw.ncpufound
332The number of CPUs found.
333.It Dv HW_PAGESIZE Pq Va hw.pagesize
334The software page size.
335.It Dv HW_PERFPOLICY Pq Va hw.perfpolicy
336The performance policy for power management.
337Can be one of
338.Dq manual ,
339.Dq auto ,
340or
341.Dq high .
342.It Dv HW_PHYSMEM
343The total physical memory, in bytes.
344This variable is deprecated; use
345.Dv HW_PHYSMEM64
346instead.
347.It Dv HW_PHYSMEM64 Pq Va hw.physmem
348The total physical memory, in bytes.
349.It Dv HW_PRODUCT Pq Va hw.product
350The product name of the machine.
351.It Dv HW_SENSORS Pq Va hw.sensors
352Third level comprises an array of
353.Li struct sensordev
354structures containing information about devices
355that may attach hardware monitoring sensors.
356.Pp
357Third, fourth and fifth levels together comprise an array of
358.Li struct sensor
359structures containing snapshot readings of hardware monitoring sensors.
360In such usage, third level indicates the numerical representation
361of the sensor device name to which the sensor is attached
362(a device's xname and number are matched with the help of
363.Li struct sensordev
364structure above),
365fourth level indicates sensor type and
366fifth level is an ordinal sensor number (unique to
367the specified sensor type on the specified sensor device).
368.Pp
369The
370.Sy sensordev
371and
372.Sy sensor
373structures
374and
375.Sy sensor_type
376enumeration
377are defined in
378.In sys/sensors.h .
379.It Dv HW_SERIALNO Pq Va hw.serialno
380The serial number of the machine.
381.It Dv HW_SETPERF Pq Va hw.setperf
382Current CPU performance
383.Pq percentage .
384It is only modifiable if
385.Dv HW_PERFPOLICY
386is set to
387.Dq manual .
388.It Dv HW_USERMEM
389The amount of available non-kernel memory in bytes.
390This variable is deprecated; use
391.Dv HW_USERMEM64
392instead.
393.It Dv HW_USERMEM64 Pq Va hw.usermem
394The amount of available non-kernel memory in bytes.
395.It Dv HW_UUID Pq Va hw.uuid
396The universal unique identification number assigned to the machine.
397.It Dv HW_VENDOR Pq Va hw.vendor
398The vendor name for this machine.
399.It Dv HW_VERSION Pq Va hw.version
400The version or revision of this machine.
401.El
402.Ss CTL_KERN
403The string and integer information available for the
404.Dv CTL_KERN
405level is detailed below.
406The changeable column shows whether a process with appropriate
407privileges may change the value.
408The types of data currently available are process information,
409system vnodes, the open file entries, routing table entries,
410virtual memory statistics, load average history, and clock rate
411information.
412.Bl -column "KERN_PROC_NOBROADCASTKILL" "u_int64_t[CPUSTATES]" "no" -offset indent
413.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
414.It Dv KERN_ALLOWKMEM Ta "integer" Ta "yes"
415.It Dv KERN_ARGMAX Ta "integer" Ta "no"
416.It Dv KERN_BOOTTIME Ta "struct timeval" Ta "no"
417.It Dv KERN_CACHEPCT Ta "integer" Ta "yes"
418.It Dv KERN_CCPU Ta "integer" Ta "no"
419.It Dv KERN_CLOCKRATE Ta "struct clockinfo" Ta "no"
420.It Dv KERN_CONSDEV Ta "dev_t" Ta "no"
421.It Dv KERN_CPTIME Ta "long[CPUSTATES]" Ta "no"
422.It Dv KERN_CPTIME2 Ta "u_int64_t[CPUSTATES]" Ta "no"
423.It Dv KERN_DNSJACKPORT Ta "integer" Ta "yes"
424.It Dv KERN_DOMAINNAME Ta "string" Ta "yes"
425.It Dv KERN_FILE Ta "struct kinfo_file" Ta "no"
426.It Dv KERN_FORKSTAT Ta "struct forkstat" Ta "no"
427.It Dv KERN_FSCALE Ta "integer" Ta "no"
428.It Dv KERN_FSYNC Ta "integer" Ta "no"
429.It Dv KERN_GLOBAL_PTRACE Ta "integer" Ta "yes"
430.It Dv KERN_HOSTID Ta "integer" Ta "yes"
431.It Dv KERN_HOSTNAME Ta "string" Ta "yes"
432.It Dv KERN_INTRCNT Ta "node" Ta "not applicable"
433.It Dv KERN_JOB_CONTROL Ta "integer" Ta "no"
434.It Dv KERN_MALLOCSTATS Ta "node" Ta "no"
435.It Dv KERN_MAXCLUSTERS Ta "integer" Ta "yes"
436.It Dv KERN_MAXFILES Ta "integer" Ta "yes"
437.It Dv KERN_MAXLOCKSPERUID Ta "integer" Ta "yes"
438.It Dv KERN_MAXPARTITIONS Ta "integer" Ta "no"
439.It Dv KERN_MAXPROC Ta "integer" Ta "yes"
440.It Dv KERN_MAXTHREAD Ta "integer" Ta "yes"
441.It Dv KERN_MAXVNODES Ta "integer" Ta "yes"
442.It Dv KERN_MBSTAT Ta "struct mbstat" Ta "no"
443.It Dv KERN_MSGBUF Ta "char[]" Ta "no"
444.It Dv KERN_MSGBUFSIZE Ta "integer" Ta "no"
445.It Dv KERN_NCHSTATS Ta "struct nchstats" Ta "no"
446.It Dv KERN_NFILES Ta "integer" Ta "no"
447.It Dv KERN_NGROUPS Ta "integer" Ta "no"
448.It Dv KERN_NOSUIDCOREDUMP Ta "integer" Ta "yes"
449.It Dv KERN_NPROCS Ta "integer" Ta "no"
450.It Dv KERN_NSELCOLL Ta "integer" Ta "no"
451.It Dv KERN_NTHREADS Ta "integer" Ta "no"
452.It Dv KERN_NUMVNODES Ta "integer" Ta "no"
453.It Dv KERN_OSRELEASE Ta "string" Ta "no"
454.It Dv KERN_OSREV Ta "integer" Ta "no"
455.It Dv KERN_OSTYPE Ta "string" Ta "no"
456.It Dv KERN_OSVERSION Ta "string" Ta "no"
457.It Dv KERN_POSIX1 Ta "integer" Ta "no"
458.It Dv KERN_PROC Ta "struct kinfo_proc" Ta "no"
459.It Dv KERN_PROC_ARGS Ta "node" Ta "not applicable"
460.It Dv KERN_PROC_CWD Ta "string" Ta "not applicable"
461.It Dv KERN_PROC_NOBROADCASTKILL Ta "node" Ta "not applicable"
462.It Dv KERN_PROC_VMMAP Ta "struct kinfo_vmentry" Ta "no"
463.It Dv KERN_PROF Ta "node" Ta "not applicable"
464.It Dv KERN_RAWPARTITION Ta "integer" Ta "no"
465.It Dv KERN_SAVED_IDS Ta "integer" Ta "no"
466.It Dv KERN_SECURELVL Ta "integer" Ta "raise only"
467.It Dv KERN_SEMINFO Ta "node" Ta "not applicable"
468.It Dv KERN_SHMINFO Ta "node" Ta "not applicable"
469.It Dv KERN_SOMAXCONN Ta "integer" Ta "yes"
470.It Dv KERN_SOMINCONN Ta "integer" Ta "yes"
471.It Dv KERN_SPLASSERT Ta "int" Ta "yes"
472.It Dv KERN_STACKGAPRANDOM Ta "integer" Ta "yes"
473.It Dv KERN_SYSVIPC_INFO Ta "node" Ta "not applicable"
474.It Dv KERN_SYSVMSG Ta "integer" Ta "no"
475.It Dv KERN_SYSVSEM Ta "integer" Ta "no"
476.It Dv KERN_SYSVSHM Ta "integer" Ta "no"
477.It Dv KERN_TIMECOUNTER Ta "node" Ta "not applicable"
478.It Dv KERN_TTY Ta "node" Ta "not applicable"
479.It Dv KERN_TTYCOUNT Ta "integer" Ta "no"
480.It Dv KERN_VERSION Ta "string" Ta "no"
481.It Dv KERN_WATCHDOG Ta "node" Ta "not applicable"
482.It Dv KERN_WXABORT Ta "integer" Ta "yes"
483.El
484.Bl -tag -width "123456"
485.It Dv KERN_ALLOWKMEM Pq Va kern.allowkmem
486Allow userland processes access to
487.Pa /dev/mem
488and
489.Pa /dev/kmem .
490When running with a
491.Xr securelevel 7
492greater than 0,
493this variable may not be changed.
494.It Dv KERN_ARGMAX Pq Va kern.argmax
495The maximum number of bytes allowed among the arguments to
496.Xr exec 3 .
497.It Dv KERN_BOOTTIME Pq Va kern.boottime
498A
499.Li struct timeval
500structure is returned.
501This structure contains the time that the system was booted.
502.It Dv KERN_CACHEPCT Pq Va kern.bufcachepercent
503The maximum percentage of physical memory the buffer cache may use;
504the default is 20%.
505.It Dv KERN_CCPU Pq Va kern.ccpu
506The scheduler exponential decay value.
507.It Dv KERN_CLOCKRATE Pq Va kern.clockrate
508A
509.Li struct clockinfo
510structure is returned.
511This structure contains the clock, statistics clock and profiling clock
512frequencies, the number of micro-seconds per hz tick, and the clock
513skew rate.
514.It Dv KERN_CONSDEV Pq Va kern.consdev
515The console device.
516.It Dv KERN_CPTIME Pq Va kern.cp_time
517An array of longs of size
518.Li CPUSTATES
519is returned, containing statistics about the number of ticks spent by
520the system in interrupt processing, user processes
521.Po
522.Xr nice 1
523or normal
524.Pc ,
525system processing, or idling.
526.It Dv KERN_CPTIME2 Pq Va kern.cp_time2
527Similar to
528.Dv KERN_CPTIME ,
529but obtains information from only the single CPU specified by the
530third level name given.
531.It Dv KERN_DNSJACKPORT Pq Va kern.dnsjackport
532When non-zero, the localhost port to which all DNS sockets should be
533redirected.
534.It Dv KERN_DOMAINNAME Pq Va kern.domainname
535Get or set the YP domain name.
536.It Dv KERN_FILE Pq Va kern.file
537Return the entire file table, or a subset of it.
538An array of
539.Li struct kinfo_file
540structures is returned,
541whose size depends on the current number of selected files in the system.
542The third and fourth level names are as follows:
543.Bl -column "Third level name" "Fourth level is:" -offset indent
544.It Sy "Third level name" Ta Sy "Fourth level is:"
545.It Dv KERN_FILE_BYFILE Ta "A file type"
546.It Dv KERN_FILE_BYPID Ta "A process ID"
547.It Dv KERN_FILE_BYUID Ta "A user ID"
548.El
549.Pp
550The fifth level name is the size of the
551.Li struct kinfo_file
552and the sixth level name is the number of structures to return.
553.It Dv KERN_FORKSTAT Pq Va kern.forkstat
554A
555.Li struct forkstat
556structure is returned.
557This structure contains information about the number of
558.Xr fork 2 ,
559.Xr vfork 2 ,
560and
561.Xr __tfork 3
562system calls as well as kernel thread creations since system startup,
563and the number of pages of virtual memory involved in each.
564.It Dv KERN_FSCALE Pq Va kern.fscale
565The kernel fixed-point scale factor.
566.It Dv KERN_FSYNC Pq Va kern.fsync
567Return 1 if the File Synchronisation Option is available on this system,
568otherwise 0.
569.It Dv KERN_GLOBAL_PTRACE Pq Va kern.global_ptrace
570When set to 1, permit
571.Xr ptrace 2
572to attach to any process with the appropriate privileges.
573When set to 0, processes may only attach to their own descendants.
574.It Dv KERN_HOSTID Pq Va kern.hostid
575Get or set the host ID.
576.It Dv KERN_HOSTNAME Pq Va kern.hostname
577Get or set the hostname.
578.It Dv KERN_JOB_CONTROL Pq Va kern.job_control
579Return 1 if job control is available on this system, otherwise 0.
580.It Dv KERN_MALLOCSTATS Pq Va kern.malloc
581Return kernel memory bucket statistics.
582The third level names are detailed below.
583There are no changeable values in this branch.
584.Bl -column "KERN_MALLOC_KMEMNAMES" "string" -offset indent
585.It Sy "Third level name" Ta Sy "Type"
586.It Dv KERN_MALLOC_BUCKET Ta "node"
587.It Dv KERN_MALLOC_BUCKETS Ta "string"
588.It Dv KERN_MALLOC_KMEMNAMES Ta "string"
589.It Dv KERN_MALLOC_KMEMSTATS Ta "node"
590.El
591.Pp
592The variables are as follows:
593.Bl -tag -width "123456"
594.It Dv KERN_MALLOC_BUCKET.<size> Pq Va kern.malloc.bucket
595A node containing the statistics for the memory bucket of the
596specified size (in decimal notation, the number of bytes per bucket
597element, e.g., 16, 32, 128).
598Each node returns a
599.Li struct kmembuckets .
600.Pp
601If a value is specified that does not correspond directly to a
602bucket size, the statistics for the closest larger bucket size will be
603returned instead.
604.Pp
605Note that bucket sizes are typically powers of 2.
606.It Dv KERN_MALLOC_BUCKETS Pq Va kern.malloc.buckets
607Return a comma-separated list of the bucket sizes used by the kernel.
608.It Dv KERN_MALLOC_KMEMNAMES Pq Va kern.malloc.kmemnames
609Return a comma-separated list of the names of the kernel
610.Xr malloc 9
611types.
612.It Dv KERN_MALLOC_KMEMSTATS Pq Va kern.malloc.kmemstat
613A node containing the statistics for the memory types of the specified
614name.
615Each node returns a
616.Li struct kmemstats .
617.El
618.It Dv KERN_MAXCLUSTERS Pq Va kern.maxclusters
619The maximum number of
620.Xr mbuf 9
621clusters that may be allocated.
622.It Dv KERN_MAXFILES Pq Va kern.maxfiles
623The maximum number of open files that may be open in the system.
624.It Dv KERN_MAXLOCKSPERUID Pq Va kern.maxlocksperuid
625The maximum number of file locks per user;
626the default is 1024.
627.It Dv KERN_MAXPARTITIONS Pq Va kern.maxpartitions
628The maximum number of partitions allowed per disk.
629.It Dv KERN_MAXPROC Pq Va kern.maxproc
630The maximum number of simultaneous processes the system will allow.
631.It Dv KERN_MAXTHREAD Pq Va kern.maxthread
632The maximum number of simultaneous threads the system will allow.
633.It Dv KERN_MAXVNODES Pq Va kern.maxvnodes
634The maximum number of vnodes available on the system.
635.It Dv KERN_MBSTAT Pq Va kern.mbstat
636A
637.Li struct mbstat
638structure is returned, containing statistics on
639.Xr mbuf 9
640usage.
641.It Dv KERN_MSGBUF Pq Va kern.msgbuf
642Returns a buffer containing kernel log messages;
643see
644.Xr dmesg 8 .
645.It Dv KERN_MSGBUFSIZE Pq Va kern.msgbufsize
646The size of the kernel message buffer.
647.It Dv KERN_NCHSTATS Pq Va kern.nchstats
648A
649.Li struct nchstats
650structure is returned.
651This structure contains information about the
652filename to
653.Xr inode 5
654mapping cache.
655.It Dv KERN_NFILES Pq Va kern.nfiles
656Number of open files.
657.It Dv KERN_NGROUPS Pq Va kern.ngroups
658The maximum number of supplemental groups.
659.It Dv KERN_NOSUIDCOREDUMP Pq Va kern.nosuidcoredump
660Whether a process may dump core after changing user or group ID:
661.Bl -column "value" "condition" "current directory"
662.It Sy "value" Ta Sy "condition" Ta Sy "dump core to"
663.It 0 Ta "euid == 0" Ta "current directory"
664.It 1 Ta "never" Ta ""
665.It 2 Ta "always" Ta Pa "/var/crash"
666.It 3 Ta "depends" Ta Pa "/var/crash/$programname/"
667.El
668.It Dv KERN_NPROCS Pq Va kern.nprocs
669The number of entries in the kernel process table.
670.It Dv KERN_NSELCOLL Pq Va kern.nselcoll
671Number of
672.Xr select 2
673collisions.
674.It Dv KERN_NTHREADS Pq Va kern.nthreads
675The number of entries in the kernel thread table.
676.It Dv KERN_NUMVNODES Pq Va kern.numvnodes
677Number of vnodes in use.
678.It Dv KERN_OSRELEASE Pq Va kern.osrelease
679The system release string.
680.It Dv KERN_OSREV Pq Va kern.osrevision
681The system revision number.
682.It Dv KERN_OSTYPE Pq Va kern.ostype
683The system type string.
684.It Dv KERN_OSVERSION Pq Va kern.osversion
685The kernel build version.
686.It Dv KERN_POSIX1 Pq Va kern.posix1version
687The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
688attempts to comply.
689.It Dv KERN_PROC Pq Va kern.proc
690Return the entire process table, or a subset of it.
691An array of
692.Li struct kinfo_proc
693structures is returned,
694whose size depends on the current number of selected processes in the system.
695The third and fourth level names are as follows:
696.Bl -column "KERN_PROC_SESSION" "Fourth level is:" -offset indent
697.It Sy "Third level name" Ta Sy "Fourth level is:"
698.It Dv KERN_PROC_ALL Ta "None"
699.It Dv KERN_PROC_KTHREAD Ta "A kernel thread"
700.It Dv KERN_PROC_PID Ta "A process ID"
701.It Dv KERN_PROC_PGRP Ta "A process group"
702.It Dv KERN_PROC_RUID Ta "A real user ID"
703.It Dv KERN_PROC_SESSION Ta "A session PID"
704.It Dv KERN_PROC_TTY Ta "A tty device"
705.It Dv KERN_PROC_UID Ta "A user ID"
706.El
707.Pp
708The fifth level name is the size of the
709.Li struct kinfo_proc
710and the sixth level name is the number of structures to return.
711.It Dv KERN_PROC_ARGS Pq Va kern.procargs
712Returns the arguments or environment of a process.
713The third level name is the PID of the process.
714The fourth level name is one of:
715.Bl -column KERN_PROC_NARGV -offset indent
716.It Dv KERN_PROC_ARGV
717.It Dv KERN_PROC_ENV
718.It Dv KERN_PROC_NARGV
719.It Dv KERN_PROC_NENV
720.El
721.Pp
722.Dv KERN_PROC_NARGV
723and
724.Dv KERN_PROC_NENV
725return the number of elements as an
726.Vt int
727in the argv or env array.
728.Dv KERN_PROC_ARGV
729returns the argv array and
730.Dv KERN_PROC_ENV
731returns the environ array.
732The buffer pointed to by
733.Fa oldp
734is filled with an array of char pointers
735followed by the strings themselves.
736The last char pointer is a
737.Dv NULL
738pointer.
739.It Dv KERN_PROC_CWD Pq Va kern.proc_cwd
740Return the current working directory of a process.
741The third level name is the target process ID.
742A NUL-terminated string is returned.
743.It Dv KERN_PROC_NOBROADCASTKILL Pq Va kern.proc_nobroadcastkill
744When set, a process will no longer be signaled when sending broadcast signals.
745The third level name is the target process ID.
746.It Dv KERN_PROC_VMMAP Pq Va kern.proc_vmmap
747Return the entire process VM map entries.
748An array of
749.Li struct kinfo_vmentry
750structures is returned,
751whose size depends on the current number of VM map entries of the selected process.
752Iteration is possible by setting the base address in the first element of
753.Li struct kinfo_vmentry .
754.It Dv KERN_PROF Pq Va kern.profiling
755Return profiling information about the kernel.
756If the kernel is not compiled for profiling,
757attempts to retrieve any of the
758.Dv KERN_PROF
759values will fail with
760.Er EOPNOTSUPP .
761The third level names for the string and integer profiling information
762are detailed below.
763The changeable column shows whether a process with appropriate
764privileges may change the value.
765.Bl -column "Third level name" "struct gmonparam" -offset indent
766.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
767.It Dv GPROF_COUNT Ta "u_short[]" Ta "yes"
768.It Dv GPROF_FROMS Ta "u_short[]" Ta "yes"
769.It Dv GPROF_GMONPARAM Ta "struct gmonparam" Ta "no"
770.It Dv GPROF_STATE Ta "integer" Ta "yes"
771.It Dv GPROF_TOS Ta "struct tostruct" Ta "yes"
772.El
773.Pp
774The variables are as follows:
775.Bl -tag -width "123456"
776.It Dv GPROF_COUNT
777Array of statistical program counter counts.
778.It Dv GPROF_FROMS
779Array indexed by program counter of call-from points.
780.It Dv GPROF_GMONPARAM
781Structure giving the sizes of the above arrays.
782.It Dv GPROF_STATE
783Returns
784.Dv GMON_PROF_ON
785or
786.Dv GMON_PROF_OFF
787to show that profiling is running or stopped.
788.It Dv GPROF_TOS
789Array of
790.Li struct tostruct
791describing destination of calls and their counts.
792.El
793.It Dv KERN_RAWPARTITION Pq Va kern.rawpartition
794The raw partition of a disk (a == 0).
795.It Dv KERN_SAVED_IDS Pq Va kern.saved_ids
796Returns 1 if saved set-group-ID and saved set-user-ID are available.
797.It Dv KERN_SECURELVL Pq Va kern.securelevel
798The system security level.
799This level may be raised by processes with appropriate privileges.
800It may only be lowered by process 1.
801.It Dv KERN_SEMINFO Pq Va kern.seminfo
802Return the elements of
803.Li struct seminfo .
804If the kernel is not compiled with System V style semaphore support,
805attempts to retrieve any of the
806.Dv KERN_SEMINFO
807values will fail with
808.Er EOPNOTSUPP .
809The third level names for the elements of
810.Li struct seminfo
811are detailed below.
812The changeable column shows whether a process with appropriate
813privileges may change the value.
814.Bl -column "KERN_SEMINFO_SEMMNI" "integer" "Changeable" -offset indent
815.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
816.It Dv KERN_SEMINFO_SEMAEM Ta "integer" Ta "no"
817.It Dv KERN_SEMINFO_SEMMNI Ta "integer" Ta "yes"
818.It Dv KERN_SEMINFO_SEMMNS Ta "integer" Ta "yes"
819.It Dv KERN_SEMINFO_SEMMNU Ta "integer" Ta "yes"
820.It Dv KERN_SEMINFO_SEMMSL Ta "integer" Ta "yes"
821.It Dv KERN_SEMINFO_SEMOPM Ta "integer" Ta "yes"
822.It Dv KERN_SEMINFO_SEMUME Ta "integer" Ta "no"
823.It Dv KERN_SEMINFO_SEMUSZ Ta "integer" Ta "no"
824.It Dv KERN_SEMINFO_SEMVMX Ta "integer" Ta "no"
825.El
826.Pp
827The variables are as follows:
828.Bl -tag -width "123456"
829.It Dv KERN_SEMINFO_SEMAEM Pq Va kern.seminfo.semaem
830The adjust on exit maximum value.
831.It Dv KERN_SEMINFO_SEMMNI Pq Va kern.seminfo.semni
832The maximum number of semaphore identifiers allowed.
833.It Dv KERN_SEMINFO_SEMMNS Pq Va kern.seminfo.semmns
834The maximum number of semaphores allowed in the system.
835.It Dv KERN_SEMINFO_SEMMNU Pq Va kern.seminfo.semnu
836The maximum number of semaphore undo structures allowed in the system.
837.It Dv KERN_SEMINFO_SEMMSL Pq Va kern.seminfo.semmsl
838The maximum number of semaphores allowed per ID.
839.It Dv KERN_SEMINFO_SEMOPM Pq Va kern.seminfo.semopm
840The maximum number of operations per
841.Xr semop 2
842call.
843.It Dv KERN_SEMINFO_SEMUME Pq Va kern.seminfo.semume
844The maximum number of undo entries per process.
845.It Dv KERN_SEMINFO_SEMUSZ Pq Va kern.seminfo.semusz
846The size (in bytes) of the undo structure.
847.It Dv KERN_SEMINFO_SEMVMX Pq Va kern.seminfo.semvmx
848The semaphore maximum value.
849.El
850.It Dv KERN_SHMINFO Pq Va kern.shminfo
851Return the elements of
852.Li struct shminfo .
853If the kernel is not compiled with System V style shared memory support,
854attempts to retrieve any of the
855.Dv KERN_SHMINFO
856values will fail with
857.Er EOPNOTSUPP .
858The third level names for the elements of
859.Li struct shminfo
860are detailed below.
861The changeable column shows whether a process with appropriate
862privileges may change the value.
863.Bl -column "KERN_SHMINFO_SHMMAX" "integer" "Changeable" -offset indent
864.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
865.It Dv KERN_SHMINFO_SHMALL Ta "integer" Ta "yes"
866.It Dv KERN_SHMINFO_SHMMAX Ta "integer" Ta "yes"
867.It Dv KERN_SHMINFO_SHMMIN Ta "integer" Ta "yes"
868.It Dv KERN_SHMINFO_SHMMNI Ta "integer" Ta "yes"
869.It Dv KERN_SHMINFO_SHMSEG Ta "integer" Ta "yes"
870.El
871.Pp
872The variables are as follows:
873.Bl -tag -width "123456"
874.It Dv KERN_SHMINFO_SHMALL Pq Va kern.shminfo.shmall
875The maximum amount of total shared memory allowed in the system (in pages).
876.It Dv KERN_SHMINFO_SHMMAX Pq Va kern.shminfo.shmmax
877The maximum shared memory segment size (in bytes).
878.It Dv KERN_SHMINFO_SHMMIN Pq Va kern.shminfo.shmmin
879The minimum shared memory segment size (in bytes).
880.It Dv KERN_SHMINFO_SHMMNI Pq Va kern.shminfo.shmmni
881The maximum number of shared memory identifiers in the system.
882.It Dv KERN_SHMINFO_SHMSEG Pq Va kern.shminfo.shmseg
883The maximum number of shared memory segments per process.
884.El
885.It Dv KERN_SOMAXCONN Pq Va kern.somaxconn
886Upper bound on the number of half-open connections a process can allow
887to be associated with a socket, using
888.Xr listen 2 .
889The default value is 128.
890.It Dv KERN_SOMINCONN Pq Va kern.sominconn
891Lower bound on the number of half-open connections a process can allow
892to be associated with a socket, using
893.Xr listen 2 .
894The default value is 80.
895.It Dv KERN_SPLASSERT Pq Va kern.splassert
896Modify the system interrupt priority level.
897Valid values are:
898.Pp
899.Bl -tag -width 3n -offset indent -compact
900.It 0
901Disable error checking.
902.It 1
903Print a message if an error is detected.
904.It 2
905Print a message if an error is detected,
906and a stack trace if possible.
907.It 3
908The same as 2, but also drop into the kernel debugger.
909.El
910.Pp
911Any other value causes a system panic on errors.
912See
913.Xr splassert 9
914for more information.
915.It Dv KERN_STACKGAPRANDOM Pq Va kern.stackgap_random
916Sets the range of the random value added to the stack pointer on each
917program execution.
918The random value is added to make buffer overflow exploitation slightly
919harder.
920The bigger the number, the harder it is to brute force this added protection,
921but it also means bigger waste of memory.
922.It Li KERN_SYSVIPC_INFO Pq Va kern.sysvipc_info
923Return System V style IPC configuration and run-time information.
924The third level name selects the System V style IPC facility.
925.Bl -column "KERN_SYSVIPC_MSG_INFO" "struct shm_sysctl_info" -offset indent
926.It Sy "Third level name" Ta Sy "Type"
927.It Dv KERN_SYSVIPC_MSG_INFO Ta "struct msg_sysctl_info"
928.It Dv KERN_SYSVIPC_SEM_INFO Ta "struct sem_sysctl_info"
929.It Dv KERN_SYSVIPC_SHM_INFO Ta "struct shm_sysctl_info"
930.El
931.Bl -tag -width "123456"
932.It Dv KERN_SYSVIPC_MSG_INFO
933Return information on the System V style message facility.
934The
935.Sy msg_sysctl_info
936structure is defined in
937.In sys/msg.h .
938.It Dv KERN_SYSVIPC_SEM_INFO
939Return information on the System V style semaphore facility.
940The
941.Sy sem_sysctl_info
942structure is defined in
943.In sys/sem.h .
944.It Dv KERN_SYSVIPC_SHM_INFO
945Return information on the System V style shared memory facility.
946The
947.Sy shm_sysctl_info
948structure is defined in
949.In sys/shm.h .
950.El
951.It Dv KERN_SYSVMSG Pq Va kern.sysvmsg
952Returns 1 if System V style message queue functionality is available on this
953system, otherwise 0.
954.It Dv KERN_SYSVSEM Pq Va kern.sysvem
955Returns 1 if System V style semaphore functionality is available on this
956system, otherwise 0.
957.It Dv KERN_SYSVSHM Pq Va kern.sysvshm
958Returns 1 if System V style shared memory functionality is available on this
959system, otherwise 0.
960.It Dv KERN_TIMECOUNTER Pq Va kern.timecounter
961Return statistics information about the kernel time counter.
962The third level names information is detailed below.
963The changeable column shows whether a process with appropriate
964privileges may change the value.
965.Bl -column "KERN_TIMECOUNTER_TIMESTEPWARNINGS" "integer" -offset indent
966.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
967.It Dv KERN_TIMECOUNTER_CHOICE Ta "string" Ta "no"
968.It Dv KERN_TIMECOUNTER_HARDWARE Ta "string" Ta "yes"
969.It Dv KERN_TIMECOUNTER_TICK Ta "integer" Ta "no"
970.It Dv KERN_TIMECOUNTER_TIMESTEPWARNINGS Ta "integer" Ta "yes"
971.El
972.Pp
973The variables are as follows:
974.Bl -tag -width "123456"
975.It Dv KERN_TIMECOUNTER_CHOICE Pq Va kern.timecounter.choice
976Get the list of kernel time counter sources and their claimed
977quality (higher is better).
978.It Dv KERN_TIMECOUNTER_HARDWARE Pq Va kern.timecounter.hardware
979Get or set the kernel time counter source by name.
980.It Dv KERN_TIMECOUNTER_TICK Pq Va kern.timecounter.tick
981Get the number of times we have reset the kernel time counter
982information.
983.It Dv KERN_TIMECOUNTER_TIMESTEPWARNINGS Pq Va kern.timecounter.timestepwarnings
984Get or set a flag to log a message when the kernel time is
985stepped.
986.El
987.It Dv KERN_TTY Pq Va kern.tty
988Return statistics information about tty input/output.
989The third level names information is detailed below.
990The changeable column shows whether a process with appropriate
991privileges may change the value.
992.Bl -column "KERN_TTY_TKRAWCC" "struct itty" "Changeable" -offset indent
993.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
994.It Dv KERN_TTY_INFO Ta "struct itty" Ta "no"
995.It Dv KERN_TTY_TKCANCC Ta "int64_t" Ta "no"
996.It Dv KERN_TTY_TKNIN Ta "int64_t" Ta "no"
997.It Dv KERN_TTY_TKNOUT Ta "int64_t" Ta "no"
998.It Dv KERN_TTY_TKRAWCC Ta "int64_t" Ta "no"
999.El
1000.Pp
1001The variables are as follows:
1002.Bl -tag -width "123456"
1003.It Dv KERN_TTY_INFO Pq Va kern.tty.ttyinfo
1004Returns an array of
1005.Li struct itty
1006structures containing tty statistics.
1007.It Dv KERN_TTY_TKCANCC Pq Va kern.tty.tk_cancc
1008Returns the number of input characters in canonical mode.
1009.It Dv KERN_TTY_TKNIN Pq Va kern.tty.tk_nin
1010Returns the number of input characters from a
1011.Xr tty 4 .
1012.It Dv KERN_TTY_TKNOUT Pq Va kern.tty.tk_nout
1013Returns the number of output characters on a
1014.Xr tty 4 .
1015.It Dv KERN_TTY_TKRAWCC Pq Va kern.tty.tk_rawcc
1016Returns the number of input characters in raw mode.
1017.El
1018.It Dv KERN_TTYCOUNT Pq Va kern.ttycount
1019Number of available
1020.Xr tty 4
1021devices.
1022.It Dv KERN_VERSION Pq Va kern.version
1023The system version string.
1024.It Dv KERN_WATCHDOG Pq Va kern.watchdog
1025Return information on hardware watchdog timers.
1026If the kernel does not support a hardware watchdog timer,
1027attempts to retrieve or set any of the
1028.Dv KERN_WATCHDOG
1029values will fail with
1030.Er EOPNOTSUPP .
1031.Bl -column "KERN_WATCHDOG_PERIOD" "integer" "Changeable" -offset indent
1032.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
1033.It Dv KERN_WATCHDOG_AUTO Ta "integer" Ta "yes"
1034.It Dv KERN_WATCHDOG_PERIOD Ta "integer" Ta "yes"
1035.El
1036.Pp
1037The variables are as follows:
1038.Bl -tag -width "123456"
1039.It Dv KERN_WATCHDOG_AUTO Pq Va kern.watchdog.auto
1040If set to 1, the kernel refreshes the watchdog timer periodically.
1041If set to 0, a userland process must ensure that the watchdog timer
1042gets refreshed by setting the
1043.Dv KERN_WATCHDOG_PERIOD
1044variable.
1045.It Dv KERN_WATCHDOG_PERIOD Pq Va kern.watchdog.period
1046The period of the watchdog timer in seconds.
1047Set to 0 to disable the watchdog timer.
1048.El
1049.It Dv KERN_WXABORT Pq Va kern.wxabort
1050Generate an abort,
1051rather than returning an error,
1052on W^X violation.
1053.El
1054.Ss CTL_MACHDEP
1055The set of variables defined is architecture dependent.
1056Most architectures define at least the following variables.
1057.Bl -column "Second level name" "dev_t" "Changeable" -offset indent
1058.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
1059.It Dv CPU_CONSDEV Ta "dev_t" Ta "no"
1060.El
1061.Pp
1062Consult the example file
1063.Pa /etc/examples/sysctl.conf
1064for a non-exhaustive list of
1065.Li machdep
1066variables.
1067.Ss CTL_NET
1068The string and integer information available for the
1069.Dv CTL_NET
1070level is detailed below.
1071The changeable column shows whether a process with appropriate
1072privileges may change the value.
1073.Bl -column "Second level name" "routing messages" "Changeable" -offset indent
1074.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
1075.It Dv PF_ROUTE Ta "routing messages" Ta "no"
1076.It Dv PF_INET Ta "IPv4 values" Ta "yes"
1077.It Dv PF_INET6 Ta "IPv6 values" Ta "yes"
1078.It Dv PF_KEY Ta "key management" Ta "no"
1079.It Dv PF_MPLS Ta "MPLS values" Ta "yes"
1080.It Dv PF_PIPEX Ta "PIPEX values" Ta "yes"
1081.El
1082.Bl -tag -width "123456"
1083.It Dv PF_ROUTE
1084Return the entire routing table or a subset of it.
1085The data is returned as a sequence of routing messages (see
1086.Xr route 4
1087for the header file, format, and meaning).
1088The length of each message is contained in the message header.
1089.Pp
1090The third level name is a protocol number, which is currently always 0.
1091The fourth level name is an address family, which may be set to 0 to
1092select all address families.
1093The fifth and sixth level names are as follows:
1094.Bl -column "Fifth level name" "Sixth level is:" -offset indent
1095.It Sy "Fifth level name" Ta Sy "Sixth level is:"
1096.It Dv NET_RT_DUMP Ta "priority"
1097.It Dv NET_RT_FLAGS Ta "rtflags"
1098.It Dv NET_RT_IFLIST Ta "None"
1099.It Dv NET_RT_IFNAMES Ta "None"
1100.It Dv NET_RT_STATS Ta "None"
1101.El
1102.Bl -tag -width "123456"
1103.It Li NET_RT_DUMP
1104If set to 0, show all routes.
1105If set to any number, show all routes with that number priority.
1106If set to a negative number, show routes that do not have the positive
1107priority value.
1108.El
1109.Pp
1110An optional seventh level name can be provided to select the routing table
1111on which to run the operation.
1112If not provided, the table with ID 0 is used.
1113.It Dv PF_INET
1114Get or set various global information about IPv4
1115.Pq Internet Protocol version 4 .
1116The third level name is the protocol.
1117The fourth level name is the variable name.
1118The currently defined protocols and names are:
1119.Bl -column "Protocol name" "ipsec-expire-acquire" "structure" "Changeable" -offset 2n
1120.It Sy "Protocol name" Ta Sy "Variable name" Ta Sy "Type" Ta Sy "Changeable"
1121.It ah Ta enable Ta integer Ta yes
1122.It bpf Ta bufsize Ta integer Ta yes
1123.It bpf Ta maxbufsize Ta integer Ta yes
1124.It carp Ta allow Ta integer Ta yes
1125.It carp Ta log Ta integer Ta yes
1126.It carp Ta preempt Ta integer Ta yes
1127.It divert Ta recvspace Ta integer Ta yes
1128.It divert Ta sendspace Ta integer Ta yes
1129.It esp Ta enable Ta integer Ta yes
1130.It esp Ta udpencap Ta integer Ta yes
1131.It esp Ta udpencap_port Ta integer Ta yes
1132.It etherip Ta allow Ta integer Ta yes
1133.It gre Ta allow Ta integer Ta yes
1134.It gre Ta wccp Ta integer Ta yes
1135.It icmp Ta bmcastecho Ta integer Ta yes
1136.It icmp Ta errppslimit Ta integer Ta yes
1137.It icmp Ta maskrepl Ta integer Ta yes
1138.It icmp Ta rediraccept Ta integer Ta yes
1139.It icmp Ta redirtimeout Ta integer Ta yes
1140.It icmp Ta stats Ta structure Ta no
1141.It icmp Ta tstamprepl Ta integer Ta yes
1142.It ip Ta arpdown Ta integer Ta yes
1143.It ip Ta arptimeout Ta integer Ta yes
1144.It ip Ta directed-broadcast Ta integer Ta yes
1145.It ip Ta encdebug Ta integer Ta yes
1146.It ip Ta forwarding Ta integer Ta yes
1147.It ip Ta ifq Ta node Ta "N/A"
1148.It ip Ta ipsec-allocs Ta integer Ta yes
1149.It ip Ta ipsec-auth-alg Ta string Ta yes
1150.It ip Ta ipsec-bytes Ta integer Ta yes
1151.It ip Ta ipsec-comp-alg Ta string Ta yes
1152.It ip Ta ipsec-enc-alg Ta string Ta yes
1153.It ip Ta ipsec-expire-acquire Ta integer Ta yes
1154.It ip Ta ipsec-firstuse Ta integer Ta yes
1155.It ip Ta ipsec-invalid-life Ta integer Ta yes
1156.It ip Ta ipsec-pfs Ta integer Ta yes
1157.It ip Ta ipsec-soft-allocs Ta integer Ta yes
1158.It ip Ta ipsec-soft-bytes Ta integer Ta yes
1159.It ip Ta ipsec-soft-firstuse Ta integer Ta yes
1160.It ip Ta ipsec-soft-timeout Ta integer Ta yes
1161.It ip Ta ipsec-timeout Ta integer Ta yes
1162.It ip Ta maxqueue Ta integer Ta yes
1163.It ip Ta mforwarding Ta integer Ta yes
1164.It ip Ta mtudisc Ta integer Ta yes
1165.It ip Ta mtudisctimeout Ta integer Ta yes
1166.It ip Ta multipath Ta integer Ta yes
1167.It ip Ta portfirst Ta integer Ta yes
1168.It ip Ta porthifirst Ta integer Ta yes
1169.It ip Ta porthilast Ta integer Ta yes
1170.It ip Ta portlast Ta integer Ta yes
1171.It ip Ta redirect Ta integer Ta yes
1172.It ip Ta sourceroute Ta integer Ta yes
1173.It ip Ta stats Ta structure Ta no
1174.It ip Ta ttl Ta integer Ta yes
1175.It ipcomp Ta enable Ta integer Ta yes
1176.It ipip Ta allow Ta integer Ta yes
1177.It mobileip Ta allow Ta integer Ta yes
1178.It tcp Ta ackonpush Ta integer Ta yes
1179.It tcp Ta always_keepalive Ta integer Ta yes
1180.It tcp Ta baddynamic Ta array Ta yes
1181.It tcp Ta ecn Ta integer Ta yes
1182.It tcp Ta ident Ta structure Ta no
1183.It tcp Ta keepidle Ta integer Ta yes
1184.It tcp Ta keepinittime Ta integer Ta yes
1185.It tcp Ta keepintvl Ta integer Ta yes
1186.It tcp Ta mssdflt Ta integer Ta yes
1187.It tcp Ta reasslimit Ta integer Ta yes
1188.It tcp Ta rfc1323 Ta integer Ta yes
1189.It tcp Ta rfc3390 Ta integer Ta yes
1190.It tcp Ta rootonly Ta array Ta yes
1191.It tcp Ta rstppslimit Ta integer Ta yes
1192.It tcp Ta sack Ta integer Ta yes
1193.It tcp Ta slowhz Ta integer Ta no
1194.It tcp Ta stats Ta structure Ta no
1195.It tcp Ta synbucketlimit Ta integer Ta yes
1196.It tcp Ta syncachelimit Ta integer Ta yes
1197.It tcp Ta synhashsize Ta integer Ta yes
1198.It tcp Ta synuselimit Ta integer Ta yes
1199.It udp Ta baddynamic Ta array Ta yes
1200.It udp Ta checksum Ta integer Ta yes
1201.It udp Ta recvspace Ta integer Ta yes
1202.It udp Ta rootonly Ta array Ta yes
1203.It udp Ta sendspace Ta integer Ta yes
1204.It udp Ta stats Ta structure Ta no
1205.El
1206.Pp
1207The variables are as follows:
1208.Bl -tag -width "123456"
1209.It Li ah.enable Pq Va net.inet.ah.enable
1210If set to 1, enable the Authentication Header
1211.Pq AH
1212IPsec protocol.
1213Enabled by default.
1214See
1215.Xr ipsec 4
1216for more information.
1217.It Li bpf.bufsize Pq Va net.bpf.bufsize
1218The initial size of
1219.Xr bpf 4
1220buffers.
1221.It Li bpf.maxbufsize Pq Va net.bpf.maxbufsize
1222The maximum size a user may request a
1223.Xr bpf 4
1224buffer to be.
1225.It Li carp.allow Pq Va net.inet.carp.allow
1226If set to 0, incoming
1227.Xr carp 4
1228packets will not be processed.
1229If set to any other value, processing will occur.
1230Enabled by default.
1231.It Li carp.log Pq Va net.inet.carp.log
1232Controls the verbosity of
1233.Xr carp 4
1234logging.
1235May be a value between 0 and 7 corresponding with
1236.Xr syslog 3
1237priorities.
1238The default value is 2.
1239.It Li carp.preempt Pq Va net.inet.carp.preempt
1240If set to 0,
1241.Xr carp 4
1242will not attempt to become master if it is receiving advertisements from
1243another active master.
1244If set to any other value, carp will become master of the virtual host if it
1245believes it can send advertisements more frequently than the current master.
1246Disabled by default.
1247.It Li divert.recvspace Pq Va net.inet.divert.recvspace
1248Returns the default divert receive buffer size.
1249.It Li divert.sendspace Pq Va net.inet.divert.sendspace
1250Returns the default divert send buffer size.
1251.It Li esp.enable Pq Va net.inet.esp.enable
1252If set to 1, enable the Encapsulating Security Payload
1253.Pq ESP
1254IPsec protocol.
1255Enabled by default.
1256See
1257.Xr ipsec 4
1258for more information.
1259.It Li esp.udpencap Pq Va net.inet.esp.udpencap
1260If set to 1, enable processing of UDP encapsulated ESP packets.
1261Enabled by default.
1262.It Li esp.udpencap_port Pq Va net.inet.udpencap_port
1263Contains the value of the UDP port that triggers
1264decapsulation for incoming UDP encapsulated ESP packets.
1265The default port is 4500.
1266.It Li etherip.allow Pq Va net.inet.etherip.allow
1267If set to 0, incoming Ethernet-in-IPv4 packets will not be processed.
1268If set to any other value, processing will occur.
1269.It Li gre.allow Pq Va net.inet.gre.allow
1270If set to 0, incoming GRE packets will not be processed.
1271If set to any other value, processing will occur.
1272.It Li gre.wccp Pq Va net.inet.gre.wccp
1273If set to 0, incoming WCCPv1-style GRE packets will not be processed.
1274If set to any other value, and gre.allow allows GRE packet processing,
1275WCCPv1-style GRE packets will be processed.
1276.It Li icmp.bmcastecho Pq Va net.inet.icmp.bmcastecho
1277If set to 1, respond to ICMP echo requests destined for
1278broadcast and multicast addresses.
1279Note, enabling this could open a system to a type of denial of service attack
1280called
1281.Qq smurfing ,
1282and is thus not advised.
1283.It Li icmp.errppslimit Pq Va net.inet.icmp.errppslimit
1284This variable specifies the maximum number of outgoing ICMP error messages
1285per second.
1286ICMP error messages exceeding this value are subject to rate limitation
1287and will not go out from the node.
1288A negative value disables rate limitation.
1289.It Li icmp.maskrepl Pq Va kern.inet.icmp.maskrepl
1290Returns 1 if ICMP network mask requests are to be answered.
1291.It Li icmp.rediraccept Pq Va kern.inet.icmp.rediraccept
1292If set to non-zero, the host will accept ICMP redirect packets.
1293Note that routers will never accept ICMP redirect packets,
1294and the variable is meaningful on IP hosts only.
1295.It Li icmp.redirtimeout Pq Va net.inet.icmp.redrttimeout
1296This variable specifies the lifetime of routing entries generated by incoming
1297ICMP redirects.
1298The default timeout is 10 minutes.
1299.It Li icmp.stats Pq Va kern.inet.icmp.stats
1300Returns the ICMP statistics in a struct icmpstat.
1301.It Li icmp.tstamprepl Pq Va net.inet.icmp.tstamprepl
1302If set to 1, reply to ICMP timestamp requests.
1303If set to 0, ignore timestamp requests.
1304.It Li ip.arpdown Pq Va net.inet.ip.arpdown
1305Lifetime of unresolved ARP entries, in seconds.
1306.It Li ip.arptimeout Pq Va net.inet.ip.arptimeout
1307Lifetime of resolved ARP entries, in seconds.
1308.It Li ip.directed-broadcast Pq Va net.inet.ip.directed-broadcast
1309Returns 1 if directed broadcast behavior is enabled for the host.
1310.It Li ip.encdebug Pq Va net.inet.ip.encdebug
1311Returns 1 when error message reporting is enabled for the host.
1312If the kernel has been compiled with the
1313.Dv ENCDEBUG
1314option,
1315then debugging information will also be reported when this variable is set.
1316.It Li ip.forwarding Pq Va net.inet.ip.forwarding
1317If set to 1, then IP forwarding is enabled for the host,
1318indicating the host is acting as a router.
1319If set to 2, then IP forwarding is restricted to traffic that has been
1320IPsec encapsulated or decapsulated by the host.
1321The default value is 0.
1322.It Li ip.ifq
1323Fifth level comprises an array of
1324.Li struct ifqueue
1325structures containing information about IP packet input queue.
1326The fifth level names for the elements of
1327.Li struct ifqueue
1328are detailed below.
1329.Bl -column "Fifth level name" "integer" "Changeable" -offset indent
1330.It Sy "Fifth level name" Ta Sy "Type" Ta Sy "Changeable"
1331.It Dv IFQCTL_DROPS Ta "integer" Ta "no"
1332.It Dv IFQCTL_LEN Ta "integer" Ta "no"
1333.It Dv IFQCTL_MAXLEN Ta "integer" Ta "yes"
1334.El
1335.Pp
1336The variables are as follows:
1337.Pp
1338.Bl -tag -width Ds -compact
1339.It Dv IFQCTL_DROPS Pq Va net.inet.ip.ifq.drops
1340Returns number of packet dropped.
1341.It Dv IFQCTL_LEN Pq Va net.inet.ip.ifq.len
1342Returns the current queue length.
1343.It Dv IFQCTL_MAXLEN Pq Va net.inet.ip.ifq.maxlen
1344Get or set the maximum number of queue length.
1345.El
1346.It Li ip.ipsec-allocs Pq Va net.inet.ip.ipsec-allocs
1347The number of IPsec flows that can use a security association before
1348it expires.
1349If set to less than or equal to zero, the security association will not
1350expire because of this counter.
1351The default value is 0.
1352.It Li ip.ipsec-auth-alg Pq Va net.inet.ip.ipsec-auth-alg
1353This is the default authentication algorithm the kernel will instruct
1354key management daemons to negotiate when establishing security
1355associations on behalf of the kernel.
1356Such security associations can occur as a result of a process having
1357requested some security level through
1358.Xr setsockopt 2 ,
1359or as a result of dynamic VPN entries.
1360Supported values are hmac-md5, hmac-sha1, and hmac-ripemd160.
1361If set to any other value, it is left to the key management daemons to
1362select an authentication algorithm for the security association.
1363The default value is hmac-sha1.
1364.It Li ip.ipsec-bytes Pq Va net.inet.ip.ipsec-bytes
1365The number of bytes that will be processed by a security association
1366before it expires.
1367If set to less than or equal to zero, the security association will not
1368expire because of this counter.
1369The default value is 0.
1370.It Li ip.ipsec-comp-alg Pq Va net.inet.ip.ipsec-comp-alg
1371The compression algorithm to use with an IP Compression Association
1372.Pq IPCA .
1373Possible values are
1374.Dq deflate
1375and
1376.Dq lzs .
1377Note that lzs is only available with
1378.Xr hifn 4 .
1379See
1380.Xr ipsecctl 8
1381for more information.
1382.It Li ip.ipsec-enc-alg Pq Va net.inet.ip.ipsec-enc-alg
1383This is the default encryption algorithm the kernel will instruct key
1384management daemons to negotiate when establishing security
1385associations on behalf of the kernel.
1386Such security associations can occur as a result of a process having
1387requested some security level through
1388.Xr setsockopt 2 ,
1389or as a result of dynamic VPN entries.
1390Supported values are aes, des, 3des, blowfish and cast128.
1391If set to any other value, it is left to the key management daemons to
1392select an encryption algorithm for the security association.
1393The default value is aes.
1394.It Li ip.ipsec-expire-acquire Pq Va net.inet.ip.ipsec-expire-acquire
1395How long the kernel should allow key management to dynamically acquire
1396security associations before re-sending a request.
1397The default value is 30 seconds.
1398.It Li ip.ipsec-firstuse Pq Va net.inet.ip.ipsec-firstuse
1399The number of seconds after a security association is first used before
1400it expires.
1401If set to less than or equal to zero, the security association will
1402not expire because of this timer.
1403The default value is 7200 seconds.
1404.It Li ip.ipsec-invalid-life Pq Va net.inet.ip.ipsec-invalid-life
1405The lifetime of embryonic Security Associations (SAs that key management
1406daemons have reserved but not fully established yet) in seconds.
1407If set to less than or equal to zero, embryonic SAs will not expire.
1408The default value is 60.
1409.It Li ip.ipsec-pfs Pq Va net.inet.ip.ipsec-pfs
1410If set to any non-zero value, the kernel will ask the key management
1411daemons to use Perfect Forward Secrecy when establishing IPsec
1412Security Associations.
1413Perfect Forward Secrecy makes IPsec Security Associations
1414cryptographically distinct from each other, such that breaking the key
1415for one such SA does not compromise any others.
1416Requiring PFS for every security association significantly increases the
1417computational load of
1418.Xr isakmpd 8
1419exchanges.
1420The default value is 1.
1421.It Li ip.ipsec-soft-allocs Pq Va net.inet.ip.ipsec-soft-allocs
1422The number of IPsec flows that can use a security association before a
1423message is sent by the kernel to key management for renegotiation
1424of the security association.
1425If set to less than or equal to zero, no message is sent to key
1426management.
1427The default value is 0.
1428.It Li ip.ipsec-soft-bytes Pq Va net.inet.ip.ipsec-soft-bytes
1429The number of bytes that will be processed by a security association
1430before a message is sent by the kernel to key management for
1431renegotiation of the security association.
1432If set to less than or equal to zero, no message is sent to key
1433management.
1434The default value is 0.
1435.It Li ip.ipsec-soft-firstuse Pq Va net.inet.ip.ipsec-soft-firstuse
1436The number of seconds after a security association is first used
1437before a message is sent by the kernel to key management for
1438renegotiation of the security association.
1439If set to less than or equal to zero, no message is sent to key
1440management.
1441The default value is 3600 seconds.
1442.It Li ip.ipsec-soft-timeout Pq Va net.inet.ip.ipsec-soft-timeout
1443The number of seconds after a security association is established
1444before a message is sent by the kernel to key management for
1445renegotiation of the security association.
1446If set to less than or equal to zero, no message is sent to key
1447management.
1448The default value is 80000 seconds.
1449.It Li ip.ipsec-timeout Pq Va net.inet.ip.ipsec-timeout
1450The number of seconds after a security association is established
1451before it will expire.
1452If set to less than or equal to zero, the security association will
1453not expire because of this timer.
1454The default value is 86400 seconds.
1455.It Li ip.maxqueue Pq Va net.inet.ip.maxqueue
1456Fragment flood protection.
1457Sets the maximum number of unassembled IP fragments in the fragment queue.
1458.It Li ip.mforwarding Pq Va net.inet.ip.mforwarding
1459If set to 1, then multicast forwarding is enabled for the host.
1460The default is 0.
1461.It Li ip.mtudisc Pq Va net.inet.ip.mtudisc
1462Returns 1 if Path MTU Discovery is enabled.
1463.It Li ip.mtudisctimeout Pq Va net.inet.ip.mtudisctimeout
1464Number of seconds in which a route added by the Path MTU
1465Discovery engine will time out.
1466When the route times out, the Path MTU Discovery engine will attempt
1467to probe a larger path MTU.
1468.It Li ip.multipath Pq Va net.inet.ip.multipath
1469This variable enables multipath routing for IPv4 addresses.
1470If set to 0, only the first route selected will be used for a given
1471destination regardless of how many routes exist in the routing table.
1472.It Li ip.portfirst Pq Va net.inet.ip.portfirst
1473Minimum registered port number for TCP/UDP port allocation.
1474Registered ports can be used by ordinary user processes
1475or programs executed by ordinary users.
1476Cannot be less than 1024 or greater than 49151.
1477Must be less than ip.portlast.
1478.It Li ip.porthifirst Pq Va net.inet.ip.porthifirst
1479Minimum dynamic/private port number for TCP/UDP port allocation.
1480Dynamic/private ports can be used by ordinary user processes
1481or programs executed by ordinary users.
1482Cannot be less than 49152 or greater than 65535.
1483Must be less than ip.porthilast.
1484.It Li ip.porthilast Pq Va net.inet.ip.porthilast
1485Maximum dynamic/private port number for TCP/UDP port allocation.
1486Dynamic/private ports can be used by ordinary user processes
1487or programs executed by ordinary users.
1488Cannot be less than 49152 or greater than 65535.
1489Must be greater than ip.porthifirst.
1490.It Li ip.portlast Pq Va net.inet.ip.portlast
1491Maximum registered port number for TCP/UDP port allocation.
1492Registered ports can be used by ordinary user processes
1493or programs executed by ordinary users.
1494Cannot be less than 1024 or greater than 49151.
1495Must be greater than ip.portfirst.
1496.It Li ip.redirect Pq Va net.inet.ip.redirect
1497Returns 1 when ICMP redirects may be sent by the host.
1498This option is ignored unless the host is routing IP packets,
1499and should normally be enabled on all systems.
1500.It Li ip.sourceroute Pq Va net.inet.ip.sourceroute
1501Returns 1 when forwarding of source-routed packets is enabled for
1502the host.
1503When running with a
1504.Xr securelevel 7
1505greater than 0,
1506this variable may not be changed.
1507.It Li ip.stats Pq Va net.inet.ip.stats
1508Returns the IP statistics in a struct ipstat.
1509.It Li ip.ttl Pq Va net.inet.ip.ttl
1510The maximum time-to-live (hop count) value for an IP packet
1511sourced by the system.
1512This value applies to normal transport protocols, not to ICMP.
1513.It Li ipcomp.enable Pq Va net.inet.ipcomp.enable
1514Enable the IPComp protocol.
1515See
1516.Xr ipsecctl 8
1517for more information.
1518.It Li ipip.allow Pq Va net.inet.ipip.allow
1519If set to 0, incoming IP-in-IP packets will not be processed.
1520If set to any other value, processing will occur; furthermore, if set
1521to 2, no checks for spoofing of loopback addresses will be done.
1522This is useful only for debugging purposes, and should never be used
1523in production systems.
1524.It Li mobileip.allow Pq Va net.inet.mobileip.allow
1525If set to 0, incoming Mobile IP encapsulated packets (RFC 2004) will not be
1526processed.
1527If set to any other value, processing will occur.
1528.It Li tcp.ackonpush Pq Va net.inet.tcp.ackonpush
1529Returns 1 if TCP segments with the
1530.Dv TH_PUSH
1531flag set are being acknowledged immediately, otherwise 0.
1532.It Li tcp.baddynamic Pq Va net.inet.tcp.baddynamic
1533An array of
1534.Li in_port_t
1535is returned specifying the bitmask of TCP ports between 512
1536and 1023 inclusive that should not be allocated dynamically
1537by the kernel (i.e., they must be bound specifically by port number).
1538.It Li tcp.ecn Pq Va net.inet.tcp.ecn
1539Returns 1 if Explicit Congestion Notifications for TCP are enabled.
1540.It Li tcp.ident Pq Va net.inet.tcp.ident
1541A
1542.Li struct tcp_ident_mapping
1543specifying a local and foreign endpoint of a TCP
1544socket is filled in with the effective and real UIDs of the process that
1545owns the socket.
1546If no such socket exists, then the effective and real UID values are
1547both set to \-1.
1548.It Li tcp.keepidle Pq Va net.inet.tcp.keepidle
1549If the socket option
1550.Dv SO_KEEPALIVE
1551has been set on a socket, then this value specifies how much time a
1552connection needs to be idle before keepalives are sent.
1553See also tcp.slowhz.
1554.It Li tcp.keepinittime Pq Va net.inet.tcp.keepinittime
1555Time to keep alive the initial SYN packet of a TCP handshake.
1556.It Li tcp.keepintvl Pq Va net.inet.tcp.keepintvl
1557Time after a keepalive probe is sent until, in the absence of any response,
1558another probe is sent.
1559See also tcp.slowhz.
1560.It Li tcp.always_keepalive Pq Va net.inet.tcp.always_keepalive
1561Act as if the option
1562.Dv SO_KEEPALIVE
1563was set on all TCP sockets.
1564.It Li tcp.mssdflt Pq Va net.inet.tcp.mssdflt
1565The maximum segment size that is used as default for non-local connections.
1566The default value is 512.
1567.It Li tcp.reasslimit Pq Va net.inet.tcp.reasslimit
1568The maximum number of out-of-order TCP
1569segments the system will store for reassembly.
1570.It Li tcp.rfc1323 Pq Va net.inet.tcp.rfc1323
1571Returns 1 if RFC 1323 extensions to TCP are enabled.
1572.It Li tcp.rfc3390 Pq Va net.inet.tcp.rfc3390
1573Returns 1 if the TCP Initial Window
1574is increased to 4 * MSS or 4380 bytes, as specified in RFC 3390.
1575Returns 2 if the TCP Initial Window
1576is increased to 10 * MSS or 14600 bytes, as specified in
1577RFC 6928.
1578.It Li tcp.rootonly Pq Va net.inet.tcp.rootonly
1579An array of
1580.Li in_port_t
1581is returned specifying the bitmask of TCP ports
1582that can only be bound by processes with root euid.
1583When running with a
1584.Xr securelevel 7
1585greater than 0,
1586this variable may not be changed.
1587.It Li tcp.rstppslimit Pq Va net.inet.tcp.rstppslimit
1588This variable specifies the maximum number of outgoing TCP RST packets
1589per second.
1590TCP RST packets exceeding this value are subject to rate limitation
1591and will not go out from the node.
1592A negative value disables rate limitation.
1593.It Li tcp.sack Pq Va net.inet.tcp.sack
1594Returns 1 if RFC 2018 Selective Acknowledgements are enabled.
1595.It Li tcp.slowhz Pq Va net.inet.tcp.slowhz
1596The units for tcp.keepidle and tcp.keepintvl; those variables are in ticks
1597of a clock that ticks tcp.slowhz times per second.
1598(That is, their values must be divided by the tcp.slowhz value to get times
1599in seconds.)
1600.It Li tcp.stats Pq Va net.inet.tcp.stats
1601Returns the TCP statistics in a struct tcpstat.
1602.It Li tcp.synbucketlimit Pq Va net.inet.tcp.synbucketlimit
1603The maximum number of entries allowed per hash bucket in the TCP SYN cache.
1604.It Li tcp.syncachelimit Pq Va net.inet.tcp.syncachelimit
1605The maximum number of entries allowed in the TCP SYN cache.
1606.It Li tcp.synhashsize Pq Va net.inet.tcp.synhashsize
1607The number of buckets in the TCP SYN cache hash array.
1608After the value is set, the actual size changes when the alternative
1609SYN cache becomes empty and both SYN caches are swapped.
1610.It Li tcp.synuselimit Pq Va net.inet.tcp.synuselimit
1611The minimum number of times the hash function for the TCP SYN cache is used
1612before it is reseeded.
1613.It Li udp.baddynamic Pq Va net.inet.udp.baddynamic
1614Analogous to
1615.Li tcp.baddynamic
1616but for UDP sockets.
1617.It Li udp.checksum Pq Va net.inet.udp.checksum
1618Returns 1 when UDP checksums are being computed and checked.
1619Disabling UDP checksums is strongly discouraged.
1620.It Li udp.recvspace Pq Va net.inet.udp.recvspace
1621Returns the default UDP receive buffer size.
1622.It Li udp.rootonly Pq Va net.inet.udp.rootonly
1623Analogous to
1624.Li tcp.rootonly
1625but for UDP sockets.
1626.It Li udp.sendspace Pq Va net.inet.udp.sendspace
1627Returns the default UDP send buffer size.
1628.It Li udp.stats Pq Va net.inet.udp.stats
1629Returns the UDP statistics in a struct udpstat.
1630.El
1631.It Dv PF_INET6
1632Get or set various global information about IPv6
1633.Pq Internet Protocol version 6 .
1634The third level name is the protocol.
1635The fourth level name is the variable name.
1636The currently defined protocols and names are:
1637.Bl -column "Protocol name" "multicast_mtudisc" "integer" "yes" -offset indent
1638.It Sy "Protocol name" Ta Sy "Variable name" Ta Sy "Type" Ta Sy "Changeable"
1639.It icmp6 Ta errppslimit Ta integer Ta yes
1640.It icmp6 Ta mtudisc_hiwat Ta integer Ta yes
1641.It icmp6 Ta mtudisc_lowat Ta integer Ta yes
1642.It icmp6 Ta nd6_debug Ta integer Ta yes
1643.It icmp6 Ta nd6_delay Ta integer Ta yes
1644.It icmp6 Ta nd6_maxnudhint Ta integer Ta yes
1645.It icmp6 Ta nd6_mmaxtries Ta integer Ta yes
1646.It icmp6 Ta nd6_umaxtries Ta integer Ta yes
1647.It icmp6 Ta redirtimeout Ta integer Ta yes
1648.It ip6 Ta auto_flowlabel Ta integer Ta yes
1649.It ip6 Ta dad_count Ta integer Ta yes
1650.It ip6 Ta dad_pending Ta integer Ta yes
1651.It ip6 Ta defmcasthlim Ta integer Ta yes
1652.It ip6 Ta forwarding Ta integer Ta yes
1653.It ip6 Ta hdrnestlimit Ta integer Ta yes
1654.It ip6 Ta hlim Ta integer Ta yes
1655.It ip6 Ta ifq Ta node Ta "N/A"
1656.It ip6 Ta log_interval Ta integer Ta yes
1657.It ip6 Ta maxdynroutes Ta integer Ta yes
1658.It ip6 Ta maxfragpackets Ta integer Ta yes
1659.It ip6 Ta maxfrags Ta integer Ta yes
1660.It ip6 Ta mforwarding Ta integer Ta yes
1661.It ip6 Ta mtudisctimeout Ta integer Ta yes
1662.It ip6 Ta multicast_mtudisc Ta integer Ta yes
1663.It ip6 Ta multipath Ta integer Ta yes
1664.It ip6 Ta neighborgcthresh Ta integer Ta yes
1665.It ip6 Ta redirect Ta integer Ta yes
1666.It ip6 Ta soiikey Ta uint8_t[] Ta yes
1667.It ip6 Ta use_deprecated Ta integer Ta yes
1668.El
1669.Pp
1670The variables are as follows:
1671.Pp
1672.Bl -tag -width "123456" -compact
1673.It Li icmp6.errppslimit Pq Va net.inet6.icmp6.errppslimit
1674This variable specifies the maximum number of outgoing ICMPv6 error messages
1675per second.
1676ICMPv6 error messages exceeding this value are subject to rate limitation
1677and will not go out from the node.
1678A negative value will disable the rate limitation.
1679.Pp
1680.It Li icmp6.mtudisc_hiwat Pq Va net.inet6.icmp6.mtudisc_hiwat
1681.It Li icmp6.mtudisc_lowat Pq Va net.inet6.icmp6.mtudisc_lowat
1682These variables define the maximum number of routing table entries
1683created due to path MTU discovery
1684.Pq preventing denial-of-service attacks with ICMPv6 too big messages .
1685After IPv6 path MTU discovery happens, path MTU information is kept in
1686the routing table.
1687If the number of routing table entries exceeds this value,
1688the kernel will not attempt to keep the path MTU information.
1689.Li icmp6.mtudisc_hiwat
1690is used when we have verified ICMPv6 too big messages.
1691.Li icmp6.mtudisc_lowat
1692is used when we have unverified ICMPv6 too big messages.
1693Verification is performed by using address/port pairs kept in connected PCBs.
1694A negative value disables the upper limit.
1695.Pp
1696.It Li icmp6.nd6_debug Pq Va net.inet6.icmp6.nd6_debug
1697If set to non-zero, IPv6 neighbor discovery will generate debugging
1698messages.
1699The debug output is useful for diagnosing IPv6 interoperability issues.
1700The flag must be set to 0 for normal operation.
1701.Pp
1702.It Li icmp6.nd6_delay Pq Va net.inet6.icmp6.nd6_delay
1703This variable specifies the
1704.Dv DELAY_FIRST_PROBE_TIME
1705timing constant in IPv6 neighbor discovery specification
1706.Pq RFC 4861 ,
1707in seconds.
1708.Pp
1709.It Li icmp6.nd6_maxnudhint Pq Va net.inet6.icmp6.nd6_maxnudhint
1710IPv6 neighbor discovery permits upper layer protocols to supply reachability
1711hints, to avoid unnecessary neighbor discovery exchanges.
1712This variable defines the number of consecutive hints the neighbor discovery
1713layer will take.
1714For example, by setting the variable to 3, neighbor discovery will take
1715a maximum of 3 consecutive hints.
1716After receiving 3 hints, the neighbor discovery layer will instead perform
1717the normal neighbor discovery process.
1718.Pp
1719.It Li icmp6.nd6_mmaxtries Pq Va net.inet6.icmp6.nd6_mmaxtries
1720This variable specifies the
1721.Dv MAX_MULTICAST_SOLICIT
1722constant in IPv6 neighbor discovery specification
1723.Pq RFC 4861 .
1724.Pp
1725.It Li icmp6.nd6_umaxtries Pq Va net.inet6.icmp6.nd6_umaxtries
1726This variable specifies the
1727.Dv MAX_UNICAST_SOLICIT
1728constant in IPv6 neighbor discovery specification
1729.Pq RFC 4861 .
1730.Pp
1731.It Li icmp6.redirtimeout Pq Va net.inet6.icmp6.redirtimeout
1732The variable specifies the lifetime of routing entries generated by
1733incoming ICMPv6 redirects.
1734.Pp
1735.It Li ip6.auto_flowlabel Pq Va net.inet6.ip6.auto_flowlabel
1736On connected transport protocol packets,
1737fill the IPv6 flowlabel field to help intermediate routers identify
1738packet flows.
1739.Pp
1740.It Li ip6.dad_count Pq Va net.inet6.ip6.dad_count
1741This variable configures the number of IPv6 DAD
1742.Pq duplicated address detection
1743probe packets.
1744These packets are generated when IPv6 interfaces are first brought up.
1745.Pp
1746.It Li ip6.dad_pending Pq Va net.inet6.ip6.dad_pending
1747This variable displays the number of pending IPv6 DAD
1748.Pq duplicated address detection
1749before completion.
1750It is used to make sure that DAD is completed before
1751.Xr netstart 8
1752is executed.
1753.Pp
1754.It Li ip6.defmcasthlim Pq Va net.inet6.ip6.defmcasthlim
1755The default hop limit value for an IPv6 multicast packet sourced by the node.
1756This value applies to all the transport protocols on top of IPv6.
1757Methods for overriding this value are documented in
1758.Xr ip6 4 .
1759.Pp
1760.It Li ip6.forwarding Pq Va net.inet6.ip6.forwarding
1761Returns 1 when IPv6 forwarding is enabled for the node,
1762meaning that the node is acting as a router.
1763Returns 0 when IPv6 forwarding is disabled for the node,
1764meaning that the node is acting as a host.
1765Note that IPv6 defines node behavior for the
1766.Dq router
1767and
1768.Dq host
1769cases quite differently, and changing this variable during operation
1770may cause serious trouble.
1771Hence, this variable should only be set at bootstrap time.
1772.Pp
1773.It Li ip6.hdrnestlimit Pq Va net.inet6.ip6.hdrnestlimit
1774The number of IPv6 extension headers permitted on incoming IPv6 packets.
1775If set to 0, the node will accept as many extension headers as possible.
1776.Pp
1777.It Li ip6.hlim Pq Va net.inet6.ip6.hlim
1778The default hop limit value for an IPv6 unicast packet sourced by the node.
1779This value applies to all the transport protocols on top of IPv6.
1780Methods for overriding this value are documented in
1781.Xr ip6 4 .
1782.Pp
1783.It Li ip6.ifq Pq Va net.inet6.ip6.ifq
1784Fifth level comprises an array of
1785.Li struct ifqueue
1786structures containing information about IPv6 packet input queue.
1787The fifth level names for the elements of
1788.Li struct ifqueue
1789are detailed above in
1790.Li ip.ifq .
1791.Pp
1792.It Li ip6.log_interval Pq Va net.inet6.ip6.log_interval
1793This variable permits adjusting the amount of logs generated by the
1794IPv6 packet forwarding engine.
1795The value indicates the number of
1796seconds of interval which must elapse between log output.
1797.Pp
1798.It Li ip6.maxdynroutes Pq Va net.inet6.ip6.maxdynroutes
1799Maximum number of routes created by redirect.
1800Set to negative to disable.
1801The default value is 4096.
1802.Pp
1803.It Li ip6.maxfragpackets Pq Va net.inet6.ip6.maxfragpackets
1804The maximum number of fragmented packets the node will accept.
18050 means that the node will not accept any fragmented packets.
1806\-1 means that the node will accept as many fragmented packets as it receives.
1807The flag is provided basically for avoiding possible DoS attacks.
1808.Pp
1809.It Li ip6.maxfrags Pq Va net.inet6.ip6.maxfrags
1810The maximum number of fragments the node will accept.
18110 means that the node will not accept any fragments.
1812\-1 means that the node will accept as many fragments as it receives.
1813The flag is provided basically for avoiding possible DoS attacks.
1814.Pp
1815.It Li ip6.mforwarding Pq Va net.inet6.ip6.mforwarding
1816If set to 1, then multicast forwarding is enabled for the host.
1817The default is 0.
1818.Pp
1819.It Li ip6.multicast_mtudisc Pq Va net.inet6.ip6.multicast_mtudisc
1820This variable controls generation of ICMPv6 Too Big messages
1821when the machine is performing as an IPv6 multicast router.
1822If set to 1, an ICMPv6 Too Big message will be generated for multicast packets
1823which were too big to be forwarded.
1824If set to 0, the ICMPv6 Too Big message will be suppressed.
1825.Pp
1826.It Li ip6.multipath Pq Va net.inet6.ip6.multipath
1827This variable enables multipath routing for IPv6 addresses.
1828If set to 0, only the first route selected will be used for a given
1829destination regardless of how many routes exist in the routing table.
1830.Pp
1831.It Li ip6.mtudisctimeout Pq Va net.inet6.ip6.mtudisctimeout
1832Number of seconds in which a route added by the Path MTU
1833Discovery engine will time out.
1834When the route times out, the Path MTU Discovery engine will attempt
1835to probe a larger path MTU.
1836.Pp
1837.It Li ip6.neighborgcthresh Pq Va net.inet6.ip6.neighborgcthresh
1838Maximum number of entries in neighbor cache.
1839Set to negative to disable.
1840The default value is 2048.
1841.Pp
1842.It Li ip6.redirect Pq Va net.inet6.ip6.redirect
1843Returns 1 when ICMPv6 redirects may be sent by the node.
1844This option is ignored unless the node is routing IP packets,
1845and should normally be enabled on all systems.
1846.Pp
1847.It Li ip6.soii Pq Va net.inet6.ip6.soiikey
1848This variable configures the secret key for the RFC 7217 algorithm to
1849calculate a persistent Semantically Opaque Interface Identifier (SOII)
1850for IPv6 link local and Stateless Address Autoconfiguration (SLAAC) addresses.
1851.Pp
1852.It Li ip6.use_deprecated Pq Va net.inet6.ip6.use_deprecated
1853This variable controls the use of deprecated addresses, specified in
1854RFC 4862 5.5.4.
1855.El
1856.Pp
1857We reuse
1858.Li net.inet.tcp
1859and
1860.Li net.inet.udp
1861for TCP/UDP over IPv6.
1862.It Dv PF_KEY
1863Return
1864.Xr ipsec 4
1865database dumps.
1866The second level name is
1867.Dv PF_KEY_V2 .
1868The third level name selects the database as follows:
1869.Pp
1870.Bl -tag -width "NET_KEY_SADB_DUMP" -offset indent -compact
1871.It Dv NET_KEY_SADB_DUMP
1872Security Association database (SADB).
1873.It Dv NET_KEY_SPD_DUMP
1874IPsec flow database (SPD).
1875.El
1876.It Dv PF_MPLS
1877Get or set global information about MPLS (Multiprotocol Label Switching).
1878.Bl -column "MPLSCTL_MAXINKLOOP " "integer" "not applicable" -offset indent
1879.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
1880.It Dv MPLSCTL_DEFTTL Ta integer Ta yes
1881.It Dv MPLSCTL_IFQUEUE Ta node Ta "not applicable"
1882.It Dv MPLSCTL_MAPTTL_IP Ta integer Ta yes
1883.It Dv MPLSCTL_MAPTTL_IP6 Ta integer Ta yes
1884.It Dv MPLSCTL_MAXINKLOOP Ta integer Ta yes
1885.El
1886.Bl -tag -width "123456"
1887.It Dv MPLSCTL_DEFTTL Pq Va net.mpls.ttl
1888Set or get the default TTL value which is used for MPLS (Shim) Header.
1889The default is 255.
1890.It Dv MPLSCTL_IFQUEUE Pq Va net.mpls.ifq
1891Fourth level comprises an array of
1892.Li struct ifqueue
1893structures containing information about MPLS packet input queue.
1894The forth level names for the elements of
1895.Li struct ifqueue are same as described in
1896.Li ip.ifq
1897in the
1898.Dv PF_INET
1899section.
1900.It Dv MPLSCTL_MAPTTL_IP Pq Va net.mpls.mapttl_ip
1901If set to 1 the TTL field is synchronized between the IP header and the
1902MPLS label stack.
1903If set to 0 the IP header TTL is not modified while passing through MPLS
1904and the MPLS label stack is initialized with the
1905.Dv MPLSCTL_DEFTTL .
1906The default is 1.
1907.It Dv MPLSCTL_MAPTTL_IP6 Pq Va net.mpls.mapttl_ip6
1908If set to 1 the TTL field is synchronized between the IPv6 header and the
1909MPLS label stack.
1910If set to 0 the IPv6 header TTL is not modified while passing through MPLS
1911and the MPLS label stack is initialized with the
1912.Dv MPLSCTL_DEFTTL .
1913The default is 0.
1914.It Dv MPLSCTL_MAXINKLOOP Pq Va net.mpls.maxloop_inkernel
1915Set or get the maxinum number of label stack operations (push, swap, pop)
1916that can be made on a packet.
1917The default is 16.
1918.El
1919.It Dv PF_PIPEX Pq Va net.pipex
1920Get or set global information about PIPEX.
1921.Pp
1922The currently defined variable names are:
1923.Bl -column "Third level name" "integer" "Changeable" -offset indent
1924.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
1925.It Dv PIPEXCTL_ENABLE Ta integer Ta yes
1926.It Dv PIPEXCTL_INQ Ta node Ta not applicable
1927.It Dv PIPEXCTL_OUTQ Ta node Ta not applicable
1928.El
1929.Bl -tag -width "123456"
1930.It Dv PIPEXCTL_ENABLE
1931If set to 1, enable PIPEX processing.
1932The default is 0.
1933.It Dv PIPEXCTL_INQ Pq Va net.pipex.inq
1934Fourth level comprises an array of
1935.Li struct ifqueue
1936structures containing information about the PIPEX packet input queue.
1937The forth level names for the elements of
1938.Li struct ifqueue
1939are the same as described in
1940.Li ip.ifq
1941in the
1942.Dv PF_INET
1943section.
1944.It Dv PIPEXCTL_OUTQ Pq Va net.pipex.outq
1945Fourth level comprises an array of
1946.Li struct ifqueue
1947structures containing information about PIPEX packet output queue.
1948The forth level names for the elements of
1949.Li struct ifqueue are same as described in
1950.Li ip.ifq
1951in the
1952.Dv PF_INET
1953section.
1954.El
1955.El
1956.Ss CTL_VFS
1957The string and integer information available for the
1958.Dv CTL_VFS
1959level is detailed below.
1960The changeable column shows whether a process with appropriate
1961privileges may change the value.
1962.Bl -column "Second level name" "VFS generic info" "Changeable" -offset indent
1963.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
1964.It Dv VFS_GENERIC Ta "VFS generic info" Ta "no"
1965.It Dv "filesystem #" Ta "filesystem info" Ta "no"
1966.El
1967.Bl -tag -width "123456"
1968.It Dv VFS_GENERIC
1969This second level identifier requests generic information about the
1970VFS layer.
1971Within it, the following third level identifiers exist:
1972.Bl -column "Third level name" "struct vfsconf" "Changeable" -offset indent
1973.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
1974.It Dv VFS_CONF Ta "struct vfsconf" Ta "no"
1975.It Dv VFS_MAXTYPENUM Ta "int" Ta "no"
1976.El
1977.It filesystem #
1978After finding the filesystem dependent
1979.Va vfc_typenum
1980using
1981.Dv VFS_GENERIC
1982with
1983.Dv VFS_CONF ,
1984it is possible to access filesystem dependent information.
1985.Pp
1986Some filesystems may contain settings.
1987.Bl -tag -width "123"
1988.It FFS
1989.Bl -column "FFS_SD_DIRECT_BLK_PTRS" "integer" "Changeable" -offset indent
1990.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
1991.It Dv FFS_DIRHASH_DIRSIZE Ta "integer" Ta "yes"
1992.It Dv FFS_DIRHASH_MAXMEM Ta "integer" Ta "yes"
1993.It Dv FFS_DIRHASH_MEM Ta "integer" Ta "no"
1994.It Dv FFS_MAX_SOFTDEPS Ta "integer" Ta "yes"
1995.It Dv FFS_SD_BLK_LIMIT_HIT Ta "integer" Ta "yes"
1996.It Dv FFS_SD_BLK_LIMIT_PUSH Ta "integer" Ta "yes"
1997.It Dv FFS_SD_DIR_ENTRY Ta "integer" Ta "yes"
1998.It Dv FFS_SD_DIRECT_BLK_PTRS Ta "integer" Ta "yes"
1999.It Dv FFS_SD_INDIR_BLK_PTRS Ta "integer" Ta "yes"
2000.It Dv FFS_SD_INO_LIMIT_HIT Ta "integer" Ta "yes"
2001.It Dv FFS_SD_INO_LIMIT_PUSH Ta "integer" Ta "yes"
2002.It Dv FFS_SD_INODE_BITMAP Ta "integer" Ta "yes"
2003.It Dv FFS_SD_SYNC_LIMIT_HIT Ta "integer" Ta "yes"
2004.It Dv FFS_SD_TICKDELAY Ta "integer" Ta "yes"
2005.It Dv FFS_SD_WORKLIST_PUSH Ta "integer" Ta "yes"
2006.El
2007.Bl -tag -width "123456"
2008.It Dv FFS_DIRHASH_DIRSIZE Pq Va vfs.ffs.dirhash_dirsize
2009The minimum size of a directory, in bytes, before it is considered for hashing.
2010.It Dv FFS_DIRHASH_MAXMEM Pq Va vfs.ffs.dirhash_maxmem
2011The maximum amount of memory, in bytes, to be used for storing directory
2012hashes.
2013.It Dv FFS_DIRHASH_MEM Pq Va vfs.ffs.dirhash_mem
2014The amount of memory currently used by all directory hashes.
2015.It Dv FFS_MAX_SOFTDEPS Pq Va vfs.ffs.max_softdeps
2016Maximum strcuctures before slowdowns.
2017.It Dv FFS_SD_BLK_LIMIT_HIT Pq Va vfs.ffs.sd_blk_limit_hit
2018Number of times block slowdown imposed.
2019.It Dv FFS_SD_BLK_LIMIT_PUSH Pq Va vfs.ffs.sd_blk_limit_push
2020Number of times block limit neared.
2021.It Dv FFS_SD_DIR_ENTRY Pq Va vfs.ffs.sd_dir_entry
2022Bufs redirtied as dir entry cannot write.
2023.It Dv FFS_SD_DIRECT_BLK_PTRS Pq Va vfs.ffs.sd_direct_blk_ptrs
2024Bufs redirtied as direct ptrs not written.
2025.It Dv FFS_SD_INDIR_BLK_PTRS Pq Va vfs.ffs.sd_indir_blk_ptrs
2026Bufs redirtied as indirect ptrs not written.
2027.It Dv FFS_SD_INO_LIMIT_HIT Pq Va vfs.ffs.sd_ino_limit_hit
2028Number of times inode limit imposed.
2029.It Dv FFS_SD_INO_LIMIT_PUSH Pq Va vfs.ffs.sd_ino_limit_push
2030Number of times inode limit neared.
2031.It Dv FFS_SD_INODE_BITMAP Pq Va vfs.ffs.sd_inode_bitmap
2032Bufs redirtied as inode bitmap not written.
2033.It Dv FFS_SD_SYNC_LIMIT_HIT Pq Va vfs.ffs.sd_sync_limit_hit
2034Number of synchronous slowdowns imposed.
2035.It Dv FFS_SD_TICKDELAY Pq Va vfs.ffs.sd_tickdelay
2036Ticks to pause during slowdown.
2037.It Dv FFS_SD_WORKLIST_PUSH Pq Va vfs.ffs.sd_worklist_push
2038Number of worklist cleanups.
2039.El
2040.It NFS
2041.Bl -column "Third level name" "struct nfsstats" "Changeable" -offset indent
2042.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
2043.It Dv NFS_NFSSTATS Ta "struct nfsstats" Ta "yes"
2044.It Dv NFS_NIOTHREADS Ta "int" Ta "yes"
2045.El
2046.Bl -tag -width Ds
2047.It Dv NFS_NIOTHREADS Pq Va vfs.nfs.iothreads
2048The number of I/O kernel threads for NFS clients.
2049The default is 4;
2050the maximum is 20.
2051.El
2052.It FUSE
2053.Bl -column "FUSEFS_POOL_NBPAGES" "Type" "Changeable" -offset indent
2054.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
2055.It Dv FUSEFS_INFBUFS Ta "int" Ta "no"
2056.It Dv FUSEFS_OPENDEVS Ta "int" Ta "no"
2057.It Dv FUSEFS_POOL_NBPAGES Ta "int" Ta "no"
2058.It Dv FUSEFS_WAITFBUFS Ta "int" Ta "no"
2059.El
2060.Bl -tag -width Ds
2061.It Dv FUSEFS_INFBUFS Pq Va vfs.fuse.fusefs_fbufs_in
2062The number of inbound fusebufs.
2063.It Dv FUSEFS_OPENDEVS Pq Va vfs.fuse.fusefs_open_devices
2064The number of FUSE devices opened.
2065.It Dv FUSEFS_POOL_NBPAGES Pq Va vfs.fuse.fusefs_pool_pages
2066The number of pages used for fusebuf memory.
2067.It Dv FUSEFS_WAITFBUFS Pq Va vfs.fuse.fusefs_fbufs_wait
2068The number of fusebufs waiting for a response.
2069.El
2070.El
2071.El
2072.Ss CTL_VM
2073The string and integer information available for the
2074.Dv CTL_VM
2075level is detailed below.
2076The changeable column shows whether a process with appropriate
2077privileges may change the value.
2078.Bl -column "Second level name" "swap encrypt values" "yes" -offset indent
2079.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
2080.It Dv VM_ANONMIN Ta "integer" Ta "yes"
2081.It Dv VM_LOADAVG Ta "struct loadavg" Ta "no"
2082.It Dv VM_MAXSLP Ta "integer" Ta "no"
2083.It Dv VM_METER Ta "struct vmtotal" Ta "no"
2084.It Dv VM_NKMEMPAGES Ta "integer" Ta "no"
2085.It Dv VM_PSSTRINGS Ta "struct psstrings" Ta "no"
2086.It Dv VM_SWAPENCRYPT Ta "swap encrypt values" Ta "yes"
2087.It Dv VM_USPACE Ta "integer" Ta "no"
2088.It Dv VM_UVMEXP Ta "struct uvmexp" Ta "no"
2089.It Dv VM_VNODEMIN Ta "integer" Ta "yes"
2090.It Dv VM_VTEXTMIN Ta "integer" Ta "yes"
2091.El
2092.Bl -tag -width "123456"
2093.It Dv VM_ANONMIN Pq Va vm.anonmin
2094Percentage of physical memory available for
2095pages which contain anonymous mapping.
2096.It Dv VM_LOADAVG Pq Va vm.loadavg
2097Return the load average history.
2098The returned data consists of a
2099.Li struct loadavg .
2100.It Dv VM_MAXSLP Pq Va vm.maxslp
2101The time for a process to be blocked before being swappable,
2102in seconds.
2103.It Dv VM_METER Pq Va vm.vmmeter
2104Return the system wide virtual memory statistics.
2105The returned data consists of a
2106.Li struct vmtotal .
2107.It Dv VM_NKMEMPAGES Pq Va vm.nkmempages
2108Number of pages in kmem_map.
2109.It Dv VM_PSSTRINGS Pq Va vm.psstrings
2110Returns the address of the process
2111.Li struct ps_strings .
2112The
2113.Xr ps 1
2114program uses it to locate the argument and environment strings.
2115.It Dv VM_SWAPENCRYPT
2116Contains statistics about swap encryption.
2117The string and integer information available for the third level is
2118detailed below.
2119.Bl -column "Third level name" "integer" "Changeable" -offset indent
2120.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
2121.It Dv SWPENC_CREATED Ta "integer" Ta "no"
2122.It Dv SWPENC_DELETED Ta "integer" Ta "no"
2123.It Dv SWPENC_ENABLE Ta "integer" Ta "yes"
2124.El
2125.Bl -tag -width "123456"
2126.It Dv SWPENC_CREATED Pq Va vm.swapencrypt.keyscreated
2127The number of encryption keys that have been randomly created.
2128The swap partition is divided into sections of normally 512KB.
2129Each section has its own encryption key.
2130.It Dv SWPENC_DELETED Pq Va vm.swapencrypt.keysdeleted
2131The number of encryption keys that have been deleted, thus effectively
2132erasing the data that has been encrypted with them.
2133Encryption keys are deleted when their reference counter reaches zero.
2134.It Dv SWPENC_ENABLE Pq Va vm.swapencrypt.enable
2135Set to 1 to enable swap encryption for all processes.
2136A 0 disables swap encryption.
2137Pages still on swap receive a grandfather clause.
2138Turning this option on does not affect legacy swap data already on the disk,
2139but all newly written data will be encrypted.
2140When swap encryption is turned on, automatic
2141.Xr crash 8
2142dumps are disabled.
2143.El
2144.It Dv VM_USPACE Pq Va vm.uspace
2145The number of bytes allocated for each kernel stack.
2146.It Dv VM_UVMEXP Pq Va vm.uvmexp
2147Contains statistics about the UVM memory management system.
2148.It Dv VM_VNODEMIN Pq Va vm.vnodemin
2149Percentage of physical memory available for
2150pages which contain cached file data.
2151.It Dv VM_VTEXTMIN Pq Va vm.vtextmin
2152Percentage of physical memory available for
2153pages which contain cached executable data.
2154.El
2155.Sh RETURN VALUES
2156If the call to
2157.Fn sysctl
2158is unsuccessful, \-1 is returned and
2159.Va errno
2160is set appropriately.
2161.Sh FILES
2162.Bl -tag -width "uvm/uvmXswapXencrypt.h  " -compact
2163.It In sys/sysctl.h
2164top level identifiers and second level kernel and hardware
2165identifiers
2166.It In sys/socket.h
2167second level network identifiers
2168.It In sys/gmon.h
2169third level profiling identifiers
2170.It In uvm/uvm_param.h
2171second level virtual memory identifiers
2172.It In uvm/uvm_swap_encrypt.h
2173third level virtual memory identifiers
2174.It In net/if.h
2175packet input/output queue identifiers
2176.It In net/pipex.h
2177third level PIPEX identifiers
2178.It In netinet/in.h
2179third and fourth level IPv4/v6 identifiers
2180.It In netinet/ip_divert.h
2181fourth level divert identifiers
2182.It In netinet/icmp_var.h
2183fourth level ICMP identifiers
2184.It In netinet/icmp6.h
2185fourth level ICMPv6 identifiers
2186.It In netinet/tcp_var.h
2187fourth level TCP identifiers
2188.It In netinet/udp_var.h
2189fourth level UDP identifiers
2190.It In ddb/db_var.h
2191second level ddb identifiers
2192.It In sys/mount.h
2193second level vfs identifiers
2194.It In miscfs/fuse/fusefs.h
2195third level fusefs identifiers
2196.It In nfs/nfs.h
2197third level NFS identifiers
2198.It In ufs/ffs/ffs_extern.h
2199third level FFS identifiers
2200.It In machine/cpu.h
2201second level CPU identifiers
2202.El
2203.Sh ERRORS
2204The following errors may be reported:
2205.Bl -tag -width Er
2206.It Bq Er EFAULT
2207The buffer
2208.Fa name ,
2209.Fa oldp ,
2210.Fa newp ,
2211or length pointer
2212.Fa oldlenp
2213contains an invalid address.
2214.It Bq Er EINVAL
2215The
2216.Fa name
2217array is less than two or greater than
2218.Dv CTL_MAXNAME .
2219.It Bq Er EINVAL
2220A non-null
2221.Fa newp
2222pointer is given and its specified length in
2223.Fa newlen
2224is too large or too small.
2225.It Bq Er ENOMEM
2226The length pointed to by
2227.Fa oldlenp
2228is too short to hold the requested value.
2229.It Bq Er ENOENT
2230The mib specified does not exist, or exceeds the range that is possible.
2231.It Bq Er ENXIO
2232If the mib is a sparsely populated array, this error may be returned
2233instead.
2234.It Bq Er ENOTDIR
2235The
2236.Fa name
2237array specifies an intermediate rather than terminal name.
2238.It Bq Er EOPNOTSUPP
2239The
2240.Fa name
2241array specifies a value that is unknown.
2242.It Bq Er EPERM
2243An attempt is made to set a read-only value.
2244.It Bq Er EPERM
2245A process without appropriate privileges attempts to set a value.
2246.It Bq Er EPERM
2247An attempt to change a value protected by the current kernel security
2248level is made.
2249.It Bq Er ESRCH
2250No process could be found which corresponds to the given process ID.
2251.El
2252.Sh SEE ALSO
2253.Xr pathconf 2 ,
2254.Xr sysconf 3 ,
2255.Xr ddb 4 ,
2256.Xr sysctl.conf 5 ,
2257.Xr securelevel 7 ,
2258.Xr sysctl 8
2259.Sh HISTORY
2260The
2261.Fn sysctl
2262function first appeared in
2263.Bx 4.4 .
2264