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