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