xref: /minix/sys/sys/sysctl.h (revision 4684ddb6)
1 /*	$NetBSD: sysctl.h,v 1.209 2013/09/20 12:20:01 wiz Exp $	*/
2 
3 /*
4  * Copyright (c) 1989, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Mike Karels at Berkeley Software Design, Inc.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *	@(#)sysctl.h	8.1 (Berkeley) 6/2/93
35  */
36 
37 #ifndef _SYS_SYSCTL_H_
38 #define	_SYS_SYSCTL_H_
39 
40 #include <sys/param.h> /* precautionary upon removal from ucred.h */
41 #include <sys/proc.h>  /* Needed for things like P_ZOMBIE() and LW_SINTR */
42 #include <uvm/uvm_param.h>
43 
44 #if defined(_KERNEL) || defined(_KMEMUSER)
45 /*
46  * These are for the eproc structure defined below.
47  */
48 #include <sys/time.h>
49 #include <sys/ucred.h>
50 #include <sys/ucontext.h>
51 #include <sys/mallocvar.h>
52 #include <uvm/uvm_extern.h>
53 #endif
54 
55 
56 /* For offsetof() */
57 #if defined(_KERNEL) || defined(_STANDALONE)
58 #include <sys/systm.h>
59 #else
60 #include <stddef.h>
61 #include <stdbool.h>
62 #endif
63 
64 #ifdef SYSCTL_PRIVATE
65 #include <sys/cprng.h>
66 #endif
67 
68 /*
69  * Definitions for sysctl call.  The sysctl call uses a hierarchical name
70  * for objects that can be examined or modified.  The name is expressed as
71  * a sequence of integers.  Like a file path name, the meaning of each
72  * component depends on its place in the hierarchy.  The top-level and kern
73  * identifiers are defined here, and other identifiers are defined in the
74  * respective subsystem header files.
75  */
76 
77 struct sysctlnode;
78 
79 #define	CTL_MAXNAME	12	/* largest number of components supported */
80 #define SYSCTL_NAMELEN	32	/* longest name allowed for a node */
81 
82 #define CREATE_BASE	(1024)	/* start of dynamic mib allocation */
83 #define SYSCTL_DEFSIZE	8	/* initial size of a child set */
84 
85 /*
86  * Each subsystem defined by sysctl defines a list of variables
87  * for that subsystem. Each name is either a node with further
88  * levels defined below it, or it is a leaf of some particular
89  * type given below. Each sysctl level defines a set of name/type
90  * pairs to be used by sysctl(1) in manipulating the subsystem.
91  */
92 struct ctlname {
93 	const char *ctl_name;	/* subsystem name */
94 	int	ctl_type;	/* type of name */
95 };
96 #define	CTLTYPE_NODE	1	/* name is a node */
97 #define	CTLTYPE_INT	2	/* name describes an integer */
98 #define	CTLTYPE_STRING	3	/* name describes a string */
99 #define	CTLTYPE_QUAD	4	/* name describes a 64-bit number */
100 #define	CTLTYPE_STRUCT	5	/* name describes a structure */
101 #define	CTLTYPE_BOOL	6	/* name describes a bool */
102 
103 #ifdef _LP64
104 #define	CTLTYPE_LONG	CTLTYPE_QUAD
105 #else
106 #define	CTLTYPE_LONG	CTLTYPE_INT
107 #endif
108 
109 /*
110  * Flags that apply to each node, governing access and other features
111  */
112 #define CTLFLAG_READONLY	0x00000000
113 /* #define CTLFLAG_UNUSED1		0x00000010 */
114 /* #define CTLFLAG_UNUSED2		0x00000020 */
115 /* #define CTLFLAG_READ*	0x00000040 */
116 #define CTLFLAG_READWRITE	0x00000070
117 #define CTLFLAG_ANYWRITE	0x00000080
118 #define CTLFLAG_PRIVATE		0x00000100
119 #define CTLFLAG_PERMANENT	0x00000200
120 #define CTLFLAG_OWNDATA		0x00000400
121 #define CTLFLAG_IMMEDIATE	0x00000800
122 #define CTLFLAG_HEX		0x00001000
123 #define CTLFLAG_ROOT		0x00002000
124 #define CTLFLAG_ANYNUMBER	0x00004000
125 #define CTLFLAG_HIDDEN		0x00008000
126 #define CTLFLAG_ALIAS		0x00010000
127 #define CTLFLAG_MMAP		0x00020000
128 #define CTLFLAG_OWNDESC		0x00040000
129 #define CTLFLAG_UNSIGNED	0x00080000
130 
131 /*
132  * sysctl API version
133  */
134 #define SYSCTL_VERS_MASK	0xff000000
135 #define SYSCTL_VERS_0		0x00000000
136 #define SYSCTL_VERS_1		0x01000000
137 #define SYSCTL_VERSION		SYSCTL_VERS_1
138 #define SYSCTL_VERS(f)		((f) & SYSCTL_VERS_MASK)
139 
140 /*
141  * Flags that can be set by a create request from user-space
142  */
143 #define SYSCTL_USERFLAGS	(CTLFLAG_READWRITE|\
144 				CTLFLAG_ANYWRITE|\
145 				CTLFLAG_PRIVATE|\
146 				CTLFLAG_OWNDATA|\
147 				CTLFLAG_IMMEDIATE|\
148 				CTLFLAG_HEX|\
149 				CTLFLAG_HIDDEN)
150 
151 /*
152  * Accessor macros
153  */
154 #define SYSCTL_TYPEMASK		0x0000000f
155 #define SYSCTL_TYPE(x)		((x) & SYSCTL_TYPEMASK)
156 #define SYSCTL_FLAGMASK		0x00fffff0
157 #define SYSCTL_FLAGS(x)		((x) & SYSCTL_FLAGMASK)
158 
159 /*
160  * Meta-identifiers
161  */
162 #define CTL_EOL		(-1)		/* end of createv/destroyv list */
163 #define CTL_QUERY	(-2)		/* enumerates children of a node */
164 #define CTL_CREATE	(-3)		/* node create request */
165 #define CTL_CREATESYM	(-4)		/* node create request with symbol */
166 #define CTL_DESTROY	(-5)		/* node destroy request */
167 #define CTL_MMAP	(-6)		/* mmap request */
168 #define CTL_DESCRIBE	(-7)		/* get node descriptions */
169 
170 /*
171  * Top-level identifiers
172  */
173 #define	CTL_UNSPEC	0		/* unused */
174 #define	CTL_KERN	1		/* "high kernel": proc, limits */
175 #define	CTL_VM		2		/* virtual memory */
176 #define	CTL_VFS		3		/* file system, mount type is next */
177 #define	CTL_NET		4		/* network, see socket.h */
178 #define	CTL_DEBUG	5		/* debugging parameters */
179 #define	CTL_HW		6		/* generic CPU/io */
180 #define	CTL_MACHDEP	7		/* machine dependent */
181 #define	CTL_USER	8		/* user-level */
182 #define	CTL_DDB		9		/* in-kernel debugger */
183 #define	CTL_PROC	10		/* per-proc attr */
184 #define	CTL_VENDOR	11		/* vendor-specific data */
185 #define	CTL_EMUL	12		/* emulation-specific data */
186 #define	CTL_SECURITY	13		/* security */
187 #define	CTL_MAXID	14		/* number of valid top-level ids */
188 
189 /*
190  * The "vendor" toplevel name is to be used by vendors who wish to
191  * have their own private MIB tree. If you do that, please use
192  * vendor.<yourname>.*
193  */
194 
195 /*
196  * CTL_KERN identifiers
197  */
198 #define	KERN_OSTYPE	 	 1	/* string: system version */
199 #define	KERN_OSRELEASE	 	 2	/* string: system release */
200 #define	KERN_OSREV	 	 3	/* int: system revision */
201 #define	KERN_VERSION	 	 4	/* string: compile time info */
202 #define	KERN_MAXVNODES	 	 5	/* int: max vnodes */
203 #define	KERN_MAXPROC	 	 6	/* int: max processes */
204 #define	KERN_MAXFILES	 	 7	/* int: max open files */
205 #define	KERN_ARGMAX	 	 8	/* int: max arguments to exec */
206 #define	KERN_SECURELVL	 	 9	/* int: system security level */
207 #define	KERN_HOSTNAME		10	/* string: hostname */
208 #define	KERN_HOSTID		11	/* int: host identifier */
209 #define	KERN_CLOCKRATE		12	/* struct: struct clockinfo */
210 #define	KERN_VNODE		13	/* struct: vnode structures */
211 #define	KERN_PROC		14	/* struct: process entries */
212 #define	KERN_FILE		15	/* struct: file entries */
213 #define	KERN_PROF		16	/* node: kernel profiling info */
214 #define	KERN_POSIX1		17	/* int: POSIX.1 version */
215 #define	KERN_NGROUPS		18	/* int: # of supplemental group ids */
216 #define	KERN_JOB_CONTROL	19	/* int: is job control available */
217 #define	KERN_SAVED_IDS		20	/* int: saved set-user/group-ID */
218 #define	KERN_OBOOTTIME		21	/* struct: time kernel was booted */
219 #define	KERN_DOMAINNAME		22	/* string: (YP) domainname */
220 #define	KERN_MAXPARTITIONS	23	/* int: number of partitions/disk */
221 #define	KERN_RAWPARTITION	24	/* int: raw partition number */
222 #define	KERN_NTPTIME		25	/* struct: extended-precision time */
223 #define	KERN_TIMEX		26	/* struct: ntp timekeeping state */
224 #define	KERN_AUTONICETIME	27	/* int: proc time before autonice */
225 #define	KERN_AUTONICEVAL	28	/* int: auto nice value */
226 #define	KERN_RTC_OFFSET		29	/* int: offset of rtc from gmt */
227 #define	KERN_ROOT_DEVICE	30	/* string: root device */
228 #define	KERN_MSGBUFSIZE		31	/* int: max # of chars in msg buffer */
229 #define	KERN_FSYNC		32	/* int: file synchronization support */
230 #define	KERN_OLDSYSVMSG		33	/* old: SysV message queue support */
231 #define	KERN_OLDSYSVSEM		34	/* old: SysV semaphore support */
232 #define	KERN_OLDSYSVSHM		35	/* old: SysV shared memory support */
233 #define	KERN_OLDSHORTCORENAME	36	/* old, unimplemented */
234 #define	KERN_SYNCHRONIZED_IO	37	/* int: POSIX synchronized I/O */
235 #define	KERN_IOV_MAX		38	/* int: max iovec's for readv(2) etc. */
236 #define	KERN_MBUF		39	/* node: mbuf parameters */
237 #define	KERN_MAPPED_FILES	40	/* int: POSIX memory mapped files */
238 #define	KERN_MEMLOCK		41	/* int: POSIX memory locking */
239 #define	KERN_MEMLOCK_RANGE	42	/* int: POSIX memory range locking */
240 #define	KERN_MEMORY_PROTECTION	43	/* int: POSIX memory protections */
241 #define	KERN_LOGIN_NAME_MAX	44	/* int: max length login name + NUL */
242 #define	KERN_DEFCORENAME	45	/* old: sort core name format */
243 #define	KERN_LOGSIGEXIT		46	/* int: log signaled processes */
244 #define	KERN_PROC2		47	/* struct: process entries */
245 #define	KERN_PROC_ARGS		48	/* struct: process argv/env */
246 #define	KERN_FSCALE		49	/* int: fixpt FSCALE */
247 #define	KERN_CCPU		50	/* old: fixpt ccpu */
248 #define	KERN_CP_TIME		51	/* struct: CPU time counters */
249 #define	KERN_OLDSYSVIPC_INFO	52	/* old: number of valid kern ids */
250 #define	KERN_MSGBUF		53	/* kernel message buffer */
251 #define	KERN_CONSDEV		54	/* dev_t: console terminal device */
252 #define	KERN_MAXPTYS		55	/* int: maximum number of ptys */
253 #define	KERN_PIPE		56	/* node: pipe limits */
254 #define	KERN_MAXPHYS		57	/* int: kernel value of MAXPHYS */
255 #define	KERN_SBMAX		58	/* int: max socket buffer size */
256 #define	KERN_TKSTAT		59	/* tty in/out counters */
257 #define	KERN_MONOTONIC_CLOCK	60	/* int: POSIX monotonic clock */
258 #define	KERN_URND		61	/* int: random integer from urandom */
259 #define	KERN_LABELSECTOR	62	/* int: disklabel sector */
260 #define	KERN_LABELOFFSET	63	/* int: offset of label within sector */
261 #define	KERN_LWP		64	/* struct: lwp entries */
262 #define	KERN_FORKFSLEEP		65	/* int: sleep length on failed fork */
263 #define	KERN_POSIX_THREADS	66	/* int: POSIX Threads option */
264 #define	KERN_POSIX_SEMAPHORES	67	/* int: POSIX Semaphores option */
265 #define	KERN_POSIX_BARRIERS	68	/* int: POSIX Barriers option */
266 #define	KERN_POSIX_TIMERS	69	/* int: POSIX Timers option */
267 #define	KERN_POSIX_SPIN_LOCKS	70	/* int: POSIX Spin Locks option */
268 #define	KERN_POSIX_READER_WRITER_LOCKS 71 /* int: POSIX R/W Locks option */
269 #define	KERN_DUMP_ON_PANIC	72	/* int: dump on panic */
270 #define	KERN_SOMAXKVA		73	/* int: max socket kernel virtual mem */
271 #define	KERN_ROOT_PARTITION	74	/* int: root partition */
272 #define	KERN_DRIVERS		75	/* struct: driver names and majors #s */
273 #define	KERN_BUF		76	/* struct: buffers */
274 #define	KERN_FILE2		77	/* struct: file entries */
275 #define	KERN_VERIEXEC		78	/* node: verified exec */
276 #define	KERN_CP_ID		79	/* struct: cpu id numbers */
277 #define	KERN_HARDCLOCK_TICKS	80	/* int: number of hardclock ticks */
278 #define	KERN_ARND		81	/* void *buf, size_t siz random */
279 #define	KERN_SYSVIPC		82	/* node: SysV IPC parameters */
280 #define	KERN_BOOTTIME		83	/* struct: time kernel was booted */
281 #define	KERN_EVCNT		84	/* struct: evcnts */
282 #define	KERN_MAXID		85	/* number of valid kern ids */
283 
284 
285 #define	CTL_KERN_NAMES { \
286 	{ 0, 0 }, \
287 	{ "ostype", CTLTYPE_STRING }, \
288 	{ "osrelease", CTLTYPE_STRING }, \
289 	{ "osrevision", CTLTYPE_INT }, \
290 	{ "version", CTLTYPE_STRING }, \
291 	{ "maxvnodes", CTLTYPE_INT }, \
292 	{ "maxproc", CTLTYPE_INT }, \
293 	{ "maxfiles", CTLTYPE_INT }, \
294 	{ "argmax", CTLTYPE_INT }, \
295 	{ "securelevel", CTLTYPE_INT }, \
296 	{ "hostname", CTLTYPE_STRING }, \
297 	{ "hostid", CTLTYPE_INT }, \
298 	{ "clockrate", CTLTYPE_STRUCT }, \
299 	{ "vnode", CTLTYPE_STRUCT }, \
300 	{ "proc", CTLTYPE_STRUCT }, \
301 	{ "file", CTLTYPE_STRUCT }, \
302 	{ "profiling", CTLTYPE_NODE }, \
303 	{ "posix1version", CTLTYPE_INT }, \
304 	{ "ngroups", CTLTYPE_INT }, \
305 	{ "job_control", CTLTYPE_INT }, \
306 	{ "saved_ids", CTLTYPE_INT }, \
307 	{ 0, 0 }, \
308 	{ "domainname", CTLTYPE_STRING }, \
309 	{ "maxpartitions", CTLTYPE_INT }, \
310 	{ "rawpartition", CTLTYPE_INT }, \
311 	{ "ntptime", CTLTYPE_STRUCT }, \
312 	{ "timex", CTLTYPE_STRUCT }, \
313 	{ "autonicetime", CTLTYPE_INT }, \
314 	{ "autoniceval", CTLTYPE_INT }, \
315 	{ "rtc_offset", CTLTYPE_INT }, \
316 	{ "root_device", CTLTYPE_STRING }, \
317 	{ "msgbufsize", CTLTYPE_INT }, \
318 	{ "fsync", CTLTYPE_INT }, \
319 	{ 0, 0 }, \
320 	{ 0, 0 }, \
321 	{ 0, 0 }, \
322 	{ 0, 0 }, \
323 	{ "synchronized_io", CTLTYPE_INT }, \
324 	{ "iov_max", CTLTYPE_INT }, \
325 	{ "mbuf", CTLTYPE_NODE }, \
326 	{ "mapped_files", CTLTYPE_INT }, \
327 	{ "memlock", CTLTYPE_INT }, \
328 	{ "memlock_range", CTLTYPE_INT }, \
329 	{ "memory_protection", CTLTYPE_INT }, \
330 	{ "login_name_max", CTLTYPE_INT }, \
331 	{ "defcorename", CTLTYPE_STRING }, \
332 	{ "logsigexit", CTLTYPE_INT }, \
333 	{ "proc2", CTLTYPE_STRUCT }, \
334 	{ "proc_args", CTLTYPE_STRING }, \
335 	{ "fscale", CTLTYPE_INT }, \
336 	{ 0, 0 }, \
337 	{ "cp_time", CTLTYPE_STRUCT }, \
338 	{ 0, 0 }, \
339 	{ "msgbuf", CTLTYPE_STRUCT }, \
340 	{ "consdev", CTLTYPE_STRUCT }, \
341 	{ "maxptys", CTLTYPE_INT }, \
342 	{ "pipe", CTLTYPE_NODE }, \
343 	{ "maxphys", CTLTYPE_INT }, \
344 	{ "sbmax", CTLTYPE_INT }, \
345 	{ "tkstat", CTLTYPE_NODE }, \
346 	{ "monotonic_clock", CTLTYPE_INT }, \
347 	{ "urandom", CTLTYPE_INT }, \
348 	{ "labelsector", CTLTYPE_INT }, \
349 	{ "labeloffset", CTLTYPE_INT }, \
350 	{ "lwp", CTLTYPE_STRUCT }, \
351 	{ "forkfsleep", CTLTYPE_INT }, \
352 	{ "posix_threads", CTLTYPE_INT }, \
353 	{ "posix_semaphores", CTLTYPE_INT }, \
354 	{ "posix_barriers", CTLTYPE_INT }, \
355 	{ "posix_timers", CTLTYPE_INT }, \
356 	{ "posix_spin_locks", CTLTYPE_INT }, \
357 	{ "posix_reader_writer_locks", CTLTYPE_INT }, \
358 	{ "dump_on_panic", CTLTYPE_INT}, \
359 	{ "somaxkva", CTLTYPE_INT}, \
360 	{ "root_partition", CTLTYPE_INT}, \
361 	{ "drivers", CTLTYPE_STRUCT }, \
362 	{ "buf", CTLTYPE_NODE }, \
363 	{ "file2", CTLTYPE_STRUCT }, \
364 	{ "veriexec", CTLTYPE_NODE }, \
365 	{ "cp_id", CTLTYPE_STRUCT }, \
366 	{ "hardclock_ticks", CTLTYPE_INT }, \
367 	{ "arandom", CTLTYPE_STRUCT }, \
368 	{ "sysvipc", CTLTYPE_STRUCT }, \
369 	{ "boottime", CTLTYPE_STRUCT }, \
370 	{ "evcnt", CTLTYPE_STRUCT }, \
371 }
372 
373 /*
374  *  KERN_CLOCKRATE structure
375  */
376 struct clockinfo {
377 	int	hz;		/* clock frequency */
378 	int	tick;		/* micro-seconds per hz tick */
379 	int	tickadj;	/* clock skew rate for adjtime() */
380 	int	stathz;		/* statistics clock frequency */
381 	int	profhz;		/* profiling clock frequency */
382 };
383 
384 /*
385  * KERN_PROC subtypes
386  */
387 #define	KERN_PROC_ALL		 0	/* everything */
388 #define	KERN_PROC_PID		 1	/* by process id */
389 #define	KERN_PROC_PGRP		 2	/* by process group id */
390 #define	KERN_PROC_SESSION	 3	/* by session of pid */
391 #define	KERN_PROC_TTY		 4	/* by controlling tty */
392 #define	KERN_PROC_UID		 5	/* by effective uid */
393 #define	KERN_PROC_RUID		 6	/* by real uid */
394 #define	KERN_PROC_GID		 7	/* by effective gid */
395 #define	KERN_PROC_RGID		 8	/* by real gid */
396 
397 /*
398  * KERN_PROC_TTY sub-subtypes
399  */
400 #define	KERN_PROC_TTY_NODEV	NODEV		/* no controlling tty */
401 #define	KERN_PROC_TTY_REVOKE	((dev_t)-2)	/* revoked tty */
402 
403 struct ki_pcred {
404 	void		*p_pad;
405 	uid_t		p_ruid;		/* Real user id */
406 	uid_t		p_svuid;	/* Saved effective user id */
407 	gid_t		p_rgid;		/* Real group id */
408 	gid_t		p_svgid;	/* Saved effective group id */
409 	int		p_refcnt;	/* Number of references */
410 };
411 
412 struct ki_ucred {
413 	uint32_t	cr_ref;			/* reference count */
414 	uid_t		cr_uid;			/* effective user id */
415 	gid_t		cr_gid;			/* effective group id */
416 	uint32_t	cr_ngroups;		/* number of groups */
417 	gid_t		cr_groups[NGROUPS];	/* groups */
418 };
419 
420 #if defined(_KERNEL) || defined(_KMEMUSER)
421 
422 /*
423  * KERN_PROC subtype ops return arrays of augmented proc structures:
424  */
425 struct kinfo_proc {
426 	struct	proc kp_proc;			/* proc structure */
427 	struct	eproc {
428 		struct	proc *e_paddr;		/* address of proc */
429 		struct	session *e_sess;	/* session pointer */
430 		struct	ki_pcred e_pcred;	/* process credentials */
431 		struct	ki_ucred e_ucred;	/* current credentials */
432 		struct	vmspace e_vm;		/* address space */
433 		pid_t	e_ppid;			/* parent process id */
434 		pid_t	e_pgid;			/* process group id */
435 		short	e_jobc;			/* job control counter */
436 		uint32_t e_tdev;		/* XXX: controlling tty dev */
437 		pid_t	e_tpgid;		/* tty process group id */
438 		struct	session *e_tsess;	/* tty session pointer */
439 #define	WMESGLEN	8
440 		char	e_wmesg[WMESGLEN];	/* wchan message */
441 		segsz_t e_xsize;		/* text size */
442 		short	e_xrssize;		/* text rss */
443 		short	e_xccount;		/* text references */
444 		short	e_xswrss;
445 		long	e_flag;			/* see p_eflag  below */
446 		char	e_login[MAXLOGNAME];	/* setlogin() name */
447 		pid_t	e_sid;			/* session id */
448 		long	e_spare[3];
449 	} kp_eproc;
450 };
451 #endif /* defined(_KERNEL) || defined(_KMEMUSER) */
452 
453 /*
454  * Convert pointer to 64 bit unsigned integer for struct
455  * kinfo_proc2, etc.
456  */
457 #define PTRTOUINT64(p) ((uint64_t)(uintptr_t)(p))
458 #define UINT64TOPTR(u) ((void *)(uintptr_t)(u))
459 
460 /*
461  * KERN_PROC2 subtype ops return arrays of relatively fixed size
462  * structures of process info.   Use 8 byte alignment, and new
463  * elements should only be added to the end of this structure so
464  * binary compatibility can be preserved.
465  */
466 #define	KI_NGROUPS	16
467 #define	KI_MAXCOMLEN	24	/* extra for 8 byte alignment */
468 #define	KI_WMESGLEN	8
469 #define	KI_MAXLOGNAME	24	/* extra for 8 byte alignment */
470 #define	KI_MAXEMULLEN	16
471 #define	KI_LNAMELEN	20	/* extra 4 for alignment */
472 
473 #define KI_NOCPU	(~(uint64_t)0)
474 
475 typedef struct {
476 	uint32_t	__bits[4];
477 } ki_sigset_t;
478 
479 struct kinfo_proc2 {
480 	uint64_t p_forw;		/* PTR: linked run/sleep queue. */
481 	uint64_t p_back;
482 	uint64_t p_paddr;		/* PTR: address of proc */
483 
484 	uint64_t p_addr;		/* PTR: Kernel virtual addr of u-area */
485 	uint64_t p_fd;			/* PTR: Ptr to open files structure. */
486 	uint64_t p_cwdi;		/* PTR: cdir/rdir/cmask info */
487 	uint64_t p_stats;		/* PTR: Accounting/statistics */
488 	uint64_t p_limit;		/* PTR: Process limits. */
489 	uint64_t p_vmspace;		/* PTR: Address space. */
490 	uint64_t p_sigacts;		/* PTR: Signal actions, state */
491 	uint64_t p_sess;		/* PTR: session pointer */
492 	uint64_t p_tsess;		/* PTR: tty session pointer */
493 	uint64_t p_ru;			/* PTR: Exit information. XXX */
494 
495 	int32_t	p_eflag;		/* LONG: extra kinfo_proc2 flags */
496 #define	EPROC_CTTY	0x01	/* controlling tty vnode active */
497 #define	EPROC_SLEADER	0x02	/* session leader */
498 	int32_t	p_exitsig;		/* INT: signal to sent to parent on exit */
499 	int32_t	p_flag;			/* INT: P_* flags. */
500 
501 	int32_t	p_pid;			/* PID_T: Process identifier. */
502 	int32_t	p_ppid;			/* PID_T: Parent process id */
503 	int32_t	p_sid;			/* PID_T: session id */
504 	int32_t	p__pgid;		/* PID_T: process group id */
505 					/* XXX: <sys/proc.h> hijacks p_pgid */
506 	int32_t	p_tpgid;		/* PID_T: tty process group id */
507 
508 	uint32_t p_uid;			/* UID_T: effective user id */
509 	uint32_t p_ruid;		/* UID_T: real user id */
510 	uint32_t p_gid;			/* GID_T: effective group id */
511 	uint32_t p_rgid;		/* GID_T: real group id */
512 
513 	uint32_t p_groups[KI_NGROUPS];	/* GID_T: groups */
514 	int16_t	p_ngroups;		/* SHORT: number of groups */
515 
516 	int16_t	p_jobc;			/* SHORT: job control counter */
517 	uint32_t p_tdev;		/* XXX: DEV_T: controlling tty dev */
518 
519 	uint32_t p_estcpu;		/* U_INT: Time averaged value of p_cpticks. */
520 	uint32_t p_rtime_sec;		/* STRUCT TIMEVAL: Real time. */
521 	uint32_t p_rtime_usec;		/* STRUCT TIMEVAL: Real time. */
522 	int32_t	p_cpticks;		/* INT: Ticks of CPU time. */
523 	uint32_t p_pctcpu;		/* FIXPT_T: %cpu for this process during p_swtime */
524 	uint32_t p_swtime;		/* U_INT: Time swapped in or out. */
525 	uint32_t p_slptime;		/* U_INT: Time since last blocked. */
526 	int32_t	p_schedflags;		/* INT: PSCHED_* flags */
527 
528 	uint64_t p_uticks;		/* U_QUAD_T: Statclock hits in user mode. */
529 	uint64_t p_sticks;		/* U_QUAD_T: Statclock hits in system mode. */
530 	uint64_t p_iticks;		/* U_QUAD_T: Statclock hits processing intr. */
531 
532 	uint64_t p_tracep;		/* PTR: Trace to vnode or file */
533 	int32_t	p_traceflag;		/* INT: Kernel trace points. */
534 
535 	int32_t	p_holdcnt;              /* INT: If non-zero, don't swap. */
536 
537 	ki_sigset_t p_siglist;		/* SIGSET_T: Signals arrived but not delivered. */
538 	ki_sigset_t p_sigmask;		/* SIGSET_T: Current signal mask. */
539 	ki_sigset_t p_sigignore;	/* SIGSET_T: Signals being ignored. */
540 	ki_sigset_t p_sigcatch;		/* SIGSET_T: Signals being caught by user. */
541 
542 	int8_t	p_stat;			/* CHAR: S* process status (from LWP). */
543 	uint8_t p_priority;		/* U_CHAR: Process priority. */
544 	uint8_t p_usrpri;		/* U_CHAR: User-priority based on p_cpu and p_nice. */
545 	uint8_t p_nice;			/* U_CHAR: Process "nice" value. */
546 
547 	uint16_t p_xstat;		/* U_SHORT: Exit status for wait; also stop signal. */
548 	uint16_t p_acflag;		/* U_SHORT: Accounting flags. */
549 
550 	char	p_comm[KI_MAXCOMLEN];
551 
552 	char	p_wmesg[KI_WMESGLEN];	/* wchan message */
553 	uint64_t p_wchan;		/* PTR: sleep address. */
554 
555 	char	p_login[KI_MAXLOGNAME];	/* setlogin() name */
556 
557 	int32_t	p_vm_rssize;		/* SEGSZ_T: current resident set size in pages */
558 	int32_t	p_vm_tsize;		/* SEGSZ_T: text size (pages) */
559 	int32_t	p_vm_dsize;		/* SEGSZ_T: data size (pages) */
560 	int32_t	p_vm_ssize;		/* SEGSZ_T: stack size (pages) */
561 
562 	int64_t	p_uvalid;		/* CHAR: following p_u* parameters are valid */
563 					/* XXX 64 bits for alignment */
564 	uint32_t p_ustart_sec;		/* STRUCT TIMEVAL: starting time. */
565 	uint32_t p_ustart_usec;		/* STRUCT TIMEVAL: starting time. */
566 
567 	uint32_t p_uutime_sec;		/* STRUCT TIMEVAL: user time. */
568 	uint32_t p_uutime_usec;		/* STRUCT TIMEVAL: user time. */
569 	uint32_t p_ustime_sec;		/* STRUCT TIMEVAL: system time. */
570 	uint32_t p_ustime_usec;		/* STRUCT TIMEVAL: system time. */
571 
572 	uint64_t p_uru_maxrss;		/* LONG: max resident set size. */
573 	uint64_t p_uru_ixrss;		/* LONG: integral shared memory size. */
574 	uint64_t p_uru_idrss;		/* LONG: integral unshared data ". */
575 	uint64_t p_uru_isrss;		/* LONG: integral unshared stack ". */
576 	uint64_t p_uru_minflt;		/* LONG: page reclaims. */
577 	uint64_t p_uru_majflt;		/* LONG: page faults. */
578 	uint64_t p_uru_nswap;		/* LONG: swaps. */
579 	uint64_t p_uru_inblock;		/* LONG: block input operations. */
580 	uint64_t p_uru_oublock;		/* LONG: block output operations. */
581 	uint64_t p_uru_msgsnd;		/* LONG: messages sent. */
582 	uint64_t p_uru_msgrcv;		/* LONG: messages received. */
583 	uint64_t p_uru_nsignals;	/* LONG: signals received. */
584 	uint64_t p_uru_nvcsw;		/* LONG: voluntary context switches. */
585 	uint64_t p_uru_nivcsw;		/* LONG: involuntary ". */
586 
587 	uint32_t p_uctime_sec;		/* STRUCT TIMEVAL: child u+s time. */
588 	uint32_t p_uctime_usec;		/* STRUCT TIMEVAL: child u+s time. */
589 	uint64_t p_cpuid;		/* LONG: CPU id */
590 	uint64_t p_realflag;	       	/* INT: P_* flags (not including LWPs). */
591 	uint64_t p_nlwps;		/* LONG: Number of LWPs */
592 	uint64_t p_nrlwps;		/* LONG: Number of running LWPs */
593 	uint64_t p_realstat;		/* LONG: non-LWP process status */
594 	uint32_t p_svuid;		/* UID_T: saved user id */
595 	uint32_t p_svgid;		/* GID_T: saved group id */
596 	char p_ename[KI_MAXEMULLEN];	/* emulation name */
597 	int64_t	p_vm_vsize;		/* SEGSZ_T: total map size (pages) */
598 	int64_t	p_vm_msize;		/* SEGSZ_T: stack-adjusted map size (pages) */
599 };
600 
601 /*
602  * Compat flags for kinfo_proc, kinfo_proc2.  Not guaranteed to be stable.
603  * Some of them used to be shared with LWP flags.
604  * XXXAD Trim to the minimum necessary...
605  */
606 
607 #define	P_ADVLOCK		0x00000001
608 #define	P_CONTROLT		0x00000002
609 #define	L_INMEM			0x00000004
610 #define	P_INMEM		     /* 0x00000004 */	L_INMEM
611 #define	P_NOCLDSTOP		0x00000008
612 #define	P_PPWAIT		0x00000010
613 #define	P_PROFIL		0x00000020
614 #define	L_SELECT		0x00000040
615 #define	P_SELECT	     /* 0x00000040 */	L_SELECT
616 #define	L_SINTR			0x00000080
617 #define	P_SINTR		     /* 0x00000080 */	L_SINTR
618 #define	P_SUGID			0x00000100
619 #define	L_SYSTEM	     	0x00000200
620 #define	P_SYSTEM	     /*	0x00000200 */	L_SYSTEM
621 #define	L_SA			0x00000400
622 #define	P_SA		     /* 0x00000400 */	L_SA
623 #define	P_TRACED		0x00000800
624 #define	P_WAITED		0x00001000
625 #define	P_WEXIT			0x00002000
626 #define	P_EXEC			0x00004000
627 #define	P_OWEUPC		0x00008000
628 #define	P_FSTRACE		0x00010000
629 #define	P_NOCLDWAIT		0x00020000
630 #define	P_32			0x00040000
631 #define	P_CLDSIGIGN		0x00080000
632 #define	P_SYSTRACE		0x00200000
633 #define	P_CHTRACED		0x00400000
634 #define	P_STOPFORK		0x00800000
635 #define	P_STOPEXEC		0x01000000
636 #define	P_STOPEXIT		0x02000000
637 #define	P_SYSCALL		0x04000000
638 #define	P_PAXMPROTECT		0x08000000
639 #define	P_PAXNOMPROTECT		0x10000000
640 
641 /*
642  * LWP compat flags.
643  */
644 #define	L_DETACHED		0x00800000
645 
646 /*
647  * KERN_LWP structure. See notes on KERN_PROC2 about adding elements.
648  */
649 struct kinfo_lwp {
650 	uint64_t l_forw;		/* PTR: linked run/sleep queue. */
651 	uint64_t l_back;
652 	uint64_t l_laddr;		/* PTR: Address of LWP */
653 	uint64_t l_addr;		/* PTR: Kernel virtual addr of u-area */
654 	int32_t	l_lid;			/* LWPID_T: LWP identifier */
655 	int32_t	l_flag;			/* INT: L_* flags. */
656 	uint32_t l_swtime;		/* U_INT: Time swapped in or out. */
657 	uint32_t l_slptime;		/* U_INT: Time since last blocked. */
658 	int32_t	l_schedflags;		/* INT: PSCHED_* flags */
659 	int32_t	l_holdcnt;              /* INT: If non-zero, don't swap. */
660 	uint8_t l_priority;		/* U_CHAR: Process priority. */
661 	uint8_t l_usrpri;		/* U_CHAR: User-priority based on l_cpu and p_nice. */
662 	int8_t	l_stat;			/* CHAR: S* process status. */
663 	int8_t	l_pad1;			/* fill out to 4-byte boundary */
664 	int32_t	l_pad2;			/* .. and then to an 8-byte boundary */
665 	char	l_wmesg[KI_WMESGLEN];	/* wchan message */
666 	uint64_t l_wchan;		/* PTR: sleep address. */
667 	uint64_t l_cpuid;		/* LONG: CPU id */
668 	uint32_t l_rtime_sec;		/* STRUCT TIMEVAL: Real time. */
669 	uint32_t l_rtime_usec;		/* STRUCT TIMEVAL: Real time. */
670 	uint32_t l_cpticks;		/* INT: ticks during l_swtime */
671 	uint32_t l_pctcpu;		/* FIXPT_T: cpu usage for ps */
672 	uint32_t l_pid;			/* PID_T: process identifier */
673 	char	l_name[KI_LNAMELEN];	/* CHAR[]: name, may be empty */
674 };
675 
676 /*
677  * KERN_PROC_ARGS subtypes
678  */
679 #define	KERN_PROC_ARGV		1	/* argv */
680 #define	KERN_PROC_NARGV		2	/* number of strings in above */
681 #define	KERN_PROC_ENV		3	/* environ */
682 #define	KERN_PROC_NENV		4	/* number of strings in above */
683 
684 /*
685  * KERN_SYSVIPC subtypes
686  */
687 #define	KERN_SYSVIPC_INFO	1	/* struct: number of valid kern ids */
688 #define	KERN_SYSVIPC_MSG	2	/* int: SysV message queue support */
689 #define	KERN_SYSVIPC_SEM	3	/* int: SysV semaphore support */
690 #define	KERN_SYSVIPC_SHM	4	/* int: SysV shared memory support */
691 #define	KERN_SYSVIPC_SHMMAX	5	/* int: max shared memory segment size (bytes) */
692 #define	KERN_SYSVIPC_SHMMNI	6	/* int: max number of shared memory identifiers */
693 #define	KERN_SYSVIPC_SHMSEG	7	/* int: max shared memory segments per process */
694 #define	KERN_SYSVIPC_SHMMAXPGS	8	/* int: max amount of shared memory (pages) */
695 #define	KERN_SYSVIPC_SHMUSEPHYS	9	/* int: physical memory usage */
696 
697 /*
698  * KERN_SYSVIPC_INFO subtypes
699  */
700 /* KERN_SYSVIPC_OMSG_INFO		1	*/
701 /* KERN_SYSVIPC_OSEM_INFO		2	*/
702 /* KERN_SYSVIPC_OSHM_INFO		3	*/
703 #define	KERN_SYSVIPC_MSG_INFO		4	/* msginfo and msgid_ds */
704 #define	KERN_SYSVIPC_SEM_INFO		5	/* seminfo and semid_ds */
705 #define	KERN_SYSVIPC_SHM_INFO		6	/* shminfo and shmid_ds */
706 
707 /*
708  * tty counter sysctl variables
709  */
710 #define	KERN_TKSTAT_NIN			1	/* total input character */
711 #define	KERN_TKSTAT_NOUT		2	/* total output character */
712 #define	KERN_TKSTAT_CANCC		3	/* canonical input character */
713 #define	KERN_TKSTAT_RAWCC		4	/* raw input character */
714 #define	KERN_TKSTAT_MAXID		5	/* number of valid TKSTAT ids */
715 
716 #define	KERN_TKSTAT_NAMES { \
717 	{ 0, 0 }, \
718 	{ "nin", CTLTYPE_QUAD }, \
719 	{ "nout", CTLTYPE_QUAD }, \
720 	{ "cancc", CTLTYPE_QUAD }, \
721 	{ "rawcc", CTLTYPE_QUAD }, \
722 }
723 
724 /*
725  * kern.drivers returns an array of these.
726  */
727 
728 struct kinfo_drivers {
729 	devmajor_t	d_cmajor;
730 	devmajor_t	d_bmajor;
731 	char		d_name[24];
732 };
733 
734 /*
735  * KERN_BUF subtypes, like KERN_PROC2, where the four following mib
736  * entries specify "which type of buf", "which particular buf",
737  * "sizeof buf", and "how many".  Currently, only "all buf" is
738  * defined.
739  */
740 #define	KERN_BUF_ALL	0		/* all buffers */
741 
742 /*
743  * kern.buf returns an array of these structures, which are designed
744  * both to be immune to 32/64 bit emulation issues and to provide
745  * backwards compatibility.  Note that the order here differs slightly
746  * from the real struct buf in order to achieve proper 64 bit
747  * alignment.
748  */
749 struct buf_sysctl {
750 	uint32_t b_flags;	/* LONG: B_* flags */
751 	int32_t  b_error;	/* INT: Errno value */
752 	int32_t  b_prio;	/* INT: Hint for buffer queue discipline */
753 	uint32_t b_dev;		/* DEV_T: Device associated with buffer */
754 	uint64_t b_bufsize;	/* LONG: Allocated buffer size */
755 	uint64_t b_bcount;	/* LONG: Valid bytes in buffer */
756 	uint64_t b_resid;	/* LONG: Remaining I/O */
757 	uint64_t b_addr;	/* CADDR_T: Memory, superblocks, indirect... */
758 	uint64_t b_blkno;	/* DADDR_T: Underlying physical block number */
759 	uint64_t b_rawblkno;	/* DADDR_T: Raw underlying physical block */
760 	uint64_t b_iodone;	/* PTR: Function called upon completion */
761 	uint64_t b_proc;	/* PTR: Associated proc if B_PHYS set */
762 	uint64_t b_vp;		/* PTR: File vnode */
763 	uint64_t b_saveaddr;	/* PTR: Original b_addr for physio */
764 	uint64_t b_lblkno;	/* DADDR_T: Logical block number */
765 };
766 
767 /*
768  * kern.file2 returns an array of these structures, which are designed
769  * both to be immune to be immune to 32/64 bit emulation issues and to
770  * provide backwards compatibility.  The order differs slightly from
771  * that of the real struct file, and some fields are taken from other
772  * structures (struct vnode, struct proc) in order to make the file
773  * information more useful.
774  */
775 struct kinfo_file {
776 	uint64_t	ki_fileaddr;	/* PTR: address of struct file */
777 	uint32_t	ki_flag;	/* INT: flags (see fcntl.h) */
778 	uint32_t	ki_iflags;	/* INT: internal flags */
779 	uint32_t	ki_ftype;	/* INT: descriptor type */
780 	uint32_t	ki_count;	/* UINT: reference count */
781 	uint32_t	ki_msgcount;	/* UINT: references from msg queue */
782 	uint32_t	ki_usecount;	/* INT: number active users */
783 	uint64_t	ki_fucred;	/* PTR: creds for descriptor */
784 	uint32_t	ki_fuid;	/* UID_T: descriptor credentials */
785 	uint32_t	ki_fgid;	/* GID_T: descriptor credentials */
786 	uint64_t	ki_fops;	/* PTR: address of fileops */
787 	uint64_t	ki_foffset;	/* OFF_T: offset */
788 	uint64_t	ki_fdata;	/* PTR: descriptor data */
789 
790 	/* vnode information to glue this file to something */
791 	uint64_t	ki_vun;		/* PTR: socket, specinfo, etc */
792 	uint64_t	ki_vsize;	/* OFF_T: size of file */
793 	uint32_t	ki_vtype;	/* ENUM: vnode type */
794 	uint32_t	ki_vtag;	/* ENUM: type of underlying data */
795 	uint64_t	ki_vdata;	/* PTR: private data for fs */
796 
797 	/* process information when retrieved via KERN_FILE_BYPID */
798 	uint32_t	ki_pid;		/* PID_T: process id */
799 	int32_t		ki_fd;		/* INT: descriptor number */
800 	uint32_t	ki_ofileflags;	/* CHAR: open file flags */
801 	uint32_t	_ki_padto64bits;
802 };
803 
804 #define	KERN_FILE_BYFILE	1
805 #define	KERN_FILE_BYPID		2
806 #define	KERN_FILESLOP		10
807 
808 /*
809  * kern.evcnt returns an array of these structures, which are designed both to
810  * be immune to 32/64 bit emulation issues.  Note that the struct here differs
811  * from the real struct evcnt but contains the same information in order to
812  * accommodate sysctl.
813  */
814 struct evcnt_sysctl {
815 	uint64_t	ev_count;		/* current count */
816 	uint64_t	ev_addr;		/* kernel address of evcnt */
817 	uint64_t	ev_parent;		/* kernel address of parent */
818 	uint8_t		ev_type;		/* EVCNT_TRAP_* */
819 	uint8_t		ev_grouplen;		/* length of group with NUL */
820 	uint8_t		ev_namelen;		/* length of name with NUL */
821 	uint8_t		ev_len;			/* multiply by 8 */
822 	/*
823 	 * Now the group and name strings follow (both include the trailing
824 	 * NUL).  ev_name start at &ev_strings[ev_grouplen+1]
825 	 */
826 	char		ev_strings[0];
827 };
828 
829 #define	KERN_EVCNT_COUNT_ANY		0
830 #define	KERN_EVCNT_COUNT_NONZERO	1
831 
832 /*
833  * CTL_HW identifiers
834  */
835 #define	HW_MACHINE	 1		/* string: machine class */
836 #define	HW_MODEL	 2		/* string: specific machine model */
837 #define	HW_NCPU		 3		/* int: number of cpus */
838 #define	HW_BYTEORDER	 4		/* int: machine byte order */
839 #define	HW_PHYSMEM	 5		/* int: total memory (bytes) */
840 #define	HW_USERMEM	 6		/* int: non-kernel memory (bytes) */
841 #define	HW_PAGESIZE	 7		/* int: software page size */
842 #define	HW_DISKNAMES	 8		/* string: disk drive names */
843 #define	HW_IOSTATS	 9		/* struct: iostats[] */
844 #define	HW_MACHINE_ARCH	10		/* string: machine architecture */
845 #define	HW_ALIGNBYTES	11		/* int: ALIGNBYTES for the kernel */
846 #define	HW_CNMAGIC	12		/* string: console magic sequence(s) */
847 #define	HW_PHYSMEM64	13		/* quad: total memory (bytes) */
848 #define	HW_USERMEM64	14		/* quad: non-kernel memory (bytes) */
849 #define	HW_IOSTATNAMES	15		/* string: iostat names */
850 #define	HW_MAXID	15		/* number of valid hw ids */
851 #define	HW_NCPUONLINE	16		/* number CPUs online */
852 
853 #define	CTL_HW_NAMES { \
854 	{ 0, 0 }, \
855 	{ "machine", CTLTYPE_STRING }, \
856 	{ "model", CTLTYPE_STRING }, \
857 	{ "ncpu", CTLTYPE_INT }, \
858 	{ "byteorder", CTLTYPE_INT }, \
859 	{ "physmem", CTLTYPE_INT }, \
860 	{ "usermem", CTLTYPE_INT }, \
861 	{ "pagesize", CTLTYPE_INT }, \
862 	{ "drivenames", CTLTYPE_STRING }, \
863 	{ "drivestats", CTLTYPE_STRUCT }, \
864 	{ "machine_arch", CTLTYPE_STRING }, \
865 	{ "alignbytes", CTLTYPE_INT }, \
866 	{ "cnmagic", CTLTYPE_STRING }, \
867 	{ "physmem64", CTLTYPE_QUAD }, \
868 	{ "usermem64", CTLTYPE_QUAD }, \
869 	{ "ncpuonline", CTLTYPE_INT }, \
870 }
871 
872 /*
873  * CTL_USER definitions
874  */
875 #define	USER_CS_PATH		 1	/* string: _CS_PATH */
876 #define	USER_BC_BASE_MAX	 2	/* int: BC_BASE_MAX */
877 #define	USER_BC_DIM_MAX		 3	/* int: BC_DIM_MAX */
878 #define	USER_BC_SCALE_MAX	 4	/* int: BC_SCALE_MAX */
879 #define	USER_BC_STRING_MAX	 5	/* int: BC_STRING_MAX */
880 #define	USER_COLL_WEIGHTS_MAX	 6	/* int: COLL_WEIGHTS_MAX */
881 #define	USER_EXPR_NEST_MAX	 7	/* int: EXPR_NEST_MAX */
882 #define	USER_LINE_MAX		 8	/* int: LINE_MAX */
883 #define	USER_RE_DUP_MAX		 9	/* int: RE_DUP_MAX */
884 #define	USER_POSIX2_VERSION	10	/* int: POSIX2_VERSION */
885 #define	USER_POSIX2_C_BIND	11	/* int: POSIX2_C_BIND */
886 #define	USER_POSIX2_C_DEV	12	/* int: POSIX2_C_DEV */
887 #define	USER_POSIX2_CHAR_TERM	13	/* int: POSIX2_CHAR_TERM */
888 #define	USER_POSIX2_FORT_DEV	14	/* int: POSIX2_FORT_DEV */
889 #define	USER_POSIX2_FORT_RUN	15	/* int: POSIX2_FORT_RUN */
890 #define	USER_POSIX2_LOCALEDEF	16	/* int: POSIX2_LOCALEDEF */
891 #define	USER_POSIX2_SW_DEV	17	/* int: POSIX2_SW_DEV */
892 #define	USER_POSIX2_UPE		18	/* int: POSIX2_UPE */
893 #define	USER_STREAM_MAX		19	/* int: POSIX2_STREAM_MAX */
894 #define	USER_TZNAME_MAX		20	/* int: _POSIX_TZNAME_MAX */
895 #define	USER_ATEXIT_MAX		21	/* int: {ATEXIT_MAX} */
896 #define	USER_MAXID		22	/* number of valid user ids */
897 
898 #define	CTL_USER_NAMES { \
899 	{ 0, 0 }, \
900 	{ "cs_path", CTLTYPE_STRING }, \
901 	{ "bc_base_max", CTLTYPE_INT }, \
902 	{ "bc_dim_max", CTLTYPE_INT }, \
903 	{ "bc_scale_max", CTLTYPE_INT }, \
904 	{ "bc_string_max", CTLTYPE_INT }, \
905 	{ "coll_weights_max", CTLTYPE_INT }, \
906 	{ "expr_nest_max", CTLTYPE_INT }, \
907 	{ "line_max", CTLTYPE_INT }, \
908 	{ "re_dup_max", CTLTYPE_INT }, \
909 	{ "posix2_version", CTLTYPE_INT }, \
910 	{ "posix2_c_bind", CTLTYPE_INT }, \
911 	{ "posix2_c_dev", CTLTYPE_INT }, \
912 	{ "posix2_char_term", CTLTYPE_INT }, \
913 	{ "posix2_fort_dev", CTLTYPE_INT }, \
914 	{ "posix2_fort_run", CTLTYPE_INT }, \
915 	{ "posix2_localedef", CTLTYPE_INT }, \
916 	{ "posix2_sw_dev", CTLTYPE_INT }, \
917 	{ "posix2_upe", CTLTYPE_INT }, \
918 	{ "stream_max", CTLTYPE_INT }, \
919 	{ "tzname_max", CTLTYPE_INT }, \
920 	{ "atexit_max", CTLTYPE_INT }, \
921 }
922 
923 /*
924  * CTL_DDB definitions
925  */
926 #define	DDBCTL_RADIX		1	/* int: Input and output radix */
927 #define	DDBCTL_MAXOFF		2	/* int: max symbol offset */
928 #define	DDBCTL_MAXWIDTH		3	/* int: width of the display line */
929 #define	DDBCTL_LINES		4	/* int: number of display lines */
930 #define	DDBCTL_TABSTOPS		5	/* int: tab width */
931 #define	DDBCTL_ONPANIC		6	/* int: DDB on panic if non-zero */
932 #define	DDBCTL_FROMCONSOLE	7	/* int: DDB via console if non-zero */
933 #define	DDBCTL_MAXID		8	/* number of valid DDB ids */
934 
935 #define	CTL_DDB_NAMES { \
936 	{ 0, 0 }, \
937 	{ "radix", CTLTYPE_INT }, \
938 	{ "maxoff", CTLTYPE_INT }, \
939 	{ "maxwidth", CTLTYPE_INT }, \
940 	{ "lines", CTLTYPE_INT }, \
941 	{ "tabstops", CTLTYPE_INT }, \
942 	{ "onpanic", CTLTYPE_INT }, \
943 	{ "fromconsole", CTLTYPE_INT }, \
944 }
945 
946 /*
947  * CTL_DEBUG definitions
948  *
949  * Second level identifier specifies which debug variable.
950  * Third level identifier specifies which structure component.
951  */
952 #define	CTL_DEBUG_NAME		0	/* string: variable name */
953 #define	CTL_DEBUG_VALUE		1	/* int: variable value */
954 #define	CTL_DEBUG_MAXID		20
955 
956 /*
957  * CTL_PROC subtype. Either a PID, or a magic value for the current proc.
958  */
959 
960 #define	PROC_CURPROC	(~((u_int)1 << 31))
961 
962 /*
963  * CTL_PROC tree: either corename (string), or a limit
964  * (rlimit.<type>.{hard,soft}, int).
965  */
966 #define	PROC_PID_CORENAME	1
967 #define	PROC_PID_LIMIT		2
968 #define	PROC_PID_STOPFORK	3
969 #define	PROC_PID_STOPEXEC	4
970 #define	PROC_PID_STOPEXIT	5
971 #define	PROC_PID_MAXID		6
972 
973 #define	PROC_PID_NAMES { \
974 	{ 0, 0 }, \
975 	{ "corename", CTLTYPE_STRING }, \
976 	{ "rlimit", CTLTYPE_NODE }, \
977 	{ "stopfork", CTLTYPE_INT }, \
978 	{ "stopexec", CTLTYPE_INT }, \
979 	{ "stopexit", CTLTYPE_INT }, \
980 }
981 
982 /* Limit types from <sys/resources.h> */
983 #define	PROC_PID_LIMIT_CPU	(RLIMIT_CPU+1)
984 #define	PROC_PID_LIMIT_FSIZE	(RLIMIT_FSIZE+1)
985 #define	PROC_PID_LIMIT_DATA	(RLIMIT_DATA+1)
986 #define	PROC_PID_LIMIT_STACK	(RLIMIT_STACK+1)
987 #define	PROC_PID_LIMIT_CORE	(RLIMIT_CORE+1)
988 #define	PROC_PID_LIMIT_RSS	(RLIMIT_RSS+1)
989 #define	PROC_PID_LIMIT_MEMLOCK	(RLIMIT_MEMLOCK+1)
990 #define PROC_PID_LIMIT_NPROC	(RLIMIT_NPROC+1)
991 #define	PROC_PID_LIMIT_NOFILE	(RLIMIT_NOFILE+1)
992 #define	PROC_PID_LIMIT_SBSIZE	(RLIMIT_SBSIZE+1)
993 #define	PROC_PID_LIMIT_AS	(RLIMIT_AS+1)
994 #define	PROC_PID_LIMIT_NTHR	(RLIMIT_NTHR+1)
995 #define	PROC_PID_LIMIT_MAXID 	(RLIM_NLIMITS+1)
996 
997 #define	PROC_PID_LIMIT_NAMES { \
998 	{ 0, 0 }, \
999 	{ "cputime", CTLTYPE_NODE }, \
1000 	{ "filesize", CTLTYPE_NODE }, \
1001 	{ "datasize", CTLTYPE_NODE }, \
1002 	{ "stacksize", CTLTYPE_NODE }, \
1003 	{ "coredumpsize", CTLTYPE_NODE }, \
1004 	{ "memoryuse", CTLTYPE_NODE }, \
1005 	{ "memorylocked", CTLTYPE_NODE }, \
1006 	{ "maxproc", CTLTYPE_NODE }, \
1007 	{ "descriptors", CTLTYPE_NODE }, \
1008 	{ "sbsize", CTLTYPE_NODE }, \
1009 	{ "vmemoryuse", CTLTYPE_NODE }, \
1010 	{ "maxlwp", CTLTYPE_NODE }, \
1011 }
1012 /* for each type, either hard or soft value */
1013 #define	PROC_PID_LIMIT_TYPE_SOFT	1
1014 #define	PROC_PID_LIMIT_TYPE_HARD	2
1015 #define	PROC_PID_LIMIT_TYPE_MAXID	3
1016 
1017 #define	PROC_PID_LIMIT_TYPE_NAMES { \
1018 	{0, 0}, \
1019 	{ "soft", CTLTYPE_QUAD }, \
1020 	{ "hard", CTLTYPE_QUAD }, \
1021 }
1022 
1023 /*
1024  * CTL_EMUL definitions
1025  *
1026  * Second level identifier specifies which emulation variable.
1027  * Subsequent levels are specified in the emulations themselves.
1028  */
1029 #define	EMUL_LINUX	1
1030 #define	EMUL_LINUX32	5
1031 
1032 #define	EMUL_MAXID	6
1033 
1034 #ifdef _KERNEL
1035 
1036 #if defined(_KERNEL_OPT)
1037 #include "opt_sysctl.h"
1038 #endif
1039 
1040 /* Root node of the kernel sysctl tree */
1041 extern struct sysctlnode sysctl_root;
1042 
1043 /*
1044  * A log of nodes created by a setup function or set of setup
1045  * functions so that they can be torn down in one "transaction"
1046  * when no longer needed.
1047  *
1048  * Users of the log merely pass a pointer to a pointer, and the sysctl
1049  * infrastructure takes care of the rest.
1050  */
1051 struct sysctllog;
1052 
1053 /*
1054  * CTL_DEBUG variables.
1055  *
1056  * These are declared as separate variables so that they can be
1057  * individually initialized at the location of their associated
1058  * variable. The loader prevents multiple use by issuing errors
1059  * if a variable is initialized in more than one place. They are
1060  * aggregated into an array in debug_sysctl(), so that it can
1061  * conveniently locate them when queried. If more debugging
1062  * variables are added, they must also be declared here and also
1063  * entered into the array.
1064  *
1065  * Note that the debug subtree is largely obsolescent in terms of
1066  * functionality now that we have dynamic sysctl, but the
1067  * infrastructure is retained for backwards compatibility.
1068  */
1069 struct ctldebug {
1070 	const char *debugname;	/* name of debugging variable */
1071 	int	*debugvar;	/* pointer to debugging variable */
1072 };
1073 #ifdef	DEBUG
1074 extern struct ctldebug debug0, debug1, debug2, debug3, debug4;
1075 extern struct ctldebug debug5, debug6, debug7, debug8, debug9;
1076 extern struct ctldebug debug10, debug11, debug12, debug13, debug14;
1077 extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
1078 #endif	/* DEBUG */
1079 
1080 #define SYSCTLFN_PROTO const int *, u_int, void *, \
1081 	size_t *, const void *, size_t, \
1082 	const int *, struct lwp *, const struct sysctlnode *
1083 #define SYSCTLFN_ARGS const int *name, u_int namelen, \
1084 	void *oldp, size_t *oldlenp, \
1085 	const void *newp, size_t newlen, \
1086 	const int *oname, struct lwp *l, \
1087 	const struct sysctlnode *rnode
1088 #define SYSCTLFN_CALL(node) name, namelen, oldp, \
1089 	oldlenp, newp, newlen, \
1090 	oname, l, node
1091 
1092 #ifdef _MODULE
1093 
1094 #define SYSCTL_SETUP_PROTO(name)				\
1095 	void name(struct sysctllog **)
1096 #ifdef SYSCTL_DEBUG_SETUP
1097 #define SYSCTL_SETUP(name, desc)				\
1098 	SYSCTL_SETUP_PROTO(name);				\
1099 	static void __CONCAT(___,name)(struct sysctllog **);	\
1100 	void name(struct sysctllog **clog) {			\
1101 		printf("%s\n", desc);				\
1102 		__CONCAT(___,name)(clog); }			\
1103 	__link_set_add_text(sysctl_funcs, name);		\
1104 	static void __CONCAT(___,name)(struct sysctllog **clog)
1105 #else  /* !SYSCTL_DEBUG_SETUP */
1106 #define SYSCTL_SETUP(name, desc)				\
1107 	SYSCTL_SETUP_PROTO(name);				\
1108 	__link_set_add_text(sysctl_funcs, name);		\
1109 	void name(struct sysctllog **clog)
1110 #endif /* !SYSCTL_DEBUG_SETUP */
1111 
1112 #else /* !_MODULE */
1113 
1114 #define SYSCTL_SETUP_PROTO(name)
1115 #ifdef SYSCTL_DEBUG_SETUP
1116 #define SYSCTL_SETUP(name, desc)				\
1117 	static void __CONCAT(___,name)(struct sysctllog **);	\
1118 	static void name(struct sysctllog **clog) {		\
1119 		printf("%s\n", desc);				\
1120 		__CONCAT(___,name)(clog); }			\
1121 	__link_set_add_text(sysctl_funcs, name);		\
1122 	static void __CONCAT(___,name)(struct sysctllog **clog)
1123 #else  /* !SYSCTL_DEBUG_SETUP */
1124 #define SYSCTL_SETUP(name, desc)				\
1125 	static void name(struct sysctllog **);			\
1126 	__link_set_add_text(sysctl_funcs, name);		\
1127 	static void name(struct sysctllog **clog)
1128 #endif /* !SYSCTL_DEBUG_SETUP */
1129 
1130 #endif /* !_MODULE */
1131 
1132 /*
1133  * Internal sysctl function calling convention:
1134  *
1135  *	(*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen,
1136  *		    origname, lwp, node);
1137  *
1138  * The name parameter points at the next component of the name to be
1139  * interpreted.  The namelen parameter is the number of integers in
1140  * the name.  The origname parameter points to the start of the name
1141  * being parsed.  The node parameter points to the node on which the
1142  * current operation is to be performed.
1143  */
1144 typedef int (*sysctlfn)(SYSCTLFN_PROTO);
1145 
1146 /*
1147  * used in more than just sysctl
1148  */
1149 void	fill_eproc(struct proc *, struct eproc *, bool);
1150 
1151 /*
1152  * subsystem setup
1153  */
1154 void	sysctl_init(void);
1155 void	sysctl_finalize(void);
1156 
1157 /*
1158  * typical syscall call order
1159  */
1160 void	sysctl_lock(bool);
1161 int	sysctl_dispatch(SYSCTLFN_PROTO);
1162 void	sysctl_unlock(void);
1163 void	sysctl_relock(void);
1164 
1165 /*
1166  * tree navigation primitives (must obtain lock before using these)
1167  */
1168 int	sysctl_locate(struct lwp *, const int *, u_int,
1169 		      const struct sysctlnode **, int *);
1170 int	sysctl_query(SYSCTLFN_PROTO);
1171 int	sysctl_create(SYSCTLFN_PROTO);
1172 int	sysctl_destroy(SYSCTLFN_PROTO);
1173 int	sysctl_lookup(SYSCTLFN_PROTO);
1174 int	sysctl_describe(SYSCTLFN_PROTO);
1175 
1176 /*
1177  * simple variadic interface for adding/removing nodes
1178  */
1179 int	sysctl_createv(struct sysctllog **, int,
1180 		       const struct sysctlnode **, const struct sysctlnode **,
1181 		       int, int, const char *, const char *,
1182 		       sysctlfn, u_quad_t, void *, size_t, ...);
1183 int	sysctl_destroyv(struct sysctlnode *, ...);
1184 
1185 #define VERIFY_FN(ctl_type, c_type) \
1186 __always_inline static __inline void * \
1187 __sysctl_verify_##ctl_type##_arg(c_type *arg) \
1188 { \
1189     return arg; \
1190 }
1191 
1192 VERIFY_FN(CTLTYPE_NODE, struct sysctlnode);
1193 VERIFY_FN(CTLTYPE_INT, int);
1194 VERIFY_FN(CTLTYPE_STRING, char);
1195 VERIFY_FN(CTLTYPE_QUAD, int64_t);
1196 VERIFY_FN(CTLTYPE_STRUCT, void);
1197 VERIFY_FN(CTLTYPE_BOOL, bool);
1198 VERIFY_FN(CTLTYPE_LONG, long);
1199 #undef VERIFY_FN
1200 
1201 #define sysctl_createv(lg, cfl, rn, cn, fl, type, nm, desc, fn, qv, newp, ...) \
1202     sysctl_createv(lg, cfl, rn, cn, fl, type, nm, desc, fn, qv, \
1203 	    __sysctl_verify_##type##_arg(newp), __VA_ARGS__)
1204 
1205 /*
1206  * miscellany
1207  */
1208 void	sysctl_dump(const struct sysctlnode *);
1209 void	sysctl_free(struct sysctlnode *);
1210 void	sysctl_teardown(struct sysctllog **);
1211 void	sysctl_log_print(const struct sysctllog *);
1212 
1213 #ifdef SYSCTL_INCLUDE_DESCR
1214 #define SYSCTL_DESCR(s) s
1215 #else /* SYSCTL_INCLUDE_DESCR */
1216 #define SYSCTL_DESCR(s) NULL
1217 #endif /* SYSCTL_INCLUDE_DESCR */
1218 
1219 /*
1220  * simple interface similar to old interface for in-kernel consumption
1221  */
1222 int	old_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
1223 
1224 /*
1225  * these helpers are in other files (XXX so should the nodes be) or
1226  * are used by more than one node
1227  */
1228 int	sysctl_hw_tapenames(SYSCTLFN_PROTO);
1229 int	sysctl_hw_tapestats(SYSCTLFN_PROTO);
1230 int	sysctl_kern_vnode(SYSCTLFN_PROTO);
1231 int	sysctl_net_inet_ip_ports(SYSCTLFN_PROTO);
1232 int	sysctl_consdev(SYSCTLFN_PROTO);
1233 int	sysctl_root_device(SYSCTLFN_PROTO);
1234 int	sysctl_vfs_generic_fstypes(SYSCTLFN_PROTO);
1235 
1236 /*
1237  * primitive helper stubs
1238  */
1239 int	sysctl_needfunc(SYSCTLFN_PROTO);
1240 int	sysctl_notavail(SYSCTLFN_PROTO);
1241 int	sysctl_null(SYSCTLFN_PROTO);
1242 
1243 int	sysctl_copyin(struct lwp *, const void *, void *, size_t);
1244 int	sysctl_copyout(struct lwp *, const void *, void *, size_t);
1245 int	sysctl_copyinstr(struct lwp *, const void *, void *, size_t, size_t *);
1246 
1247 u_int	sysctl_map_flags(const u_int *, u_int);
1248 
1249 MALLOC_DECLARE(M_SYSCTLNODE);
1250 MALLOC_DECLARE(M_SYSCTLDATA);
1251 
1252 extern const u_int sysctl_lwpflagmap[];
1253 
1254 #ifdef SYSCTL_PRIVATE
1255 extern cprng_strong_t *sysctl_prng;
1256 #endif
1257 
1258 #else	/* !_KERNEL */
1259 #include <sys/cdefs.h>
1260 
1261 typedef void *sysctlfn;
1262 
1263 __BEGIN_DECLS
1264 int	sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
1265 #if !defined(__minix)
1266 int	sysctlbyname(const char *, void *, size_t *, const void *, size_t);
1267 int	sysctlgetmibinfo(const char *, int *, u_int *,
1268 			 char *, size_t *, struct sysctlnode **, int);
1269 int	sysctlnametomib(const char *, int *, size_t *);
1270 int	proc_compare(const struct kinfo_proc2 *, const struct kinfo_lwp *,
1271     const struct kinfo_proc2 *, const struct kinfo_lwp *);
1272 #endif /* !defined(__minix) */
1273 __END_DECLS
1274 
1275 #endif	/* !_KERNEL */
1276 
1277 #ifdef __COMPAT_SYSCTL
1278 /*
1279  * old node definitions go here
1280  */
1281 #endif /* __COMPAT_SYSCTL */
1282 
1283 /*
1284  * padding makes alignment magically "work" for 32/64 compatibility at
1285  * the expense of making things bigger on 32 bit platforms.
1286  */
1287 #if defined(_LP64) || (BYTE_ORDER == LITTLE_ENDIAN)
1288 #define __sysc_pad(type) union { uint64_t __sysc_upad; \
1289 	struct { type __sysc_sdatum; } __sysc_ustr; }
1290 #else
1291 #define __sysc_pad(type) union { uint64_t __sysc_upad; \
1292 	struct { uint32_t __sysc_spad; type __sysc_sdatum; } __sysc_ustr; }
1293 #endif
1294 #define __sysc_unpad(x) x.__sysc_ustr.__sysc_sdatum
1295 
1296 /*
1297  * The following is for gcc2, which doesn't handle __sysc_unpad().
1298  * The code gets a little less ugly this way.
1299  */
1300 #define sysc_init_field(field, value) 	\
1301 	.field = { .__sysc_ustr = { .__sysc_sdatum = (value), }, }
1302 
1303 struct sysctlnode {
1304 	uint32_t sysctl_flags;		/* flags and type */
1305 	int32_t sysctl_num;		/* mib number */
1306 	char sysctl_name[SYSCTL_NAMELEN]; /* node name */
1307 	uint32_t sysctl_ver;		/* node's version vs. rest of tree */
1308 	uint32_t __rsvd;
1309 	union {
1310 		struct {
1311 			uint32_t suc_csize;	/* size of child node array */
1312 			uint32_t suc_clen;	/* number of valid children */
1313 			__sysc_pad(struct sysctlnode*) _suc_child; /* array of child nodes */
1314 		} scu_child;
1315 		struct {
1316 			__sysc_pad(void*) _sud_data; /* pointer to external data */
1317 			__sysc_pad(size_t) _sud_offset; /* offset to data */
1318 		} scu_data;
1319 		int32_t scu_alias;		/* node this node refers to */
1320 		int32_t scu_idata;		/* immediate "int" data */
1321 		u_quad_t scu_qdata;		/* immediate "u_quad_t" data */
1322 		bool scu_bdata;			/* immediate bool data */
1323 	} sysctl_un;
1324 	__sysc_pad(size_t) _sysctl_size;	/* size of instrumented data */
1325 	__sysc_pad(sysctlfn) _sysctl_func;	/* access helper function */
1326 	__sysc_pad(struct sysctlnode*) _sysctl_parent; /* parent of this node */
1327 	__sysc_pad(const char *) _sysctl_desc;	/* description of node */
1328 };
1329 
1330 /*
1331  * padded data
1332  */
1333 #define suc_child	__sysc_unpad(_suc_child)
1334 #define sud_data	__sysc_unpad(_sud_data)
1335 #define sud_offset	__sysc_unpad(_sud_offset)
1336 #define sysctl_size	__sysc_unpad(_sysctl_size)
1337 #define sysctl_func	__sysc_unpad(_sysctl_func)
1338 #define sysctl_parent	__sysc_unpad(_sysctl_parent)
1339 #define sysctl_desc	__sysc_unpad(_sysctl_desc)
1340 
1341 /*
1342  * nested data (may also be padded)
1343  */
1344 #define sysctl_csize	sysctl_un.scu_child.suc_csize
1345 #define sysctl_clen	sysctl_un.scu_child.suc_clen
1346 #define sysctl_child	sysctl_un.scu_child.suc_child
1347 #define sysctl_data	sysctl_un.scu_data.sud_data
1348 #define sysctl_offset	sysctl_un.scu_data.sud_offset
1349 #define sysctl_alias	sysctl_un.scu_alias
1350 #define sysctl_idata	sysctl_un.scu_idata
1351 #define sysctl_qdata	sysctl_un.scu_qdata
1352 #define sysctl_bdata	sysctl_un.scu_bdata
1353 
1354 /*
1355  * when requesting a description of a node (a set of nodes, actually),
1356  * you get back an "array" of these, where the actual length of the
1357  * descr_str is noted in descr_len (which includes the trailing nul
1358  * byte), rounded up to the nearest four (sizeof(int32_t) actually).
1359  *
1360  * NEXT_DESCR() will take a pointer to a description and advance it to
1361  * the next description.
1362  */
1363 struct sysctldesc {
1364 	int32_t		descr_num;	/* mib number of node */
1365 	uint32_t	descr_ver;	/* version of node */
1366 	uint32_t	descr_len;	/* length of description string */
1367 	char		descr_str[1];	/* not really 1...see above */
1368 };
1369 
1370 #define __sysc_desc_roundup(x) ((((x) - 1) | (sizeof(int32_t) - 1)) + 1)
1371 #define __sysc_desc_adv(d, l) \
1372 	(/*XXXUNCONST ptr cast*/(struct sysctldesc *) \
1373 	__UNCONST(((const char*)(d)) + offsetof(struct sysctldesc, descr_str) +\
1374 		__sysc_desc_roundup(l)))
1375 #define NEXT_DESCR(d) __sysc_desc_adv((d), (d)->descr_len)
1376 
1377 static __inline const struct sysctlnode *
1378 sysctl_rootof(const struct sysctlnode *n)
1379 {
1380 	while (n->sysctl_parent != NULL)
1381 		n = n->sysctl_parent;
1382 	return (n);
1383 }
1384 
1385 #endif	/* !_SYS_SYSCTL_H_ */
1386