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