xref: /csrg-svn/lib/libc/gen/sysctl.3 (revision 59868)
158401Smckusick.\" Copyright (c) 1993 The Regents of the University of California.
258401Smckusick.\" All rights reserved.
358401Smckusick.\"
458401Smckusick.\" %sccs.include.redist.roff%
558401Smckusick.\"
6*59868Sbostic.\"	@(#)sysctl.3	6.4 (Berkeley) 05/10/93
758401Smckusick.\"
858401Smckusick.Dd ""
9*59868Sbostic.Dt SYSCTL 3
1058401Smckusick.Os
1158401Smckusick.Sh NAME
1258401Smckusick.Nm sysctl
13*59868Sbostic.Nd get or set system information
1458401Smckusick.Sh SYNOPSIS
1558401Smckusick.Fd #include <sys/sysctl.h>
1658401Smckusick.Ft int
17*59868Sbostic.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
1858401Smckusick.Sh DESCRIPTION
1958401SmckusickThe
20*59868Sbostic.Nm sysctl
21*59868Sbosticfunction retrieves system information and allows processes with
22*59868Sbosticappropriate privileges to set system information.
23*59868SbosticThe information available from
24*59868Sbostic.Nm sysctl
25*59868Sbosticconsists of integers, strings, and tables.
26*59868SbosticUnless explicitly noted below,
27*59868Sbostic.Nm sysctl
28*59868Sbosticreturns a consistent snapshot of the data requested
29*59868SbosticInformation may be retrieved and set from the command interface
30*59868Sbosticusing the
31*59868Sbostic.Xr sysctl 1
32*59868Sbosticutility.
33*59868Sbostic.Pp
34*59868SbosticThe state is described using a ``Management Information Base'' (MIB)
35*59868Sbosticstyle name, listed in
36*59868Sbostic.Fa name ,
37*59868Sbosticwhich is a
3858401Smckusick.Fa namelen
39*59868Sbosticlength array of integers.
4058401Smckusick.Pp
4158507SmckusickThe information is copied into the buffer specified by
42*59868Sbostic.Fa oldp .
4358507SmckusickThe size of the buffer is given by the location specified by
4458507Smckusick.Fa oldlenp
4558507Smckusickbefore the call,
4658507Smckusickand that location gives the amount of data copied after a successful call.
4758507SmckusickIf the amount of data available is greater
4858507Smckusickthan the size of the buffer supplied,
4958507Smckusickthe call supplies as much data as fits in the buffer provided
5058507Smckusickand returns with the error code EINVAL.
5158401SmckusickIf the old value is not desired,
52*59868Sbostic.Fa oldp
5358401Smckusickand
5458401Smckusick.Fa oldlenp
55*59868Sbosticshould be set to NULL.
5658401Smckusick.Pp
5758507SmckusickThe size of the available data can be determined by calling
58*59868Sbostic.Nm sysctl
5958507Smckusickwith a NULL parameter for
60*59868Sbostic.Fa oldp .
6158507SmckusickThe size of the available data be returned in the location pointed to by
6258507Smckusick.Fa oldlenp .
6358507SmckusickFor some operations, the amount of space may change often;
6458507Smckusickthe system attempts to round up so that the returned size is
6558507Smckusicklarge enough for a call to return the data shortly thereafter.
6658507Smckusick.Pp
6758401SmckusickTo set a new value,
68*59868Sbostic.Fa newp
6958401Smckusickis set to point to a buffer of length
7058401Smckusick.Fa newlen
7158401Smckusickfrom which the requested value is to be taken.
7258507SmckusickIf a new value is not to be set,
73*59868Sbostic.Fa newp
7458401Smckusickshould be set to NULL and
7558401Smckusick.Fa newlen
7658401Smckusickset to 0.
7758401Smckusick.Pp
78*59868SbosticThe top level names are defined with a CTL_ prefix in
79*59868Sbostic.Pa <sys/sysctl.h> ,
80*59868Sbosticand are as follows.
81*59868SbosticThe next and subsequent levels down are found in the include files
82*59868Sbosticlisted here, and described in separate sections below.
83*59868Sbostic.Pp
84*59868Sbostic.Bl -column CTLXMACHDEPXXX "Next level namesXXX" -offset indent
85*59868Sbostic.It Sy Pa Name	Next level names	Description
86*59868Sbostic.It CTL\_DEBUG	sys/sysctl.h	Debugging
87*59868Sbostic.It CTL\_FS	sys/sysctl.h	File system
88*59868Sbostic.It CTL\_HW	sys/sysctl.h	Generic CPU, I/O
89*59868Sbostic.It CTL\_KERN	sys/sysctl.h	High kernel: processes, limits
90*59868Sbostic.It CTL\_MACHDEP	sys/sysctl.h	Machine dependent
91*59868Sbostic.It CTL\_NET	sys/socket.h	Networking
92*59868Sbostic.It CTL\_USER	sys/sysctl.h	User-level
93*59868Sbostic.It CTL\_VM	vm/vm_param.h	Virtual memory
9458507Smckusick.El
9558507Smckusick.Pp
9658507SmckusickFor example, the following retrieves the maximum number of processes allowed
9758507Smckusickin the system:
9858401Smckusick.Bd -literal -offset indent -compact
99*59868Sbosticint mib[2], maxproc;
10058462Sbosticsize_t len;
10158507Smckusick.sp
102*59868Sbosticmib[0] = CTL_KERN;
103*59868Sbosticmib[1] = KERN_MAXPROC;
10458462Sbosticlen = sizeof(maxproc);
105*59868Sbosticsysctl(mib, 2, &maxproc, &len, NULL, 0);
10658401Smckusick.Ed
107*59868Sbostic.sp
108*59868SbosticTo retrieve the standard search path for the system utilities:
109*59868Sbostic.Bd -literal -offset indent -compact
110*59868Sbosticint mib[2];
111*59868Sbosticsize_t len;
112*59868Sbosticchar *p;
113*59868Sbostic.sp
114*59868Sbosticmib[0] = CTL_USER;
115*59868Sbosticmib[1] = USER_CS_PATH;
116*59868Sbosticsysctl(mib, 2, NULL, &len, NULL, 0);
117*59868Sbosticp = malloc(len);
118*59868Sbosticsysctl(mib, 2, p, &len, NULL, 0);
119*59868Sbostic.Ed
120*59868Sbostic.Sh RETURN VALUES
121*59868SbosticIf the call to
122*59868Sbostic.Nm sysctl
123*59868Sbosticis successful, 0 is returned.
124*59868SbosticOtherwise \-1 is returned and
125*59868Sbostic.Va errno
126*59868Sbosticis set appropriately.
127*59868Sbostic.Sh CTL_DEBUG
128*59868SbosticThere are currently no second level names for the debugging interface.
129*59868Sbostic.Sh CTL_FS
130*59868SbosticThere are currently no second level names for the file system.
131*59868Sbostic.Sh CTL_HW
132*59868SbosticThe string and integer information available for the CTL_KERN level
133*59868Sbosticis detailed below.
134*59868SbosticThe changeable column shows whether a process with appropriate
135*59868Sbosticprivilege may change the value.
136*59868Sbostic.Bl -column "Second level nameXXX" integerXXX -offset indent
137*59868Sbostic.It Sy Pa Second level name	Type	Changeable
138*59868Sbostic.It HW\_MACHINE	string	no
139*59868Sbostic.It HW\_MODEL	string	no
140*59868Sbostic.It HW\_NCPU	integer	no
141*59868Sbostic.It HW\_BYTEORDER	integer	no
142*59868Sbostic.It HW\_PHYSMEM	integer	no
143*59868Sbostic.It HW\_USERMEM	integer	no
144*59868Sbostic.It HW\_PAGESIZE	integer	no
145*59868Sbostic.\".It HW\_DISKNAMES	integer	no
146*59868Sbostic.\".It HW\_DISKSTATS	integer	no
147*59868Sbostic.El
14858507Smckusick.Pp
149*59868Sbostic.Bl -tag -width "123456"
150*59868Sbostic.It Li HW_MACHINE
151*59868SbosticReturn the machine class.
152*59868Sbostic.It Li HW_MODEL
153*59868SbosticReturn the machine model
154*59868Sbostic.It Li HW_NCPU
155*59868SbosticReturn the number of cpus.
156*59868Sbostic.It Li HW_BYTEORDER
157*59868SbosticReturn the byteorder (4,321, or 1,234).
158*59868Sbostic.It Li HW_PHYSMEM
159*59868SbosticReturn the bytes of physical memory.
160*59868Sbostic.It Li HW_USERMEM
161*59868SbosticReturn the bytes of non-kernel memory.
162*59868Sbostic.It Li HW_PAGESIZE
163*59868SbosticReturn the software page size.
164*59868Sbostic.\".It Fa HW_DISKNAMES
165*59868Sbostic.\".It Fa HW_DISKSTATS
166*59868Sbostic.El
167*59868Sbostic.Sh CTL_KERN
168*59868SbosticThe string and integer information available for the CTL_KERN level
169*59868Sbosticis detailed below.
170*59868SbosticThe changeable column shows whether a process with appropriate
171*59868Sbosticprivilege may change the value.
17258507SmckusickThe types of data currently available are process information,
17358507Smckusicksystem vnodes, the open file entries, routing table entries,
174*59868Sbosticvirtual memory statistics, load average history, and clock rate
175*59868Sbosticinformation.
176*59868SbosticConsistency in the kernel tables is obtained by locking the destination
177*59868Sbosticbuffer into memory so that the data may be copied out without blocking.
178*59868SbosticCalls are serialized to avoid deadlock.
179*59868Sbostic.Bl -column "KERNXCHOWNXRESTRICTEDXXX" "struct clockrateXXX" -offset indent
180*59868Sbostic.It Sy Pa Second level name	Type	Changeable
181*59868Sbostic.It KERN\_ARGMAX	integer	no
182*59868Sbostic.It KERN\_CHOWN\_RESTRICTED	integer	no
183*59868Sbostic.It KERN\_CLOCKRATE	struct clockinfo	yes
184*59868Sbostic.It KERN\_FILE	struct file	yes
185*59868Sbostic.It KERN\_HOSTID	integer	yes
186*59868Sbostic.It KERN\_HOSTNAME	string	yes
187*59868Sbostic.It KERN\_JOB\_CONTROL	integer	no
188*59868Sbostic.It KERN\_LINK\_MAX	integer	no
189*59868Sbostic.It KERN\_MAXFILES	integer	yes
190*59868Sbostic.It KERN\_MAXPROC	integer	yes
191*59868Sbostic.It KERN\_MAXVNODES	integer	no
192*59868Sbostic.It KERN\_MAX\_CANON	integer	no
193*59868Sbostic.It KERN\_MAX\_INPUT	integer	no
194*59868Sbostic.It KERN\_NAME\_MAX	integer	no
195*59868Sbostic.It KERN\_NGROUPS	integer	no
196*59868Sbostic.It KERN\_NO\_TRUNC	integer	no
197*59868Sbostic.It KERN\_OSRELEASE	string	no
198*59868Sbostic.It KERN\_OSREV	integer	no
199*59868Sbostic.It KERN\_OSTYPE	string	no
200*59868Sbostic.It KERN\_PATH\_MAX	integer	no
201*59868Sbostic.It KERN\_PIPE\_BUF	integer	no
202*59868Sbostic.It KERN\_POSIX1	integer	no
203*59868Sbostic.It KERN\_PROC	struct proc	yes
204*59868Sbostic.It KERN\_PROF	node	yes
205*59868Sbostic.It KERN\_SAVED\_IDS	integer	no
206*59868Sbostic.It KERN\_SECURELVL	integer	raise only
207*59868Sbostic.It KERN\_VDISABLE	integer	no
208*59868Sbostic.It KERN\_VERSION	string	no
209*59868Sbostic.It KERN\_VNODE	struct vnode	yes
210*59868Sbostic.El
21158507Smckusick.Pp
212*59868Sbostic.Bl -tag -width "123456"
213*59868Sbostic.It Li KERN_ARGMAX
214*59868SbosticMaximum bytes of argument to exec.
215*59868Sbostic.It Li KERN_CHOWN_RESTRICTED
216*59868SbosticReturn 1 if appropriate privileges are required for the
217*59868Sbostic.Xr chown 2
218*59868Sbosticsystem call, otherwise 0.
219*59868Sbostic.It Li KERN_CLOCKRATE
220*59868SbosticA
221*59868Sbostic.Ns ( Li struct clockinfo Ns )
222*59868Sbosticstructure is returned.
223*59868SbosticThis structure contains the clock, statistics clock and profiling clock
224*59868Sbosticfrequencies, and the number of micro-seconds per hz tick.
225*59868Sbostic.It Li KERN_FILE
226*59868SbosticReturn the entire file table.
227*59868SbosticThe returned data consists of a single
228*59868Sbostic.Ns ( Li struct filehead Ns )
229*59868Sbosticfollowed by an array of
230*59868Sbostic.Ns ( Li struct file Ns ) ,
231*59868Sbosticwhose size depends on the current number of such objects in the system.
232*59868Sbostic.It Li KERN_HOSTID
233*59868SbosticReturn the host id.
234*59868Sbostic.It Li KERN_HOSTNAME
235*59868SbosticReturn the hostname.
236*59868Sbostic.It Li KERN_JOB_CONTROL
237*59868SbosticReturn 1 if job control is available on this system, otherwise 0.
238*59868Sbostic.It Li KERN_LINK_MAX
239*59868SbosticReturn the maximum file link count.
240*59868Sbostic.It Li KERN_MAXFILES
241*59868SbosticReturn the maximum number of open files a process may have.
242*59868Sbostic.It Li KERN_MAXPROC
243*59868SbosticReturn the maximum number of simultaneous processes a user may have.
244*59868Sbostic.It Li KERN_MAXVNODES
245*59868SbosticReturn the maximum number of vnodes available on the system.
246*59868Sbostic.It Li KERN_MAX_CANON
247*59868SbosticReturn the maximum number of bytes in terminal canonical input line.
248*59868Sbostic.It Li KERN_MAX_INPUT
249*59868SbosticReturn the minimum number of bytes for which space is available in
250*59868Sbostica terminal input queue.
251*59868Sbostic.It Li KERN_NAME_MAX
252*59868SbosticMaximum number of bytes in a file name.
253*59868Sbostic.It Li KERN_NGROUPS
254*59868SbosticMaximum number of supplemental groups.
255*59868Sbostic.It Li KERN_NO_TRUNC
256*59868SbosticReturn 1 if too long pathnames are truncated.
257*59868Sbostic.It Li KERN_OSRELEASE
258*59868SbosticReturn the system release string.
259*59868Sbostic.It Li KERN_OSREV
260*59868SbosticReturn the system revision string.
261*59868Sbostic.It Li KERN_OSTYPE
262*59868SbosticReturn the system type string.
263*59868Sbostic.It Li KERN_PATH_MAX
264*59868SbosticMaximum number of bytes in a pathname.
265*59868Sbostic.It Li KERN_PIPE_BUF
266*59868SbosticMaximum number of bytes which will be written atomically to a pipe.
267*59868Sbostic.It Li KERN_POSIX1
268*59868SbosticReturn the POSIX 1003.1 version with which the system attempts to comply.
269*59868Sbostic.It Li KERN_PROC
270*59868SbosticReturn the entire process table, or a subset of it.
27158507SmckusickAn array of
272*59868Sbostic.Ns ( Li struct kinfo_proc Ns )
27358507Smckusickstructures is returned,
27458507Smckusickwhose size depends on the current number of such objects in the system.
275*59868SbosticThe third and fourth level names are as follows:
276*59868Sbostic.Bl -column "Third level nameXXX" "Fourth level is:XXX" -offset indent
277*59868Sbostic.It Pa Third level name	Fourth level is:
278*59868Sbostic.It KERN\_PROC\_ALL	None
279*59868Sbostic.It KERN\_PROC\_PID	A process ID
280*59868Sbostic.It KERN\_PROC\_PGRP	A process group
281*59868Sbostic.It KERN\_PROC\_TTY	A tty device
282*59868Sbostic.It KERN\_PROC\_UID	A user ID
283*59868Sbostic.It KERN\_PROC\_RUID	A real user ID
28458507Smckusick.El
285*59868Sbostic.It Li KERN_PROF
286*59868SbosticReturn kernel profiling information.
287*59868SbosticThe only currently available third level name is GPROF_STATE, which
288*59868Sbosticreturns 1 if the kernel was compiled for profiling, and 0 if it was
289*59868Sbosticnot.
290*59868Sbostic.It Li KERN_SAVED_IDS
291*59868SbosticReturns 1 if saved set-group and saved set-user ID is available.
292*59868Sbostic.It Li KERN_SECURELVL
293*59868SbosticReturns the system security level.
294*59868SbosticThis level may be raised by processes with appropriate privilege.
295*59868Sbostic.It Li KERN_VDISABLE
296*59868SbosticReturns the terminal character disabling value.
297*59868Sbostic.It Li KERN_VERSION
298*59868SbosticReturn the system version string.
299*59868Sbostic.It Li KERN_VNODE
300*59868SbosticReturn the entire vnode table.
301*59868Sbostic(Note, the vnode table is not necessarily a consistent snapshot of
302*59868Sbosticthe system.)
303*59868SbosticThe returned data consists of an array whose size depends on the
304*59868Sbosticcurrent number of such objects in the system.
30558507SmckusickEach element of the array contains the kernel address of a vnode
306*59868Sbostic.Ns ( Li struct vnode * Ns )
30758507Smckusickfollowed by the vnode itself
308*59868Sbostic.Ns ( Li struct vnode Ns ) .
309*59868Sbostic.El
310*59868Sbostic.Sh CTL_MACHDEP
311*59868SbosticThere are currently no second level names for the machine dependent
312*59868Sbosticinterface.
313*59868Sbostic.Sh CTL_NET
314*59868SbosticThe string and integer information available for the CTL_NET level
315*59868Sbosticis detailed below.
316*59868SbosticThe changeable column shows whether a process with appropriate
317*59868Sbosticprivilege may change the value.
318*59868Sbostic.Bl -column "Second level nameXXX" "routine messagesXXX" -offset indent
319*59868Sbostic.It Sy Pa Second level name	Type	Changeable
320*59868Sbostic.It PF\_ROUTE	routine messages	no
321*59868Sbostic.El
32258507Smckusick.Pp
323*59868Sbostic.Bl -tag -width "123456"
324*59868Sbostic.It Li PF_ROUTE
325*59868SbosticReturn the entire routing table or a subset of it.
326*59868SbosticThe data is returned as a sequence of routing messages (see
327*59868Sbostic.Xr route 4
328*59868Sbosticfor the header file, format and meaning).
329*59868SbosticThe length of each message is contained in the message header.
33058507Smckusick.Pp
331*59868SbosticThe third level name is a protocol number, which is currently always 0.
332*59868SbosticThe fourth level name is an address family, which may be set to 0 to
333*59868Sbosticselect all address families.
334*59868SbosticThe fifth and sixth level names are as follows:
335*59868Sbostic.Bl -column "Fifth level nameXXX" "Sixth level is:XXX" -offset indent
336*59868Sbostic.It Pa Fifth level name	Sixth level is:
337*59868Sbostic.It NET\_RT\_FLAGS	rtflags
338*59868Sbostic.It NET\_RT\_DUMP	None
339*59868Sbostic.It NET\_RT\_IFLIST	None
340*59868Sbostic.El
341*59868Sbostic.Sh CTL_USER
342*59868SbosticThe string and integer information available for the CTL_USER level
343*59868Sbosticis detailed below.
344*59868SbosticThe changeable column shows whether a process with appropriate
345*59868Sbosticprivilege may change the value.
346*59868Sbostic.Bl -column "Second level nameXXX" "integerXXX" -offset indent
347*59868Sbostic.It Sy Pa Second level name	Type	Changeable
348*59868Sbostic.It USER\_BC\_BASE\_MAX	integer	no
349*59868Sbostic.It USER\_BC\_DIM\_MAX	integer	no
350*59868Sbostic.It USER\_BC\_SCALE\_MAX	integer	no
351*59868Sbostic.It USER\_BC\_STRING\_MAX	integer	no
352*59868Sbostic.It USER\_COLL\_WEIGHTS\_MAX	integer	no
353*59868Sbostic.It USER\_CS\_PATH	string	no
354*59868Sbostic.It USER\_EXPR\_NEST\_MAX	integer	no
355*59868Sbostic.It USER\_LINE\_MAX	integer	no
356*59868Sbostic.It USER\_POSIX2\_CHAR\_TERM	integer	no
357*59868Sbostic.It USER\_POSIX2\_C\_BIND	integer	no
358*59868Sbostic.It USER\_POSIX2\_C\_DEV	integer	no
359*59868Sbostic.It USER\_POSIX2\_FORT\_DEV	integer	no
360*59868Sbostic.It USER\_POSIX2\_FORT\_RUN	integer	no
361*59868Sbostic.It USER\_POSIX2\_LOCALEDEF	integer	no
362*59868Sbostic.It USER\_POSIX2\_SW\_DEV	integer	no
363*59868Sbostic.It USER\_POSIX2\_UPE	integer	no
364*59868Sbostic.It USER\_POSIX2\_VERSION	integer	no
365*59868Sbostic.It USER\_RE\_DUP\_MAX	integer	no
366*59868Sbostic.El
367*59868Sbostic.Bl -tag -width "123456"
36858507Smckusick.Pp
369*59868Sbostic.It Li USER_BC_BASE_MAX
370*59868SbosticReturn the maximum ibase/obase values in the
371*59868Sbostic.Xr bc 1
372*59868Sbosticutility
373*59868Sbostic.It Li USER_BC_DIM_MAX
374*59868SbosticReturn the maximum array size in the
375*59868Sbostic.Xr bc 1
376*59868Sbosticutility.
377*59868Sbostic.It Li USER_BC_SCALE_MAX
378*59868SbosticReturn the maximum scale value in the
379*59868Sbostic.Xr bc 1
380*59868Sbosticutility.
381*59868Sbostic.It Li USER_BC_STRING_MAX
382*59868SbosticReturn the maximum string length in the
383*59868Sbostic.Xr bc 1
384*59868Sbosticutility.
385*59868Sbostic.It Li USER_COLL_WEIGHTS_MAX
386*59868SbosticReturn the maximum number of weights that can be assigned to any entry of
387*59868Sbosticthe LC_COLLATE order keyword in the locale definition file.
388*59868Sbostic.It Li USER_CS_PATH
389*59868SbosticReturn a value for the
390*59868Sbostic.Ev PATH
391*59868Sbosticenvironment variable that finds all of the standard utilities.
392*59868Sbostic.It Li USER_EXPR_NEST_MAX
393*59868SbosticReturn the maximum number of expressions that can be nested within
394*59868Sbosticparenthesis by the
395*59868Sbostic.Xr expr 1
396*59868Sbosticutility.
397*59868Sbostic.It Li USER_LINE_MAX
398*59868SbosticReturn the maximum length in bytes of a text-processing utility's input
399*59868Sbosticline.
400*59868Sbostic.It Li USER_POSIX2_CHAR_TERM
401*59868SbosticReturn 1 if the system supports at least one terminal type capable of
402*59868Sbosticall operations described in POSIX 1003.2, otherwise 0.
403*59868Sbostic.It Li USER_POSIX2_C_BIND
404*59868SbosticReturn 1 if the system's C-language development facilities support the
405*59868SbosticC-Language Bindings Option, otherwise 0.
406*59868Sbostic.It Li USER_POSIX2_C_DEV
407*59868SbosticReturn 1 if the system supports the C-Language Development Utilities Option,
408*59868Sbosticotherwise 0.
409*59868Sbostic.It Li USER_POSIX2_FORT_DEV
410*59868SbosticReturn 1 if the system supports the FORTRAN Development Utilities Option,
411*59868Sbosticotherwise 0.
412*59868Sbostic.It Li USER_POSIX2_FORT_RUN
413*59868SbosticReturn 1 if the system supports the FORTRAN Runtime Utilities Option,
414*59868Sbosticotherwise 0.
415*59868Sbostic.It Li USER_POSIX2_LOCALEDEF
416*59868SbosticReturn 1 if the system supports the creation of locales, otherwise 0.
417*59868Sbostic.It Li USER_POSIX2_SW_DEV
418*59868SbosticReturn 1 if the system supports the Software Development Utilities Option,
419*59868Sbosticotherwise 0.
420*59868Sbostic.It Li USER_POSIX2_UPE
421*59868SbosticReturn 1 if the system supports the User Portability Utilities Option,
422*59868Sbosticotherwise 0.
423*59868Sbostic.It Li USER_POSIX2_VERSION
424*59868SbosticReturn the POSIX 1003.2 version with which the system attempts to comply.
425*59868Sbostic.It Li USER_RE_DUP_MAX
426*59868SbosticReturn the maximum number of repeated occurrences of a regular expression
427*59868Sbosticpermitted when using interval notation.
428*59868Sbostic.El
429*59868Sbostic.Sh CTL_VM
430*59868SbosticThe string and integer information available for the CTL_VM level
431*59868Sbosticis detailed below.
432*59868SbosticThe changeable column shows whether a process with appropriate
433*59868Sbosticprivilege may change the value.
434*59868Sbostic.Bl -column "Second level nameXXX" "struct loadavgXXX" -offset indent
435*59868Sbostic.It Sy Pa Second level name	Type	Changeable
436*59868Sbostic.It VM\_LOADAVG	struct loadavg	no
437*59868Sbostic.It VM\_METER	struct vmtotal	no
438*59868Sbostic.El
43958507Smckusick.Pp
440*59868Sbostic.Bl -tag -width "123456"
441*59868Sbostic.It Li VM_LOADAVG
442*59868SbosticReturn the load average history.
44358507SmckusickThe returned data consists of a
444*59868Sbostic.Ns ( Li struct loadavg Ns ) .
445*59868Sbostic.It Li VM_METER
446*59868SbosticReturn the system wide virtual memory statistics.
447*59868SbosticThe returned data consists of a
448*59868Sbostic.Ns ( Li struct vmtotal Ns ) .
44958507Smckusick.El
45058401Smckusick.Sh ERRORS
451*59868SbosticThe following errors may be reported:
45258401Smckusick.Bl -tag -width Er
45358401Smckusick.It Bq Er EFAULT
45458401SmckusickThe buffer
45558401Smckusick.Fa name ,
456*59868Sbostic.Fa oldp ,
457*59868Sbostic.Fa newp ,
45858401Smckusickor length pointer
45958401Smckusick.Fa oldlenp
46058401Smckusickcontains an invalid address.
46158401Smckusick.It Bq Er EINVAL
46258401SmckusickThe
46358401Smckusick.Fa name
46458401Smckusickarray is less than two or greater than CTL_MAXNAME.
46558401Smckusick.It Bq Er EINVAL
46658401SmckusickA non-null
467*59868Sbostic.Fa newp
46858401Smckusickis given and its specified length in
46958401Smckusick.Fa newlen
47058401Smckusickis too large or too small.
47158401Smckusick.It Bq Er ENOMEM
47258401SmckusickThe length pointed to by
47358401Smckusick.Fa oldlenp
47458401Smckusickis too short to hold the requested value.
47558401Smckusick.It Bq Er ENOTDIR
47658401SmckusickThe
47758401Smckusick.Fa name
47858401Smckusickarray specifies an intermediate rather than terminal name.
47958401Smckusick.It Bq Er EOPNOTSUPP
48058401SmckusickThe
48158401Smckusick.Fa name
48258401Smckusickarray specifies a value that is unknown.
48358401Smckusick.It Bq Er EPERM
48458401SmckusickAn attempt is made to set a read-only value.
48558401Smckusick.It Bq Er EPERM
48658401SmckusickA process without appropriate privilege attempts to set a value.
48758401Smckusick.El
48858401Smckusick.Sh FILES
489*59868Sbostic.Bl -tag -width <vm/vmXparam.h> -compact
49058401Smckusick.It Pa <sys/sysctl.h>
491*59868Sbosticdefinitions for top level identifiers, second level kernel and hardware
492*59868Sbosticidentifiers, user level identifiers
49358401Smckusick.It Pa <sys/socket.h>
49458401Smckusickdefinitions for second level network identifiers
49558401Smckusick.It Pa <vm/vm_param.h>
49658401Smckusickdefinitions for second level virtual memory identifiers
49758401Smckusick.El
49858401Smckusick.Sh SEE ALSO
49958401Smckusick.Xr sysctl 8
50058401Smckusick.Sh HISTORY
50158507SmckusickThe
502*59868Sbostic.Nm sysctl
50358507Smckusickfunction first appeared in 4.4BSD.
504