]> git.saurik.com Git - apple/libc.git/blame - gen/FreeBSD/sysctl.3
Libc-1082.50.1.tar.gz
[apple/libc.git] / gen / FreeBSD / sysctl.3
CommitLineData
5b2abdfb
A
1.\" Copyright (c) 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
5b2abdfb
A
12.\" 4. Neither the name of the University nor the names of its contributors
13.\" may be used to endorse or promote products derived from this software
14.\" without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95
23e20b00 29.\" $FreeBSD$
5b2abdfb 30.\"
23e20b00 31.Dd May 17, 2013
5b2abdfb
A
32.Dt SYSCTL 3
33.Os
34.Sh NAME
35.Nm sysctl ,
36.Nm sysctlbyname ,
37.Nm sysctlnametomib
38.Nd get or set system information
39.Sh LIBRARY
40.Lb libc
41.Sh SYNOPSIS
42.In sys/types.h
43.In sys/sysctl.h
44.Ft int
45.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
46.Ft int
47.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
48.Ft int
49.Fn sysctlnametomib "const char *name" "int *mibp" "size_t *sizep"
50.Sh DESCRIPTION
51The
52.Fn sysctl
53function retrieves system information and allows processes with
54appropriate privileges to set system information.
55The information available from
56.Fn sysctl
57consists of integers, strings, and tables.
58Information may be retrieved and set from the command interface
59using the
60.Xr sysctl 8
61utility.
62.Pp
63Unless explicitly noted below,
64.Fn sysctl
65returns a consistent snapshot of the data requested.
66Consistency is obtained by locking the destination
67buffer into memory so that the data may be copied out without blocking.
68Calls to
69.Fn sysctl
70are serialized to avoid deadlock.
71.Pp
72The state is described using a ``Management Information Base'' (MIB)
73style name, listed in
74.Fa name ,
75which is a
76.Fa namelen
77length array of integers.
78.Pp
79The
80.Fn sysctlbyname
81function accepts an ASCII representation of the name and internally
3d9156a7
A
82looks up the integer name vector.
83Apart from that, it behaves the same
5b2abdfb
A
84as the standard
85.Fn sysctl
86function.
87.Pp
88The information is copied into the buffer specified by
89.Fa oldp .
90The size of the buffer is given by the location specified by
91.Fa oldlenp
92before the call,
93and that location gives the amount of data copied after a successful call
94and after a call that returns with the error code
95.Er ENOMEM .
96If the amount of data available is greater
97than the size of the buffer supplied,
98the call supplies as much data as fits in the buffer provided
99and returns with the error code
100.Er ENOMEM .
101If the old value is not desired,
102.Fa oldp
103and
104.Fa oldlenp
105should be set to NULL.
106.Pp
107The size of the available data can be determined by calling
108.Fn sysctl
9385eb3d
A
109with the
110.Dv NULL
111argument for
5b2abdfb
A
112.Fa oldp .
113The size of the available data will be returned in the location pointed to by
114.Fa oldlenp .
115For some operations, the amount of space may change often.
116For these operations,
117the system attempts to round up so that the returned size is
118large enough for a call to return the data shortly thereafter.
119.Pp
120To set a new value,
121.Fa newp
122is set to point to a buffer of length
123.Fa newlen
124from which the requested value is to be taken.
125If a new value is not to be set,
126.Fa newp
127should be set to NULL and
128.Fa newlen
129set to 0.
130.Pp
131The
132.Fn sysctlnametomib
133function accepts an ASCII representation of the name,
134looks up the integer name vector,
135and returns the numeric representation in the mib array pointed to by
136.Fa mibp .
137The number of elements in the mib array is given by the location specified by
138.Fa sizep
139before the call,
140and that location gives the number of entries copied after a successful call.
141The resulting
142.Fa mib
143and
144.Fa size
145may be used in subsequent
146.Fn sysctl
147calls to get the data associated with the requested ASCII name.
148This interface is intended for use by applications that want to
149repeatedly request the same variable (the
150.Fn sysctl
151function runs in about a third the time as the same request made via the
152.Fn sysctlbyname
153function).
ad3c9f2a 154.Pp
5b2abdfb 155The top level names are defined with a CTL_ prefix in
3d9156a7 156.In sys/sysctl.h ,
5b2abdfb
A
157and are as follows.
158The next and subsequent levels down are found in the include files
159listed here, and described in separate sections below.
23e20b00 160.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
5b2abdfb 161.It Sy "Name Next level names Description"
3d9156a7
A
162.It "CTL_DEBUG sys/sysctl.h Debugging"
163.It "CTL_VFS sys/mount.h File system"
164.It "CTL_HW sys/sysctl.h Generic CPU, I/O"
165.It "CTL_KERN sys/sysctl.h High kernel limits"
166.It "CTL_MACHDEP sys/sysctl.h Machine dependent"
167.It "CTL_NET sys/socket.h Networking"
168.It "CTL_USER sys/sysctl.h User-level"
ad3c9f2a 169.It "CTL_VM sys/resources.h Virtual memory (struct loadavg)"
5b2abdfb
A
170.El
171.Pp
172For example, the following retrieves the maximum number of processes allowed
173in the system:
174.Pp
175.Bd -literal -offset indent -compact
23e20b00
A
176int maxproc;
177size_t len = sizeof(maxproc);
178sysctlbyname("kern.maxproc", &maxproc, &len, NULL, 0);
5b2abdfb
A
179.Ed
180.Pp
181To retrieve the standard search path for the system utilities:
182.Pp
183.Bd -literal -offset indent -compact
5b2abdfb 184char *p;
23e20b00
A
185size_t len;
186sysctlbyname("user.cs_path", NULL, &len, NULL, 0);
5b2abdfb 187p = malloc(len);
23e20b00 188sysctlbyname("user.cs_path", p, &len, NULL, 0);
5b2abdfb
A
189.Ed
190.Ss CTL_VFS
191A distinguished second level name, VFS_GENERIC,
9385eb3d 192is used to get general information about all file systems.
5b2abdfb 193One of its third level identifiers is VFS_MAXTYPENUM
9385eb3d 194that gives the highest valid file system type number.
5b2abdfb 195Its other third level identifier is VFS_CONF that
9385eb3d 196returns configuration information about the file system
5b2abdfb
A
197type given as a fourth level identifier (see
198.Xr getvfsbyname 3
199as an example of its use).
200The remaining second level identifiers are the
9385eb3d 201file system type number returned by a
5b2abdfb
A
202.Xr statfs 2
203call or from VFS_CONF.
9385eb3d 204The third level identifiers available for each file system
5b2abdfb 205are given in the header file that defines the mount
9385eb3d 206argument structure for that file system.
5b2abdfb
A
207.Ss CTL_HW
208The string and integer information available for the CTL_HW level
209is detailed below.
210The changeable column shows whether a process with appropriate
211privilege may change the value.
23e20b00
A
212.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxx" -offset indent
213.It Sy "Name Type Changeable"
214.It "hw.activecpu int32_t no"
215.It "hw.byteorder int32_t no"
216.It "hw.cacheconfig uint64_t[] no"
217.It "hw.cachelinesize int64_t no"
218.It "hw.cachesize uint64_t[] no"
219.It "hw.cpu64bit_capable int32_t no"
220.It "hw.cpufamily int32_t no"
221.It "hw.cpufrequency int64_t no"
222.It "hw.cpufrequency_max int64_t no"
223.It "hw.cpufrequency_min int64_t no"
224.It "hw.cpusubtype int32_t no"
225.It "hw.cputhreadtype int32_t no"
226.It "hw.cputype int32_t no"
227.It "hw.l1dcachesize int64_t no"
228.It "hw.l1icachesize int64_t no"
229.It "hw.l2cachesize int64_t no"
230.It "hw.l3cachesize int64_t no"
231.It "hw.logicalcpu int32_t no"
232.It "hw.logicalcpu_max int32_t no"
233.It "hw.machine char[] no"
234.It "hw.memsize int64_t no"
235.It "hw.model char[] no"
236.It "hw.ncpu int32_t no"
237.It "hw.packages int32_t no"
238.It "hw.pagesize int64_t no"
239.It "hw.physicalcpu int32_t no"
240.It "hw.physicalcpu_max int32_t no"
241.It "hw.tbfrequency int64_t no"
5b2abdfb 242.El
5b2abdfb 243.Bl -tag -width 6n
23e20b00
A
244.It Li "hw.byteorder"
245The byte order (4321 or 1234).
246.It Li "hw.model"
247The machine model.
248.It Li "hw.ncpu"
249The number of cpus. This attribute is deprecated and it is recommended that
250.Va "hw.logicalcpu" ,
251.Va "hw.logicalcpu_max" ,
252.Va "hw.physicalcpu" ,
253or
254.Va "hw.physicalcpu_max"
255be used instead.
ad3c9f2a
A
256.It Li "hw.logicalcpu"
257The number of logical processors available in the current power management mode.
258.It Li "hw.logicalcpu_max"
259The maximum number of logical processors that could be available this boot.
23e20b00
A
260.It Li "hw.physicalcpu"
261The number of physical processors available in the current power management mode.
262.It Li "hw.physicalcpu_max"
263The maximum number of physical processors that could be available this boot.
264.It Li "hw.pagesize"
265The software page size in bytes.
5b2abdfb
A
266.El
267.Ss CTL_KERN
268The string and integer information available for the CTL_KERN level
269is detailed below.
270The changeable column shows whether a process with appropriate
271privilege may change the value.
272The types of data currently available are process information,
273system vnodes, the open file entries, routing table entries,
274virtual memory statistics, load average history, and clock rate
275information.
23e20b00
A
276.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxxxxxxxxxxxx" -offset indent
277.It Sy "Name Type Changeable"
278.It "kern.argmax int32_t no"
279.It "kern.bootargs char[] no"
280.It "kern.boottime struct timeval no"
281.It "kern.check_openevt int32_t yes"
282.It "kern.clockrate struct clockinfo no"
283.It "kern.coredump int32_t yes"
284.It "kern.corefile char[] yes"
285.It "kern.flush_cache_on_write int32_t yes"
286.It "kern.hostid int32_t yes"
287.It "kern.hostname char[] yes"
288.It "kern.job_control int32_t no"
289.It "kern.maxfiles int32_t yes"
290.It "kern.maxfilesperproc int32_t yes"
291.It "kern.maxnbuf int32_t yes"
292.It "kern.maxproc int32_t yes"
293.It "kern.maxprocperuid int32_t yes"
294.It "kern.maxvnodes int32_t yes"
295.It "kern.msgbuf int32_t yes"
296.It "kern.nbuf int32_t no"
297.It "kern.netboot int32_t no"
298.It "kern.ngroups int32_t no"
299.It "kern.nisdomainname char[] yes"
300.It "kern.num_files int32_t no"
301.It "kern.num_tasks int32_t no"
302.It "kern.num_taskthreads int32_t no"
303.It "kern.num_threads int32_t no"
304.It "kern.num_vnodes int32_t no"
305.It "kern.nx int32_t yes"
306.It "kern.osrelease char[] no"
307.It "kern.osrevision int32_t no"
308.It "kern.ostype char[] no"
309.It "kern.osversion char[] yes"
310.It "kern.posix1version int32_t no"
311.It "kern.procname char[] yes"
312.It "kern.safeboot int32_t no"
313.It "kern.saved_ids int32_t no"
314.It "kern.secure_kernel int32_t no"
315.It "kern.securelevel int32_t yes"
316.It "kern.singleuser int32_t no"
317.It "kern.sleeptime struct timeval no"
318.It "kern.slide int32_t no"
319.It "kern.stack_depth_max int32_t no"
320.It "kern.stack_size int32_t no"
321.It "kern.sugid_coredump int32_t yes"
322.It "kern.sugid_scripts int32_t yes"
323.It "kern.symfile char[] no"
324.It "kern.usrstack int32_t no"
325.It "kern.usrstack64 int64_t no"
326.It "kern.uuid char[] no"
327.It "kern.version char[] no"
328.It "kern.waketime struct timeval no"
5b2abdfb 329.El
5b2abdfb 330.Bl -tag -width 6n
23e20b00 331.It Li "kern.argmax"
5b2abdfb
A
332The maximum bytes of argument to
333.Xr execve 2 .
23e20b00 334.It Li "kern.boottime"
5b2abdfb
A
335A
336.Va struct timeval
337structure is returned.
338This structure contains the time that the system was booted.
23e20b00 339.It Li "kern.clockrate"
5b2abdfb
A
340A
341.Va struct clockinfo
342structure is returned.
343This structure contains the clock, statistics clock and profiling clock
344frequencies, the number of micro-seconds per hz tick and the skew rate.
23e20b00 345.It Li "kern.hostid"
5b2abdfb 346Get or set the host id.
23e20b00 347.It Li "kern.hostname"
5b2abdfb 348Get or set the hostname.
23e20b00 349.It Li "kern.job_control"
5b2abdfb 350Return 1 if job control is available on this system, otherwise 0.
23e20b00 351.It Li "kern.maxfiles"
5b2abdfb 352The maximum number of files that may be open in the system.
23e20b00 353.It Li "kern.maxfilesperproc"
5b2abdfb
A
354The maximum number of files that may be open for a single process.
355This limit only applies to processes with an effective uid of nonzero
356at the time of the open request.
357Files that have already been opened are not affected if the limit
358or the effective uid is changed.
23e20b00 359.It Li "kern.maxproc"
5b2abdfb 360The maximum number of concurrent processes the system will allow.
23e20b00 361.It Li "kern.maxprocperuid"
5b2abdfb
A
362The maximum number of concurrent processes the system will allow
363for a single effective uid.
364This limit only applies to processes with an effective uid of nonzero
365at the time of a fork request.
366Processes that have already been started are not affected if the limit
367is changed.
23e20b00 368.It Li "kern.maxvnodes"
5b2abdfb 369The maximum number of vnodes available on the system.
23e20b00 370.It Li "kern.ngroups"
5b2abdfb 371The maximum number of supplemental groups.
23e20b00 372.It Li "kern.nisdomainname"
5b2abdfb 373The name of the current YP/NIS domain.
23e20b00 374.It Li "kern.osrelease"
5b2abdfb 375The system release string.
23e20b00
A
376.It Li "kern.osrevision"
377The system revision number.
378.It Li "kern.ostype"
5b2abdfb 379The system type string.
23e20b00 380.It Li "kern.posix1version"
5b2abdfb
A
381The version of
382.St -p1003.1
383with which the system
384attempts to comply.
23e20b00 385.It Li "kern.saved_ids"
5b2abdfb 386Returns 1 if saved set-group and saved set-user ID is available.
23e20b00 387.It Li "kern.securelevel"
5b2abdfb
A
388The system security level.
389This level may be raised by processes with appropriate privilege.
390It may not be lowered.
23e20b00 391.It Li "kern.version"
5b2abdfb 392The system version string.
5b2abdfb
A
393.El
394.Ss CTL_MACHDEP
395The set of variables defined is architecture dependent.
396The following variables are defined for the i386 architecture.
23e20b00
A
397.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxx" -offset indent
398.It Sy "Name Type Changeable"
399.It "machdep.cpu.address_bits.physical int32_t no"
400.It "machdep.cpu.address_bits.virtual int32_t no"
401.It "machdep.cpu.brand int32_t no"
402.It "machdep.cpu.brand_string char[] no"
403.It "machdep.cpu.cache.L2_associativity int32_t no"
404.It "machdep.cpu.cache.linesize int32_t no"
405.It "machdep.cpu.cache.size int32_t no"
406.It "machdep.cpu.core_count int32_t no"
407.It "machdep.cpu.cores_per_package int32_t no"
408.It "machdep.cpu.extfamily int32_t no"
409.It "machdep.cpu.extfeature_bits int64_t no"
410.It "machdep.cpu.extfeatures char[] no"
411.It "machdep.cpu.extmodel int32_t no"
412.It "machdep.cpu.family int32_t no"
413.It "machdep.cpu.feature_bits int64_t no"
414.It "machdep.cpu.features char[] no"
415.It "machdep.cpu.leaf7_feature_bits uint32_t no"
416.It "machdep.cpu.leaf7_features char[] no"
417.It "machdep.cpu.logical_per_package int32_t no"
418.It "machdep.cpu.max_basic uint32_t no"
419.It "machdep.cpu.max_ext uint32_t no"
420.It "machdep.cpu.microcode_version int32_t no"
421.It "machdep.cpu.model int32_t no"
422.It "machdep.cpu.processor_flag int32_t no"
423.It "machdep.cpu.signature int32_t no"
424.It "machdep.cpu.stepping int32_t no"
425.It "machdep.cpu.thread_count int32_t no"
426.It "machdep.cpu.tlb.data.large int32_t no"
427.It "machdep.cpu.tlb.data.large_level1 int32_t no"
428.It "machdep.cpu.tlb.data.small int32_t no"
429.It "machdep.cpu.tlb.data.small_level1 int32_t no"
430.It "machdep.cpu.tlb.inst.large int32_t no"
431.It "machdep.cpu.tlb.inst.small int32_t no"
432.It "machdep.cpu.tlb.shared int32_t no"
433.It "machdep.cpu.ucupdate int32_t yes"
434.It "machdep.cpu.vendor char[] no"
435.It "machdep.cpu.xsave.extended_state uint32_t no"
436.It "machdep.tsc.deep_idle_rebase uint32_t yes"
437.It "machdep.tsc.frequency int64_t no"
438.It "machdep.tsc.nanotime.generation uint32_t no"
439.It "machdep.tsc.nanotime.shift uint32_t no"
5b2abdfb
A
440.El
441.Ss CTL_NET
442The string and integer information available for the CTL_NET level
443is detailed below.
444The changeable column shows whether a process with appropriate
445privilege may change the value.
446.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
447.It Sy "Second level name Type Changeable"
3d9156a7
A
448.It "PF_ROUTE routing messages no"
449.It "PF_INET IPv4 values yes"
450.It "PF_INET6 IPv6 values yes"
5b2abdfb 451.El
5b2abdfb
A
452.Bl -tag -width 6n
453.It Li PF_ROUTE
454Return the entire routing table or a subset of it.
455The data is returned as a sequence of routing messages (see
456.Xr route 4
457for the header file, format and meaning).
458The length of each message is contained in the message header.
459.Pp
460The third level name is a protocol number, which is currently always 0.
461The fourth level name is an address family, which may be set to 0 to
462select all address families.
23e20b00
A
463The fifth, sixth, and seventh level names are as follows:
464.Bl -column -offset indent "Fifth level Sixth level" "Seventh level"
465.It Sy "Fifth level Sixth level" Ta Sy "Seventh level"
466.It "NET_RT_FLAGS rtflags" Ta "None"
467.It "NET_RT_DUMP None" Ta "None or fib number"
468.It "NET_RT_IFLIST 0 or if_index" Ta None
469.It "NET_RT_IFMALIST 0 or if_index" Ta None
470.It "NET_RT_IFLISTL 0 or if_index" Ta None
5b2abdfb 471.El
3d9156a7
A
472.Pp
473The
474.Dv NET_RT_IFMALIST
475name returns information about multicast group memberships on all interfaces
476if 0 is specified, or for the interface specified by
477.Va if_index .
5b2abdfb
A
478.It Li PF_INET
479Get or set various global information about the IPv4
480(Internet Protocol version 4).
481The third level name is the protocol.
482The fourth level name is the variable name.
483The currently defined protocols and names are:
484.Bl -column ProtocolXX VariableXX TypeXX ChangeableXX
485.It Sy "Protocol Variable Type Changeable"
486.It "icmp bmcastecho integer yes"
487.It "icmp maskrepl integer yes"
488.It "ip forwarding integer yes"
489.It "ip redirect integer yes"
490.It "ip ttl integer yes"
491.It "udp checksum integer yes"
492.El
493.Pp
494The variables are as follows:
495.Bl -tag -width 6n
496.It Li icmp.bmcastecho
497Returns 1 if an ICMP echo request to a broadcast or multicast address is
498to be answered.
499.It Li icmp.maskrepl
500Returns 1 if ICMP network mask requests are to be answered.
501.It Li ip.forwarding
502Returns 1 when IP forwarding is enabled for the host,
503meaning that the host is acting as a router.
504.It Li ip.redirect
505Returns 1 when ICMP redirects may be sent by the host.
506This option is ignored unless the host is routing IP packets,
507and should normally be enabled on all systems.
508.It Li ip.ttl
509The maximum time-to-live (hop count) value for an IP packet sourced by
510the system.
511This value applies to normal transport protocols, not to ICMP.
512.It Li udp.checksum
513Returns 1 when UDP checksums are being computed and checked.
514Disabling UDP checksums is strongly discouraged.
515.Pp
516For variables net.inet.*.ipsec, please refer to
517.Xr ipsec 4 .
518.El
519.It Li PF_INET6
520Get or set various global information about the IPv6
521(Internet Protocol version 6).
522The third level name is the protocol.
523The fourth level name is the variable name.
524.Pp
525For variables net.inet6.* please refer to
526.Xr inet6 4 .
527For variables net.inet6.*.ipsec6, please refer to
528.Xr ipsec 4 .
529.El
530.Ss CTL_USER
531The string and integer information available for the CTL_USER level
532is detailed below.
533The changeable column shows whether a process with appropriate
534privilege may change the value.
23e20b00
A
535.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxx" -offset indent
536.It Sy "Name Type Changeable"
537.It "user.bc_base_max int32_t no"
538.It "user.bc_dim_max int32_t no"
539.It "user.bc_scale_max int32_t no"
540.It "user.bc_string_max int32_t no"
541.It "user.coll_weights_max int32_t no"
542.It "user.cs_path char[] no"
543.It "user.expr_nest_max int32_t no"
544.It "user.line_max int32_t no"
545.It "user.posix2_c_bind int32_t no"
546.It "user.posix2_c_dev int32_t no"
547.It "user.posix2_char_term int32_t no"
548.It "user.posix2_fort_dev int32_t no"
549.It "user.posix2_fort_run int32_t no"
550.It "user.posix2_localedef int32_t no"
551.It "user.posix2_sw_dev int32_t no"
552.It "user.posix2_upe int32_t no"
553.It "user.posix2_version int32_t no"
554.It "user.re_dup_max int32_t no"
555.It "user.stream_max int32_t no"
556.It "user.tzname_max int32_t no"
5b2abdfb
A
557.El
558.Bl -tag -width 6n
559.Pp
23e20b00 560.It Li "user.bc_base_max"
5b2abdfb
A
561The maximum ibase/obase values in the
562.Xr bc 1
563utility.
23e20b00 564.It Li "user.bc_dim_max"
5b2abdfb
A
565The maximum array size in the
566.Xr bc 1
567utility.
23e20b00 568.It Li "user.bc_scale_max"
5b2abdfb
A
569The maximum scale value in the
570.Xr bc 1
571utility.
23e20b00 572.It Li "user.bc_string_max"
5b2abdfb
A
573The maximum string length in the
574.Xr bc 1
575utility.
23e20b00 576.It Li "user.coll_weights_max"
5b2abdfb
A
577The maximum number of weights that can be assigned to any entry of
578the LC_COLLATE order keyword in the locale definition file.
23e20b00 579.It Li "user.cs_path"
5b2abdfb
A
580Return a value for the
581.Ev PATH
582environment variable that finds all the standard utilities.
23e20b00 583.It Li "user.expr_nest_max"
5b2abdfb
A
584The maximum number of expressions that can be nested within
585parenthesis by the
586.Xr expr 1
587utility.
23e20b00 588.It Li "user.line_max"
5b2abdfb
A
589The maximum length in bytes of a text-processing utility's input
590line.
23e20b00 591.It Li "user.posix2_c_bind"
5b2abdfb
A
592Return 1 if the system's C-language development facilities support the
593C-Language Bindings Option, otherwise 0.
23e20b00 594.It Li "user.posix2_c_dev"
5b2abdfb
A
595Return 1 if the system supports the C-Language Development Utilities Option,
596otherwise 0.
23e20b00
A
597.It Li "user.posix2_char_term"
598Return 1 if the system supports at least one terminal type capable of
599all operations described in
600.St -p1003.2 ,
601otherwise 0.
602.It Li "user.posix2_fort_dev"
5b2abdfb
A
603Return 1 if the system supports the FORTRAN Development Utilities Option,
604otherwise 0.
23e20b00 605.It Li "user.posix2_fort_run"
5b2abdfb
A
606Return 1 if the system supports the FORTRAN Runtime Utilities Option,
607otherwise 0.
23e20b00 608.It Li "user.posix2_localedef"
5b2abdfb 609Return 1 if the system supports the creation of locales, otherwise 0.
23e20b00 610.It Li "user.posix2_sw_dev"
5b2abdfb
A
611Return 1 if the system supports the Software Development Utilities Option,
612otherwise 0.
23e20b00 613.It Li "user.posix2_upe"
5b2abdfb
A
614Return 1 if the system supports the User Portability Utilities Option,
615otherwise 0.
23e20b00 616.It Li "user.posix2_version"
5b2abdfb
A
617The version of
618.St -p1003.2
619with which the system attempts to comply.
23e20b00 620.It Li "user.re_dup_max"
5b2abdfb
A
621The maximum number of repeated occurrences of a regular expression
622permitted when using interval notation.
23e20b00 623.It Li "user.stream_max"
5b2abdfb
A
624The minimum maximum number of streams that a process may have open
625at any one time.
23e20b00 626.It Li "user.tzname_max"
5b2abdfb
A
627The minimum maximum number of types supported for the name of a
628timezone.
629.El
630.Ss CTL_VM
631The string and integer information available for the CTL_VM level
632is detailed below.
633The changeable column shows whether a process with appropriate
634privilege may change the value.
23e20b00
A
635.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxx" -offset indent
636.It Sy "Name Type Changeable"
637.It "vm.loadavg struct loadavg no"
638.It "vm.swapusage struct xsw_usage no"
5b2abdfb
A
639.El
640.Pp
641.Bl -tag -width 6n
23e20b00 642.It Li "vm.loadavg"
5b2abdfb
A
643Return the load average history.
644The returned data consists of a
645.Va struct loadavg .
5b2abdfb
A
646.El
647.Sh RETURN VALUES
648.Rv -std
23e20b00
A
649.Sh FILES
650.Bl -tag -width <netinet/icmpXvar.h> -compact
651.It In sys/sysctl.h
652definitions for top level identifiers, second level kernel and hardware
653identifiers, and user level identifiers
654.It In sys/socket.h
655definitions for second level network identifiers
656.It In netinet/in.h
657definitions for third level IPv4/IPv6 identifiers and
658fourth level IPv4/v6 identifiers
659.It In netinet/icmp_var.h
660definitions for fourth level ICMP identifiers
661.It In netinet/icmp6.h
662definitions for fourth level ICMPv6 identifiers
663.It In netinet/udp_var.h
664definitions for fourth level UDP identifiers
665.El
5b2abdfb
A
666.Sh ERRORS
667The following errors may be reported:
668.Bl -tag -width Er
669.It Bq Er EFAULT
670The buffer
671.Fa name ,
672.Fa oldp ,
673.Fa newp ,
674or length pointer
675.Fa oldlenp
676contains an invalid address.
677.It Bq Er EINVAL
678The
679.Fa name
680array is less than two or greater than CTL_MAXNAME.
681.It Bq Er EINVAL
682A non-null
683.Fa newp
684is given and its specified length in
685.Fa newlen
686is too large or too small.
687.It Bq Er ENOMEM
688The length pointed to by
689.Fa oldlenp
690is too short to hold the requested value.
3d9156a7
A
691.It Bq Er ENOMEM
692The smaller of either the length pointed to by
693.Fa oldlenp
694or the estimated size of the returned data exceeds the
695system limit on locked memory.
696.It Bq Er ENOMEM
697Locking the buffer
698.Fa oldp ,
699or a portion of the buffer if the estimated size of the data
700to be returned is smaller,
701would cause the process to exceed its per-process locked memory limit.
5b2abdfb
A
702.It Bq Er ENOTDIR
703The
704.Fa name
705array specifies an intermediate rather than terminal name.
706.It Bq Er EISDIR
707The
708.Fa name
709array specifies a terminal name, but the actual name is not terminal.
9385eb3d 710.It Bq Er ENOENT
5b2abdfb
A
711The
712.Fa name
713array specifies a value that is unknown.
714.It Bq Er EPERM
715An attempt is made to set a read-only value.
716.It Bq Er EPERM
717A process without appropriate privilege attempts to set a value.
718.El
5b2abdfb 719.Sh SEE ALSO
23e20b00 720.Xr confstr 3 ,
5b2abdfb
A
721.Xr sysconf 3 ,
722.Xr sysctl 8
723.Sh HISTORY
724The
725.Fn sysctl
726function first appeared in
727.Bx 4.4 .