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  * Portions copyright (c) 1999, 2000
9  * Intel Corporation.
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  *
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  *
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  *
23  * 3. All advertising materials mentioning features or use of this software
24  *    must display the following acknowledgement:
25  *
26  *    This product includes software developed by the University of
27  *    California, Berkeley, Intel Corporation, and its contributors.
28  *
29  * 4. Neither the name of University, Intel Corporation, or their respective
30  *    contributors may be used to endorse or promote products derived from
31  *    this software without specific prior written permission.
32  *
33  * THIS SOFTWARE IS PROVIDED BY THE REGENTS, INTEL CORPORATION AND
34  * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
35  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
36  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS,
37  * INTEL CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
38  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
39  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
40  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
41  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
43  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44  *
45  *	@(#)sysctl.h	8.1 (Berkeley) 6/2/93
46  * $Id: sysctl.h,v 1.1.1.1 2006/05/30 06:13:00 hhzhou Exp $
47  */
48 
49 #ifndef _SYS_SYSCTL_H_
50 #define	_SYS_SYSCTL_H_
51 
52 #include <sys/_posix.h>
53 
54 /*
55  * Definitions for sysctl call.  The sysctl call uses a hierarchical name
56  * for objects that can be examined or modified.  The name is expressed as
57  * a sequence of integers.  Like a file path name, the meaning of each
58  * component depends on its place in the hierarchy.  The top-level and kern
59  * identifiers are defined here, and other identifiers are defined in the
60  * respective subsystem header files.
61  */
62 
63 #define CTL_MAXNAME	12	/* largest number of components supported */
64 
65 /*
66  * Each subsystem defined by sysctl defines a list of variables
67  * for that subsystem. Each name is either a node with further
68  * levels defined below it, or it is a leaf of some particular
69  * type given below. Each sysctl level defines a set of name/type
70  * pairs to be used by sysctl(1) in manipulating the subsystem.
71  */
72 struct ctlname {
73 	char	*ctl_name;	/* subsystem name */
74 	int	ctl_type;	/* type of name */
75 };
76 
77 #define CTLTYPE		0xf	/* Mask for the type */
78 #define	CTLTYPE_NODE	1	/* name is a node */
79 #define	CTLTYPE_INT	2	/* name describes an integer */
80 #define	CTLTYPE_STRING	3	/* name describes a string */
81 #define	CTLTYPE_QUAD	4	/* name describes a 64-bit number */
82 #define	CTLTYPE_OPAQUE	5	/* name describes a structure */
83 #define	CTLTYPE_STRUCT	CTLTYPE_OPAQUE	/* name describes a structure */
84 
85 #define CTLFLAG_RD	0x80000000	/* Allow reads of variable */
86 #define CTLFLAG_WR	0x40000000	/* Allow writes to the variable */
87 #define CTLFLAG_RW	(CTLFLAG_RD|CTLFLAG_WR)
88 #define CTLFLAG_NOLOCK	0x20000000	/* XXX Don't Lock */
89 #define CTLFLAG_ANYBODY	0x10000000	/* All users can set this var */
90 #define CTLFLAG_SECURE	0x08000000	/* Permit set only if securelevel<=0 */
91 
92 /*
93  * USE THIS instead of a hardwired number from the categories below
94  * to get dynamically assigned sysctl entries using the linker-set
95  * technology. This is the way nearly all new sysctl variables should
96  * be implemented.
97  * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
98  */
99 #define OID_AUTO	(-1)
100 
101 #ifdef KERNEL
102 #define SYSCTL_HANDLER_ARGS (struct sysctl_oid *oidp, void *arg1, int arg2, \
103 	struct sysctl_req *req)
104 
105 /*
106  * This describes the access space for a sysctl request.  This is needed
107  * so that we can use the interface from the kernel or from user-space.
108  */
109 struct sysctl_req {
110 	struct proc	*p;
111 	int		lock;
112 	void		*oldptr;
113 	size_t		oldlen;
114 	size_t		oldidx;
115 	int		(*oldfunc)(struct sysctl_req *, const void *, size_t);
116 	void		*newptr;
117 	size_t		newlen;
118 	size_t		newidx;
119 	int		(*newfunc)(struct sysctl_req *, void *, size_t);
120 };
121 
122 #ifndef _ORG_FREEBSD_
123 #include <sys/ioccom.h>
124 /*
125  *  Pseudo sysctl call through ioctl(2) interface
126  */
127 #define IOCSYSCTL	_IOWR('X', 0, struct sysctl_req)
128 
129 struct pseudo_sysctl {
130 	int			*name;
131 	u_int			namelen;
132 	struct sysctl_req	req;
133 };
134 
135 #endif
136 
137 /*
138  * This describes one "oid" in the MIB tree.  Potentially more nodes can
139  * be hidden behind it, expanded by the handler.
140  */
141 struct sysctl_oid {
142 	int		oid_number;
143 	int		oid_kind;
144 	void		*oid_arg1;
145 	int		oid_arg2;
146 	const char	*oid_name;
147 	int 		(*oid_handler) SYSCTL_HANDLER_ARGS;
148 	const char	*oid_fmt;
149 };
150 
151 #define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
152 #define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
153 
154 int sysctl_handle_int SYSCTL_HANDLER_ARGS;
155 int sysctl_handle_long SYSCTL_HANDLER_ARGS;
156 int sysctl_handle_intptr SYSCTL_HANDLER_ARGS;
157 int sysctl_handle_string SYSCTL_HANDLER_ARGS;
158 int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
159 
160 #ifdef _ORG_FREEBSD_
161 /* This constructs a "raw" MIB oid. */
162 #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
163 	static struct sysctl_oid sysctl__##parent##_##name = { \
164 		nbr, kind, a1, a2, #name, handler, fmt }; \
165 	DATA_SET(sysctl_##parent, sysctl__##parent##_##name)
166 
167 /* This constructs a node from which other oids can hang. */
168 #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
169 	extern struct linker_set sysctl_##parent##_##name; \
170 	SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access, \
171 		(void*)&sysctl_##parent##_##name, 0, handler, "N", descr); \
172 	DATA_SET(sysctl_##parent##_##name, sysctl__##parent##_##name)
173 #else
174 #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr)
175 #define SYSCTL_NODE(parent, nbr, name, access, handler, descr)
176 #endif
177 
178 /* Oid for a string.  len can be 0 to indicate '\0' termination. */
179 #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
180 	SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \
181 		arg, len, sysctl_handle_string, "A", descr)
182 
183 /* Oid for an int.  If ptr is NULL, val is returned. */
184 #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
185 	SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
186 		ptr, val, sysctl_handle_int, "I", descr)
187 
188 /* Oid for a long.  The pointer must be non NULL. */
189 #define SYSCTL_LONG(parent, nbr, name, access, ptr, descr) \
190 	SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
191 		ptr, 0, sysctl_handle_long, "L", descr)
192 
193 /* Oid for an opaque object.  Specified by a pointer and a length. */
194 #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
195 	SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
196 		ptr, len, sysctl_handle_opaque, fmt, descr)
197 
198 /* Oid for a struct.  Specified by a pointer and a type. */
199 #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
200 	SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
201 		ptr, sizeof(struct type), sysctl_handle_opaque, \
202 		"S," #type, descr)
203 
204 /* Oid for a procedure.  Specified by a pointer and an arg. */
205 #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
206 	SYSCTL_OID(parent, nbr, name, access, \
207 		ptr, arg, handler, fmt, descr)
208 #endif /* KERNEL */
209 
210 /*
211  * Top-level identifiers
212  */
213 #define	CTL_UNSPEC	0		/* unused */
214 #define	CTL_KERN	1		/* "high kernel": proc, limits */
215 #define	CTL_VM		2		/* virtual memory */
216 #define	CTL_VFS		3		/* file system, mount type is next */
217 #define	CTL_NET		4		/* network, see socket.h */
218 #define	CTL_DEBUG	5		/* debugging parameters */
219 #define	CTL_HW		6		/* generic cpu/io */
220 #define	CTL_MACHDEP	7		/* machine dependent */
221 #define	CTL_USER	8		/* user-level */
222 #define	CTL_P1003_1B	9		/* POSIX 1003.1B */
223 #define	CTL_MAXID	10		/* number of valid top-level ids */
224 
225 #define CTL_NAMES { \
226 	{ 0, 0 }, \
227 	{ "kern", CTLTYPE_NODE }, \
228 	{ "vm", CTLTYPE_NODE }, \
229 	{ "vfs", CTLTYPE_NODE }, \
230 	{ "net", CTLTYPE_NODE }, \
231 	{ "debug", CTLTYPE_NODE }, \
232 	{ "hw", CTLTYPE_NODE }, \
233 	{ "machdep", CTLTYPE_NODE }, \
234 	{ "user", CTLTYPE_NODE }, \
235 	{ "p1003_1b", CTLTYPE_NODE }, \
236 }
237 
238 /*
239  * CTL_KERN identifiers
240  */
241 #define	KERN_OSTYPE	 	 1	/* string: system version */
242 #define	KERN_OSRELEASE	 	 2	/* string: system release */
243 #define	KERN_OSREV	 	 3	/* int: system revision */
244 #define	KERN_VERSION	 	 4	/* string: compile time info */
245 #define	KERN_MAXVNODES	 	 5	/* int: max vnodes */
246 #define	KERN_MAXPROC	 	 6	/* int: max processes */
247 #define	KERN_MAXFILES	 	 7	/* int: max open files */
248 #define	KERN_ARGMAX	 	 8	/* int: max arguments to exec */
249 #define	KERN_SECURELVL	 	 9	/* int: system security level */
250 #define	KERN_HOSTNAME		10	/* string: hostname */
251 #define	KERN_HOSTID		11	/* int: host identifier */
252 #define	KERN_CLOCKRATE		12	/* struct: struct clockrate */
253 #define	KERN_VNODE		13	/* struct: vnode structures */
254 #define	KERN_PROC		14	/* struct: process entries */
255 #define	KERN_FILE		15	/* struct: file entries */
256 #define	KERN_PROF		16	/* node: kernel profiling info */
257 #define	KERN_POSIX1		17	/* int: POSIX.1 version */
258 #define	KERN_NGROUPS		18	/* int: # of supplemental group ids */
259 #define	KERN_JOB_CONTROL	19	/* int: is job control available */
260 #define	KERN_SAVED_IDS		20	/* int: saved set-user/group-ID */
261 #define	KERN_BOOTTIME		21	/* struct: time kernel was booted */
262 #define KERN_NISDOMAINNAME	22	/* string: YP domain name */
263 #define KERN_UPDATEINTERVAL	23	/* int: update process sleep time */
264 #define KERN_OSRELDATE		24	/* int: OS release date */
265 #define KERN_NTP_PLL		25	/* node: NTP PLL control */
266 #define	KERN_BOOTFILE		26	/* string: name of booted kernel */
267 #define	KERN_MAXFILESPERPROC	27	/* int: max open files per proc */
268 #define	KERN_MAXPROCPERUID 	28	/* int: max processes per uid */
269 #define KERN_DUMPDEV		29	/* dev_t: device to dump on */
270 #define	KERN_IPC		30	/* node: anything related to IPC */
271 #define	KERN_DUMMY		31	/* unused */
272 #define	KERN_PS_STRINGS		32	/* int: address of PS_STRINGS */
273 #define	KERN_USRSTACK		33	/* int: address of USRSTACK */
274 #define	KERN_LOGSIGEXIT		34	/* int: do we log sigexit procs? */
275 #define KERN_MAXID		35      /* number of valid kern ids */
276 
277 #define CTL_KERN_NAMES { \
278 	{ 0, 0 }, \
279 	{ "ostype", CTLTYPE_STRING }, \
280 	{ "osrelease", CTLTYPE_STRING }, \
281 	{ "osrevision", CTLTYPE_INT }, \
282 	{ "version", CTLTYPE_STRING }, \
283 	{ "maxvnodes", CTLTYPE_INT }, \
284 	{ "maxproc", CTLTYPE_INT }, \
285 	{ "maxfiles", CTLTYPE_INT }, \
286 	{ "argmax", CTLTYPE_INT }, \
287 	{ "securelevel", CTLTYPE_INT }, \
288 	{ "hostname", CTLTYPE_STRING }, \
289 	{ "hostid", CTLTYPE_INT }, \
290 	{ "clockrate", CTLTYPE_STRUCT }, \
291 	{ "vnode", CTLTYPE_STRUCT }, \
292 	{ "proc", CTLTYPE_STRUCT }, \
293 	{ "file", CTLTYPE_STRUCT }, \
294 	{ "profiling", CTLTYPE_NODE }, \
295 	{ "posix1version", CTLTYPE_INT }, \
296 	{ "ngroups", CTLTYPE_INT }, \
297 	{ "job_control", CTLTYPE_INT }, \
298 	{ "saved_ids", CTLTYPE_INT }, \
299 	{ "boottime", CTLTYPE_STRUCT }, \
300 	{ "nisdomainname", CTLTYPE_STRING }, \
301 	{ "update", CTLTYPE_INT }, \
302 	{ "osreldate", CTLTYPE_INT }, \
303         { "ntp_pll", CTLTYPE_NODE }, \
304 	{ "bootfile", CTLTYPE_STRING }, \
305 	{ "maxfilesperproc", CTLTYPE_INT }, \
306 	{ "maxprocperuid", CTLTYPE_INT }, \
307 	{ "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
308 	{ "ipc", CTLTYPE_NODE }, \
309 	{ "dummy", CTLTYPE_INT }, \
310 	{ "ps_strings", CTLTYPE_INT }, \
311 	{ "usrstack", CTLTYPE_INT }, \
312 	{ "logsigexit", CTLTYPE_INT }, \
313 }
314 
315 /*
316  * CTL_VFS identifiers
317  */
318 #define CTL_VFS_NAMES { \
319 	{ "vfsconf", CTLTYPE_STRUCT }, \
320 }
321 
322 /*
323  * KERN_PROC subtypes
324  */
325 #define KERN_PROC_ALL		0	/* everything */
326 #define	KERN_PROC_PID		1	/* by process id */
327 #define	KERN_PROC_PGRP		2	/* by process group id */
328 #define	KERN_PROC_SESSION	3	/* by session of pid */
329 #define	KERN_PROC_TTY		4	/* by controlling tty */
330 #define	KERN_PROC_UID		5	/* by effective uid */
331 #define	KERN_PROC_RUID		6	/* by real uid */
332 
333 /*
334  * KERN_IPC identifiers
335  */
336 #define KIPC_MAXSOCKBUF		1	/* int: max size of a socket buffer */
337 #define	KIPC_SOCKBUF_WASTE	2	/* int: wastage factor in sockbuf */
338 #define	KIPC_SOMAXCONN		3	/* int: max length of connection q */
339 #define	KIPC_MAX_LINKHDR	4	/* int: max length of link header */
340 #define	KIPC_MAX_PROTOHDR	5	/* int: max length of network header */
341 #define	KIPC_MAX_HDR		6	/* int: max total length of headers */
342 #define	KIPC_MAX_DATALEN	7	/* int: max length of data? */
343 #define	KIPC_MBSTAT		8	/* struct: mbuf usage statistics */
344 #define	KIPC_NMBCLUSTERS	9	/* int: maximum mbuf clusters */
345 
346 /*
347  * CTL_HW identifiers
348  */
349 #define	HW_MACHINE	 1		/* string: machine class */
350 #define	HW_MODEL	 2		/* string: specific machine model */
351 #define	HW_NCPU		 3		/* int: number of cpus */
352 #define	HW_BYTEORDER	 4		/* int: machine byte order */
353 #define	HW_PHYSMEM	 5		/* int: total memory */
354 #define	HW_USERMEM	 6		/* int: non-kernel memory */
355 #define	HW_PAGESIZE	 7		/* int: software page size */
356 #define	HW_DISKNAMES	 8		/* strings: disk drive names */
357 #define	HW_DISKSTATS	 9		/* struct: diskstats[] */
358 #define HW_FLOATINGPT	10		/* int: has HW floating point? */
359 #define HW_MACHINE_ARCH	11		/* string: machine architecture */
360 #define	HW_MAXID	12		/* number of valid hw ids */
361 
362 #define CTL_HW_NAMES { \
363 	{ 0, 0 }, \
364 	{ "machine", CTLTYPE_STRING }, \
365 	{ "model", CTLTYPE_STRING }, \
366 	{ "ncpu", CTLTYPE_INT }, \
367 	{ "byteorder", CTLTYPE_INT }, \
368 	{ "physmem", CTLTYPE_INT }, \
369 	{ "usermem", CTLTYPE_INT }, \
370 	{ "pagesize", CTLTYPE_INT }, \
371 	{ "disknames", CTLTYPE_STRUCT }, \
372 	{ "diskstats", CTLTYPE_STRUCT }, \
373 	{ "floatingpoint", CTLTYPE_INT }, \
374 }
375 
376 /*
377  * CTL_USER definitions
378  */
379 #define	USER_CS_PATH		 1	/* string: _CS_PATH */
380 #define	USER_BC_BASE_MAX	 2	/* int: BC_BASE_MAX */
381 #define	USER_BC_DIM_MAX		 3	/* int: BC_DIM_MAX */
382 #define	USER_BC_SCALE_MAX	 4	/* int: BC_SCALE_MAX */
383 #define	USER_BC_STRING_MAX	 5	/* int: BC_STRING_MAX */
384 #define	USER_COLL_WEIGHTS_MAX	 6	/* int: COLL_WEIGHTS_MAX */
385 #define	USER_EXPR_NEST_MAX	 7	/* int: EXPR_NEST_MAX */
386 #define	USER_LINE_MAX		 8	/* int: LINE_MAX */
387 #define	USER_RE_DUP_MAX		 9	/* int: RE_DUP_MAX */
388 #define	USER_POSIX2_VERSION	10	/* int: POSIX2_VERSION */
389 #define	USER_POSIX2_C_BIND	11	/* int: POSIX2_C_BIND */
390 #define	USER_POSIX2_C_DEV	12	/* int: POSIX2_C_DEV */
391 #define	USER_POSIX2_CHAR_TERM	13	/* int: POSIX2_CHAR_TERM */
392 #define	USER_POSIX2_FORT_DEV	14	/* int: POSIX2_FORT_DEV */
393 #define	USER_POSIX2_FORT_RUN	15	/* int: POSIX2_FORT_RUN */
394 #define	USER_POSIX2_LOCALEDEF	16	/* int: POSIX2_LOCALEDEF */
395 #define	USER_POSIX2_SW_DEV	17	/* int: POSIX2_SW_DEV */
396 #define	USER_POSIX2_UPE		18	/* int: POSIX2_UPE */
397 #define	USER_STREAM_MAX		19	/* int: POSIX2_STREAM_MAX */
398 #define	USER_TZNAME_MAX		20	/* int: POSIX2_TZNAME_MAX */
399 #define	USER_MAXID		21	/* number of valid user ids */
400 
401 #define	CTL_USER_NAMES { \
402 	{ 0, 0 }, \
403 	{ "cs_path", CTLTYPE_STRING }, \
404 	{ "bc_base_max", CTLTYPE_INT }, \
405 	{ "bc_dim_max", CTLTYPE_INT }, \
406 	{ "bc_scale_max", CTLTYPE_INT }, \
407 	{ "bc_string_max", CTLTYPE_INT }, \
408 	{ "coll_weights_max", CTLTYPE_INT }, \
409 	{ "expr_nest_max", CTLTYPE_INT }, \
410 	{ "line_max", CTLTYPE_INT }, \
411 	{ "re_dup_max", CTLTYPE_INT }, \
412 	{ "posix2_version", CTLTYPE_INT }, \
413 	{ "posix2_c_bind", CTLTYPE_INT }, \
414 	{ "posix2_c_dev", CTLTYPE_INT }, \
415 	{ "posix2_char_term", CTLTYPE_INT }, \
416 	{ "posix2_fort_dev", CTLTYPE_INT }, \
417 	{ "posix2_fort_run", CTLTYPE_INT }, \
418 	{ "posix2_localedef", CTLTYPE_INT }, \
419 	{ "posix2_sw_dev", CTLTYPE_INT }, \
420 	{ "posix2_upe", CTLTYPE_INT }, \
421 	{ "stream_max", CTLTYPE_INT }, \
422 	{ "tzname_max", CTLTYPE_INT }, \
423 }
424 
425 #define CTL_P1003_1B_ASYNCHRONOUS_IO		1	/* boolean */
426 #define CTL_P1003_1B_MAPPED_FILES		2	/* boolean */
427 #define CTL_P1003_1B_MEMLOCK			3	/* boolean */
428 #define CTL_P1003_1B_MEMLOCK_RANGE		4	/* boolean */
429 #define CTL_P1003_1B_MEMORY_PROTECTION		5	/* boolean */
430 #define CTL_P1003_1B_MESSAGE_PASSING		6	/* boolean */
431 #define CTL_P1003_1B_PRIORITIZED_IO		7	/* boolean */
432 #define CTL_P1003_1B_PRIORITY_SCHEDULING	8	/* boolean */
433 #define CTL_P1003_1B_REALTIME_SIGNALS		9	/* boolean */
434 #define CTL_P1003_1B_SEMAPHORES			10	/* boolean */
435 #define CTL_P1003_1B_FSYNC			11	/* boolean */
436 #define CTL_P1003_1B_SHARED_MEMORY_OBJECTS	12	/* boolean */
437 #define CTL_P1003_1B_SYNCHRONIZED_IO		13	/* boolean */
438 #define CTL_P1003_1B_TIMERS			14	/* boolean */
439 #define CTL_P1003_1B_AIO_LISTIO_MAX		15	/* int */
440 #define CTL_P1003_1B_AIO_MAX			16	/* int */
441 #define CTL_P1003_1B_AIO_PRIO_DELTA_MAX		17	/* int */
442 #define CTL_P1003_1B_DELAYTIMER_MAX		18	/* int */
443 #define CTL_P1003_1B_MQ_OPEN_MAX		19	/* int */
444 #define CTL_P1003_1B_PAGESIZE			20	/* int */
445 #define CTL_P1003_1B_RTSIG_MAX			21	/* int */
446 #define CTL_P1003_1B_SEM_NSEMS_MAX		22	/* int */
447 #define CTL_P1003_1B_SEM_VALUE_MAX		23	/* int */
448 #define CTL_P1003_1B_SIGQUEUE_MAX		24	/* int */
449 #define CTL_P1003_1B_TIMER_MAX			25	/* int */
450 
451 #define CTL_P1003_1B_MAXID		26
452 
453 #define	CTL_P1003_1B_NAMES { \
454 	{ 0, 0 }, \
455 	{ "asynchronous_io", CTLTYPE_INT }, \
456 	{ "mapped_files", CTLTYPE_INT }, \
457 	{ "memlock", CTLTYPE_INT }, \
458 	{ "memlock_range", CTLTYPE_INT }, \
459 	{ "memory_protection", CTLTYPE_INT }, \
460 	{ "message_passing", CTLTYPE_INT }, \
461 	{ "prioritized_io", CTLTYPE_INT }, \
462 	{ "priority_scheduling", CTLTYPE_INT }, \
463 	{ "realtime_signals", CTLTYPE_INT }, \
464 	{ "semaphores", CTLTYPE_INT }, \
465 	{ "fsync", CTLTYPE_INT }, \
466 	{ "shared_memory_objects", CTLTYPE_INT }, \
467 	{ "synchronized_io", CTLTYPE_INT }, \
468 	{ "timers", CTLTYPE_INT }, \
469 	{ "aio_listio_max", CTLTYPE_INT }, \
470 	{ "aio_max", CTLTYPE_INT }, \
471 	{ "aio_prio_delta_max", CTLTYPE_INT }, \
472 	{ "delaytimer_max", CTLTYPE_INT }, \
473 	{ "mq_open_max", CTLTYPE_INT }, \
474 	{ "pagesize", CTLTYPE_INT }, \
475 	{ "rtsig_max", CTLTYPE_INT }, \
476 	{ "nsems_max", CTLTYPE_INT }, \
477 	{ "sem_value_max", CTLTYPE_INT }, \
478 	{ "sigqueue_max", CTLTYPE_INT }, \
479 	{ "timer_max", CTLTYPE_INT }, \
480 }
481 
482 #ifdef KERNEL
483 
484 extern char	machine[];
485 extern char	osrelease[];
486 extern char	ostype[];
487 
488 int	kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old,
489 		      size_t *oldlenp, void *new, size_t newlen,
490 		      size_t *retval);
491 void	sysctl_order_all(void);
492 int	userland_sysctl(struct proc *p, int *name, u_int namelen, void *old,
493 			size_t *oldlenp, int inkernel, void *new, size_t newlen,
494 			size_t *retval);
495 
496 #else	/* !KERNEL */
497 #include <sys/EfiCdefs.h>
498 
499 __BEGIN_DECLS
500 int	sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
501 int	sysctlbyname __P((const char *, void *, size_t *, void *, size_t));
502 __END_DECLS
503 #endif	/* KERNEL */
504 
505 #endif	/* !_SYS_SYSCTL_H_ */
506