xref: /minix3/sbin/sysctl/sysctl.8 (revision b4f34f94bee271f15440c5c33aecbd4cd2e40676)
1*b4f34f94SDavid van Moolenbroek.\"	$NetBSD: sysctl.8,v 1.162 2011/08/03 01:47:40 christos Exp $
2*b4f34f94SDavid van Moolenbroek.\"
3*b4f34f94SDavid van Moolenbroek.\" Copyright (c) 2004 The NetBSD Foundation, Inc.
4*b4f34f94SDavid van Moolenbroek.\" All rights reserved.
5*b4f34f94SDavid van Moolenbroek.\"
6*b4f34f94SDavid van Moolenbroek.\" Redistribution and use in source and binary forms, with or without
7*b4f34f94SDavid van Moolenbroek.\" modification, are permitted provided that the following conditions
8*b4f34f94SDavid van Moolenbroek.\" are met:
9*b4f34f94SDavid van Moolenbroek.\" 1. Redistributions of source code must retain the above copyright
10*b4f34f94SDavid van Moolenbroek.\"    notice, this list of conditions and the following disclaimer.
11*b4f34f94SDavid van Moolenbroek.\" 2. Redistributions in binary form must reproduce the above copyright
12*b4f34f94SDavid van Moolenbroek.\"    notice, this list of conditions and the following disclaimer in the
13*b4f34f94SDavid van Moolenbroek.\"    documentation and/or other materials provided with the distribution.
14*b4f34f94SDavid van Moolenbroek.\"
15*b4f34f94SDavid van Moolenbroek.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16*b4f34f94SDavid van Moolenbroek.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17*b4f34f94SDavid van Moolenbroek.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18*b4f34f94SDavid van Moolenbroek.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19*b4f34f94SDavid van Moolenbroek.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20*b4f34f94SDavid van Moolenbroek.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21*b4f34f94SDavid van Moolenbroek.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22*b4f34f94SDavid van Moolenbroek.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23*b4f34f94SDavid van Moolenbroek.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24*b4f34f94SDavid van Moolenbroek.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25*b4f34f94SDavid van Moolenbroek.\" POSSIBILITY OF SUCH DAMAGE.
26*b4f34f94SDavid van Moolenbroek.\"
27*b4f34f94SDavid van Moolenbroek.\"
28*b4f34f94SDavid van Moolenbroek.\" Copyright (c) 1993
29*b4f34f94SDavid van Moolenbroek.\"	The Regents of the University of California.  All rights reserved.
30*b4f34f94SDavid van Moolenbroek.\"
31*b4f34f94SDavid van Moolenbroek.\" Redistribution and use in source and binary forms, with or without
32*b4f34f94SDavid van Moolenbroek.\" modification, are permitted provided that the following conditions
33*b4f34f94SDavid van Moolenbroek.\" are met:
34*b4f34f94SDavid van Moolenbroek.\" 1. Redistributions of source code must retain the above copyright
35*b4f34f94SDavid van Moolenbroek.\"    notice, this list of conditions and the following disclaimer.
36*b4f34f94SDavid van Moolenbroek.\" 2. Redistributions in binary form must reproduce the above copyright
37*b4f34f94SDavid van Moolenbroek.\"    notice, this list of conditions and the following disclaimer in the
38*b4f34f94SDavid van Moolenbroek.\"    documentation and/or other materials provided with the distribution.
39*b4f34f94SDavid van Moolenbroek.\" 3. Neither the name of the University nor the names of its contributors
40*b4f34f94SDavid van Moolenbroek.\"    may be used to endorse or promote products derived from this software
41*b4f34f94SDavid van Moolenbroek.\"    without specific prior written permission.
42*b4f34f94SDavid van Moolenbroek.\"
43*b4f34f94SDavid van Moolenbroek.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44*b4f34f94SDavid van Moolenbroek.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45*b4f34f94SDavid van Moolenbroek.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46*b4f34f94SDavid van Moolenbroek.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47*b4f34f94SDavid van Moolenbroek.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48*b4f34f94SDavid van Moolenbroek.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49*b4f34f94SDavid van Moolenbroek.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50*b4f34f94SDavid van Moolenbroek.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51*b4f34f94SDavid van Moolenbroek.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52*b4f34f94SDavid van Moolenbroek.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53*b4f34f94SDavid van Moolenbroek.\" SUCH DAMAGE.
54*b4f34f94SDavid van Moolenbroek.\"
55*b4f34f94SDavid van Moolenbroek.\"	@(#)sysctl.8	8.1 (Berkeley) 6/6/93
56*b4f34f94SDavid van Moolenbroek.\"
57*b4f34f94SDavid van Moolenbroek.Dd August 2, 2011
58*b4f34f94SDavid van Moolenbroek.Dt SYSCTL 8
59*b4f34f94SDavid van Moolenbroek.Os
60*b4f34f94SDavid van Moolenbroek.Sh NAME
61*b4f34f94SDavid van Moolenbroek.Nm sysctl
62*b4f34f94SDavid van Moolenbroek.Nd get or set kernel state
63*b4f34f94SDavid van Moolenbroek.Sh SYNOPSIS
64*b4f34f94SDavid van Moolenbroek.Nm sysctl
65*b4f34f94SDavid van Moolenbroek.Op Fl AdeMnq
66*b4f34f94SDavid van Moolenbroek.Oo
67*b4f34f94SDavid van Moolenbroek.Fl r |
68*b4f34f94SDavid van Moolenbroek.Fl x
69*b4f34f94SDavid van Moolenbroek.Oc
70*b4f34f94SDavid van Moolenbroek.Op Ar name ...
71*b4f34f94SDavid van Moolenbroek.Nm sysctl
72*b4f34f94SDavid van Moolenbroek.Op Fl nq
73*b4f34f94SDavid van Moolenbroek.Oo
74*b4f34f94SDavid van Moolenbroek.Fl r |
75*b4f34f94SDavid van Moolenbroek.Fl x
76*b4f34f94SDavid van Moolenbroek.Oc
77*b4f34f94SDavid van Moolenbroek.Fl w
78*b4f34f94SDavid van Moolenbroek.Ar name Ns Li [?]= Ns Ar value ...
79*b4f34f94SDavid van Moolenbroek.Nm sysctl
80*b4f34f94SDavid van Moolenbroek.Op Fl en
81*b4f34f94SDavid van Moolenbroek.Oo
82*b4f34f94SDavid van Moolenbroek.Fl r |
83*b4f34f94SDavid van Moolenbroek.Fl x
84*b4f34f94SDavid van Moolenbroek.Oc
85*b4f34f94SDavid van Moolenbroek.Fl a
86*b4f34f94SDavid van Moolenbroek.Nm sysctl
87*b4f34f94SDavid van Moolenbroek.Op Fl nq
88*b4f34f94SDavid van Moolenbroek.Oo
89*b4f34f94SDavid van Moolenbroek.Fl r |
90*b4f34f94SDavid van Moolenbroek.Fl x
91*b4f34f94SDavid van Moolenbroek.Oc
92*b4f34f94SDavid van Moolenbroek.Fl f
93*b4f34f94SDavid van Moolenbroek.Ar file
94*b4f34f94SDavid van Moolenbroek.Sh DESCRIPTION
95*b4f34f94SDavid van MoolenbroekThe
96*b4f34f94SDavid van Moolenbroek.Nm sysctl
97*b4f34f94SDavid van Moolenbroekutility retrieves kernel state and allows processes with
98*b4f34f94SDavid van Moolenbroekappropriate privilege to set kernel state.
99*b4f34f94SDavid van MoolenbroekThe state to be retrieved or set is described using a
100*b4f34f94SDavid van Moolenbroek``Management Information Base'' (``MIB'') style name,
101*b4f34f94SDavid van Moolenbroekdescribed as a dotted set of components.
102*b4f34f94SDavid van MoolenbroekThe
103*b4f34f94SDavid van Moolenbroek.Sq /
104*b4f34f94SDavid van Moolenbroekcharacter may also be used as a separator and a leading separator
105*b4f34f94SDavid van Moolenbroekcharacter is accepted.
106*b4f34f94SDavid van MoolenbroekIf
107*b4f34f94SDavid van Moolenbroek.Ar name
108*b4f34f94SDavid van Moolenbroekspecifies a non-leaf node in the MIB, all the nodes underneath
109*b4f34f94SDavid van Moolenbroek.Ar name
110*b4f34f94SDavid van Moolenbroekwill be printed.
111*b4f34f94SDavid van Moolenbroek.Pp
112*b4f34f94SDavid van MoolenbroekThe following options are available:
113*b4f34f94SDavid van Moolenbroek.Bl -tag -width indent
114*b4f34f94SDavid van Moolenbroek.It Fl A
115*b4f34f94SDavid van MoolenbroekList all the known MIB names including tables, unless any MIB
116*b4f34f94SDavid van Moolenbroekarguments or
117*b4f34f94SDavid van Moolenbroek.Fl f Ar file
118*b4f34f94SDavid van Moolenbroekare given.
119*b4f34f94SDavid van MoolenbroekThose with string or integer values will be printed as with the
120*b4f34f94SDavid van Moolenbroek.Fl a
121*b4f34f94SDavid van Moolenbroekflag; for table or structure values that
122*b4f34f94SDavid van Moolenbroek.Nm
123*b4f34f94SDavid van Moolenbroekis not able to print,
124*b4f34f94SDavid van Moolenbroekthe name of the utility to retrieve them is given.
125*b4f34f94SDavid van MoolenbroekErrors in retrieving or setting values will be directed to stdout
126*b4f34f94SDavid van Moolenbroekinstead of stderr.
127*b4f34f94SDavid van Moolenbroek.It Fl a
128*b4f34f94SDavid van MoolenbroekList all the currently available string or integer values.
129*b4f34f94SDavid van MoolenbroekThe use of a solitary separator character (either
130*b4f34f94SDavid van Moolenbroek.Sq \&.
131*b4f34f94SDavid van Moolenbroekor
132*b4f34f94SDavid van Moolenbroek.Sq / )
133*b4f34f94SDavid van Moolenbroekby
134*b4f34f94SDavid van Moolenbroekitself has the same effect.
135*b4f34f94SDavid van MoolenbroekAny given
136*b4f34f94SDavid van Moolenbroek.Ar name
137*b4f34f94SDavid van Moolenbroekarguments are ignored if this option is specified.
138*b4f34f94SDavid van Moolenbroek.It Fl d
139*b4f34f94SDavid van MoolenbroekDescriptions of each of the nodes selected will be printed instead of
140*b4f34f94SDavid van Moolenbroektheir values.
141*b4f34f94SDavid van Moolenbroek.It Fl e
142*b4f34f94SDavid van MoolenbroekSeparate the name and the value of the variable(s) with
143*b4f34f94SDavid van Moolenbroek.Ql = .
144*b4f34f94SDavid van MoolenbroekThis is useful for producing output which can be fed back to the
145*b4f34f94SDavid van Moolenbroek.Nm
146*b4f34f94SDavid van Moolenbroekutility.
147*b4f34f94SDavid van MoolenbroekThis option is ignored if
148*b4f34f94SDavid van Moolenbroek.Fl n
149*b4f34f94SDavid van Moolenbroekis specified or a variable is being set.
150*b4f34f94SDavid van Moolenbroek.It Fl f
151*b4f34f94SDavid van MoolenbroekSpecifies the name of a file to read and process.
152*b4f34f94SDavid van MoolenbroekBlank lines and comments (beginning with
153*b4f34f94SDavid van Moolenbroek.Ql # )
154*b4f34f94SDavid van Moolenbroekare ignored.
155*b4f34f94SDavid van MoolenbroekLine continuations with
156*b4f34f94SDavid van Moolenbroek.Ql \e
157*b4f34f94SDavid van Moolenbroekare permitted.
158*b4f34f94SDavid van MoolenbroekRemaining lines are processed similarly to
159*b4f34f94SDavid van Moolenbroekcommand line arguments of the form
160*b4f34f94SDavid van Moolenbroek.Ar name
161*b4f34f94SDavid van Moolenbroekor
162*b4f34f94SDavid van Moolenbroek.Ar name Ns Li = Ns Ar value .
163*b4f34f94SDavid van MoolenbroekThe
164*b4f34f94SDavid van Moolenbroek.Fl w
165*b4f34f94SDavid van Moolenbroekflag is implied by
166*b4f34f94SDavid van Moolenbroek.Fl f .
167*b4f34f94SDavid van MoolenbroekAny
168*b4f34f94SDavid van Moolenbroek.Ar name
169*b4f34f94SDavid van Moolenbroekarguments are ignored.
170*b4f34f94SDavid van Moolenbroek.It Fl M
171*b4f34f94SDavid van MoolenbroekMakes
172*b4f34f94SDavid van Moolenbroek.Nm
173*b4f34f94SDavid van Moolenbroekprint the MIB instead of any of the actual values contained in the
174*b4f34f94SDavid van MoolenbroekMIB.
175*b4f34f94SDavid van MoolenbroekThis causes the entire MIB to be printed unless specific MIB arguments
176*b4f34f94SDavid van Moolenbroekor
177*b4f34f94SDavid van Moolenbroek.Fl f Ar file
178*b4f34f94SDavid van Moolenbroekare also given.
179*b4f34f94SDavid van Moolenbroek.It Fl n
180*b4f34f94SDavid van MoolenbroekSpecifies that the printing of the field name should be
181*b4f34f94SDavid van Moolenbroeksuppressed and that only its value should be output.
182*b4f34f94SDavid van MoolenbroekThis flag is useful for setting shell variables.
183*b4f34f94SDavid van MoolenbroekFor example, to save the pagesize in variable psize, use:
184*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
185*b4f34f94SDavid van Moolenbroekset psize=`sysctl -n hw.pagesize`
186*b4f34f94SDavid van Moolenbroek.Ed
187*b4f34f94SDavid van Moolenbroek.It Fl q
188*b4f34f94SDavid van MoolenbroekUsed to indicate that nothing should be printed for reads or writes unless an
189*b4f34f94SDavid van Moolenbroekerror is detected.
190*b4f34f94SDavid van MoolenbroekFor reads, not finding a variable does not print an error, but exits with
191*b4f34f94SDavid van Moolenbroekan error code.
192*b4f34f94SDavid van MoolenbroekThis is useful just for testing that a variable exists.
193*b4f34f94SDavid van Moolenbroek.It Fl r
194*b4f34f94SDavid van MoolenbroekRaw output form.
195*b4f34f94SDavid van MoolenbroekValues printed are in their raw binary forms as retrieved directly
196*b4f34f94SDavid van Moolenbroekfrom the kernel.
197*b4f34f94SDavid van MoolenbroekSome additional nodes that
198*b4f34f94SDavid van Moolenbroek.Nm
199*b4f34f94SDavid van Moolenbroekcannot print directly can be retrieved with this flag.
200*b4f34f94SDavid van MoolenbroekThis option conflicts with the
201*b4f34f94SDavid van Moolenbroek.Fl x
202*b4f34f94SDavid van Moolenbroekoption.
203*b4f34f94SDavid van Moolenbroek.It Fl w
204*b4f34f94SDavid van MoolenbroekSets the MIB style name given to the value given.
205*b4f34f94SDavid van MoolenbroekThe MIB style name and value must be separated by
206*b4f34f94SDavid van Moolenbroek.Ql =
207*b4f34f94SDavid van Moolenbroekwith no whitespace.
208*b4f34f94SDavid van MoolenbroekTo prevent an error if the MIB style name does not exist (as would be the
209*b4f34f94SDavid van Moolenbroekcase with optional kernel components), one can separate the MIB style name
210*b4f34f94SDavid van Moolenbroekand the value with
211*b4f34f94SDavid van Moolenbroek.Ql ?= .
212*b4f34f94SDavid van MoolenbroekOnly integral and string values can be set via this method.
213*b4f34f94SDavid van Moolenbroek.It Fl x
214*b4f34f94SDavid van MoolenbroekMakes
215*b4f34f94SDavid van Moolenbroek.Nm
216*b4f34f94SDavid van Moolenbroekprint the requested value in a hexadecimal representation instead of
217*b4f34f94SDavid van Moolenbroekits regular form.
218*b4f34f94SDavid van MoolenbroekIf specified more than once, the output for each value resembles that of
219*b4f34f94SDavid van Moolenbroek.Xr hexdump 1
220*b4f34f94SDavid van Moolenbroekwhen given the
221*b4f34f94SDavid van Moolenbroek.Fl C
222*b4f34f94SDavid van Moolenbroekflag.
223*b4f34f94SDavid van MoolenbroekThis option conflicts with the
224*b4f34f94SDavid van Moolenbroek.Fl r
225*b4f34f94SDavid van Moolenbroekoption.
226*b4f34f94SDavid van Moolenbroek.Pp
227*b4f34f94SDavid van Moolenbroek.El
228*b4f34f94SDavid van MoolenbroekThe
229*b4f34f94SDavid van Moolenbroek.Ql proc
230*b4f34f94SDavid van Moolenbroektop-level MIB has a special semantic: it represent per-process values
231*b4f34f94SDavid van Moolenbroekand as such may differ from one process to another.
232*b4f34f94SDavid van MoolenbroekThe second-level name is the pid of the process (in decimal form),
233*b4f34f94SDavid van Moolenbroekor the special word
234*b4f34f94SDavid van Moolenbroek.Ql curproc .
235*b4f34f94SDavid van MoolenbroekFor variables below
236*b4f34f94SDavid van Moolenbroek.Ql proc. Ns Ao pid Ac Ns .rlimit ,
237*b4f34f94SDavid van Moolenbroekthe integer value may be replaced
238*b4f34f94SDavid van Moolenbroekwith the string
239*b4f34f94SDavid van Moolenbroek.Ql unlimited
240*b4f34f94SDavid van Moolenbroekif it matches the magic value used to disable
241*b4f34f94SDavid van Moolenbroeka limit.
242*b4f34f94SDavid van Moolenbroek.Pp
243*b4f34f94SDavid van MoolenbroekThe information available from
244*b4f34f94SDavid van Moolenbroek.Nm sysctl
245*b4f34f94SDavid van Moolenbroekconsists of integers, strings, and tables.
246*b4f34f94SDavid van MoolenbroekThe tabular information can only be retrieved by special
247*b4f34f94SDavid van Moolenbroekpurpose programs such as
248*b4f34f94SDavid van Moolenbroek.Nm ps ,
249*b4f34f94SDavid van Moolenbroek.Nm systat ,
250*b4f34f94SDavid van Moolenbroekand
251*b4f34f94SDavid van Moolenbroek.Nm netstat .
252*b4f34f94SDavid van MoolenbroekSee
253*b4f34f94SDavid van Moolenbroek.Xr sysctl 7
254*b4f34f94SDavid van Moolenbroekfor description of available MIBs.
255*b4f34f94SDavid van Moolenbroek.Sh CREATION AND DELETION
256*b4f34f94SDavid van MoolenbroekNew nodes are allowed to be created by the superuser when the kernel
257*b4f34f94SDavid van Moolenbroekis running at security level 0.
258*b4f34f94SDavid van MoolenbroekThese new nodes may refer to existing kernel data or to new data that
259*b4f34f94SDavid van Moolenbroekis only instrumented by
260*b4f34f94SDavid van Moolenbroek.Xr sysctl 3
261*b4f34f94SDavid van Moolenbroekitself.
262*b4f34f94SDavid van Moolenbroek.Pp
263*b4f34f94SDavid van MoolenbroekThe syntax for creating new nodes is
264*b4f34f94SDavid van Moolenbroek.Dq //create=new.node.path
265*b4f34f94SDavid van Moolenbroekfollowed by one or more of the following attributes separated by
266*b4f34f94SDavid van Moolenbroekcommas.
267*b4f34f94SDavid van MoolenbroekThe use of a double separator (both
268*b4f34f94SDavid van Moolenbroek.Sq /
269*b4f34f94SDavid van Moolenbroekand
270*b4f34f94SDavid van Moolenbroek.Sq \&.
271*b4f34f94SDavid van Moolenbroekcan be used as
272*b4f34f94SDavid van Moolenbroekseparators) as the prefix tells sysctl that the first series of tokens
273*b4f34f94SDavid van Moolenbroekis not a MIB name, but a command.
274*b4f34f94SDavid van MoolenbroekIt is recommended that the double separator preceding the command not
275*b4f34f94SDavid van Moolenbroekbe the same as the separator used in naming the MIB entry so as to
276*b4f34f94SDavid van Moolenbroekavoid possible parse conflicts.
277*b4f34f94SDavid van MoolenbroekThe
278*b4f34f94SDavid van Moolenbroek.Dq value
279*b4f34f94SDavid van Moolenbroekassigned, if one is given, must be last.
280*b4f34f94SDavid van Moolenbroek.Pp
281*b4f34f94SDavid van Moolenbroek.Bl -bullet -compact
282*b4f34f94SDavid van Moolenbroek.It
283*b4f34f94SDavid van Moolenbroek.Ar type= Ns Aq Ar T
284*b4f34f94SDavid van Moolenbroekwhere
285*b4f34f94SDavid van Moolenbroek.Ar T
286*b4f34f94SDavid van Moolenbroekmust be one of
287*b4f34f94SDavid van Moolenbroek.Dq node ,
288*b4f34f94SDavid van Moolenbroek.Dq int ,
289*b4f34f94SDavid van Moolenbroek.Dq string ,
290*b4f34f94SDavid van Moolenbroek.Dq quad ,
291*b4f34f94SDavid van Moolenbroekor
292*b4f34f94SDavid van Moolenbroek.Dq struct .
293*b4f34f94SDavid van MoolenbroekIf the type is omitted, the
294*b4f34f94SDavid van Moolenbroek.Dq node
295*b4f34f94SDavid van Moolenbroektype is assumed.
296*b4f34f94SDavid van Moolenbroek.It
297*b4f34f94SDavid van Moolenbroek.Ar size= Ns Aq Ar S
298*b4f34f94SDavid van Moolenbroekhere,
299*b4f34f94SDavid van Moolenbroek.Ar S
300*b4f34f94SDavid van Moolenbroekasserts the size of the new node.
301*b4f34f94SDavid van MoolenbroekNodes of type
302*b4f34f94SDavid van Moolenbroek.Dq node
303*b4f34f94SDavid van Moolenbroekshould not have a size set.
304*b4f34f94SDavid van MoolenbroekThe size may be omitted for nodes of types
305*b4f34f94SDavid van Moolenbroek.Dq int
306*b4f34f94SDavid van Moolenbroekor
307*b4f34f94SDavid van Moolenbroek.Dq quad .
308*b4f34f94SDavid van MoolenbroekIf the size is omitted for a node of type
309*b4f34f94SDavid van Moolenbroek.Dq string ,
310*b4f34f94SDavid van Moolenbroekthe size will be determined by the length of the given value, or by
311*b4f34f94SDavid van Moolenbroekthe kernel for kernel strings.
312*b4f34f94SDavid van MoolenbroekNodes of type
313*b4f34f94SDavid van Moolenbroek.Dq struct
314*b4f34f94SDavid van Moolenbroekmust have their size explicitly set.
315*b4f34f94SDavid van Moolenbroek.It
316*b4f34f94SDavid van Moolenbroek.Ar addr= Ns Aq Ar A
317*b4f34f94SDavid van Moolenbroekor
318*b4f34f94SDavid van Moolenbroek.Ar symbol= Ns Aq Ar A
319*b4f34f94SDavid van MoolenbroekThe kernel address of the data being instrumented.
320*b4f34f94SDavid van MoolenbroekIf
321*b4f34f94SDavid van Moolenbroek.Dq symbol
322*b4f34f94SDavid van Moolenbroekis used, the symbol must be globally visible to the in-kernel
323*b4f34f94SDavid van Moolenbroek.Xr ksyms 4
324*b4f34f94SDavid van Moolenbroekdriver.
325*b4f34f94SDavid van Moolenbroek.It
326*b4f34f94SDavid van Moolenbroek.Ar n= Ns Aq Ar N
327*b4f34f94SDavid van MoolenbroekThe MIB number to be assigned to the new node.
328*b4f34f94SDavid van MoolenbroekIf no number is specified, the kernel will assign a value.
329*b4f34f94SDavid van Moolenbroek.It
330*b4f34f94SDavid van Moolenbroek.Ar flags= Ns Aq Ar F
331*b4f34f94SDavid van MoolenbroekA concatenated string of single letters that govern the behavior of
332*b4f34f94SDavid van Moolenbroekthe node.
333*b4f34f94SDavid van MoolenbroekFlags currently available are:
334*b4f34f94SDavid van Moolenbroek.Bl -tag -width www
335*b4f34f94SDavid van Moolenbroek.It a
336*b4f34f94SDavid van MoolenbroekAllow anyone to write to the node, if it is writable.
337*b4f34f94SDavid van Moolenbroek.It h
338*b4f34f94SDavid van Moolenbroek.Dq Hidden .
339*b4f34f94SDavid van Moolenbroek.Nm
340*b4f34f94SDavid van Moolenbroekmust be invoked with
341*b4f34f94SDavid van Moolenbroek.Fl A
342*b4f34f94SDavid van Moolenbroekor the hidden node must be specifically requested in order to see it
343*b4f34f94SDavid van Moolenbroek.It i
344*b4f34f94SDavid van Moolenbroek.Dq Immediate .
345*b4f34f94SDavid van MoolenbroekMakes the node store data in itself, rather than allocating new space
346*b4f34f94SDavid van Moolenbroekfor it.
347*b4f34f94SDavid van MoolenbroekThis is the default for nodes of type
348*b4f34f94SDavid van Moolenbroek.Dq int
349*b4f34f94SDavid van Moolenbroekand
350*b4f34f94SDavid van Moolenbroek.Dq quad .
351*b4f34f94SDavid van MoolenbroekThis is the opposite of owning data.
352*b4f34f94SDavid van Moolenbroek.It o
353*b4f34f94SDavid van Moolenbroek.Dq Own .
354*b4f34f94SDavid van MoolenbroekWhen the node is created, separate space will be allocated to store
355*b4f34f94SDavid van Moolenbroekthe data to be instrumented.
356*b4f34f94SDavid van MoolenbroekThis is the default for nodes of type
357*b4f34f94SDavid van Moolenbroek.Dq string
358*b4f34f94SDavid van Moolenbroekand
359*b4f34f94SDavid van Moolenbroek.Dq struct
360*b4f34f94SDavid van Moolenbroekwhere it is not possible to guarantee sufficient space to store the
361*b4f34f94SDavid van Moolenbroekdata in the node itself.
362*b4f34f94SDavid van Moolenbroek.It p
363*b4f34f94SDavid van Moolenbroek.Dq Private .
364*b4f34f94SDavid van MoolenbroekNodes that are marked private, and children of nodes so marked, are
365*b4f34f94SDavid van Moolenbroekonly viewable by the superuser.
366*b4f34f94SDavid van MoolenbroekBe aware that the immediate data that some nodes may store is not
367*b4f34f94SDavid van Moolenbroeknecessarily protected by this.
368*b4f34f94SDavid van Moolenbroek.It x
369*b4f34f94SDavid van Moolenbroek.Dq Hexadecimal .
370*b4f34f94SDavid van MoolenbroekMake
371*b4f34f94SDavid van Moolenbroek.Nm
372*b4f34f94SDavid van Moolenbroekdefault to hexadecimal display of the retrieved value
373*b4f34f94SDavid van Moolenbroek.It r
374*b4f34f94SDavid van Moolenbroek.Dq Read-only .
375*b4f34f94SDavid van MoolenbroekThe data instrumented by the given node is read-only.
376*b4f34f94SDavid van MoolenbroekNote that other mechanisms may still exist for changing the data.
377*b4f34f94SDavid van MoolenbroekThis is the default for nodes that instrument data.
378*b4f34f94SDavid van Moolenbroek.It w
379*b4f34f94SDavid van Moolenbroek.Dq Writable .
380*b4f34f94SDavid van MoolenbroekThe data instrumented by the given node is writable at any time.
381*b4f34f94SDavid van MoolenbroekThis is the default for nodes that can have children.
382*b4f34f94SDavid van Moolenbroek.El
383*b4f34f94SDavid van Moolenbroek.Pp
384*b4f34f94SDavid van Moolenbroek.It
385*b4f34f94SDavid van Moolenbroek.Ar value= Ns Aq Ar V
386*b4f34f94SDavid van MoolenbroekAn initial starting value for a new node that does not reference
387*b4f34f94SDavid van Moolenbroekexisting kernel data.
388*b4f34f94SDavid van MoolenbroekInitial values can only be assigned for nodes of the
389*b4f34f94SDavid van Moolenbroek.Dq int ,
390*b4f34f94SDavid van Moolenbroek.Dq quad ,
391*b4f34f94SDavid van Moolenbroekand
392*b4f34f94SDavid van Moolenbroek.Dq string
393*b4f34f94SDavid van Moolenbroektypes.
394*b4f34f94SDavid van Moolenbroek.El
395*b4f34f94SDavid van Moolenbroek.Pp
396*b4f34f94SDavid van MoolenbroekNew nodes must fit the following set of criteria:
397*b4f34f94SDavid van Moolenbroek.Pp
398*b4f34f94SDavid van Moolenbroek.Bl -bullet -compact
399*b4f34f94SDavid van Moolenbroek.It
400*b4f34f94SDavid van MoolenbroekIf the new node is to address an existing kernel object, only one of the
401*b4f34f94SDavid van Moolenbroek.Dq symbol
402*b4f34f94SDavid van Moolenbroekor
403*b4f34f94SDavid van Moolenbroek.Dq addr
404*b4f34f94SDavid van Moolenbroekarguments may be given.
405*b4f34f94SDavid van Moolenbroek.It
406*b4f34f94SDavid van MoolenbroekThe size for a
407*b4f34f94SDavid van Moolenbroek.Dq struct
408*b4f34f94SDavid van Moolenbroektype node must be specified; no initial value is expected or permitted.
409*b4f34f94SDavid van Moolenbroek.It
410*b4f34f94SDavid van MoolenbroekEither the size or the initial value for a
411*b4f34f94SDavid van Moolenbroek.Dq string
412*b4f34f94SDavid van Moolenbroeknode must be given.
413*b4f34f94SDavid van Moolenbroek.It
414*b4f34f94SDavid van MoolenbroekThe node which will be the parent of the new node must be writable.
415*b4f34f94SDavid van Moolenbroek.El
416*b4f34f94SDavid van Moolenbroek.Pp
417*b4f34f94SDavid van MoolenbroekIf any of the given parameters describes an invalid configuration,
418*b4f34f94SDavid van Moolenbroek.Nm
419*b4f34f94SDavid van Moolenbroekwill emit a diagnostic message to the standard error and exit.
420*b4f34f94SDavid van Moolenbroek.Pp
421*b4f34f94SDavid van MoolenbroekDescriptions can be added by the super-user to any node that does not
422*b4f34f94SDavid van Moolenbroekhave one, provided that the node is not marked with the
423*b4f34f94SDavid van Moolenbroek.Dq PERMANENT
424*b4f34f94SDavid van Moolenbroekflag.
425*b4f34f94SDavid van MoolenbroekThe syntax is similar to the syntax for creating new nodes with the
426*b4f34f94SDavid van Moolenbroekexception of the keyword that follows the double separator at the
427*b4f34f94SDavid van Moolenbroekstart of the command:
428*b4f34f94SDavid van Moolenbroek.Dq //describe=new.node.path=new node description .
429*b4f34f94SDavid van MoolenbroekOnce a description has been added, it cannot be changed or removed.
430*b4f34f94SDavid van Moolenbroek.Pp
431*b4f34f94SDavid van MoolenbroekWhen destroying nodes, only the path to the node is necessary, i.e.,
432*b4f34f94SDavid van Moolenbroek.Dq //destroy=old.node.path .
433*b4f34f94SDavid van MoolenbroekNo other parameters are expected or permitted.
434*b4f34f94SDavid van MoolenbroekNodes being destroyed must have no children, and their parent must be
435*b4f34f94SDavid van Moolenbroekwritable.
436*b4f34f94SDavid van MoolenbroekNodes that are marked with the
437*b4f34f94SDavid van Moolenbroek.Dq Dv PERMANENT
438*b4f34f94SDavid van Moolenbroekflag (as assigned by the kernel) may not be deleted.
439*b4f34f94SDavid van Moolenbroek.Pp
440*b4f34f94SDavid van MoolenbroekIn all cases, the initial
441*b4f34f94SDavid van Moolenbroek.Sq =
442*b4f34f94SDavid van Moolenbroekthat follows the command (eg,
443*b4f34f94SDavid van Moolenbroek.Dq create ,
444*b4f34f94SDavid van Moolenbroek.Dq destroy ,
445*b4f34f94SDavid van Moolenbroekor
446*b4f34f94SDavid van Moolenbroek.Dq describe )
447*b4f34f94SDavid van Moolenbroekmay be replaced with another instance of the separator character,
448*b4f34f94SDavid van Moolenbroekprovided that the same separator character is used for the length of
449*b4f34f94SDavid van Moolenbroekthe name specification.
450*b4f34f94SDavid van Moolenbroek.Sh FILES
451*b4f34f94SDavid van Moolenbroek.Bl -tag -width /etc/sysctl.conf -compact
452*b4f34f94SDavid van Moolenbroek.It Pa /etc/sysctl.conf
453*b4f34f94SDavid van Moolenbroek.Nm
454*b4f34f94SDavid van Moolenbroekvariables set at boot time
455*b4f34f94SDavid van Moolenbroek.El
456*b4f34f94SDavid van Moolenbroek.Sh EXAMPLES
457*b4f34f94SDavid van MoolenbroekFor example, to retrieve the maximum number of processes allowed
458*b4f34f94SDavid van Moolenbroekin the system, one would use the following request:
459*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
460*b4f34f94SDavid van Moolenbroeksysctl kern.maxproc
461*b4f34f94SDavid van Moolenbroek.Ed
462*b4f34f94SDavid van Moolenbroek.Pp
463*b4f34f94SDavid van MoolenbroekTo set the maximum number of processes allowed
464*b4f34f94SDavid van Moolenbroekin the system to 1000, one would use the following request:
465*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
466*b4f34f94SDavid van Moolenbroeksysctl -w kern.maxproc=1000
467*b4f34f94SDavid van Moolenbroek.Ed
468*b4f34f94SDavid van Moolenbroek.Pp
469*b4f34f94SDavid van MoolenbroekInformation about the system clock rate may be obtained with:
470*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
471*b4f34f94SDavid van Moolenbroeksysctl kern.clockrate
472*b4f34f94SDavid van Moolenbroek.Ed
473*b4f34f94SDavid van Moolenbroek.Pp
474*b4f34f94SDavid van MoolenbroekInformation about the load average history may be obtained with:
475*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
476*b4f34f94SDavid van Moolenbroeksysctl vm.loadavg
477*b4f34f94SDavid van Moolenbroek.Ed
478*b4f34f94SDavid van Moolenbroek.Pp
479*b4f34f94SDavid van MoolenbroekTo view the values of the per-process variables of the current shell,
480*b4f34f94SDavid van Moolenbroekthe request:
481*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
482*b4f34f94SDavid van Moolenbroeksysctl proc.$$
483*b4f34f94SDavid van Moolenbroek.Ed
484*b4f34f94SDavid van Moolenbroekcan be used if the shell interpreter replaces $$ with its pid (this is true
485*b4f34f94SDavid van Moolenbroekfor most shells).
486*b4f34f94SDavid van Moolenbroek.Pp
487*b4f34f94SDavid van MoolenbroekTo redirect core dumps to the
488*b4f34f94SDavid van Moolenbroek.Pa /var/tmp/ Ns Aq username
489*b4f34f94SDavid van Moolenbroekdirectory,
490*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
491*b4f34f94SDavid van Moolenbroeksysctl -w proc.$$.corename=/var/tmp/%u/%n.core
492*b4f34f94SDavid van Moolenbroek.Ed
493*b4f34f94SDavid van Moolenbroekshould be used.
494*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
495*b4f34f94SDavid van Moolenbroeksysctl -w proc.curproc.corename=/var/tmp/%u/%n.core
496*b4f34f94SDavid van Moolenbroek.Ed
497*b4f34f94SDavid van Moolenbroekchanges the value for the sysctl process itself, and will not have the desired
498*b4f34f94SDavid van Moolenbroekeffect.
499*b4f34f94SDavid van Moolenbroek.Pp
500*b4f34f94SDavid van MoolenbroekTo create the root of a new sub-tree called
501*b4f34f94SDavid van Moolenbroek.Dq local
502*b4f34f94SDavid van Moolenbroekadd some children to the new node, and some descriptions:
503*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
504*b4f34f94SDavid van Moolenbroeksysctl -w //create=local
505*b4f34f94SDavid van Moolenbroeksysctl -w //describe=local=my local sysctl tree
506*b4f34f94SDavid van Moolenbroeksysctl -w //create=local.esm_debug,type=int,symbol=esm_debug,flags=w
507*b4f34f94SDavid van Moolenbroeksysctl -w //describe=local.esm_debug=esm driver debug knob
508*b4f34f94SDavid van Moolenbroeksysctl -w //create=local.audiodebug,type=int,symbol=audiodebug,flags=w
509*b4f34f94SDavid van Moolenbroeksysctl -w //describe=local.audiodebug=generic audio debug knob
510*b4f34f94SDavid van Moolenbroek.Ed
511*b4f34f94SDavid van MoolenbroekNote that the children are made writable so that the two debug
512*b4f34f94SDavid van Moolenbroeksettings in question can be tuned arbitrarily.
513*b4f34f94SDavid van Moolenbroek.Pp
514*b4f34f94SDavid van MoolenbroekTo destroy that same subtree:
515*b4f34f94SDavid van Moolenbroek.Bd -literal -offset indent -compact
516*b4f34f94SDavid van Moolenbroeksysctl -w //destroy=local.esm_debug
517*b4f34f94SDavid van Moolenbroeksysctl -w //destroy=local.audiodebug
518*b4f34f94SDavid van Moolenbroeksysctl -w //destroy=local
519*b4f34f94SDavid van Moolenbroek.Ed
520*b4f34f94SDavid van Moolenbroek.Sh SEE ALSO
521*b4f34f94SDavid van Moolenbroek.Xr sysctl 3 ,
522*b4f34f94SDavid van Moolenbroek.Xr ksyms 4 ,
523*b4f34f94SDavid van Moolenbroek.Xr sysctl 7
524*b4f34f94SDavid van Moolenbroek.Sh HISTORY
525*b4f34f94SDavid van Moolenbroek.Nm sysctl
526*b4f34f94SDavid van Moolenbroekfirst appeared in
527*b4f34f94SDavid van Moolenbroek.Bx 4.4 .
528