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