]> git.saurik.com Git - apple/libc.git/blob - gen/FreeBSD/sysctl.3
Libc-1082.50.1.tar.gz
[apple/libc.git] / gen / FreeBSD / sysctl.3
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.
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
29 .\" $FreeBSD$
30 .\"
31 .Dd May 17, 2013
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
51 The
52 .Fn sysctl
53 function retrieves system information and allows processes with
54 appropriate privileges to set system information.
55 The information available from
56 .Fn sysctl
57 consists of integers, strings, and tables.
58 Information may be retrieved and set from the command interface
59 using the
60 .Xr sysctl 8
61 utility.
62 .Pp
63 Unless explicitly noted below,
64 .Fn sysctl
65 returns a consistent snapshot of the data requested.
66 Consistency is obtained by locking the destination
67 buffer into memory so that the data may be copied out without blocking.
68 Calls to
69 .Fn sysctl
70 are serialized to avoid deadlock.
71 .Pp
72 The state is described using a ``Management Information Base'' (MIB)
73 style name, listed in
74 .Fa name ,
75 which is a
76 .Fa namelen
77 length array of integers.
78 .Pp
79 The
80 .Fn sysctlbyname
81 function accepts an ASCII representation of the name and internally
82 looks up the integer name vector.
83 Apart from that, it behaves the same
84 as the standard
85 .Fn sysctl
86 function.
87 .Pp
88 The information is copied into the buffer specified by
89 .Fa oldp .
90 The size of the buffer is given by the location specified by
91 .Fa oldlenp
92 before the call,
93 and that location gives the amount of data copied after a successful call
94 and after a call that returns with the error code
95 .Er ENOMEM .
96 If the amount of data available is greater
97 than the size of the buffer supplied,
98 the call supplies as much data as fits in the buffer provided
99 and returns with the error code
100 .Er ENOMEM .
101 If the old value is not desired,
102 .Fa oldp
103 and
104 .Fa oldlenp
105 should be set to NULL.
106 .Pp
107 The size of the available data can be determined by calling
108 .Fn sysctl
109 with the
110 .Dv NULL
111 argument for
112 .Fa oldp .
113 The size of the available data will be returned in the location pointed to by
114 .Fa oldlenp .
115 For some operations, the amount of space may change often.
116 For these operations,
117 the system attempts to round up so that the returned size is
118 large enough for a call to return the data shortly thereafter.
119 .Pp
120 To set a new value,
121 .Fa newp
122 is set to point to a buffer of length
123 .Fa newlen
124 from which the requested value is to be taken.
125 If a new value is not to be set,
126 .Fa newp
127 should be set to NULL and
128 .Fa newlen
129 set to 0.
130 .Pp
131 The
132 .Fn sysctlnametomib
133 function accepts an ASCII representation of the name,
134 looks up the integer name vector,
135 and returns the numeric representation in the mib array pointed to by
136 .Fa mibp .
137 The number of elements in the mib array is given by the location specified by
138 .Fa sizep
139 before the call,
140 and that location gives the number of entries copied after a successful call.
141 The resulting
142 .Fa mib
143 and
144 .Fa size
145 may be used in subsequent
146 .Fn sysctl
147 calls to get the data associated with the requested ASCII name.
148 This interface is intended for use by applications that want to
149 repeatedly request the same variable (the
150 .Fn sysctl
151 function runs in about a third the time as the same request made via the
152 .Fn sysctlbyname
153 function).
154 .Pp
155 The top level names are defined with a CTL_ prefix in
156 .In sys/sysctl.h ,
157 and are as follows.
158 The next and subsequent levels down are found in the include files
159 listed here, and described in separate sections below.
160 .Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
161 .It Sy "Name Next level names Description"
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"
169 .It "CTL_VM sys/resources.h Virtual memory (struct loadavg)"
170 .El
171 .Pp
172 For example, the following retrieves the maximum number of processes allowed
173 in the system:
174 .Pp
175 .Bd -literal -offset indent -compact
176 int maxproc;
177 size_t len = sizeof(maxproc);
178 sysctlbyname("kern.maxproc", &maxproc, &len, NULL, 0);
179 .Ed
180 .Pp
181 To retrieve the standard search path for the system utilities:
182 .Pp
183 .Bd -literal -offset indent -compact
184 char *p;
185 size_t len;
186 sysctlbyname("user.cs_path", NULL, &len, NULL, 0);
187 p = malloc(len);
188 sysctlbyname("user.cs_path", p, &len, NULL, 0);
189 .Ed
190 .Ss CTL_VFS
191 A distinguished second level name, VFS_GENERIC,
192 is used to get general information about all file systems.
193 One of its third level identifiers is VFS_MAXTYPENUM
194 that gives the highest valid file system type number.
195 Its other third level identifier is VFS_CONF that
196 returns configuration information about the file system
197 type given as a fourth level identifier (see
198 .Xr getvfsbyname 3
199 as an example of its use).
200 The remaining second level identifiers are the
201 file system type number returned by a
202 .Xr statfs 2
203 call or from VFS_CONF.
204 The third level identifiers available for each file system
205 are given in the header file that defines the mount
206 argument structure for that file system.
207 .Ss CTL_HW
208 The string and integer information available for the CTL_HW level
209 is detailed below.
210 The changeable column shows whether a process with appropriate
211 privilege may change the value.
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"
242 .El
243 .Bl -tag -width 6n
244 .It Li "hw.byteorder"
245 The byte order (4321 or 1234).
246 .It Li "hw.model"
247 The machine model.
248 .It Li "hw.ncpu"
249 The 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" ,
253 or
254 .Va "hw.physicalcpu_max"
255 be used instead.
256 .It Li "hw.logicalcpu"
257 The number of logical processors available in the current power management mode.
258 .It Li "hw.logicalcpu_max"
259 The maximum number of logical processors that could be available this boot.
260 .It Li "hw.physicalcpu"
261 The number of physical processors available in the current power management mode.
262 .It Li "hw.physicalcpu_max"
263 The maximum number of physical processors that could be available this boot.
264 .It Li "hw.pagesize"
265 The software page size in bytes.
266 .El
267 .Ss CTL_KERN
268 The string and integer information available for the CTL_KERN level
269 is detailed below.
270 The changeable column shows whether a process with appropriate
271 privilege may change the value.
272 The types of data currently available are process information,
273 system vnodes, the open file entries, routing table entries,
274 virtual memory statistics, load average history, and clock rate
275 information.
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"
329 .El
330 .Bl -tag -width 6n
331 .It Li "kern.argmax"
332 The maximum bytes of argument to
333 .Xr execve 2 .
334 .It Li "kern.boottime"
335 A
336 .Va struct timeval
337 structure is returned.
338 This structure contains the time that the system was booted.
339 .It Li "kern.clockrate"
340 A
341 .Va struct clockinfo
342 structure is returned.
343 This structure contains the clock, statistics clock and profiling clock
344 frequencies, the number of micro-seconds per hz tick and the skew rate.
345 .It Li "kern.hostid"
346 Get or set the host id.
347 .It Li "kern.hostname"
348 Get or set the hostname.
349 .It Li "kern.job_control"
350 Return 1 if job control is available on this system, otherwise 0.
351 .It Li "kern.maxfiles"
352 The maximum number of files that may be open in the system.
353 .It Li "kern.maxfilesperproc"
354 The maximum number of files that may be open for a single process.
355 This limit only applies to processes with an effective uid of nonzero
356 at the time of the open request.
357 Files that have already been opened are not affected if the limit
358 or the effective uid is changed.
359 .It Li "kern.maxproc"
360 The maximum number of concurrent processes the system will allow.
361 .It Li "kern.maxprocperuid"
362 The maximum number of concurrent processes the system will allow
363 for a single effective uid.
364 This limit only applies to processes with an effective uid of nonzero
365 at the time of a fork request.
366 Processes that have already been started are not affected if the limit
367 is changed.
368 .It Li "kern.maxvnodes"
369 The maximum number of vnodes available on the system.
370 .It Li "kern.ngroups"
371 The maximum number of supplemental groups.
372 .It Li "kern.nisdomainname"
373 The name of the current YP/NIS domain.
374 .It Li "kern.osrelease"
375 The system release string.
376 .It Li "kern.osrevision"
377 The system revision number.
378 .It Li "kern.ostype"
379 The system type string.
380 .It Li "kern.posix1version"
381 The version of
382 .St -p1003.1
383 with which the system
384 attempts to comply.
385 .It Li "kern.saved_ids"
386 Returns 1 if saved set-group and saved set-user ID is available.
387 .It Li "kern.securelevel"
388 The system security level.
389 This level may be raised by processes with appropriate privilege.
390 It may not be lowered.
391 .It Li "kern.version"
392 The system version string.
393 .El
394 .Ss CTL_MACHDEP
395 The set of variables defined is architecture dependent.
396 The following variables are defined for the i386 architecture.
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"
440 .El
441 .Ss CTL_NET
442 The string and integer information available for the CTL_NET level
443 is detailed below.
444 The changeable column shows whether a process with appropriate
445 privilege may change the value.
446 .Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
447 .It Sy "Second level name Type Changeable"
448 .It "PF_ROUTE routing messages no"
449 .It "PF_INET IPv4 values yes"
450 .It "PF_INET6 IPv6 values yes"
451 .El
452 .Bl -tag -width 6n
453 .It Li PF_ROUTE
454 Return the entire routing table or a subset of it.
455 The data is returned as a sequence of routing messages (see
456 .Xr route 4
457 for the header file, format and meaning).
458 The length of each message is contained in the message header.
459 .Pp
460 The third level name is a protocol number, which is currently always 0.
461 The fourth level name is an address family, which may be set to 0 to
462 select all address families.
463 The 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
471 .El
472 .Pp
473 The
474 .Dv NET_RT_IFMALIST
475 name returns information about multicast group memberships on all interfaces
476 if 0 is specified, or for the interface specified by
477 .Va if_index .
478 .It Li PF_INET
479 Get or set various global information about the IPv4
480 (Internet Protocol version 4).
481 The third level name is the protocol.
482 The fourth level name is the variable name.
483 The 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
494 The variables are as follows:
495 .Bl -tag -width 6n
496 .It Li icmp.bmcastecho
497 Returns 1 if an ICMP echo request to a broadcast or multicast address is
498 to be answered.
499 .It Li icmp.maskrepl
500 Returns 1 if ICMP network mask requests are to be answered.
501 .It Li ip.forwarding
502 Returns 1 when IP forwarding is enabled for the host,
503 meaning that the host is acting as a router.
504 .It Li ip.redirect
505 Returns 1 when ICMP redirects may be sent by the host.
506 This option is ignored unless the host is routing IP packets,
507 and should normally be enabled on all systems.
508 .It Li ip.ttl
509 The maximum time-to-live (hop count) value for an IP packet sourced by
510 the system.
511 This value applies to normal transport protocols, not to ICMP.
512 .It Li udp.checksum
513 Returns 1 when UDP checksums are being computed and checked.
514 Disabling UDP checksums is strongly discouraged.
515 .Pp
516 For variables net.inet.*.ipsec, please refer to
517 .Xr ipsec 4 .
518 .El
519 .It Li PF_INET6
520 Get or set various global information about the IPv6
521 (Internet Protocol version 6).
522 The third level name is the protocol.
523 The fourth level name is the variable name.
524 .Pp
525 For variables net.inet6.* please refer to
526 .Xr inet6 4 .
527 For variables net.inet6.*.ipsec6, please refer to
528 .Xr ipsec 4 .
529 .El
530 .Ss CTL_USER
531 The string and integer information available for the CTL_USER level
532 is detailed below.
533 The changeable column shows whether a process with appropriate
534 privilege may change the value.
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"
557 .El
558 .Bl -tag -width 6n
559 .Pp
560 .It Li "user.bc_base_max"
561 The maximum ibase/obase values in the
562 .Xr bc 1
563 utility.
564 .It Li "user.bc_dim_max"
565 The maximum array size in the
566 .Xr bc 1
567 utility.
568 .It Li "user.bc_scale_max"
569 The maximum scale value in the
570 .Xr bc 1
571 utility.
572 .It Li "user.bc_string_max"
573 The maximum string length in the
574 .Xr bc 1
575 utility.
576 .It Li "user.coll_weights_max"
577 The maximum number of weights that can be assigned to any entry of
578 the LC_COLLATE order keyword in the locale definition file.
579 .It Li "user.cs_path"
580 Return a value for the
581 .Ev PATH
582 environment variable that finds all the standard utilities.
583 .It Li "user.expr_nest_max"
584 The maximum number of expressions that can be nested within
585 parenthesis by the
586 .Xr expr 1
587 utility.
588 .It Li "user.line_max"
589 The maximum length in bytes of a text-processing utility's input
590 line.
591 .It Li "user.posix2_c_bind"
592 Return 1 if the system's C-language development facilities support the
593 C-Language Bindings Option, otherwise 0.
594 .It Li "user.posix2_c_dev"
595 Return 1 if the system supports the C-Language Development Utilities Option,
596 otherwise 0.
597 .It Li "user.posix2_char_term"
598 Return 1 if the system supports at least one terminal type capable of
599 all operations described in
600 .St -p1003.2 ,
601 otherwise 0.
602 .It Li "user.posix2_fort_dev"
603 Return 1 if the system supports the FORTRAN Development Utilities Option,
604 otherwise 0.
605 .It Li "user.posix2_fort_run"
606 Return 1 if the system supports the FORTRAN Runtime Utilities Option,
607 otherwise 0.
608 .It Li "user.posix2_localedef"
609 Return 1 if the system supports the creation of locales, otherwise 0.
610 .It Li "user.posix2_sw_dev"
611 Return 1 if the system supports the Software Development Utilities Option,
612 otherwise 0.
613 .It Li "user.posix2_upe"
614 Return 1 if the system supports the User Portability Utilities Option,
615 otherwise 0.
616 .It Li "user.posix2_version"
617 The version of
618 .St -p1003.2
619 with which the system attempts to comply.
620 .It Li "user.re_dup_max"
621 The maximum number of repeated occurrences of a regular expression
622 permitted when using interval notation.
623 .It Li "user.stream_max"
624 The minimum maximum number of streams that a process may have open
625 at any one time.
626 .It Li "user.tzname_max"
627 The minimum maximum number of types supported for the name of a
628 timezone.
629 .El
630 .Ss CTL_VM
631 The string and integer information available for the CTL_VM level
632 is detailed below.
633 The changeable column shows whether a process with appropriate
634 privilege may change the value.
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"
639 .El
640 .Pp
641 .Bl -tag -width 6n
642 .It Li "vm.loadavg"
643 Return the load average history.
644 The returned data consists of a
645 .Va struct loadavg .
646 .El
647 .Sh RETURN VALUES
648 .Rv -std
649 .Sh FILES
650 .Bl -tag -width <netinet/icmpXvar.h> -compact
651 .It In sys/sysctl.h
652 definitions for top level identifiers, second level kernel and hardware
653 identifiers, and user level identifiers
654 .It In sys/socket.h
655 definitions for second level network identifiers
656 .It In netinet/in.h
657 definitions for third level IPv4/IPv6 identifiers and
658 fourth level IPv4/v6 identifiers
659 .It In netinet/icmp_var.h
660 definitions for fourth level ICMP identifiers
661 .It In netinet/icmp6.h
662 definitions for fourth level ICMPv6 identifiers
663 .It In netinet/udp_var.h
664 definitions for fourth level UDP identifiers
665 .El
666 .Sh ERRORS
667 The following errors may be reported:
668 .Bl -tag -width Er
669 .It Bq Er EFAULT
670 The buffer
671 .Fa name ,
672 .Fa oldp ,
673 .Fa newp ,
674 or length pointer
675 .Fa oldlenp
676 contains an invalid address.
677 .It Bq Er EINVAL
678 The
679 .Fa name
680 array is less than two or greater than CTL_MAXNAME.
681 .It Bq Er EINVAL
682 A non-null
683 .Fa newp
684 is given and its specified length in
685 .Fa newlen
686 is too large or too small.
687 .It Bq Er ENOMEM
688 The length pointed to by
689 .Fa oldlenp
690 is too short to hold the requested value.
691 .It Bq Er ENOMEM
692 The smaller of either the length pointed to by
693 .Fa oldlenp
694 or the estimated size of the returned data exceeds the
695 system limit on locked memory.
696 .It Bq Er ENOMEM
697 Locking the buffer
698 .Fa oldp ,
699 or a portion of the buffer if the estimated size of the data
700 to be returned is smaller,
701 would cause the process to exceed its per-process locked memory limit.
702 .It Bq Er ENOTDIR
703 The
704 .Fa name
705 array specifies an intermediate rather than terminal name.
706 .It Bq Er EISDIR
707 The
708 .Fa name
709 array specifies a terminal name, but the actual name is not terminal.
710 .It Bq Er ENOENT
711 The
712 .Fa name
713 array specifies a value that is unknown.
714 .It Bq Er EPERM
715 An attempt is made to set a read-only value.
716 .It Bq Er EPERM
717 A process without appropriate privilege attempts to set a value.
718 .El
719 .Sh SEE ALSO
720 .Xr confstr 3 ,
721 .Xr sysconf 3 ,
722 .Xr sysctl 8
723 .Sh HISTORY
724 The
725 .Fn sysctl
726 function first appeared in
727 .Bx 4.4 .