xref: /dragonfly/sys/sys/sysctl.h (revision a162a738eca94f99d45d88429e86cfd0fbfbe95d)
1 /*
2  * Copyright (c) 1989, 1993
3  *        The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Mike Karels at Berkeley Software Design, Inc.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of the University nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  *        @(#)sysctl.h        8.1 (Berkeley) 6/2/93
33  * $FreeBSD: head/sys/sys/sysctl.h 204170 2010-02-21 13:57:02Z ed $
34  */
35 
36 #ifndef _SYS_SYSCTL_H_
37 #define   _SYS_SYSCTL_H_
38 
39 #ifndef _SYS_TYPES_H_
40 #include <sys/types.h>
41 #endif
42 #ifndef _SYS_QUEUE_H_
43 #include <sys/queue.h>
44 #endif
45 
46 /*
47  * Definitions for sysctl call.  The sysctl call uses a hierarchical name
48  * for objects that can be examined or modified.  The name is expressed as
49  * a sequence of integers.  Like a file path name, the meaning of each
50  * component depends on its place in the hierarchy.  The top-level and kern
51  * identifiers are defined here, and other identifiers are defined in the
52  * respective subsystem header files.
53  */
54 
55 #define CTL_MAXNAME 12        /* largest number of components supported */
56 
57 /*
58  * Each subsystem defined by sysctl defines a list of variables
59  * for that subsystem. Each name is either a node with further
60  * levels defined below it, or it is a leaf of some particular
61  * type given below. Each sysctl level defines a set of name/type
62  * pairs to be used by sysctl(1) in manipulating the subsystem.
63  */
64 struct ctlname {
65           char      *ctl_name;          /* subsystem name */
66           int       ctl_type; /* type of name */
67 };
68 
69 #define CTLTYPE               0x1f      /* Mask for the type */
70 #define   CTLTYPE_NODE        0x01      /* name is a node */
71 #define   CTLTYPE_INT         0x02      /* name describes an integer */
72 #define   CTLTYPE_STRING      0x03      /* name describes a string */
73 #define   CTLTYPE_S64         0x04      /* name describes a signed 64-bit number */
74 #define   CTLTYPE_QUAD        CTLTYPE_S64 /* name describes a signed 64-bit number */
75 #define   CTLTYPE_OPAQUE      0x05      /* name describes a structure */
76 #define   CTLTYPE_STRUCT      CTLTYPE_OPAQUE      /* name describes a structure */
77 #define   CTLTYPE_UINT        0x06      /* name describes an unsigned integer */
78 #define   CTLTYPE_LONG        0x07      /* name describes a long */
79 #define   CTLTYPE_ULONG       0x08      /* name describes an unsigned long */
80 #define   CTLTYPE_U64         0x09      /* name describes an unsigned 64-bit number */
81 #define   CTLTYPE_UQUAD       CTLTYPE_U64 /* name describes an unsgn 64-bit number */
82 #define   CTLTYPE_U8          0x0a      /* name describes an unsigned 8-bit number */
83 #define   CTLTYPE_U16         0x0b      /* name describes an unsigned 16-bit number */
84 #define   CTLTYPE_S8          0x0c      /* name describes a signed 8-bit number */
85 #define   CTLTYPE_S16         0x0d      /* name describes a signed 16-bit number */
86 #define   CTLTYPE_S32         0x0e      /* name describes a signed 32-bit number */
87 #define   CTLTYPE_U32         0x0f      /* name describes an unsigned 32-bit number */
88 
89 #define CTLTYPE_BIT32(n) (0x10 | ((n) << CTLSHIFT_BITFLD))
90 #define CTLTYPE_BIT64(n) (0x11 | ((n) << CTLSHIFT_BITFLD))
91 
92 #define   CTLFLAG_RD          0x80000000          /* Allow reads of variable */
93 #define   CTLFLAG_WR          0x40000000          /* Allow writes to the variable */
94 #define   CTLFLAG_RW          (CTLFLAG_RD|CTLFLAG_WR)
95 #define   CTLFLAG_ANYBODY     0x10000000          /* All users can set this var */
96 #define   CTLFLAG_SECURE      0x08000000          /* Permit set only if securelevel<=0 */
97 #define   CTLFLAG_PRISON      0x04000000          /* Prisoned roots can fiddle */
98 #define   CTLFLAG_DYN         0x02000000          /* Dynamic oid - can be freed */
99 #define   CTLFLAG_SKIP        0x01000000          /* Skip this sysctl when listing */
100 #define   CTLMASK_SECURE      0x00F00000          /* Secure level */
101 #define   CTLFLAG_DYING       0x00010000          /* Oid is being removed */
102 #define CTLFLAG_SHLOCK        0x00008000          /* shlock on write (def is exlock) */
103 #define CTLFLAG_EXLOCK        0x00004000          /* exlock on read (def is shlock) */
104 #define CTLFLAG_NOLOCK        0x00002000          /* no lock required */
105 #define CTLFLAG_RSV12         0x00001000
106 #define CTLMASK_BITFLD        0x00000FC0          /* bitfield extension */
107 #define CTLFLAG_RSV5          0x00000020
108 #define CTLMASK_TYPE          0x0000001F          /* type field */
109 
110 #define CTLSHIFT_BITFLD       6
111 #define CTLINFO_MAXBITN       64
112 
113 /*
114  * USE THIS instead of a hardwired number from the categories below
115  * to get dynamically assigned sysctl entries using the linker-set
116  * technology. This is the way nearly all new sysctl variables should
117  * be implemented.
118  * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
119  */
120 #define OID_AUTO    (-1)
121 
122 #ifdef _KERNEL
123 
124 #include <sys/kernel.h>                           /* for DATA_SET */
125 #ifndef _SYS_LOCK_H_
126 #include <sys/lock.h>
127 #endif
128 
129 #define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
130           struct sysctl_req *req
131 
132 /*
133  * This describes the access space for a sysctl request.  This is needed
134  * so that we can use the interface from the kernel or from user-space.
135  */
136 struct sysctl_req {
137           struct thread       *td;                /* used for access checking */
138           int                  lock;              /* wiring state */
139           void                *oldptr;
140           size_t               oldlen;
141           size_t               oldidx;
142           int                 (*oldfunc)(struct sysctl_req *, const void *, size_t);
143           void                *newptr;
144           size_t               newlen;
145           size_t               newidx;
146           int                 (*newfunc)(struct sysctl_req *, void *, size_t);
147           size_t               validlen;
148           int                  flags;
149 };
150 
151 SLIST_HEAD(sysctl_oid_list, sysctl_oid);
152 
153 /*
154  * This describes one "oid" in the MIB tree.  Potentially more nodes can
155  * be hidden behind it, expanded by the handler.
156  */
157 struct sysctl_oid {
158           struct sysctl_oid_list *oid_parent;
159           SLIST_ENTRY(sysctl_oid) oid_link;
160           int                 oid_number;
161           int                 oid_kind;
162           void                *oid_arg1;
163           int                 oid_arg2;
164           const char          *oid_name;
165           int                 (*oid_handler)(SYSCTL_HANDLER_ARGS);
166           const char          *oid_fmt;
167           int                 oid_refcnt;
168           u_int                oid_running;
169           const char          *oid_descr;
170           struct lock         oid_lock; /* per-node lock */
171 };
172 
173 #define SYSCTL_IN(r, p, l)    (r->newfunc)(r, p, l)
174 #define SYSCTL_OUT(r, p, l)   (r->oldfunc)(r, p, l)
175 #define SYSCTL_OUT_STR(r, p)  (r->oldfunc)(r, p, strlen(p) + 1)
176 
177 int sysctl_handle_8(SYSCTL_HANDLER_ARGS);
178 int sysctl_handle_16(SYSCTL_HANDLER_ARGS);
179 int sysctl_handle_32(SYSCTL_HANDLER_ARGS);
180 int sysctl_handle_64(SYSCTL_HANDLER_ARGS);
181 int sysctl_handle_int(SYSCTL_HANDLER_ARGS);
182 int sysctl_handle_long(SYSCTL_HANDLER_ARGS);
183 int sysctl_handle_quad(SYSCTL_HANDLER_ARGS);
184 int sysctl_handle_bit32(SYSCTL_HANDLER_ARGS);
185 int sysctl_handle_bit64(SYSCTL_HANDLER_ARGS);
186 int sysctl_handle_intptr(SYSCTL_HANDLER_ARGS);
187 int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
188 int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
189 
190 extern struct lock sysctllock;
191 
192 #define   SYSCTL_XLOCK()                _sysctl_xlock()
193 #define   SYSCTL_XUNLOCK()    _sysctl_xunlock()
194 #define   SYSCTL_SLOCK()                lockmgr(&mycpu->gd_sysctllock, LK_SHARED)
195 #define   SYSCTL_SUNLOCK()    lockmgr(&mycpu->gd_sysctllock, LK_RELEASE)
196 #define   SYSCTL_ASSERT_LOCKED() \
197           KKASSERT(lockstatus(&mycpu->gd_sysctllock, curthread) != 0)
198 
199 /*
200  * These functions are used to add/remove an oid from the mib.
201  */
202 void sysctl_register_oid(struct sysctl_oid *oidp);
203 void sysctl_unregister_oid(struct sysctl_oid *oidp);
204 
205 /* Declare a static oid to allow child oids to be added to it. */
206 #define SYSCTL_DECL(name)                                             \
207           extern struct sysctl_oid_list sysctl_##name##_children
208 
209 /* Hide these in macros */
210 #define   SYSCTL_SET_CHILDREN(oid_ptr, children) do {                           \
211           (oid_ptr)->oid_arg1 = (children);                                     \
212 } while(0)
213 #define   SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \
214           (oid_ptr)->oid_arg1
215 #define   SYSCTL_STATIC_CHILDREN(oid_name) \
216           (&sysctl_##oid_name##_children)
217 
218 /* === Structs and macros related to context handling === */
219 
220 /* All dynamically created sysctls can be tracked in a context list. */
221 struct sysctl_ctx_entry {
222           struct sysctl_oid *entry;
223           TAILQ_ENTRY(sysctl_ctx_entry) link;
224 };
225 
226 TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
227 
228 #define   SYSCTL_NODE_CHILDREN(parent, name) \
229           sysctl_##parent##_##name##_children
230 
231 #ifndef NO_SYSCTL_DESCR
232 #define   __DESCR(d) d
233 #else
234 #define   __DESCR(d) ""
235 #endif
236 
237 /* This constructs a "raw" MIB oid. */
238 #define   SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr)\
239           static struct sysctl_oid sysctl__##parent##_##name = {                \
240                     &sysctl_##parent##_children,                                \
241                     { NULL },                                                   \
242                     nbr,                                                                  \
243                     kind,                                                                 \
244                     a1,                                                                   \
245                     a2,                                                                   \
246                     #name,                                                                \
247                     handler,                                                    \
248                     fmt,                                                                  \
249                     0,                                                                    \
250                     0,                                                                    \
251                     __DESCR(descr)                                                        \
252                     };                                                                    \
253           DATA_SET(sysctl_set, sysctl__##parent##_##name)
254 
255 #define   SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
256           sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr);
257 
258 /* This constructs a node from which other oids can hang. */
259 #define   SYSCTL_NODE(parent, nbr, name, access, handler, descr)                \
260           struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name);  \
261           SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access),                  \
262               (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, "N", descr)
263 
264 #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr)         \
265           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access),         \
266           0, 0, handler, "N", descr)
267 
268 /* Oid for a string.  len can be 0 to indicate '\0' termination. */
269 #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr)     \
270           SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access),                \
271                     arg, len, sysctl_handle_string, "A", descr)
272 
273 #define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \
274           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access),       \
275           arg, len, sysctl_handle_string, "A", descr)
276 
277 /* Oid for an int.  If ptr is NULL, val is returned. */
278 #define   SYSCTL_INT(parent, nbr, name, access, ptr, val, descr)                \
279           SYSCTL_OID(parent, nbr, name,                                         \
280                     CTLTYPE_INT|CTLFLAG_NOLOCK|(access),                        \
281                     ptr, val, sysctl_handle_int, "I", descr)
282 
283 #define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr)         \
284           sysctl_add_oid(ctx, parent, nbr, name,                                \
285                     CTLTYPE_INT|CTLFLAG_NOLOCK|(access),                        \
286           ptr, val, sysctl_handle_int, "I", descr)
287 
288 /* Oid for a quad.  If ptr is NULL, val is returned. */
289 #define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr)                 \
290           SYSCTL_OID(parent, nbr, name,                                         \
291                     CTLTYPE_QUAD|CTLFLAG_NOLOCK|(access),                       \
292                     ptr, val, sysctl_handle_quad, "Q", descr)
293 
294 #define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, val, descr) \
295           sysctl_add_oid(ctx, parent, nbr, name,                                \
296                     CTLTYPE_QUAD|CTLFLAG_NOLOCK|(access),                       \
297                     ptr, val, sysctl_handle_quad, "Q", descr)
298 
299 /* Oid for an unsigned quad.  If ptr is NULL, val is returned. */
300 #define SYSCTL_UQUAD(parent, nbr, name, access, ptr, val, descr)      \
301           SYSCTL_OID(parent, nbr, name,                                         \
302                     CTLTYPE_UQUAD|CTLFLAG_NOLOCK|(access),                      \
303                     ptr, val, sysctl_handle_quad, "QU", descr)
304 
305 #define SYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, val, descr) \
306           sysctl_add_oid(ctx, parent, nbr, name,                                \
307                     CTLTYPE_UQUAD|CTLFLAG_NOLOCK|(access),                      \
308                     ptr, val, sysctl_handle_quad, "QU", descr)
309 
310 /* Oid for an unsigned int.  If ptr is NULL, val is returned. */
311 #define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr)                 \
312           SYSCTL_OID(parent, nbr, name,                                         \
313                     CTLTYPE_UINT|CTLFLAG_NOLOCK|(access),                       \
314                     ptr, val, sysctl_handle_int, "IU", descr)
315 
316 #define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \
317           sysctl_add_oid(ctx, parent, nbr, name,                                \
318                     CTLTYPE_UINT|CTLFLAG_NOLOCK|(access),                       \
319                     ptr, val, sysctl_handle_int, "IU", descr)
320 
321 /* Oid for a long.  The pointer must be non NULL. */
322 #define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr)                 \
323           SYSCTL_OID(parent, nbr, name,                                         \
324                     CTLTYPE_LONG|CTLFLAG_NOLOCK|(access),                       \
325                     ptr, val, sysctl_handle_long, "L", descr)
326 
327 #define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr)   \
328           sysctl_add_oid(ctx, parent, nbr, name,                                \
329                     CTLTYPE_LONG|CTLFLAG_NOLOCK|(access),                       \
330                     ptr, 0, sysctl_handle_long, "L", descr)
331 
332 /* Oid for a long.  The pointer must be non NULL. */
333 #define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr)      \
334           SYSCTL_OID(parent, nbr, name,                                         \
335                     CTLTYPE_ULONG|CTLFLAG_NOLOCK|(access),                      \
336                     ptr, val, sysctl_handle_long, "LU", descr)
337 
338 #define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr)  \
339           sysctl_add_oid(ctx, parent, nbr, name,                                \
340                     CTLTYPE_ULONG|CTLFLAG_NOLOCK|(access),                      \
341                     ptr, 0, sysctl_handle_long, "LU", descr)
342 
343 /* Oid for a signed 8-bit int.  The pointer must be non NULL. */
344 #define SYSCTL_S8(parent, nbr, name, access, ptr, val, descr)         \
345           SYSCTL_OID(parent, nbr, name, CTLTYPE_S8|(access),                    \
346                     ptr, val, sysctl_handle_8, "C", descr)
347 
348 #define SYSCTL_ADD_S8(ctx, parent, nbr, name, access, ptr, descr)     \
349           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_S8|(access), \
350           ptr, 0, sysctl_handle_8, "C", descr)
351 
352 /* Oid for a signed 16-bit int.  The pointer must be non NULL. */
353 #define SYSCTL_S16(parent, nbr, name, access, ptr, val, descr)        \
354           SYSCTL_OID(parent, nbr, name, CTLTYPE_S16|(access),                   \
355                     ptr, val, sysctl_handle_16, "S", descr)
356 
357 #define SYSCTL_ADD_S16(ctx, parent, nbr, name, access, ptr, descr)    \
358           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_S16|(access),          \
359           ptr, 0, sysctl_handle_16, "S", descr)
360 
361 /* Oid for a signed 32-bit int.  The pointer must be non NULL. */
362 #define SYSCTL_S32(parent, nbr, name, access, ptr, val, descr)        \
363           SYSCTL_OID(parent, nbr, name, CTLTYPE_S32|(access),                   \
364                     ptr, val, sysctl_handle_32, "I", descr)
365 
366 #define SYSCTL_ADD_S32(ctx, parent, nbr, name, access, ptr, descr)    \
367           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_S32|(access),          \
368           ptr, 0, sysctl_handle_32, "I", descr)
369 
370 /* Oid for a signed 64-bit int.  The pointer must be non NULL. */
371 #define SYSCTL_S64(parent, nbr, name, access, ptr, val, descr)        \
372           SYSCTL_OID(parent, nbr, name, CTLTYPE_S64|(access),                   \
373                     ptr, val, sysctl_handle_64, "Q", descr)
374 
375 #define SYSCTL_ADD_S64(ctx, parent, nbr, name, access, ptr, descr)    \
376           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_S64|(access),          \
377           ptr, 0, sysctl_handle_64, "Q", descr)
378 
379 /* Oid for an unsigned 8-bit int.  The pointer must be non NULL. */
380 #define SYSCTL_U8(parent, nbr, name, access, ptr, val, descr)         \
381           SYSCTL_OID(parent, nbr, name, CTLTYPE_U8|(access),                    \
382                     ptr, val, sysctl_handle_8, "CU", descr)
383 
384 #define SYSCTL_ADD_U8(ctx, parent, nbr, name, access, ptr, descr)     \
385           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_U8|(access), \
386           ptr, 0, sysctl_handle_8, "CU", descr)
387 
388 /* Oid for an unsigned 16-bit int.  The pointer must be non NULL. */
389 #define SYSCTL_U16(parent, nbr, name, access, ptr, val, descr)        \
390           SYSCTL_OID(parent, nbr, name, CTLTYPE_U16|(access),                   \
391                     ptr, val, sysctl_handle_16, "SU", descr)
392 
393 #define SYSCTL_ADD_U16(ctx, parent, nbr, name, access, ptr, descr)    \
394           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_U16|(access),          \
395           ptr, 0, sysctl_handle_16, "SU", descr)
396 
397 /* Oid for an unsigned 32-bit int.  The pointer must be non NULL. */
398 #define SYSCTL_U32(parent, nbr, name, access, ptr, val, descr)        \
399           SYSCTL_OID(parent, nbr, name, CTLTYPE_U32|(access),                   \
400                     ptr, val, sysctl_handle_32, "IU", descr)
401 
402 #define SYSCTL_ADD_U32(ctx, parent, nbr, name, access, ptr, descr)    \
403           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_U32|(access),          \
404           ptr, 0, sysctl_handle_32, "IU", descr)
405 
406 /* Oid for an unsigned 64-bit int.  The pointer must be non NULL. */
407 #define SYSCTL_U64(parent, nbr, name, access, ptr, val, descr)        \
408           SYSCTL_OID(parent, nbr, name, CTLTYPE_U64|(access),                   \
409                     ptr, val, sysctl_handle_64, "QU", descr)
410 
411 #define SYSCTL_ADD_U64(ctx, parent, nbr, name, access, ptr, descr)    \
412           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_U64|(access),          \
413           ptr, 0, sysctl_handle_64, "QU", descr)
414 
415 /* Oid for a bit in a uint32_t.  If ptr is NULL, val is returned. */
416 /* API passes and returns an integer */
417 #define   SYSCTL_BIT32(parent, nbr, name, access, ptr, val, bit, descr)         \
418           SYSCTL_OID(parent, nbr, name,                                         \
419                     CTLTYPE_BIT32(bit)|CTLFLAG_NOLOCK|(access),                 \
420                     ptr, val, sysctl_handle_bit32, "I", descr)
421 
422 #define SYSCTL_ADD_BIT32(ctx, parent, nbr, name, access, ptr, val, bit, descr) \
423           sysctl_add_oid(ctx, parent, nbr, name,                                \
424               CTLTYPE_BIT32(bit)|CTLFLAG_NOLOCK|(access),                       \
425               ptr, val, sysctl_handle_bit32, "I", descr)
426 
427 /* Oid for a bit in a uint64_t.  If ptr is NULL, val is returned. */
428 /* API passes and returns an integer */
429 #define   SYSCTL_BIT64(parent, nbr, name, access, ptr, val, bit, descr)         \
430           SYSCTL_OID(parent, nbr, name,                                         \
431                     CTLTYPE_BIT64(bit)|CTLFLAG_NOLOCK|(access),                 \
432                     ptr, val, sysctl_handle_bit64, "I", descr)
433 
434 #define SYSCTL_ADD_BIT64(ctx, parent, nbr, name, access, ptr, val, bit, descr) \
435           sysctl_add_oid(ctx, parent, nbr, name,                                \
436               CTLTYPE_BIT64(bit)|CTLFLAG_NOLOCK|(access),                       \
437               ptr, val, sysctl_handle_bit64, "I", descr)
438 
439 /* Oid for an opaque object.  Specified by a pointer and a length. */
440 #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr)          \
441           SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access),                \
442                     ptr, len, sysctl_handle_opaque, fmt, descr)
443 
444 #define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr) \
445           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),       \
446           ptr, len, sysctl_handle_opaque, fmt, descr)
447 
448 /* Oid for a struct.  Specified by a pointer and a type. */
449 #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr)    \
450           SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access),                \
451                     ptr, sizeof(struct type), sysctl_handle_opaque,             \
452                     "S," #type, descr)
453 
454 #define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
455           sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),       \
456           ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, descr)
457 
458 /* Oid for a procedure.  Specified by a pointer and an arg. */
459 #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
460           SYSCTL_OID(parent, nbr, name, (access),                               \
461                     ptr, arg, handler, fmt, descr)
462 
463 #define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
464           sysctl_add_oid(ctx, parent, nbr, name, (access),            \
465           ptr, arg, handler, fmt, descr)
466 
467 #endif /* _KERNEL */
468 
469 /*
470  * Top-level identifiers
471  */
472 #define   CTL_SYSCTL          0                   /* "magic" numbers */
473 #define   CTL_KERN  1                   /* "high kernel": proc, limits */
474 #define   CTL_VM              2                   /* virtual memory */
475 #define   CTL_VFS             3                   /* file system, mount type is next */
476 #define   CTL_NET             4                   /* network, see socket.h */
477 #define   CTL_DEBUG 5                   /* debugging parameters */
478 #define   CTL_HW              6                   /* generic cpu/io */
479 #define   CTL_MACHDEP         7                   /* machine dependent */
480 #define   CTL_USER  8                   /* user-level */
481 #define   CTL_P1003_1B        9                   /* POSIX 1003.1B */
482 #define   CTL_LWKT  10                  /* light weight kernel threads */
483 #define   CTL_MAXID 11                  /* number of valid top-level ids */
484 
485 #define CTL_NAMES { \
486           { 0, 0 }, \
487           { "kern", CTLTYPE_NODE }, \
488           { "vm", CTLTYPE_NODE }, \
489           { "vfs", CTLTYPE_NODE }, \
490           { "net", CTLTYPE_NODE }, \
491           { "debug", CTLTYPE_NODE }, \
492           { "hw", CTLTYPE_NODE }, \
493           { "machdep", CTLTYPE_NODE }, \
494           { "user", CTLTYPE_NODE }, \
495           { "p1003_1b", CTLTYPE_NODE }, \
496           { "lwkt", CTLTYPE_NODE }, \
497 }
498 
499 /*
500  * CTL_SYSCTL identifiers
501  */
502 #define   CTL_SYSCTL_DEBUG    0         /* printf all nodes */
503 #define   CTL_SYSCTL_NAME               1         /* string name of OID */
504 #define   CTL_SYSCTL_NEXT               2         /* next OID */
505 #define   CTL_SYSCTL_NAME2OID 3         /* int array of name */
506 #define   CTL_SYSCTL_OIDFMT   4         /* OID's kind and format */
507 #define   CTL_SYSCTL_OIDDESCR 5         /* OID's description */
508 
509 /*
510  * CTL_KERN identifiers
511  */
512 #define   KERN_OSTYPE                    1        /* string: system version */
513 #define   KERN_OSRELEASE                 2        /* string: system release */
514 #define   KERN_OSREV                     3        /* int: system revision */
515 #define   KERN_VERSION                   4        /* string: compile time info */
516 #define   KERN_MAXVNODES                 5        /* int: max vnodes */
517 #define   KERN_MAXPROC                   6        /* int: max processes */
518 #define   KERN_MAXFILES                  7        /* int: max open files */
519 #define   KERN_ARGMAX                    8        /* int: max arguments to exec */
520 #define   KERN_SECURELVL                 9        /* int: system security level */
521 #define   KERN_HOSTNAME                 10        /* string: hostname */
522 #define   KERN_HOSTID                   11        /* int: host identifier */
523 #define   KERN_CLOCKRATE                12        /* struct: struct clockrate */
524 #define   KERN_VNODE                    13        /* struct: vnode structures */
525 #define   KERN_PROC           14        /* struct: process entries */
526 #define   KERN_FILE           15        /* struct: file entries */
527 #define   KERN_UNUSED16                 16        /* was: node: kernel profiling info */
528 #define   KERN_POSIX1                   17        /* int: POSIX.1 version */
529 #define   KERN_NGROUPS                  18        /* int: # of supplemental group ids */
530 #define   KERN_JOB_CONTROL    19        /* int: is job control available */
531 #define   KERN_SAVED_IDS                20        /* int: saved set-user/group-ID */
532 #define   KERN_BOOTTIME                 21        /* struct: time kernel was booted */
533 #define KERN_NISDOMAINNAME    22        /* string: YP domain name */
534 #define KERN_UPDATEINTERVAL   23        /* int: update process sleep time */
535 #define KERN_OSRELDATE                  24        /* int: OS release date */
536 #define KERN_NTP_PLL                    25        /* node: NTP PLL control */
537 #define   KERN_BOOTFILE                 26        /* string: name of booted kernel */
538 #define   KERN_MAXFILESPERPROC          27        /* int: max open files per proc */
539 #define   KERN_MAXPROCPERUID  28        /* int: max processes per uid */
540 #define   KERN_DUMPDEV                  29        /* dev_t: device to dump on */
541 #define   KERN_IPC            30        /* node: anything related to IPC */
542 #define   KERN_DUMMY                    31        /* unused */
543 #define   KERN_PS_STRINGS               32        /* int: address of PS_STRINGS */
544 #define   KERN_USRSTACK                 33        /* int: address of USRSTACK */
545 #define   KERN_LOGSIGEXIT               34        /* int: do we log sigexit procs? */
546 #define   KERN_IOV_MAX                  35        /* int: value of UIO_MAXIOV */
547 #define KERN_MAXPOSIXLOCKSPERUID 36     /* int: max POSIX locks per uid */
548 #define KERN_STATIC_TLS_EXTRA 37        /* int: extra tls space for rtld */
549 #define KERN_MAXID            38      /* number of valid kern ids */
550 
551 #define CTL_KERN_NAMES { \
552           { 0, 0 }, \
553           { "ostype", CTLTYPE_STRING }, \
554           { "osrelease", CTLTYPE_STRING }, \
555           { "osrevision", CTLTYPE_INT }, \
556           { "version", CTLTYPE_STRING }, \
557           { "maxvnodes", CTLTYPE_INT }, \
558           { "maxproc", CTLTYPE_INT }, \
559           { "maxfiles", CTLTYPE_INT }, \
560           { "argmax", CTLTYPE_INT }, \
561           { "securelevel", CTLTYPE_INT }, \
562           { "hostname", CTLTYPE_STRING }, \
563           { "hostid", CTLTYPE_UINT }, \
564           { "clockrate", CTLTYPE_STRUCT }, \
565           { "vnode", CTLTYPE_STRUCT }, \
566           { "proc", CTLTYPE_STRUCT }, \
567           { "file", CTLTYPE_STRUCT }, \
568           { "profiling", CTLTYPE_NODE }, \
569           { "posix1version", CTLTYPE_INT }, \
570           { "ngroups", CTLTYPE_INT }, \
571           { "job_control", CTLTYPE_INT }, \
572           { "saved_ids", CTLTYPE_INT }, \
573           { "boottime", CTLTYPE_STRUCT }, \
574           { "nisdomainname", CTLTYPE_STRING }, \
575           { "update", CTLTYPE_INT }, \
576           { "osreldate", CTLTYPE_INT }, \
577           { "ntp_pll", CTLTYPE_NODE }, \
578           { "bootfile", CTLTYPE_STRING }, \
579           { "maxfilesperproc", CTLTYPE_INT }, \
580           { "maxprocperuid", CTLTYPE_INT }, \
581           { "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
582           { "ipc", CTLTYPE_NODE }, \
583           { "dummy", CTLTYPE_INT }, \
584           { "ps_strings", CTLTYPE_INT }, \
585           { "usrstack", CTLTYPE_INT }, \
586           { "logsigexit", CTLTYPE_INT }, \
587           { "iov_max", CTLTYPE_INT }, \
588           { "maxposixlocksperuid", CTLTYPE_INT }, \
589 }
590 
591 /*
592  * CTL_VFS identifiers
593  */
594 #define CTL_VFS_NAMES { \
595           { "vfsconf", CTLTYPE_STRUCT }, \
596 }
597 
598 /*
599  * KERN_PROC subtypes
600  */
601 #define KERN_PROC_ALL                   0         /* everything */
602 #define   KERN_PROC_PID                 1         /* by process id */
603 #define   KERN_PROC_PGRP                2         /* by process group id */
604 #define   KERN_PROC_SESSION   3         /* by session of pid */
605 #define   KERN_PROC_TTY                 4         /* by controlling tty */
606 #define   KERN_PROC_UID                 5         /* by effective uid */
607 #define   KERN_PROC_RUID                6         /* by real uid */
608 #define   KERN_PROC_ARGS                7         /* get/set arguments/proctitle */
609 #define   KERN_PROC_CWD                 8         /* get cwd */
610 #define   KERN_PROC_PATHNAME      9     /* path to executable */
611 #define KERN_PROC_SIGTRAMP    10        /* addr[2]: sigtramp addr range */
612 
613 #define KERN_PROC_FLAGMASK    0xF0
614 #define KERN_PROC_FLAG_LWP    0x10
615 #define KERN_PROC_FLAG_LWKT   0x20
616 
617 /*
618  * KERN_IPC identifiers
619  */
620 #define KIPC_MAXSOCKBUF                 1         /* int: max size of a socket buffer */
621 #define   KIPC_SOCKBUF_WASTE  2         /* int: wastage factor in sockbuf */
622 #define   KIPC_SOMAXCONN                3         /* int: max length of connection q */
623 #define   KIPC_MAX_LINKHDR    4         /* int: max length of link header */
624 #define   KIPC_MAX_PROTOHDR   5         /* int: max length of network header */
625 #define   KIPC_MAX_HDR                  6         /* int: max total length of headers */
626 #define   KIPC_MAX_DATALEN    7         /* int: max length of data? */
627 #define   KIPC_MBSTAT                   8         /* struct: mbuf usage statistics */
628 #define   KIPC_NMBCLUSTERS    9         /* int: maximum mbuf clusters */
629 
630 /*
631  * CTL_HW identifiers
632  */
633 #define   HW_MACHINE           1                  /* string: machine class */
634 #define   HW_MODEL   2                  /* string: specific machine model */
635 #define   HW_NCPU              3                  /* int: number of cpus */
636 #define   HW_BYTEORDER         4                  /* int: machine byte order */
637 #define   HW_PHYSMEM           5                  /* int: total memory */
638 #define   HW_USERMEM           6                  /* int: non-kernel memory */
639 #define   HW_PAGESIZE          7                  /* int: software page size */
640 #define   HW_DISKNAMES         8                  /* strings: disk drive names */
641 #define   HW_DISKSTATS         9                  /* struct: diskstats[] */
642 #define HW_FLOATINGPT         10                  /* int: has HW floating point? */
643 #define HW_MACHINE_ARCH       11                  /* string: machine architecture */
644 #define HW_MACHINE_PLATFORM 12                    /* string: platform architecture */
645 #define HW_SENSORS  13                  /* node: hardware sensors */
646 #define HW_MAXID    14                  /* number of valid hw ids */
647 
648 /*
649  * CTL_USER definitions
650  */
651 #define   USER_CS_PATH                   1        /* string: _CS_PATH */
652 #define   USER_BC_BASE_MAX     2        /* int: BC_BASE_MAX */
653 #define   USER_BC_DIM_MAX                3        /* int: BC_DIM_MAX */
654 #define   USER_BC_SCALE_MAX    4        /* int: BC_SCALE_MAX */
655 #define   USER_BC_STRING_MAX   5        /* int: BC_STRING_MAX */
656 #define   USER_COLL_WEIGHTS_MAX          6        /* int: COLL_WEIGHTS_MAX */
657 #define   USER_EXPR_NEST_MAX   7        /* int: EXPR_NEST_MAX */
658 #define   USER_LINE_MAX                  8        /* int: LINE_MAX */
659 #define   USER_RE_DUP_MAX                9        /* int: RE_DUP_MAX */
660 #define   USER_POSIX2_VERSION 10        /* int: _POSIX2_VERSION */
661 #define   USER_POSIX2_C_BIND  11        /* int: _POSIX2_C_BIND */
662 #define   USER_POSIX2_C_DEV   12        /* int: _POSIX2_C_DEV */
663 #define   USER_POSIX2_CHAR_TERM         13        /* int: _POSIX2_CHAR_TERM */
664 #define   USER_POSIX2_FORT_DEV          14        /* int: _POSIX2_FORT_DEV */
665 #define   USER_POSIX2_FORT_RUN          15        /* int: _POSIX2_FORT_RUN */
666 #define   USER_POSIX2_LOCALEDEF         16        /* int: _POSIX2_LOCALEDEF */
667 #define   USER_POSIX2_SW_DEV  17        /* int: _POSIX2_SW_DEV */
668 #define   USER_POSIX2_UPE               18        /* int: _POSIX2_UPE */
669 #define   USER_STREAM_MAX               19        /* int: _POSIX2_STREAM_MAX */
670 #define   USER_TZNAME_MAX               20        /* int: _POSIX2_TZNAME_MAX */
671 #define   USER_MAXID                    21        /* number of valid user ids */
672 
673 #define   CTL_USER_NAMES { \
674           { 0, 0 }, \
675           { "cs_path", CTLTYPE_STRING }, \
676           { "bc_base_max", CTLTYPE_INT }, \
677           { "bc_dim_max", CTLTYPE_INT }, \
678           { "bc_scale_max", CTLTYPE_INT }, \
679           { "bc_string_max", CTLTYPE_INT }, \
680           { "coll_weights_max", CTLTYPE_INT }, \
681           { "expr_nest_max", CTLTYPE_INT }, \
682           { "line_max", CTLTYPE_INT }, \
683           { "re_dup_max", CTLTYPE_INT }, \
684           { "posix2_version", CTLTYPE_INT }, \
685           { "posix2_c_bind", CTLTYPE_INT }, \
686           { "posix2_c_dev", CTLTYPE_INT }, \
687           { "posix2_char_term", CTLTYPE_INT }, \
688           { "posix2_fort_dev", CTLTYPE_INT }, \
689           { "posix2_fort_run", CTLTYPE_INT }, \
690           { "posix2_localedef", CTLTYPE_INT }, \
691           { "posix2_sw_dev", CTLTYPE_INT }, \
692           { "posix2_upe", CTLTYPE_INT }, \
693           { "stream_max", CTLTYPE_INT }, \
694           { "tzname_max", CTLTYPE_INT }, \
695 }
696 
697 #define CTL_P1003_1B_ASYNCHRONOUS_IO              1         /* boolean */
698 #define CTL_P1003_1B_MAPPED_FILES                 2         /* boolean */
699 #define CTL_P1003_1B_MEMLOCK                      3         /* boolean */
700 #define CTL_P1003_1B_MEMLOCK_RANGE                4         /* boolean */
701 #define CTL_P1003_1B_MEMORY_PROTECTION            5         /* boolean */
702 #define CTL_P1003_1B_MESSAGE_PASSING              6         /* boolean */
703 #define CTL_P1003_1B_PRIORITIZED_IO               7         /* boolean */
704 #define CTL_P1003_1B_PRIORITY_SCHEDULING          8         /* boolean */
705 #define CTL_P1003_1B_REALTIME_SIGNALS             9         /* boolean */
706 #define CTL_P1003_1B_SEMAPHORES                             10        /* boolean */
707 #define CTL_P1003_1B_FSYNC                        11        /* boolean */
708 #define CTL_P1003_1B_SHARED_MEMORY_OBJECTS        12        /* boolean */
709 #define CTL_P1003_1B_SYNCHRONIZED_IO              13        /* boolean */
710 #define CTL_P1003_1B_TIMERS                       14        /* boolean */
711 #define CTL_P1003_1B_AIO_LISTIO_MAX               15        /* int */
712 #define CTL_P1003_1B_AIO_MAX                      16        /* int */
713 #define CTL_P1003_1B_AIO_PRIO_DELTA_MAX           17        /* int */
714 #define CTL_P1003_1B_DELAYTIMER_MAX               18        /* int */
715 #define CTL_P1003_1B_UNUSED19                     19        /* int */
716 #define CTL_P1003_1B_PAGESIZE                     20        /* int */
717 #define CTL_P1003_1B_RTSIG_MAX                              21        /* int */
718 #define CTL_P1003_1B_SEM_NSEMS_MAX                22        /* int */
719 #define CTL_P1003_1B_UNUSED23                     23        /* int */
720 #define CTL_P1003_1B_SIGQUEUE_MAX                 24        /* int */
721 #define CTL_P1003_1B_TIMER_MAX                              25        /* int */
722 
723 #define CTL_P1003_1B_MAXID              26
724 
725 #define   CTL_P1003_1B_NAMES { \
726           { 0, 0 }, \
727           { "asynchronous_io", CTLTYPE_INT }, \
728           { "mapped_files", CTLTYPE_INT }, \
729           { "memlock", CTLTYPE_INT }, \
730           { "memlock_range", CTLTYPE_INT }, \
731           { "memory_protection", CTLTYPE_INT }, \
732           { "message_passing", CTLTYPE_INT }, \
733           { "prioritized_io", CTLTYPE_INT }, \
734           { "priority_scheduling", CTLTYPE_INT }, \
735           { "realtime_signals", CTLTYPE_INT }, \
736           { "semaphores", CTLTYPE_INT }, \
737           { "fsync", CTLTYPE_INT }, \
738           { "shared_memory_objects", CTLTYPE_INT }, \
739           { "synchronized_io", CTLTYPE_INT }, \
740           { "timers", CTLTYPE_INT }, \
741           { "aio_listio_max", CTLTYPE_INT }, \
742           { "aio_max", CTLTYPE_INT }, \
743           { "aio_prio_delta_max", CTLTYPE_INT }, \
744           { "delaytimer_max", CTLTYPE_INT }, \
745           { "unused1", CTLTYPE_INT }, \
746           { "pagesize", CTLTYPE_INT }, \
747           { "rtsig_max", CTLTYPE_INT }, \
748           { "nsems_max", CTLTYPE_INT }, \
749           { "sem_value_max", CTLTYPE_INT }, \
750           { "sigqueue_max", CTLTYPE_INT }, \
751           { "timer_max", CTLTYPE_INT }, \
752 }
753 
754 #ifdef _KERNEL
755 
756 /*
757  * Declare some common oids.
758  */
759 extern struct sysctl_oid_list sysctl__children;
760 SYSCTL_DECL(_kern);
761 SYSCTL_DECL(_kern_features);
762 SYSCTL_DECL(_sysctl);
763 SYSCTL_DECL(_vm);
764 SYSCTL_DECL(_vfs);
765 SYSCTL_DECL(_net);
766 SYSCTL_DECL(_debug);
767 SYSCTL_DECL(_debug_sizeof);
768 SYSCTL_DECL(_dev);
769 SYSCTL_DECL(_hw);
770 SYSCTL_DECL(_hw_bus);
771 SYSCTL_DECL(_machdep);
772 SYSCTL_DECL(_user);
773 SYSCTL_DECL(_compat);
774 SYSCTL_DECL(_lwkt);
775 SYSCTL_DECL(_security);
776 
777 /*
778  * Common second-level oids.
779  */
780 SYSCTL_DECL(_kern_ipc);
781 
782 extern char         machine[];
783 extern char         osrelease[];
784 extern char         ostype[];
785 extern char         kern_ident[];
786 
787 /* Dynamic oid handling */
788 struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,
789                     struct sysctl_oid_list *parent, int nbr, const char *name,
790                     int kind, void *arg1, int arg2,
791                     int (*handler) (SYSCTL_HANDLER_ARGS),
792                     const char *fmt, const char *descr);
793 void      sysctl_rename_oid(struct sysctl_oid *oidp, const char *name);
794 int       sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del,
795               int recurse);
796 int       sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse);
797 int       sysctl_ctx_init(struct sysctl_ctx_list *clist);
798 int       sysctl_ctx_free(struct sysctl_ctx_list *clist);
799 struct    sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist,
800                     struct sysctl_oid *oidp);
801 struct    sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist,
802                     struct sysctl_oid *oidp);
803 int       sysctl_ctx_entry_del(struct sysctl_ctx_list *clist,
804                     struct sysctl_oid *oidp);
805 
806 int       kernel_sysctl(int *name, u_int namelen, void *old,
807                           size_t *oldlenp, void *new, size_t newlen,
808                           size_t *retval);
809 int       kernel_sysctlbyname(char *name,
810                     void *old, size_t *oldlenp, void *new, size_t newlen,
811                     size_t *retval);
812 int       userland_sysctl(int *name, u_int namelen, void *old,
813               size_t *oldlenp, int inkernel, void *new, size_t newlen,
814               size_t *retval);
815 int       sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
816                               int *nindx, struct sysctl_req *req);
817 
818 int       sysctl_int_range(SYSCTL_HANDLER_ARGS, int low, int high);
819 void      _sysctl_xlock(void);
820 void      _sysctl_xunlock(void);
821 
822 struct sbuf;
823 struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int,
824               struct sysctl_req *);
825 
826 /*
827  * A macro to generate a read-only sysctl to indicate the presence of optional
828  * kernel features.
829  */
830 #define FEATURE(name, desc)                                                     \
831           SYSCTL_INT(_kern_features, OID_AUTO, name,                  \
832               CTLFLAG_RD, NULL, 1, desc)
833 
834 #endif    /* _KERNEL */
835 
836 #if !defined(_KERNEL) || defined(_KERNEL_VIRTUAL)
837 
838 #include <sys/cdefs.h>
839 
840 __BEGIN_DECLS
841 int       sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
842 int       sysctlbyname(const char *, void *, size_t *, const void *, size_t);
843 int       sysctlnametomib (const char *, int *, size_t *);
844 __END_DECLS
845 
846 #endif    /* _KERNEL && _KERNEL_VIRTUAL */
847 
848 #endif    /* !_SYS_SYSCTL_H_ */
849