2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
24 * Copyright (c) 1989, 1993
25 * The Regents of the University of California. All rights reserved.
27 * This code is derived from software contributed to Berkeley by
28 * Mike Karels at Berkeley Software Design, Inc.
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 * 3. All advertising materials mentioning features or use of this software
39 * must display the following acknowledgement:
40 * This product includes software developed by the University of
41 * California, Berkeley and its contributors.
42 * 4. Neither the name of the University nor the names of its contributors
43 * may be used to endorse or promote products derived from this software
44 * without specific prior written permission.
46 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * @(#)sysctl.h 8.1 (Berkeley) 6/2/93
61 #ifndef _SYS_SYSCTL_H_
62 #define _SYS_SYSCTL_H_
65 * These are for the eproc structure defined below.
67 #include <sys/appleapiopts.h>
70 #include <sys/ucred.h>
75 #include <sys/linker_set.h>
78 * Definitions for sysctl call. The sysctl call uses a hierarchical name
79 * for objects that can be examined or modified. The name is expressed as
80 * a sequence of integers. Like a file path name, the meaning of each
81 * component depends on its place in the hierarchy. The top-level and kern
82 * identifiers are defined here, and other identifiers are defined in the
83 * respective subsystem header files.
86 #define CTL_MAXNAME 12 /* largest number of components supported */
89 * Each subsystem defined by sysctl defines a list of variables
90 * for that subsystem. Each name is either a node with further
91 * levels defined below it, or it is a leaf of some particular
92 * type given below. Each sysctl level defines a set of name/type
93 * pairs to be used by sysctl(1) in manipulating the subsystem.
96 char *ctl_name
; /* subsystem name */
97 int ctl_type
; /* type of name */
100 #define CTLTYPE 0xf /* Mask for the type */
101 #define CTLTYPE_NODE 1 /* name is a node */
102 #define CTLTYPE_INT 2 /* name describes an integer */
103 #define CTLTYPE_STRING 3 /* name describes a string */
104 #define CTLTYPE_QUAD 4 /* name describes a 64-bit number */
105 #define CTLTYPE_OPAQUE 5 /* name describes a structure */
106 #define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */
108 #define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
109 #define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
110 #define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
111 #define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */
112 #define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
113 #define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */
116 * USE THIS instead of a hardwired number from the categories below
117 * to get dynamically assigned sysctl entries using the linker-set
118 * technology. This is the way nearly all new sysctl variables should
120 * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
122 #define OID_AUTO (-1)
125 #ifdef __APPLE_API_UNSTABLE
126 #define SYSCTL_HANDLER_ARGS (struct sysctl_oid *oidp, void *arg1, int arg2, \
127 struct sysctl_req *req)
130 * This describes the access space for a sysctl request. This is needed
131 * so that we can use the interface from the kernel or from user-space.
139 int (*oldfunc
)(struct sysctl_req
*, const void *, size_t);
143 int (*newfunc
)(struct sysctl_req
*, void *, size_t);
146 SLIST_HEAD(sysctl_oid_list
, sysctl_oid
);
149 * This describes one "oid" in the MIB tree. Potentially more nodes can
150 * be hidden behind it, expanded by the handler.
153 struct sysctl_oid_list
*oid_parent
;
154 SLIST_ENTRY(sysctl_oid
) oid_link
;
159 const char *oid_name
;
160 int (*oid_handler
) SYSCTL_HANDLER_ARGS
;
164 #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
165 #define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
167 int sysctl_handle_int SYSCTL_HANDLER_ARGS
;
168 int sysctl_handle_long SYSCTL_HANDLER_ARGS
;
169 int sysctl_handle_intptr SYSCTL_HANDLER_ARGS
;
170 int sysctl_handle_string SYSCTL_HANDLER_ARGS
;
171 int sysctl_handle_opaque SYSCTL_HANDLER_ARGS
;
174 * These functions are used to add/remove an oid from the mib.
176 void sysctl_register_oid(struct sysctl_oid
*oidp
);
177 void sysctl_unregister_oid(struct sysctl_oid
*oidp
);
179 /* Declare an oid to allow child oids to be added to it. */
180 #define SYSCTL_DECL(name) \
181 extern struct sysctl_oid_list sysctl_##name##_children
183 /* This constructs a "raw" MIB oid. */
184 #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
185 struct sysctl_oid sysctl_##parent##_##name = { \
186 &sysctl_##parent##_children, { 0 }, \
187 nbr, kind, a1, a2, #name, handler, fmt };
190 /* This constructs a node from which other oids can hang. */
191 #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
192 struct sysctl_oid_list sysctl_##parent##_##name##_children; \
193 SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access, \
194 (void*)&sysctl_##parent##_##name##_children, 0, handler, \
197 /* Oid for a string. len can be 0 to indicate '\0' termination. */
198 #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
199 SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \
200 arg, len, sysctl_handle_string, "A", descr)
202 /* Oid for an int. If ptr is NULL, val is returned. */
203 #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
204 SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
205 ptr, val, sysctl_handle_int, "I", descr)
207 /* Oid for a long. The pointer must be non NULL. */
208 #define SYSCTL_LONG(parent, nbr, name, access, ptr, descr) \
209 SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
210 ptr, 0, sysctl_handle_long, "L", descr)
212 /* Oid for an opaque object. Specified by a pointer and a length. */
213 #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
214 SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
215 ptr, len, sysctl_handle_opaque, fmt, descr)
217 /* Oid for a struct. Specified by a pointer and a type. */
218 #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
219 SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
220 ptr, sizeof(struct type), sysctl_handle_opaque, \
223 /* Oid for a procedure. Specified by a pointer and an arg. */
224 #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
225 SYSCTL_OID(parent, nbr, name, access, \
226 ptr, arg, handler, fmt, descr)
227 #endif /* __APPLE_API_UNSTABLE */
231 * Top-level identifiers
233 #define CTL_UNSPEC 0 /* unused */
234 #define CTL_KERN 1 /* "high kernel": proc, limits */
235 #define CTL_VM 2 /* virtual memory */
236 #define CTL_VFS 3 /* file system, mount type is next */
237 #define CTL_NET 4 /* network, see socket.h */
238 #define CTL_DEBUG 5 /* debugging parameters */
239 #define CTL_HW 6 /* generic cpu/io */
240 #define CTL_MACHDEP 7 /* machine dependent */
241 #define CTL_USER 8 /* user-level */
242 #define CTL_MAXID 9 /* number of valid top-level ids */
244 #define CTL_NAMES { \
246 { "kern", CTLTYPE_NODE }, \
247 { "vm", CTLTYPE_NODE }, \
248 { "vfs", CTLTYPE_NODE }, \
249 { "net", CTLTYPE_NODE }, \
250 { "debug", CTLTYPE_NODE }, \
251 { "hw", CTLTYPE_NODE }, \
252 { "machdep", CTLTYPE_NODE }, \
253 { "user", CTLTYPE_NODE }, \
257 * CTL_KERN identifiers
259 #define KERN_OSTYPE 1 /* string: system version */
260 #define KERN_OSRELEASE 2 /* string: system release */
261 #define KERN_OSREV 3 /* int: system revision */
262 #define KERN_VERSION 4 /* string: compile time info */
263 #define KERN_MAXVNODES 5 /* int: max vnodes */
264 #define KERN_MAXPROC 6 /* int: max processes */
265 #define KERN_MAXFILES 7 /* int: max open files */
266 #define KERN_ARGMAX 8 /* int: max arguments to exec */
267 #define KERN_SECURELVL 9 /* int: system security level */
268 #define KERN_HOSTNAME 10 /* string: hostname */
269 #define KERN_HOSTID 11 /* int: host identifier */
270 #define KERN_CLOCKRATE 12 /* struct: struct clockrate */
271 #define KERN_VNODE 13 /* struct: vnode structures */
272 #define KERN_PROC 14 /* struct: process entries */
273 #define KERN_FILE 15 /* struct: file entries */
274 #define KERN_PROF 16 /* node: kernel profiling info */
275 #define KERN_POSIX1 17 /* int: POSIX.1 version */
276 #define KERN_NGROUPS 18 /* int: # of supplemental group ids */
277 #define KERN_JOB_CONTROL 19 /* int: is job control available */
278 #define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */
279 #define KERN_BOOTTIME 21 /* struct: time kernel was booted */
280 #define KERN_NISDOMAINNAME 22 /* string: YP domain name */
281 #define KERN_DOMAINNAME KERN_NISDOMAINNAME
282 #define KERN_MAXPARTITIONS 23 /* int: number of partitions/disk */
283 #define KERN_KDEBUG 24 /* int: kernel trace points */
284 #define KERN_UPDATEINTERVAL 25 /* int: update process sleep time */
285 #define KERN_OSRELDATE 26 /* int: OS release date */
286 #define KERN_NTP_PLL 27 /* node: NTP PLL control */
287 #define KERN_BOOTFILE 28 /* string: name of booted kernel */
288 #define KERN_MAXFILESPERPROC 29 /* int: max open files per proc */
289 #define KERN_MAXPROCPERUID 30 /* int: max processes per uid */
290 #define KERN_DUMPDEV 31 /* dev_t: device to dump on */
291 #define KERN_IPC 32 /* node: anything related to IPC */
292 #define KERN_DUMMY 33 /* unused */
293 #define KERN_PS_STRINGS 34 /* int: address of PS_STRINGS */
294 #define KERN_USRSTACK 35 /* int: address of USRSTACK */
295 #define KERN_LOGSIGEXIT 36 /* int: do we log sigexit procs? */
296 #define KERN_SYMFILE 37 /* string: kernel symbol filename */
297 #define KERN_PROCARGS 38
298 #define KERN_PCSAMPLES 39 /* node: pc sampling */
299 #define KERN_NETBOOT 40 /* int: are we netbooted? 1=yes,0=no */
300 #define KERN_PANICINFO 41 /* node: panic UI information */
301 #define KERN_SYSV 42 /* node: panic UI information */
302 #define KERN_MAXID 43 /* number of valid kern ids */
305 /* KERN_KDEBUG types */
306 #define KERN_KDEFLAGS 1
307 #define KERN_KDDFLAGS 2
308 #define KERN_KDENABLE 3
309 #define KERN_KDSETBUF 4
310 #define KERN_KDGETBUF 5
311 #define KERN_KDSETUP 6
312 #define KERN_KDREMOVE 7
313 #define KERN_KDSETREG 8
314 #define KERN_KDGETREG 9
315 #define KERN_KDREADTR 10
316 #define KERN_KDPIDTR 11
317 #define KERN_KDTHRMAP 12
318 /* Don't use 13 as it is overloaded with KERN_VNODE */
319 #define KERN_KDPIDEX 14
320 #define KERN_KDSETRTCDEC 15
321 #define KERN_KDGETENTROPY 16
323 /* KERN_PCSAMPLES types */
324 #define KERN_PCDISABLE 1
325 #define KERN_PCSETBUF 2
326 #define KERN_PCGETBUF 3
327 #define KERN_PCSETUP 4
328 #define KERN_PCREMOVE 5
329 #define KERN_PCREADBUF 6
330 #define KERN_PCSETREG 7
331 #define KERN_PCCOMM 8
333 /* KERN_PANICINFO types */
334 #define KERN_PANICINFO_MAXSIZE 1 /* quad: panic UI image size limit */
335 #define KERN_PANICINFO_IMAGE16 2 /* string: path to the panic UI (16 bit) */
336 #define KERN_PANICINFO_IMAGE32 3 /* string: path to the panic UI (32 bit) */
339 * KERN_SYSV identifiers
341 #define KSYSV_SHMMAX 1 /* int: max shared memory segment size (bytes) */
342 #define KSYSV_SHMMIN 2 /* int: min shared memory segment size (bytes) */
343 #define KSYSV_SHMMNI 3 /* int: max number of shared memory identifiers */
344 #define KSYSV_SHMSEG 4 /* int: max shared memory segments per process */
345 #define KSYSV_SHMALL 5 /* int: max amount of shared memory (pages) */
348 #define CTL_KERN_NAMES { \
350 { "ostype", CTLTYPE_STRING }, \
351 { "osrelease", CTLTYPE_STRING }, \
352 { "osrevision", CTLTYPE_INT }, \
353 { "version", CTLTYPE_STRING }, \
354 { "maxvnodes", CTLTYPE_INT }, \
355 { "maxproc", CTLTYPE_INT }, \
356 { "maxfiles", CTLTYPE_INT }, \
357 { "argmax", CTLTYPE_INT }, \
358 { "securelevel", CTLTYPE_INT }, \
359 { "hostname", CTLTYPE_STRING }, \
360 { "hostid", CTLTYPE_INT }, \
361 { "clockrate", CTLTYPE_STRUCT }, \
362 { "vnode", CTLTYPE_STRUCT }, \
363 { "proc", CTLTYPE_STRUCT }, \
364 { "file", CTLTYPE_STRUCT }, \
365 { "profiling", CTLTYPE_NODE }, \
366 { "posix1version", CTLTYPE_INT }, \
367 { "ngroups", CTLTYPE_INT }, \
368 { "job_control", CTLTYPE_INT }, \
369 { "saved_ids", CTLTYPE_INT }, \
370 { "boottime", CTLTYPE_STRUCT }, \
371 { "nisdomainname", CTLTYPE_STRING }, \
372 { "maxpartitions", CTLTYPE_INT }, \
373 { "kdebug", CTLTYPE_INT }, \
374 { "update", CTLTYPE_INT }, \
375 { "osreldate", CTLTYPE_INT }, \
376 { "ntp_pll", CTLTYPE_NODE }, \
377 { "bootfile", CTLTYPE_STRING }, \
378 { "maxfilesperproc", CTLTYPE_INT }, \
379 { "maxprocperuid", CTLTYPE_INT }, \
380 { "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
381 { "ipc", CTLTYPE_NODE }, \
382 { "dummy", CTLTYPE_INT }, \
383 { "ps_strings", CTLTYPE_INT }, \
384 { "usrstack", CTLTYPE_INT }, \
385 { "logsigexit", CTLTYPE_INT }, \
386 { "symfile",CTLTYPE_STRING },\
387 { "procargs",CTLTYPE_STRUCT },\
388 { "pcsamples",CTLTYPE_STRUCT },\
389 { "netboot", CTLTYPE_INT }, \
390 { "panicinfo", CTLTYPE_NODE }, \
391 { "sysv", CTLTYPE_NODE } \
395 * CTL_VFS identifiers
397 #define CTL_VFS_NAMES { \
398 { "vfsconf", CTLTYPE_STRUCT } \
404 #define KERN_PROC_ALL 0 /* everything */
405 #define KERN_PROC_PID 1 /* by process id */
406 #define KERN_PROC_PGRP 2 /* by process group id */
407 #define KERN_PROC_SESSION 3 /* by session of pid */
408 #define KERN_PROC_TTY 4 /* by controlling tty */
409 #define KERN_PROC_UID 5 /* by effective uid */
410 #define KERN_PROC_RUID 6 /* by real uid */
413 * KERN_PROC subtype ops return arrays of augmented proc structures:
415 #ifdef __APPLE_API_UNSTABLE
417 struct extern_proc kp_proc
; /* proc structure */
419 struct proc
*e_paddr
; /* address of proc */
420 struct session
*e_sess
; /* session pointer */
421 struct pcred e_pcred
; /* process credentials */
422 struct ucred e_ucred
; /* current credentials */
423 struct vmspace e_vm
; /* address space */
424 pid_t e_ppid
; /* parent process id */
425 pid_t e_pgid
; /* process group id */
426 short e_jobc
; /* job control counter */
427 dev_t e_tdev
; /* controlling tty dev */
428 pid_t e_tpgid
; /* tty process group id */
429 struct session
*e_tsess
; /* tty session pointer */
431 char e_wmesg
[WMESGLEN
+1]; /* wchan message */
432 segsz_t e_xsize
; /* text size */
433 short e_xrssize
; /* text rss */
434 short e_xccount
; /* text references */
437 #define EPROC_CTTY 0x01 /* controlling tty vnode active */
438 #define EPROC_SLEADER 0x02 /* session leader */
439 #define COMAPT_MAXLOGNAME 12
440 char e_login
[COMAPT_MAXLOGNAME
]; /* short setlogin() name */
444 #endif /* __APPLE_API_UNSTABLE */
447 * KERN_IPC identifiers
449 #define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */
450 #define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */
451 #define KIPC_SOMAXCONN 3 /* int: max length of connection q */
452 #define KIPC_MAX_LINKHDR 4 /* int: max length of link header */
453 #define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */
454 #define KIPC_MAX_HDR 6 /* int: max total length of headers */
455 #define KIPC_MAX_DATALEN 7 /* int: max length of data? */
456 #define KIPC_MBSTAT 8 /* struct: mbuf usage statistics */
457 #define KIPC_NMBCLUSTERS 9 /* int: maximum mbuf clusters */
462 #define VM_METER 1 /* struct vmmeter */
463 #define VM_LOADAVG 2 /* struct loadavg */
464 #define VM_MAXID 3 /* number of valid vm ids */
465 #define VM_MACHFACTOR 4 /* struct loadavg with mach factor*/
467 #define CTL_VM_NAMES { \
469 { "vmmeter", CTLTYPE_STRUCT }, \
470 { "loadavg", CTLTYPE_STRUCT } \
476 #define HW_MACHINE 1 /* string: machine class */
477 #define HW_MODEL 2 /* string: specific machine model */
478 #define HW_NCPU 3 /* int: number of cpus */
479 #define HW_BYTEORDER 4 /* int: machine byte order */
480 #define HW_PHYSMEM 5 /* int: total memory */
481 #define HW_USERMEM 6 /* int: non-kernel memory */
482 #define HW_PAGESIZE 7 /* int: software page size */
483 #define HW_DISKNAMES 8 /* strings: disk drive names */
484 #define HW_DISKSTATS 9 /* struct: diskstats[] */
485 #define HW_EPOCH 10 /* int: 0 for Legacy, else NewWorld */
486 #define HW_FLOATINGPT 11 /* int: has HW floating point? */
487 #define HW_MACHINE_ARCH 12 /* string: machine architecture */
488 #define HW_VECTORUNIT 13 /* int: has HW vector unit? */
489 #define HW_BUS_FREQ 14 /* int: Bus Frequency */
490 #define HW_CPU_FREQ 15 /* int: CPU Frequency */
491 #define HW_CACHELINE 16 /* int: Cache Line Size in Bytes */
492 #define HW_L1ICACHESIZE 17 /* int: L1 I Cache Size in Bytes */
493 #define HW_L1DCACHESIZE 18 /* int: L1 D Cache Size in Bytes */
494 #define HW_L2SETTINGS 19 /* int: L2 Cache Settings */
495 #define HW_L2CACHESIZE 20 /* int: L2 Cache Size in Bytes */
496 #define HW_L3SETTINGS 21 /* int: L3 Cache Settings */
497 #define HW_L3CACHESIZE 22 /* int: L3 Cache Size in Bytes */
498 #define HW_MAXID 23 /* number of valid hw ids */
500 #define CTL_HW_NAMES { \
502 { "machine", CTLTYPE_STRING }, \
503 { "model", CTLTYPE_STRING }, \
504 { "ncpu", CTLTYPE_INT }, \
505 { "byteorder", CTLTYPE_INT }, \
506 { "physmem", CTLTYPE_INT }, \
507 { "usermem", CTLTYPE_INT }, \
508 { "pagesize", CTLTYPE_INT }, \
509 { "disknames", CTLTYPE_STRUCT }, \
510 { "diskstats", CTLTYPE_STRUCT }, \
511 { "epoch", CTLTYPE_INT }, \
512 { "floatingpoint", CTLTYPE_INT }, \
513 { "machinearch", CTLTYPE_STRING }, \
514 { "vectorunit", CTLTYPE_INT }, \
515 { "busfrequency", CTLTYPE_INT }, \
516 { "cpufrequency", CTLTYPE_INT }, \
517 { "cachelinesize", CTLTYPE_INT }, \
518 { "l1icachesize", CTLTYPE_INT }, \
519 { "l1dcachesize", CTLTYPE_INT }, \
520 { "l2settings", CTLTYPE_INT }, \
521 { "l2cachesize", CTLTYPE_INT }, \
522 { "l3settings", CTLTYPE_INT }, \
523 { "l3cachesize", CTLTYPE_INT } \
527 * CTL_USER definitions
529 #define USER_CS_PATH 1 /* string: _CS_PATH */
530 #define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */
531 #define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */
532 #define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */
533 #define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */
534 #define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */
535 #define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */
536 #define USER_LINE_MAX 8 /* int: LINE_MAX */
537 #define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */
538 #define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */
539 #define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */
540 #define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */
541 #define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */
542 #define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */
543 #define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */
544 #define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */
545 #define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */
546 #define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */
547 #define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */
548 #define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
549 #define USER_MAXID 21 /* number of valid user ids */
551 #define CTL_USER_NAMES { \
553 { "cs_path", CTLTYPE_STRING }, \
554 { "bc_base_max", CTLTYPE_INT }, \
555 { "bc_dim_max", CTLTYPE_INT }, \
556 { "bc_scale_max", CTLTYPE_INT }, \
557 { "bc_string_max", CTLTYPE_INT }, \
558 { "coll_weights_max", CTLTYPE_INT }, \
559 { "expr_nest_max", CTLTYPE_INT }, \
560 { "line_max", CTLTYPE_INT }, \
561 { "re_dup_max", CTLTYPE_INT }, \
562 { "posix2_version", CTLTYPE_INT }, \
563 { "posix2_c_bind", CTLTYPE_INT }, \
564 { "posix2_c_dev", CTLTYPE_INT }, \
565 { "posix2_char_term", CTLTYPE_INT }, \
566 { "posix2_fort_dev", CTLTYPE_INT }, \
567 { "posix2_fort_run", CTLTYPE_INT }, \
568 { "posix2_localedef", CTLTYPE_INT }, \
569 { "posix2_sw_dev", CTLTYPE_INT }, \
570 { "posix2_upe", CTLTYPE_INT }, \
571 { "stream_max", CTLTYPE_INT }, \
572 { "tzname_max", CTLTYPE_INT } \
578 * CTL_DEBUG definitions
580 * Second level identifier specifies which debug variable.
581 * Third level identifier specifies which stucture component.
583 #define CTL_DEBUG_NAME 0 /* string: variable name */
584 #define CTL_DEBUG_VALUE 1 /* int: variable value */
585 #define CTL_DEBUG_MAXID 20
588 #ifdef __APPLE_API_UNSTABLE
590 extern struct sysctl_oid_list sysctl__children
;
592 SYSCTL_DECL(_sysctl
);
598 SYSCTL_DECL(_machdep
);
604 * CTL_DEBUG variables.
606 * These are declared as separate variables so that they can be
607 * individually initialized at the location of their associated
608 * variable. The loader prevents multiple use by issuing errors
609 * if a variable is initialized in more than one place. They are
610 * aggregated into an array in debug_sysctl(), so that it can
611 * conveniently locate them when querried. If more debugging
612 * variables are added, they must also be declared here and also
613 * entered into the array.
616 char *debugname
; /* name of debugging variable */
617 int *debugvar
; /* pointer to debugging variable */
619 extern struct ctldebug debug0
, debug1
, debug2
, debug3
, debug4
;
620 extern struct ctldebug debug5
, debug6
, debug7
, debug8
, debug9
;
621 extern struct ctldebug debug10
, debug11
, debug12
, debug13
, debug14
;
622 extern struct ctldebug debug15
, debug16
, debug17
, debug18
, debug19
;
625 extern char machine
[];
626 extern char osrelease
[];
627 extern char ostype
[];
631 void sysctl_register_set(struct linker_set
*lsp
);
632 void sysctl_unregister_set(struct linker_set
*lsp
);
633 int kernel_sysctl(struct proc
*p
, int *name
, u_int namelen
, void *old
,
634 size_t *oldlenp
, void *new, size_t newlen
,
636 int userland_sysctl(struct proc
*p
, int *name
, u_int namelen
, void *old
,
637 size_t *oldlenp
, int inkernel
, void *new, size_t newlen
,
640 * Internal sysctl function calling convention:
642 * (*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen);
644 * The name parameter points at the next component of the name to be
645 * interpreted. The namelen parameter is the number of integers in
648 typedef int (sysctlfn
)
649 __P((int *, u_int
, void *, size_t *, void *, size_t, struct proc
*));
651 int sysctl_int
__P((void *, size_t *, void *, size_t, int *));
652 int sysctl_rdint
__P((void *, size_t *, void *, int));
653 int sysctl_quad
__P((void *, size_t *, void *, size_t, quad_t
*));
654 int sysctl_rdquad
__P((void *, size_t *, void *, quad_t
));
655 int sysctl_string
__P((void *, size_t *, void *, size_t, char *, int));
656 int sysctl_rdstring
__P((void *, size_t *, void *, char *));
657 int sysctl_rdstruct
__P((void *, size_t *, void *, void *, int));
658 void fill_eproc
__P((struct proc
*, struct eproc
*));
660 #endif /* __APPLE_API_UNSTABLE */
662 #include <sys/cdefs.h>
665 int sysctl
__P((int *, u_int
, void *, size_t *, void *, size_t));
666 int sysctlbyname
__P((const char *, void *, size_t *, void *, size_t));
669 #endif /* !_SYS_SYSCTL_H_ */