sysctl.h revision 44078
1321936Shselasky/*
2321936Shselasky * Copyright (c) 1989, 1993
3321936Shselasky *	The Regents of the University of California.  All rights reserved.
4321936Shselasky *
5321936Shselasky * This code is derived from software contributed to Berkeley by
6321936Shselasky * Mike Karels at Berkeley Software Design, Inc.
7321936Shselasky *
8321936Shselasky * Redistribution and use in source and binary forms, with or without
9321936Shselasky * modification, are permitted provided that the following conditions
10321936Shselasky * are met:
11321936Shselasky * 1. Redistributions of source code must retain the above copyright
12321936Shselasky *    notice, this list of conditions and the following disclaimer.
13321936Shselasky * 2. Redistributions in binary form must reproduce the above copyright
14321936Shselasky *    notice, this list of conditions and the following disclaimer in the
15321936Shselasky *    documentation and/or other materials provided with the distribution.
16321936Shselasky * 3. All advertising materials mentioning features or use of this software
17321936Shselasky *    must display the following acknowledgement:
18321936Shselasky *	This product includes software developed by the University of
19321936Shselasky *	California, Berkeley and its contributors.
20321936Shselasky * 4. Neither the name of the University nor the names of its contributors
21321936Shselasky *    may be used to endorse or promote products derived from this software
22321936Shselasky *    without specific prior written permission.
23321936Shselasky *
24321936Shselasky * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25321936Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26321936Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27321936Shselasky * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28321936Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29321936Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30321936Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31321936Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32321936Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33321936Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34321936Shselasky * SUCH DAMAGE.
35321936Shselasky *
36321936Shselasky *	@(#)sysctl.h	8.1 (Berkeley) 6/2/93
37321936Shselasky * $Id: sysctl.h,v 1.70 1999/01/10 07:45:27 phk Exp $
38321936Shselasky */
39321936Shselasky
40321936Shselasky#ifndef _SYS_SYSCTL_H_
41321936Shselasky#define	_SYS_SYSCTL_H_
42321936Shselasky
43321936Shselasky#include <sys/_posix.h>
44321936Shselasky
45321936Shselasky/*
46321936Shselasky * Definitions for sysctl call.  The sysctl call uses a hierarchical name
47321936Shselasky * for objects that can be examined or modified.  The name is expressed as
48321936Shselasky * a sequence of integers.  Like a file path name, the meaning of each
49321936Shselasky * component depends on its place in the hierarchy.  The top-level and kern
50321936Shselasky * identifiers are defined here, and other identifiers are defined in the
51321936Shselasky * respective subsystem header files.
52321936Shselasky */
53321936Shselasky
54321936Shselasky#define CTL_MAXNAME	12	/* largest number of components supported */
55321936Shselasky
56321936Shselasky/*
57321936Shselasky * Each subsystem defined by sysctl defines a list of variables
58321936Shselasky * for that subsystem. Each name is either a node with further
59321936Shselasky * levels defined below it, or it is a leaf of some particular
60321936Shselasky * type given below. Each sysctl level defines a set of name/type
61321936Shselasky * pairs to be used by sysctl(1) in manipulating the subsystem.
62321936Shselasky */
63321936Shselaskystruct ctlname {
64321936Shselasky	char	*ctl_name;	/* subsystem name */
65321936Shselasky	int	ctl_type;	/* type of name */
66321936Shselasky};
67321936Shselasky
68321936Shselasky#define CTLTYPE		0xf	/* Mask for the type */
69321936Shselasky#define	CTLTYPE_NODE	1	/* name is a node */
70321936Shselasky#define	CTLTYPE_INT	2	/* name describes an integer */
71321936Shselasky#define	CTLTYPE_STRING	3	/* name describes a string */
72321936Shselasky#define	CTLTYPE_QUAD	4	/* name describes a 64-bit number */
73321936Shselasky#define	CTLTYPE_OPAQUE	5	/* name describes a structure */
74321936Shselasky#define	CTLTYPE_STRUCT	CTLTYPE_OPAQUE	/* name describes a structure */
75321936Shselasky
76321936Shselasky#define CTLFLAG_RD	0x80000000	/* Allow reads of variable */
77321936Shselasky#define CTLFLAG_WR	0x40000000	/* Allow writes to the variable */
78321936Shselasky#define CTLFLAG_RW	(CTLFLAG_RD|CTLFLAG_WR)
79321936Shselasky#define CTLFLAG_NOLOCK	0x20000000	/* XXX Don't Lock */
80321936Shselasky#define CTLFLAG_ANYBODY	0x10000000	/* All users can set this var */
81321936Shselasky#define CTLFLAG_SECURE	0x08000000	/* Permit set only if securelevel<=0 */
82321936Shselasky
83321936Shselasky/*
84321936Shselasky * USE THIS instead of a hardwired number from the categories below
85321936Shselasky * to get dynamically assigned sysctl entries using the linker-set
86321936Shselasky * technology. This is the way nearly all new sysctl variables should
87321936Shselasky * be implemented.
88321936Shselasky * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
89321936Shselasky */
90321936Shselasky#define OID_AUTO	(-1)
91321936Shselasky
92321936Shselasky#ifdef KERNEL
93321936Shselasky#define SYSCTL_HANDLER_ARGS (struct sysctl_oid *oidp, void *arg1, int arg2, \
94321936Shselasky	struct sysctl_req *req)
95321936Shselasky
96321936Shselasky/*
97321936Shselasky * This describes the access space for a sysctl request.  This is needed
98321936Shselasky * so that we can use the interface from the kernel or from user-space.
99321936Shselasky */
100321936Shselaskystruct sysctl_req {
101321936Shselasky	struct proc	*p;
102321936Shselasky	int		lock;
103321936Shselasky	void		*oldptr;
104321936Shselasky	size_t		oldlen;
105321936Shselasky	size_t		oldidx;
106321936Shselasky	int		(*oldfunc)(struct sysctl_req *, const void *, size_t);
107321936Shselasky	void		*newptr;
108321936Shselasky	size_t		newlen;
109321936Shselasky	size_t		newidx;
110321936Shselasky	int		(*newfunc)(struct sysctl_req *, void *, size_t);
111321936Shselasky};
112321936Shselasky
113321936ShselaskySLIST_HEAD(sysctl_oid_list, sysctl_oid);
114321936Shselasky
115321936Shselasky/*
116321936Shselasky * This describes one "oid" in the MIB tree.  Potentially more nodes can
117321936Shselasky * be hidden behind it, expanded by the handler.
118321936Shselasky */
119321936Shselaskystruct sysctl_oid {
120321936Shselasky	struct sysctl_oid_list *oid_parent;
121321936Shselasky	SLIST_ENTRY(sysctl_oid) oid_link;
122321936Shselasky	int		oid_number;
123321936Shselasky	int		oid_kind;
124321936Shselasky	void		*oid_arg1;
125321936Shselasky	int		oid_arg2;
126321936Shselasky	const char	*oid_name;
127321936Shselasky	int 		(*oid_handler) SYSCTL_HANDLER_ARGS;
128321936Shselasky	const char	*oid_fmt;
129321936Shselasky};
130321936Shselasky
131321936Shselasky#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
132321936Shselasky#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
133321936Shselasky
134321936Shselaskyint sysctl_handle_int SYSCTL_HANDLER_ARGS;
135321936Shselaskyint sysctl_handle_long SYSCTL_HANDLER_ARGS;
136321936Shselaskyint sysctl_handle_intptr SYSCTL_HANDLER_ARGS;
137321936Shselaskyint sysctl_handle_string SYSCTL_HANDLER_ARGS;
138321936Shselaskyint sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
139321936Shselasky
140321936Shselasky/*
141321936Shselasky * These functions are used to add/remove an oid from the mib.
142321936Shselasky */
143321936Shselaskyvoid sysctl_register_oid(struct sysctl_oid *oidp);
144321936Shselaskyvoid sysctl_unregister_oid(struct sysctl_oid *oidp);
145321936Shselasky
146321936Shselasky/* Declare an oid to allow child oids to be added to it. */
147321936Shselasky#define SYSCTL_DECL(name)					\
148321936Shselasky	extern struct sysctl_oid_list sysctl_##name##_children
149321936Shselasky
150321936Shselasky/* This constructs a "raw" MIB oid. */
151321936Shselasky#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
152321936Shselasky	static struct sysctl_oid sysctl__##parent##_##name = {		 \
153321936Shselasky		&sysctl_##parent##_children, { 0 },			 \
154321936Shselasky		nbr, kind, a1, a2, #name, handler, fmt };		 \
155321936Shselasky	DATA_SET(sysctl_set, sysctl__##parent##_##name);
156321936Shselasky
157321936Shselasky/* This constructs a node from which other oids can hang. */
158321936Shselasky#define SYSCTL_NODE(parent, nbr, name, access, handler, descr)		    \
159321936Shselasky	struct sysctl_oid_list sysctl_##parent##_##name##_children;	    \
160321936Shselasky	SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access,		    \
161321936Shselasky		   (void*)&sysctl_##parent##_##name##_children, 0, handler, \
162321936Shselasky		   "N", descr);
163321936Shselasky
164321936Shselasky/* Oid for a string.  len can be 0 to indicate '\0' termination. */
165321936Shselasky#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
166321936Shselasky	SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \
167321936Shselasky		arg, len, sysctl_handle_string, "A", descr)
168321936Shselasky
169321936Shselasky/* Oid for an int.  If ptr is NULL, val is returned. */
170321936Shselasky#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
171321936Shselasky	SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
172321936Shselasky		ptr, val, sysctl_handle_int, "I", descr)
173321936Shselasky
174321936Shselasky/* Oid for a long.  The pointer must be non NULL. */
175321936Shselasky#define SYSCTL_LONG(parent, nbr, name, access, ptr, descr) \
176321936Shselasky	SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
177321936Shselasky		ptr, 0, sysctl_handle_long, "L", descr)
178321936Shselasky
179321936Shselasky/* Oid for an opaque object.  Specified by a pointer and a length. */
180321936Shselasky#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
181321936Shselasky	SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
182321936Shselasky		ptr, len, sysctl_handle_opaque, fmt, descr)
183321936Shselasky
184321936Shselasky/* Oid for a struct.  Specified by a pointer and a type. */
185321936Shselasky#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
186321936Shselasky	SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
187321936Shselasky		ptr, sizeof(struct type), sysctl_handle_opaque, \
188321936Shselasky		"S," #type, descr)
189321936Shselasky
190321936Shselasky/* Oid for a procedure.  Specified by a pointer and an arg. */
191321936Shselasky#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
192321936Shselasky	SYSCTL_OID(parent, nbr, name, access, \
193321936Shselasky		ptr, arg, handler, fmt, descr)
194321936Shselasky#endif /* KERNEL */
195321936Shselasky
196321936Shselasky/*
197321936Shselasky * Top-level identifiers
198321936Shselasky */
199321936Shselasky#define	CTL_UNSPEC	0		/* unused */
200321936Shselasky#define	CTL_KERN	1		/* "high kernel": proc, limits */
201321936Shselasky#define	CTL_VM		2		/* virtual memory */
202321936Shselasky#define	CTL_VFS		3		/* file system, mount type is next */
203321936Shselasky#define	CTL_NET		4		/* network, see socket.h */
204321936Shselasky#define	CTL_DEBUG	5		/* debugging parameters */
205321936Shselasky#define	CTL_HW		6		/* generic cpu/io */
206321936Shselasky#define	CTL_MACHDEP	7		/* machine dependent */
207321936Shselasky#define	CTL_USER	8		/* user-level */
208321936Shselasky#define	CTL_P1003_1B	9		/* POSIX 1003.1B */
209321936Shselasky#define	CTL_MAXID	10		/* number of valid top-level ids */
210321936Shselasky
211321936Shselasky#define CTL_NAMES { \
212321936Shselasky	{ 0, 0 }, \
213321936Shselasky	{ "kern", CTLTYPE_NODE }, \
214321936Shselasky	{ "vm", CTLTYPE_NODE }, \
215321936Shselasky	{ "vfs", CTLTYPE_NODE }, \
216321936Shselasky	{ "net", CTLTYPE_NODE }, \
217321936Shselasky	{ "debug", CTLTYPE_NODE }, \
218321936Shselasky	{ "hw", CTLTYPE_NODE }, \
219321936Shselasky	{ "machdep", CTLTYPE_NODE }, \
220321936Shselasky	{ "user", CTLTYPE_NODE }, \
221321936Shselasky	{ "p1003_1b", CTLTYPE_NODE }, \
222321936Shselasky}
223321936Shselasky
224321936Shselasky/*
225321936Shselasky * CTL_KERN identifiers
226321936Shselasky */
227321936Shselasky#define	KERN_OSTYPE	 	 1	/* string: system version */
228321936Shselasky#define	KERN_OSRELEASE	 	 2	/* string: system release */
229321936Shselasky#define	KERN_OSREV	 	 3	/* int: system revision */
230321936Shselasky#define	KERN_VERSION	 	 4	/* string: compile time info */
231321936Shselasky#define	KERN_MAXVNODES	 	 5	/* int: max vnodes */
232321936Shselasky#define	KERN_MAXPROC	 	 6	/* int: max processes */
233321936Shselasky#define	KERN_MAXFILES	 	 7	/* int: max open files */
234321936Shselasky#define	KERN_ARGMAX	 	 8	/* int: max arguments to exec */
235321936Shselasky#define	KERN_SECURELVL	 	 9	/* int: system security level */
236321936Shselasky#define	KERN_HOSTNAME		10	/* string: hostname */
237321936Shselasky#define	KERN_HOSTID		11	/* int: host identifier */
238321936Shselasky#define	KERN_CLOCKRATE		12	/* struct: struct clockrate */
239321936Shselasky#define	KERN_VNODE		13	/* struct: vnode structures */
240321936Shselasky#define	KERN_PROC		14	/* struct: process entries */
241321936Shselasky#define	KERN_FILE		15	/* struct: file entries */
242321936Shselasky#define	KERN_PROF		16	/* node: kernel profiling info */
243321936Shselasky#define	KERN_POSIX1		17	/* int: POSIX.1 version */
244321936Shselasky#define	KERN_NGROUPS		18	/* int: # of supplemental group ids */
245321936Shselasky#define	KERN_JOB_CONTROL	19	/* int: is job control available */
246321936Shselasky#define	KERN_SAVED_IDS		20	/* int: saved set-user/group-ID */
247321936Shselasky#define	KERN_BOOTTIME		21	/* struct: time kernel was booted */
248321936Shselasky#define KERN_NISDOMAINNAME	22	/* string: YP domain name */
249321936Shselasky#define KERN_UPDATEINTERVAL	23	/* int: update process sleep time */
250321936Shselasky#define KERN_OSRELDATE		24	/* int: OS release date */
251321936Shselasky#define KERN_NTP_PLL		25	/* node: NTP PLL control */
252321936Shselasky#define	KERN_BOOTFILE		26	/* string: name of booted kernel */
253321936Shselasky#define	KERN_MAXFILESPERPROC	27	/* int: max open files per proc */
254321936Shselasky#define	KERN_MAXPROCPERUID 	28	/* int: max processes per uid */
255321936Shselasky#define KERN_DUMPDEV		29	/* dev_t: device to dump on */
256321936Shselasky#define	KERN_IPC		30	/* node: anything related to IPC */
257321936Shselasky#define	KERN_DUMMY		31	/* unused */
258321936Shselasky#define	KERN_PS_STRINGS		32	/* int: address of PS_STRINGS */
259321936Shselasky#define	KERN_USRSTACK		33	/* int: address of USRSTACK */
260321936Shselasky#define	KERN_LOGSIGEXIT		34	/* int: do we log sigexit procs? */
261321936Shselasky#define KERN_MAXID		35      /* number of valid kern ids */
262321936Shselasky
263321936Shselasky#define CTL_KERN_NAMES { \
264321936Shselasky	{ 0, 0 }, \
265321936Shselasky	{ "ostype", CTLTYPE_STRING }, \
266321936Shselasky	{ "osrelease", CTLTYPE_STRING }, \
267321936Shselasky	{ "osrevision", CTLTYPE_INT }, \
268321936Shselasky	{ "version", CTLTYPE_STRING }, \
269321936Shselasky	{ "maxvnodes", CTLTYPE_INT }, \
270321936Shselasky	{ "maxproc", CTLTYPE_INT }, \
271321936Shselasky	{ "maxfiles", CTLTYPE_INT }, \
272321936Shselasky	{ "argmax", CTLTYPE_INT }, \
273321936Shselasky	{ "securelevel", CTLTYPE_INT }, \
274321936Shselasky	{ "hostname", CTLTYPE_STRING }, \
275321936Shselasky	{ "hostid", CTLTYPE_INT }, \
276321936Shselasky	{ "clockrate", CTLTYPE_STRUCT }, \
277321936Shselasky	{ "vnode", CTLTYPE_STRUCT }, \
278321936Shselasky	{ "proc", CTLTYPE_STRUCT }, \
279321936Shselasky	{ "file", CTLTYPE_STRUCT }, \
280321936Shselasky	{ "profiling", CTLTYPE_NODE }, \
281321936Shselasky	{ "posix1version", CTLTYPE_INT }, \
282321936Shselasky	{ "ngroups", CTLTYPE_INT }, \
283321936Shselasky	{ "job_control", CTLTYPE_INT }, \
284321936Shselasky	{ "saved_ids", CTLTYPE_INT }, \
285321936Shselasky	{ "boottime", CTLTYPE_STRUCT }, \
286321936Shselasky	{ "nisdomainname", CTLTYPE_STRING }, \
287321936Shselasky	{ "update", CTLTYPE_INT }, \
288321936Shselasky	{ "osreldate", CTLTYPE_INT }, \
289321936Shselasky        { "ntp_pll", CTLTYPE_NODE }, \
290321936Shselasky	{ "bootfile", CTLTYPE_STRING }, \
291321936Shselasky	{ "maxfilesperproc", CTLTYPE_INT }, \
292321936Shselasky	{ "maxprocperuid", CTLTYPE_INT }, \
293321936Shselasky	{ "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
294321936Shselasky	{ "ipc", CTLTYPE_NODE }, \
295321936Shselasky	{ "dummy", CTLTYPE_INT }, \
296321936Shselasky	{ "ps_strings", CTLTYPE_INT }, \
297321936Shselasky	{ "usrstack", CTLTYPE_INT }, \
298321936Shselasky	{ "logsigexit", CTLTYPE_INT }, \
299321936Shselasky}
300321936Shselasky
301321936Shselasky/*
302321936Shselasky * CTL_VFS identifiers
303321936Shselasky */
304321936Shselasky#define CTL_VFS_NAMES { \
305321936Shselasky	{ "vfsconf", CTLTYPE_STRUCT }, \
306321936Shselasky}
307321936Shselasky
308321936Shselasky/*
309321936Shselasky * KERN_PROC subtypes
310321936Shselasky */
311321936Shselasky#define KERN_PROC_ALL		0	/* everything */
312321936Shselasky#define	KERN_PROC_PID		1	/* by process id */
313321936Shselasky#define	KERN_PROC_PGRP		2	/* by process group id */
314321936Shselasky#define	KERN_PROC_SESSION	3	/* by session of pid */
315321936Shselasky#define	KERN_PROC_TTY		4	/* by controlling tty */
316321936Shselasky#define	KERN_PROC_UID		5	/* by effective uid */
317321936Shselasky#define	KERN_PROC_RUID		6	/* by real uid */
318321936Shselasky
319321936Shselasky/*
320321936Shselasky * KERN_IPC identifiers
321321936Shselasky */
322321936Shselasky#define KIPC_MAXSOCKBUF		1	/* int: max size of a socket buffer */
323321936Shselasky#define	KIPC_SOCKBUF_WASTE	2	/* int: wastage factor in sockbuf */
324321936Shselasky#define	KIPC_SOMAXCONN		3	/* int: max length of connection q */
325321936Shselasky#define	KIPC_MAX_LINKHDR	4	/* int: max length of link header */
326321936Shselasky#define	KIPC_MAX_PROTOHDR	5	/* int: max length of network header */
327321936Shselasky#define	KIPC_MAX_HDR		6	/* int: max total length of headers */
328321936Shselasky#define	KIPC_MAX_DATALEN	7	/* int: max length of data? */
329321936Shselasky#define	KIPC_MBSTAT		8	/* struct: mbuf usage statistics */
330321936Shselasky#define	KIPC_NMBCLUSTERS	9	/* int: maximum mbuf clusters */
331321936Shselasky
332321936Shselasky/*
333321936Shselasky * CTL_HW identifiers
334321936Shselasky */
335321936Shselasky#define	HW_MACHINE	 1		/* string: machine class */
336321936Shselasky#define	HW_MODEL	 2		/* string: specific machine model */
337321936Shselasky#define	HW_NCPU		 3		/* int: number of cpus */
338321936Shselasky#define	HW_BYTEORDER	 4		/* int: machine byte order */
339321936Shselasky#define	HW_PHYSMEM	 5		/* int: total memory */
340321936Shselasky#define	HW_USERMEM	 6		/* int: non-kernel memory */
341321936Shselasky#define	HW_PAGESIZE	 7		/* int: software page size */
342321936Shselasky#define	HW_DISKNAMES	 8		/* strings: disk drive names */
343321936Shselasky#define	HW_DISKSTATS	 9		/* struct: diskstats[] */
344321936Shselasky#define HW_FLOATINGPT	10		/* int: has HW floating point? */
345321936Shselasky#define HW_MACHINE_ARCH	11		/* string: machine architecture */
346321936Shselasky#define	HW_MAXID	12		/* number of valid hw ids */
347321936Shselasky
348321936Shselasky#define CTL_HW_NAMES { \
349321936Shselasky	{ 0, 0 }, \
350321936Shselasky	{ "machine", CTLTYPE_STRING }, \
351321936Shselasky	{ "model", CTLTYPE_STRING }, \
352321936Shselasky	{ "ncpu", CTLTYPE_INT }, \
353321936Shselasky	{ "byteorder", CTLTYPE_INT }, \
354321936Shselasky	{ "physmem", CTLTYPE_INT }, \
355321936Shselasky	{ "usermem", CTLTYPE_INT }, \
356321936Shselasky	{ "pagesize", CTLTYPE_INT }, \
357321936Shselasky	{ "disknames", CTLTYPE_STRUCT }, \
358321936Shselasky	{ "diskstats", CTLTYPE_STRUCT }, \
359321936Shselasky	{ "floatingpoint", CTLTYPE_INT }, \
360321936Shselasky}
361321936Shselasky
362321936Shselasky/*
363321936Shselasky * CTL_USER definitions
364321936Shselasky */
365321936Shselasky#define	USER_CS_PATH		 1	/* string: _CS_PATH */
366321936Shselasky#define	USER_BC_BASE_MAX	 2	/* int: BC_BASE_MAX */
367321936Shselasky#define	USER_BC_DIM_MAX		 3	/* int: BC_DIM_MAX */
368321936Shselasky#define	USER_BC_SCALE_MAX	 4	/* int: BC_SCALE_MAX */
369321936Shselasky#define	USER_BC_STRING_MAX	 5	/* int: BC_STRING_MAX */
370321936Shselasky#define	USER_COLL_WEIGHTS_MAX	 6	/* int: COLL_WEIGHTS_MAX */
371321936Shselasky#define	USER_EXPR_NEST_MAX	 7	/* int: EXPR_NEST_MAX */
372321936Shselasky#define	USER_LINE_MAX		 8	/* int: LINE_MAX */
373321936Shselasky#define	USER_RE_DUP_MAX		 9	/* int: RE_DUP_MAX */
374321936Shselasky#define	USER_POSIX2_VERSION	10	/* int: POSIX2_VERSION */
375321936Shselasky#define	USER_POSIX2_C_BIND	11	/* int: POSIX2_C_BIND */
376321936Shselasky#define	USER_POSIX2_C_DEV	12	/* int: POSIX2_C_DEV */
377321936Shselasky#define	USER_POSIX2_CHAR_TERM	13	/* int: POSIX2_CHAR_TERM */
378321936Shselasky#define	USER_POSIX2_FORT_DEV	14	/* int: POSIX2_FORT_DEV */
379321936Shselasky#define	USER_POSIX2_FORT_RUN	15	/* int: POSIX2_FORT_RUN */
380321936Shselasky#define	USER_POSIX2_LOCALEDEF	16	/* int: POSIX2_LOCALEDEF */
381321936Shselasky#define	USER_POSIX2_SW_DEV	17	/* int: POSIX2_SW_DEV */
382321936Shselasky#define	USER_POSIX2_UPE		18	/* int: POSIX2_UPE */
383321936Shselasky#define	USER_STREAM_MAX		19	/* int: POSIX2_STREAM_MAX */
384321936Shselasky#define	USER_TZNAME_MAX		20	/* int: POSIX2_TZNAME_MAX */
385321936Shselasky#define	USER_MAXID		21	/* number of valid user ids */
386321936Shselasky
387321936Shselasky#define	CTL_USER_NAMES { \
388321936Shselasky	{ 0, 0 }, \
389321936Shselasky	{ "cs_path", CTLTYPE_STRING }, \
390321936Shselasky	{ "bc_base_max", CTLTYPE_INT }, \
391321936Shselasky	{ "bc_dim_max", CTLTYPE_INT }, \
392321936Shselasky	{ "bc_scale_max", CTLTYPE_INT }, \
393321936Shselasky	{ "bc_string_max", CTLTYPE_INT }, \
394321936Shselasky	{ "coll_weights_max", CTLTYPE_INT }, \
395321936Shselasky	{ "expr_nest_max", CTLTYPE_INT }, \
396321936Shselasky	{ "line_max", CTLTYPE_INT }, \
397321936Shselasky	{ "re_dup_max", CTLTYPE_INT }, \
398321936Shselasky	{ "posix2_version", CTLTYPE_INT }, \
399321936Shselasky	{ "posix2_c_bind", CTLTYPE_INT }, \
400321936Shselasky	{ "posix2_c_dev", CTLTYPE_INT }, \
401321936Shselasky	{ "posix2_char_term", CTLTYPE_INT }, \
402321936Shselasky	{ "posix2_fort_dev", CTLTYPE_INT }, \
403321936Shselasky	{ "posix2_fort_run", CTLTYPE_INT }, \
404321936Shselasky	{ "posix2_localedef", CTLTYPE_INT }, \
405321936Shselasky	{ "posix2_sw_dev", CTLTYPE_INT }, \
406321936Shselasky	{ "posix2_upe", CTLTYPE_INT }, \
407321936Shselasky	{ "stream_max", CTLTYPE_INT }, \
408321936Shselasky	{ "tzname_max", CTLTYPE_INT }, \
409321936Shselasky}
410321936Shselasky
411321936Shselasky#define CTL_P1003_1B_ASYNCHRONOUS_IO		1	/* boolean */
412321936Shselasky#define CTL_P1003_1B_MAPPED_FILES		2	/* boolean */
413321936Shselasky#define CTL_P1003_1B_MEMLOCK			3	/* boolean */
414321936Shselasky#define CTL_P1003_1B_MEMLOCK_RANGE		4	/* boolean */
415321936Shselasky#define CTL_P1003_1B_MEMORY_PROTECTION		5	/* boolean */
416321936Shselasky#define CTL_P1003_1B_MESSAGE_PASSING		6	/* boolean */
417321936Shselasky#define CTL_P1003_1B_PRIORITIZED_IO		7	/* boolean */
418321936Shselasky#define CTL_P1003_1B_PRIORITY_SCHEDULING	8	/* boolean */
419321936Shselasky#define CTL_P1003_1B_REALTIME_SIGNALS		9	/* boolean */
420321936Shselasky#define CTL_P1003_1B_SEMAPHORES			10	/* boolean */
421321936Shselasky#define CTL_P1003_1B_FSYNC			11	/* boolean */
422321936Shselasky#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS	12	/* boolean */
423321936Shselasky#define CTL_P1003_1B_SYNCHRONIZED_IO		13	/* boolean */
424321936Shselasky#define CTL_P1003_1B_TIMERS			14	/* boolean */
425321936Shselasky#define CTL_P1003_1B_AIO_LISTIO_MAX		15	/* int */
426321936Shselasky#define CTL_P1003_1B_AIO_MAX			16	/* int */
427321936Shselasky#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX		17	/* int */
428321936Shselasky#define CTL_P1003_1B_DELAYTIMER_MAX		18	/* int */
429321936Shselasky#define CTL_P1003_1B_MQ_OPEN_MAX		19	/* int */
430321936Shselasky#define CTL_P1003_1B_PAGESIZE			20	/* int */
431321936Shselasky#define CTL_P1003_1B_RTSIG_MAX			21	/* int */
432321936Shselasky#define CTL_P1003_1B_SEM_NSEMS_MAX		22	/* int */
433321936Shselasky#define CTL_P1003_1B_SEM_VALUE_MAX		23	/* int */
434321936Shselasky#define CTL_P1003_1B_SIGQUEUE_MAX		24	/* int */
435321936Shselasky#define CTL_P1003_1B_TIMER_MAX			25	/* int */
436321936Shselasky
437321936Shselasky#define CTL_P1003_1B_MAXID		26
438321936Shselasky
439321936Shselasky#define	CTL_P1003_1B_NAMES { \
440321936Shselasky	{ 0, 0 }, \
441321936Shselasky	{ "asynchronous_io", CTLTYPE_INT }, \
442321936Shselasky	{ "mapped_files", CTLTYPE_INT }, \
443321936Shselasky	{ "memlock", CTLTYPE_INT }, \
444321936Shselasky	{ "memlock_range", CTLTYPE_INT }, \
445321936Shselasky	{ "memory_protection", CTLTYPE_INT }, \
446321936Shselasky	{ "message_passing", CTLTYPE_INT }, \
447321936Shselasky	{ "prioritized_io", CTLTYPE_INT }, \
448321936Shselasky	{ "priority_scheduling", CTLTYPE_INT }, \
449321936Shselasky	{ "realtime_signals", CTLTYPE_INT }, \
450321936Shselasky	{ "semaphores", CTLTYPE_INT }, \
451321936Shselasky	{ "fsync", CTLTYPE_INT }, \
452321936Shselasky	{ "shared_memory_objects", CTLTYPE_INT }, \
453321936Shselasky	{ "synchronized_io", CTLTYPE_INT }, \
454321936Shselasky	{ "timers", CTLTYPE_INT }, \
455321936Shselasky	{ "aio_listio_max", CTLTYPE_INT }, \
456321936Shselasky	{ "aio_max", CTLTYPE_INT }, \
457321936Shselasky	{ "aio_prio_delta_max", CTLTYPE_INT }, \
458321936Shselasky	{ "delaytimer_max", CTLTYPE_INT }, \
459321936Shselasky	{ "mq_open_max", CTLTYPE_INT }, \
460321936Shselasky	{ "pagesize", CTLTYPE_INT }, \
461321936Shselasky	{ "rtsig_max", CTLTYPE_INT }, \
462321936Shselasky	{ "nsems_max", CTLTYPE_INT }, \
463321936Shselasky	{ "sem_value_max", CTLTYPE_INT }, \
464321936Shselasky	{ "sigqueue_max", CTLTYPE_INT }, \
465321936Shselasky	{ "timer_max", CTLTYPE_INT }, \
466321936Shselasky}
467321936Shselasky
468321936Shselasky#ifdef KERNEL
469321936Shselasky
470321936Shselasky/*
471321936Shselasky * Declare some common oids.
472321936Shselasky */
473321936Shselaskyextern struct sysctl_oid_list sysctl__children;
474321936ShselaskySYSCTL_DECL(_kern);
475321936ShselaskySYSCTL_DECL(_sysctl);
476321936ShselaskySYSCTL_DECL(_vm);
477321936ShselaskySYSCTL_DECL(_vfs);
478321936ShselaskySYSCTL_DECL(_net);
479321936ShselaskySYSCTL_DECL(_debug);
480321936ShselaskySYSCTL_DECL(_hw);
481321936ShselaskySYSCTL_DECL(_machdep);
482321936ShselaskySYSCTL_DECL(_user);
483321936Shselasky
484321936Shselaskyextern char	machine[];
485321936Shselaskyextern char	osrelease[];
486321936Shselaskyextern char	ostype[];
487321936Shselasky
488321936Shselaskyvoid	sysctl_register_set(struct linker_set *lsp);
489321936Shselaskyvoid	sysctl_unregister_set(struct linker_set *lsp);
490321936Shselaskyint	kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old,
491321936Shselasky		      size_t *oldlenp, void *new, size_t newlen,
492321936Shselasky		      size_t *retval);
493321936Shselaskyint	userland_sysctl(struct proc *p, int *name, u_int namelen, void *old,
494321936Shselasky			size_t *oldlenp, int inkernel, void *new, size_t newlen,
495321936Shselasky			size_t *retval);
496321936Shselasky
497321936Shselasky#else	/* !KERNEL */
498321936Shselasky#include <sys/cdefs.h>
499321936Shselasky
500321936Shselasky__BEGIN_DECLS
501321936Shselaskyint	sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
502321936Shselaskyint	sysctlbyname __P((const char *, void *, size_t *, void *, size_t));
503321936Shselasky__END_DECLS
504321936Shselasky#endif	/* KERNEL */
505321936Shselasky
506321936Shselasky#endif	/* !_SYS_SYSCTL_H_ */
507321936Shselasky