os/ossrv/genericopenlibs/openenvcore/include/sys/sysctl.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*-
sl@0
     2
 * Copyright (c) 1989, 1993
sl@0
     3
 *	The Regents of the University of California.  All rights reserved.
sl@0
     4
 *
sl@0
     5
 * This code is derived from software contributed to Berkeley by
sl@0
     6
 * Mike Karels at Berkeley Software Design, Inc.
sl@0
     7
 *
sl@0
     8
 * Redistribution and use in source and binary forms, with or without
sl@0
     9
 * modification, are permitted provided that the following conditions
sl@0
    10
 * are met:
sl@0
    11
 * 1. Redistributions of source code must retain the above copyright
sl@0
    12
 *    notice, this list of conditions and the following disclaimer.
sl@0
    13
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    14
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    15
 *    documentation and/or other materials provided with the distribution.
sl@0
    16
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    17
 *    may be used to endorse or promote products derived from this software
sl@0
    18
 *    without specific prior written permission.
sl@0
    19
 *
sl@0
    20
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    21
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    22
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    23
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    24
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    25
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    26
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    27
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    28
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    29
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    30
 * SUCH DAMAGE.
sl@0
    31
 * © * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0
    32
 *	@(#)sysctl.h	8.1 (Berkeley) 6/2/93
sl@0
    33
 * $FreeBSD: src/sys/sys/sysctl.h,v 1.138 2005/04/18 02:10:37 das Exp $
sl@0
    34
 */
sl@0
    35
sl@0
    36
#ifndef _SYS_SYSCTL_H_
sl@0
    37
#define	_SYS_SYSCTL_H_
sl@0
    38
sl@0
    39
#include <sys/queue.h>
sl@0
    40
sl@0
    41
struct thread;
sl@0
    42
/*
sl@0
    43
 * Definitions for sysctl call.  The sysctl call uses a hierarchical name
sl@0
    44
 * for objects that can be examined or modified.  The name is expressed as
sl@0
    45
 * a sequence of integers.  Like a file path name, the meaning of each
sl@0
    46
 * component depends on its place in the hierarchy.  The top-level and kern
sl@0
    47
 * identifiers are defined here, and other identifiers are defined in the
sl@0
    48
 * respective subsystem header files.
sl@0
    49
 */
sl@0
    50
sl@0
    51
#define CTL_MAXNAME	24	/* largest number of components supported */
sl@0
    52
sl@0
    53
/*
sl@0
    54
 * Each subsystem defined by sysctl defines a list of variables
sl@0
    55
 * for that subsystem. Each name is either a node with further
sl@0
    56
 * levels defined below it, or it is a leaf of some particular
sl@0
    57
 * type given below. Each sysctl level defines a set of name/type
sl@0
    58
 * pairs to be used by sysctl(8) in manipulating the subsystem.
sl@0
    59
 */
sl@0
    60
struct ctlname {
sl@0
    61
	char	*ctl_name;	/* subsystem name */
sl@0
    62
	int	ctl_type;	/* type of name */
sl@0
    63
};
sl@0
    64
sl@0
    65
#define CTLTYPE		0xf	/* Mask for the type */
sl@0
    66
#define	CTLTYPE_NODE	1	/* name is a node */
sl@0
    67
#define	CTLTYPE_INT	2	/* name describes an integer */
sl@0
    68
#define	CTLTYPE_STRING	3	/* name describes a string */
sl@0
    69
#define	CTLTYPE_QUAD	4	/* name describes a 64-bit number */
sl@0
    70
#define	CTLTYPE_OPAQUE	5	/* name describes a structure */
sl@0
    71
#define	CTLTYPE_STRUCT	CTLTYPE_OPAQUE	/* name describes a structure */
sl@0
    72
#define	CTLTYPE_UINT	6	/* name describes an unsigned integer */
sl@0
    73
#define	CTLTYPE_LONG	7	/* name describes a long */
sl@0
    74
#define	CTLTYPE_ULONG	8	/* name describes an unsigned long */
sl@0
    75
sl@0
    76
#define CTLFLAG_RD	0x80000000	/* Allow reads of variable */
sl@0
    77
#define CTLFLAG_WR	0x40000000	/* Allow writes to the variable */
sl@0
    78
#define CTLFLAG_RW	(CTLFLAG_RD|CTLFLAG_WR)
sl@0
    79
#define CTLFLAG_NOLOCK	0x20000000	/* XXX Don't Lock */
sl@0
    80
#define CTLFLAG_ANYBODY	0x10000000	/* All users can set this var */
sl@0
    81
#define CTLFLAG_SECURE	0x08000000	/* Permit set only if securelevel<=0 */
sl@0
    82
#define CTLFLAG_PRISON	0x04000000	/* Prisoned roots can fiddle */
sl@0
    83
#define CTLFLAG_DYN	0x02000000	/* Dynamic oid - can be freed */
sl@0
    84
#define CTLFLAG_SKIP	0x01000000	/* Skip this sysctl when listing */
sl@0
    85
#define CTLMASK_SECURE	0x00F00000	/* Secure level */
sl@0
    86
#define CTLFLAG_TUN	0x00080000	/* Tunable variable */
sl@0
    87
#define CTLFLAG_RDTUN	(CTLFLAG_RD|CTLFLAG_TUN)
sl@0
    88
sl@0
    89
/*
sl@0
    90
 * Secure level.   Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.  
sl@0
    91
 *
sl@0
    92
 * Secure when the securelevel is raised to at least N.
sl@0
    93
 */
sl@0
    94
#define CTLSHIFT_SECURE	20
sl@0
    95
#define CTLFLAG_SECURE1	(CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))
sl@0
    96
#define CTLFLAG_SECURE2	(CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))
sl@0
    97
#define CTLFLAG_SECURE3	(CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))
sl@0
    98
sl@0
    99
/*
sl@0
   100
 * USE THIS instead of a hardwired number from the categories below
sl@0
   101
 * to get dynamically assigned sysctl entries using the linker-set
sl@0
   102
 * technology. This is the way nearly all new sysctl variables should
sl@0
   103
 * be implemented.
sl@0
   104
 * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
sl@0
   105
 */ 
sl@0
   106
#define OID_AUTO	(-1)
sl@0
   107
sl@0
   108
/*
sl@0
   109
 * The starting number for dynamically-assigned entries.  WARNING!
sl@0
   110
 * ALL static sysctl entries should have numbers LESS than this!
sl@0
   111
 */
sl@0
   112
#define CTL_AUTO_START	0x100
sl@0
   113
sl@0
   114
#ifdef _KERNEL
sl@0
   115
#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
sl@0
   116
	struct sysctl_req *req
sl@0
   117
sl@0
   118
/* definitions for sysctl_req 'lock' member */
sl@0
   119
#define REQ_UNLOCKED	0	/* not locked and not wired */
sl@0
   120
#define REQ_LOCKED	1	/* locked and not wired */
sl@0
   121
#define REQ_WIRED	2	/* locked and wired */
sl@0
   122
sl@0
   123
/* definitions for sysctl_req 'flags' member */
sl@0
   124
#if defined(__amd64__) || defined(__ia64__)
sl@0
   125
#define	SCTL_MASK32	1	/* 32 bit emulation */
sl@0
   126
#endif
sl@0
   127
sl@0
   128
/*
sl@0
   129
 * This describes the access space for a sysctl request.  This is needed
sl@0
   130
 * so that we can use the interface from the kernel or from user-space.
sl@0
   131
 */
sl@0
   132
struct sysctl_req {
sl@0
   133
	struct thread	*td;		/* used for access checking */
sl@0
   134
	int		lock;		/* locking/wiring state */
sl@0
   135
	void		*oldptr;
sl@0
   136
	size_t		oldlen;
sl@0
   137
	size_t		oldidx;
sl@0
   138
	int		(*oldfunc)(struct sysctl_req *, const void *, size_t);
sl@0
   139
	void		*newptr;
sl@0
   140
	size_t		newlen;
sl@0
   141
	size_t		newidx;
sl@0
   142
	int		(*newfunc)(struct sysctl_req *, void *, size_t);
sl@0
   143
	size_t		validlen;
sl@0
   144
	int		flags;
sl@0
   145
};
sl@0
   146
sl@0
   147
/*
sl@0
   148
 * This describes one "oid" in the MIB tree.  Potentially more nodes can
sl@0
   149
 * be hidden behind it, expanded by the handler.
sl@0
   150
 */
sl@0
   151
struct sysctl_oid {
sl@0
   152
	struct sysctl_oid_list *oid_parent;
sl@0
   153
	SLIST_ENTRY(sysctl_oid) oid_link;
sl@0
   154
	int		oid_number;
sl@0
   155
	u_int		oid_kind;
sl@0
   156
	void		*oid_arg1;
sl@0
   157
	int		oid_arg2;
sl@0
   158
	const char	*oid_name;
sl@0
   159
	int 		(*oid_handler)(SYSCTL_HANDLER_ARGS);
sl@0
   160
	const char	*oid_fmt;
sl@0
   161
	int		oid_refcnt;
sl@0
   162
	const char	*oid_descr;
sl@0
   163
};
sl@0
   164
sl@0
   165
#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
sl@0
   166
#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
sl@0
   167
sl@0
   168
/* Declare a static oid to allow child oids to be added to it. */
sl@0
   169
#define SYSCTL_DECL(name)					\
sl@0
   170
	extern struct sysctl_oid_list sysctl_##name##_children
sl@0
   171
sl@0
   172
/* Hide these in macros */
sl@0
   173
#define	SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \
sl@0
   174
	(oid_ptr)->oid_arg1
sl@0
   175
#define	SYSCTL_CHILDREN_SET(oid_ptr, val) \
sl@0
   176
	(oid_ptr)->oid_arg1 = (val);
sl@0
   177
#define	SYSCTL_STATIC_CHILDREN(oid_name) \
sl@0
   178
	(&sysctl_##oid_name##_children)
sl@0
   179
sl@0
   180
/* === Structs and macros related to context handling === */
sl@0
   181
sl@0
   182
/* All dynamically created sysctls can be tracked in a context list. */
sl@0
   183
struct sysctl_ctx_entry {
sl@0
   184
	struct sysctl_oid *entry;
sl@0
   185
	TAILQ_ENTRY(sysctl_ctx_entry) link;
sl@0
   186
};
sl@0
   187
sl@0
   188
#define SYSCTL_NODE_CHILDREN(parent, name) \
sl@0
   189
	sysctl_##parent##_##name##_children
sl@0
   190
sl@0
   191
/* This constructs a "raw" MIB oid. */
sl@0
   192
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
sl@0
   193
	static struct sysctl_oid sysctl__##parent##_##name = {		 \
sl@0
   194
		&sysctl_##parent##_children, { 0 },			 \
sl@0
   195
		nbr, kind, a1, a2, #name, handler, fmt, 0, descr };	 \
sl@0
   196
	DATA_SET(sysctl_set, sysctl__##parent##_##name)
sl@0
   197
sl@0
   198
#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
sl@0
   199
	sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr)
sl@0
   200
sl@0
   201
/* This constructs a node from which other oids can hang. */
sl@0
   202
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr)		    \
sl@0
   203
	struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name);	    \
sl@0
   204
	SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access),		    \
sl@0
   205
		   (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, \
sl@0
   206
		   "N", descr)
sl@0
   207
sl@0
   208
#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr)	    \
sl@0
   209
	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access),	    \
sl@0
   210
	0, 0, handler, "N", descr)
sl@0
   211
sl@0
   212
/* Oid for a string.  len can be 0 to indicate '\0' termination. */
sl@0
   213
#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
sl@0
   214
	SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \
sl@0
   215
		arg, len, sysctl_handle_string, "A", descr)
sl@0
   216
sl@0
   217
#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr)  \
sl@0
   218
	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access),	    \
sl@0
   219
	arg, len, sysctl_handle_string, "A", descr)
sl@0
   220
sl@0
   221
/* Oid for an int.  If ptr is NULL, val is returned. */
sl@0
   222
#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
sl@0
   223
	SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|(access), \
sl@0
   224
		ptr, val, sysctl_handle_int, "I", descr)
sl@0
   225
sl@0
   226
#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr)	    \
sl@0
   227
	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_INT|(access),	    \
sl@0
   228
	ptr, val, sysctl_handle_int, "I", descr)
sl@0
   229
sl@0
   230
/* Oid for an unsigned int.  If ptr is NULL, val is returned. */
sl@0
   231
#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \
sl@0
   232
	SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|(access), \
sl@0
   233
		ptr, val, sysctl_handle_int, "IU", descr)
sl@0
   234
sl@0
   235
#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr)    \
sl@0
   236
	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|(access),	    \
sl@0
   237
	ptr, val, sysctl_handle_int, "IU", descr)
sl@0
   238
sl@0
   239
/* Oid for a long.  The pointer must be non NULL. */
sl@0
   240
#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \
sl@0
   241
	SYSCTL_OID(parent, nbr, name, CTLTYPE_LONG|(access), \
sl@0
   242
		ptr, val, sysctl_handle_long, "L", descr)
sl@0
   243
sl@0
   244
#define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr)	    \
sl@0
   245
	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|(access),	    \
sl@0
   246
	ptr, 0, sysctl_handle_long, "L", descr)
sl@0
   247
sl@0
   248
/* Oid for an unsigned long.  The pointer must be non NULL. */
sl@0
   249
#define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \
sl@0
   250
	SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|(access), \
sl@0
   251
		ptr, val, sysctl_handle_long, "LU", descr)
sl@0
   252
sl@0
   253
#define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr)	    \
sl@0
   254
	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|(access),	    \
sl@0
   255
	ptr, 0, sysctl_handle_long, "LU", descr)
sl@0
   256
sl@0
   257
/* Oid for an opaque object.  Specified by a pointer and a length. */
sl@0
   258
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
sl@0
   259
	SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
sl@0
   260
		ptr, len, sysctl_handle_opaque, fmt, descr)
sl@0
   261
sl@0
   262
#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\
sl@0
   263
	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),	    \
sl@0
   264
	ptr, len, sysctl_handle_opaque, fmt, descr)
sl@0
   265
sl@0
   266
/* Oid for a struct.  Specified by a pointer and a type. */
sl@0
   267
#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
sl@0
   268
	SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
sl@0
   269
		ptr, sizeof(struct type), sysctl_handle_opaque, \
sl@0
   270
		"S," #type, descr)
sl@0
   271
sl@0
   272
#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
sl@0
   273
	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),	    \
sl@0
   274
	ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, descr)
sl@0
   275
sl@0
   276
/* Oid for a procedure.  Specified by a pointer and an arg. */
sl@0
   277
#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
sl@0
   278
	SYSCTL_OID(parent, nbr, name, (access), \
sl@0
   279
		ptr, arg, handler, fmt, descr)
sl@0
   280
sl@0
   281
#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
sl@0
   282
	sysctl_add_oid(ctx, parent, nbr, name, (access),			    \
sl@0
   283
	ptr, arg, handler, fmt, descr)
sl@0
   284
sl@0
   285
#endif /* _KERNEL */
sl@0
   286
sl@0
   287
/*
sl@0
   288
 * Top-level identifiers
sl@0
   289
 */
sl@0
   290
#define	CTL_UNSPEC	0		/* unused */
sl@0
   291
#define	CTL_KERN	1		/* "high kernel": proc, limits */
sl@0
   292
#define	CTL_VM		2		/* virtual memory */
sl@0
   293
#define	CTL_VFS		3		/* filesystem, mount type is next */
sl@0
   294
#define	CTL_NET		4		/* network, see socket.h */
sl@0
   295
#define	CTL_DEBUG	5		/* debugging parameters */
sl@0
   296
#define	CTL_HW		6		/* generic cpu/io */
sl@0
   297
#define	CTL_MACHDEP	7		/* machine dependent */
sl@0
   298
#define	CTL_USER	8		/* user-level */
sl@0
   299
#define	CTL_P1003_1B	9		/* POSIX 1003.1B */
sl@0
   300
#define	CTL_MAXID	10		/* number of valid top-level ids */
sl@0
   301
sl@0
   302
#define CTL_NAMES { \
sl@0
   303
	{ 0, 0 }, \
sl@0
   304
	{ "kern", CTLTYPE_NODE }, \
sl@0
   305
	{ "vm", CTLTYPE_NODE }, \
sl@0
   306
	{ "vfs", CTLTYPE_NODE }, \
sl@0
   307
	{ "net", CTLTYPE_NODE }, \
sl@0
   308
	{ "debug", CTLTYPE_NODE }, \
sl@0
   309
	{ "hw", CTLTYPE_NODE }, \
sl@0
   310
	{ "machdep", CTLTYPE_NODE }, \
sl@0
   311
	{ "user", CTLTYPE_NODE }, \
sl@0
   312
	{ "p1003_1b", CTLTYPE_NODE }, \
sl@0
   313
}
sl@0
   314
sl@0
   315
/*
sl@0
   316
 * CTL_KERN identifiers
sl@0
   317
 */
sl@0
   318
#define	KERN_OSTYPE	 	 1	/* string: system version */
sl@0
   319
#define	KERN_OSRELEASE	 	 2	/* string: system release */
sl@0
   320
#define	KERN_OSREV	 	 3	/* int: system revision */
sl@0
   321
#define	KERN_VERSION	 	 4	/* string: compile time info */
sl@0
   322
#define	KERN_MAXVNODES	 	 5	/* int: max vnodes */
sl@0
   323
#define	KERN_MAXPROC	 	 6	/* int: max processes */
sl@0
   324
#define	KERN_MAXFILES	 	 7	/* int: max open files */
sl@0
   325
#define	KERN_ARGMAX	 	 8	/* int: max arguments to exec */
sl@0
   326
#define	KERN_SECURELVL	 	 9	/* int: system security level */
sl@0
   327
#define	KERN_HOSTNAME		10	/* string: hostname */
sl@0
   328
#define	KERN_HOSTID		11	/* int: host identifier */
sl@0
   329
#define	KERN_CLOCKRATE		12	/* struct: struct clockrate */
sl@0
   330
#define	KERN_VNODE		13	/* struct: vnode structures */
sl@0
   331
#define	KERN_PROC		14	/* struct: process entries */
sl@0
   332
#define	KERN_FILE		15	/* struct: file entries */
sl@0
   333
#define	KERN_PROF		16	/* node: kernel profiling info */
sl@0
   334
#define	KERN_POSIX1		17	/* int: POSIX.1 version */
sl@0
   335
#define	KERN_NGROUPS		18	/* int: # of supplemental group ids */
sl@0
   336
#define	KERN_JOB_CONTROL	19	/* int: is job control available */
sl@0
   337
#define	KERN_SAVED_IDS		20	/* int: saved set-user/group-ID */
sl@0
   338
#define	KERN_BOOTTIME		21	/* struct: time kernel was booted */
sl@0
   339
#define KERN_NISDOMAINNAME	22	/* string: YP domain name */
sl@0
   340
#define KERN_UPDATEINTERVAL	23	/* int: update process sleep time */
sl@0
   341
#define KERN_OSRELDATE		24	/* int: kernel release date */
sl@0
   342
#define KERN_NTP_PLL		25	/* node: NTP PLL control */
sl@0
   343
#define	KERN_BOOTFILE		26	/* string: name of booted kernel */
sl@0
   344
#define	KERN_MAXFILESPERPROC	27	/* int: max open files per proc */
sl@0
   345
#define	KERN_MAXPROCPERUID 	28	/* int: max processes per uid */
sl@0
   346
#define KERN_DUMPDEV		29	/* struct cdev *: device to dump on */
sl@0
   347
#define	KERN_IPC		30	/* node: anything related to IPC */
sl@0
   348
#define	KERN_DUMMY		31	/* unused */
sl@0
   349
#define	KERN_PS_STRINGS		32	/* int: address of PS_STRINGS */
sl@0
   350
#define	KERN_USRSTACK		33	/* int: address of USRSTACK */
sl@0
   351
#define	KERN_LOGSIGEXIT		34	/* int: do we log sigexit procs? */
sl@0
   352
#define	KERN_IOV_MAX		35	/* int: value of UIO_MAXIOV */
sl@0
   353
#define KERN_MAXID		36	/* number of valid kern ids */
sl@0
   354
sl@0
   355
#define CTL_KERN_NAMES { \
sl@0
   356
	{ 0, 0 }, \
sl@0
   357
	{ "ostype", CTLTYPE_STRING }, \
sl@0
   358
	{ "osrelease", CTLTYPE_STRING }, \
sl@0
   359
	{ "osrevision", CTLTYPE_INT }, \
sl@0
   360
	{ "version", CTLTYPE_STRING }, \
sl@0
   361
	{ "maxvnodes", CTLTYPE_INT }, \
sl@0
   362
	{ "maxproc", CTLTYPE_INT }, \
sl@0
   363
	{ "maxfiles", CTLTYPE_INT }, \
sl@0
   364
	{ "argmax", CTLTYPE_INT }, \
sl@0
   365
	{ "securelevel", CTLTYPE_INT }, \
sl@0
   366
	{ "hostname", CTLTYPE_STRING }, \
sl@0
   367
	{ "hostid", CTLTYPE_UINT }, \
sl@0
   368
	{ "clockrate", CTLTYPE_STRUCT }, \
sl@0
   369
	{ "vnode", CTLTYPE_STRUCT }, \
sl@0
   370
	{ "proc", CTLTYPE_STRUCT }, \
sl@0
   371
	{ "file", CTLTYPE_STRUCT }, \
sl@0
   372
	{ "profiling", CTLTYPE_NODE }, \
sl@0
   373
	{ "posix1version", CTLTYPE_INT }, \
sl@0
   374
	{ "ngroups", CTLTYPE_INT }, \
sl@0
   375
	{ "job_control", CTLTYPE_INT }, \
sl@0
   376
	{ "saved_ids", CTLTYPE_INT }, \
sl@0
   377
	{ "boottime", CTLTYPE_STRUCT }, \
sl@0
   378
	{ "nisdomainname", CTLTYPE_STRING }, \
sl@0
   379
	{ "update", CTLTYPE_INT }, \
sl@0
   380
	{ "osreldate", CTLTYPE_INT }, \
sl@0
   381
	{ "ntp_pll", CTLTYPE_NODE }, \
sl@0
   382
	{ "bootfile", CTLTYPE_STRING }, \
sl@0
   383
	{ "maxfilesperproc", CTLTYPE_INT }, \
sl@0
   384
	{ "maxprocperuid", CTLTYPE_INT }, \
sl@0
   385
	{ "ipc", CTLTYPE_NODE }, \
sl@0
   386
	{ "dummy", CTLTYPE_INT }, \
sl@0
   387
	{ "ps_strings", CTLTYPE_INT }, \
sl@0
   388
	{ "usrstack", CTLTYPE_INT }, \
sl@0
   389
	{ "logsigexit", CTLTYPE_INT }, \
sl@0
   390
	{ "iov_max", CTLTYPE_INT }, \
sl@0
   391
}
sl@0
   392
sl@0
   393
/*
sl@0
   394
 * CTL_VFS identifiers
sl@0
   395
 */
sl@0
   396
#define CTL_VFS_NAMES { \
sl@0
   397
	{ "vfsconf", CTLTYPE_STRUCT }, \
sl@0
   398
}
sl@0
   399
sl@0
   400
/*
sl@0
   401
 * KERN_PROC subtypes
sl@0
   402
 */
sl@0
   403
#define KERN_PROC_ALL		0	/* everything */
sl@0
   404
#define	KERN_PROC_PID		1	/* by process id */
sl@0
   405
#define	KERN_PROC_PGRP		2	/* by process group id */
sl@0
   406
#define	KERN_PROC_SESSION	3	/* by session of pid */
sl@0
   407
#define	KERN_PROC_TTY		4	/* by controlling tty */
sl@0
   408
#define	KERN_PROC_UID		5	/* by effective uid */
sl@0
   409
#define	KERN_PROC_RUID		6	/* by real uid */
sl@0
   410
#define	KERN_PROC_ARGS		7	/* get/set arguments/proctitle */
sl@0
   411
#define	KERN_PROC_PROC		8	/* only return procs */
sl@0
   412
#define	KERN_PROC_SV_NAME	9	/* get syscall vector name */
sl@0
   413
#define	KERN_PROC_RGID		10	/* by real group id */
sl@0
   414
#define	KERN_PROC_GID		11	/* by effective group id */
sl@0
   415
#define	KERN_PROC_PATHNAME	12	/* path to executable */
sl@0
   416
#define	KERN_PROC_INC_THREAD	0x10	/*
sl@0
   417
					 * modifier for pid, pgrp, tty,
sl@0
   418
					 * uid, ruid, gid, rgid and proc
sl@0
   419
					 */
sl@0
   420
sl@0
   421
/*
sl@0
   422
 * KERN_IPC identifiers
sl@0
   423
 */
sl@0
   424
#define KIPC_MAXSOCKBUF		1	/* int: max size of a socket buffer */
sl@0
   425
#define	KIPC_SOCKBUF_WASTE	2	/* int: wastage factor in sockbuf */
sl@0
   426
#define	KIPC_SOMAXCONN		3	/* int: max length of connection q */
sl@0
   427
#define	KIPC_MAX_LINKHDR	4	/* int: max length of link header */
sl@0
   428
#define	KIPC_MAX_PROTOHDR	5	/* int: max length of network header */
sl@0
   429
#define	KIPC_MAX_HDR		6	/* int: max total length of headers */
sl@0
   430
#define	KIPC_MAX_DATALEN	7	/* int: max length of data? */
sl@0
   431
sl@0
   432
/*
sl@0
   433
 * CTL_HW identifiers
sl@0
   434
 */
sl@0
   435
#define	HW_MACHINE	 1		/* string: machine class */
sl@0
   436
#define	HW_MODEL	 2		/* string: specific machine model */
sl@0
   437
#define	HW_NCPU		 3		/* int: number of cpus */
sl@0
   438
#define	HW_BYTEORDER	 4		/* int: machine byte order */
sl@0
   439
#define	HW_PHYSMEM	 5		/* int: total memory */
sl@0
   440
#define	HW_USERMEM	 6		/* int: non-kernel memory */
sl@0
   441
#define	HW_PAGESIZE	 7		/* int: software page size */
sl@0
   442
#define	HW_DISKNAMES	 8		/* strings: disk drive names */
sl@0
   443
#define	HW_DISKSTATS	 9		/* struct: diskstats[] */
sl@0
   444
#define HW_FLOATINGPT	10		/* int: has HW floating point? */
sl@0
   445
#define HW_MACHINE_ARCH	11		/* string: machine architecture */
sl@0
   446
#define	HW_REALMEM	12		/* int: 'real' memory */
sl@0
   447
#define	HW_MAXID	13		/* number of valid hw ids */
sl@0
   448
sl@0
   449
#define CTL_HW_NAMES { \
sl@0
   450
	{ 0, 0 }, \
sl@0
   451
	{ "machine", CTLTYPE_STRING }, \
sl@0
   452
	{ "model", CTLTYPE_STRING }, \
sl@0
   453
	{ "ncpu", CTLTYPE_INT }, \
sl@0
   454
	{ "byteorder", CTLTYPE_INT }, \
sl@0
   455
	{ "physmem", CTLTYPE_ULONG }, \
sl@0
   456
	{ "usermem", CTLTYPE_ULONG }, \
sl@0
   457
	{ "pagesize", CTLTYPE_INT }, \
sl@0
   458
	{ "disknames", CTLTYPE_STRUCT }, \
sl@0
   459
	{ "diskstats", CTLTYPE_STRUCT }, \
sl@0
   460
	{ "floatingpoint", CTLTYPE_INT }, \
sl@0
   461
	{ "realmem", CTLTYPE_ULONG }, \
sl@0
   462
}
sl@0
   463
sl@0
   464
/*
sl@0
   465
 * CTL_USER definitions
sl@0
   466
 */
sl@0
   467
#define	USER_CS_PATH		 1	/* string: _CS_PATH */
sl@0
   468
#define	USER_BC_BASE_MAX	 2	/* int: BC_BASE_MAX */
sl@0
   469
#define	USER_BC_DIM_MAX		 3	/* int: BC_DIM_MAX */
sl@0
   470
#define	USER_BC_SCALE_MAX	 4	/* int: BC_SCALE_MAX */
sl@0
   471
#define	USER_BC_STRING_MAX	 5	/* int: BC_STRING_MAX */
sl@0
   472
#define	USER_COLL_WEIGHTS_MAX	 6	/* int: COLL_WEIGHTS_MAX */
sl@0
   473
#define	USER_EXPR_NEST_MAX	 7	/* int: EXPR_NEST_MAX */
sl@0
   474
#define	USER_LINE_MAX		 8	/* int: LINE_MAX */
sl@0
   475
#define	USER_RE_DUP_MAX		 9	/* int: RE_DUP_MAX */
sl@0
   476
#define	USER_POSIX2_VERSION	10	/* int: POSIX2_VERSION */
sl@0
   477
#define	USER_POSIX2_C_BIND	11	/* int: POSIX2_C_BIND */
sl@0
   478
#define	USER_POSIX2_C_DEV	12	/* int: POSIX2_C_DEV */
sl@0
   479
#define	USER_POSIX2_CHAR_TERM	13	/* int: POSIX2_CHAR_TERM */
sl@0
   480
#define	USER_POSIX2_FORT_DEV	14	/* int: POSIX2_FORT_DEV */
sl@0
   481
#define	USER_POSIX2_FORT_RUN	15	/* int: POSIX2_FORT_RUN */
sl@0
   482
#define	USER_POSIX2_LOCALEDEF	16	/* int: POSIX2_LOCALEDEF */
sl@0
   483
#define	USER_POSIX2_SW_DEV	17	/* int: POSIX2_SW_DEV */
sl@0
   484
#define	USER_POSIX2_UPE		18	/* int: POSIX2_UPE */
sl@0
   485
#define	USER_STREAM_MAX		19	/* int: POSIX2_STREAM_MAX */
sl@0
   486
#define	USER_TZNAME_MAX		20	/* int: POSIX2_TZNAME_MAX */
sl@0
   487
#define	USER_MAXID		21	/* number of valid user ids */
sl@0
   488
sl@0
   489
#define	CTL_USER_NAMES { \
sl@0
   490
	{ 0, 0 }, \
sl@0
   491
	{ "cs_path", CTLTYPE_STRING }, \
sl@0
   492
	{ "bc_base_max", CTLTYPE_INT }, \
sl@0
   493
	{ "bc_dim_max", CTLTYPE_INT }, \
sl@0
   494
	{ "bc_scale_max", CTLTYPE_INT }, \
sl@0
   495
	{ "bc_string_max", CTLTYPE_INT }, \
sl@0
   496
	{ "coll_weights_max", CTLTYPE_INT }, \
sl@0
   497
	{ "expr_nest_max", CTLTYPE_INT }, \
sl@0
   498
	{ "line_max", CTLTYPE_INT }, \
sl@0
   499
	{ "re_dup_max", CTLTYPE_INT }, \
sl@0
   500
	{ "posix2_version", CTLTYPE_INT }, \
sl@0
   501
	{ "posix2_c_bind", CTLTYPE_INT }, \
sl@0
   502
	{ "posix2_c_dev", CTLTYPE_INT }, \
sl@0
   503
	{ "posix2_char_term", CTLTYPE_INT }, \
sl@0
   504
	{ "posix2_fort_dev", CTLTYPE_INT }, \
sl@0
   505
	{ "posix2_fort_run", CTLTYPE_INT }, \
sl@0
   506
	{ "posix2_localedef", CTLTYPE_INT }, \
sl@0
   507
	{ "posix2_sw_dev", CTLTYPE_INT }, \
sl@0
   508
	{ "posix2_upe", CTLTYPE_INT }, \
sl@0
   509
	{ "stream_max", CTLTYPE_INT }, \
sl@0
   510
	{ "tzname_max", CTLTYPE_INT }, \
sl@0
   511
}
sl@0
   512
sl@0
   513
#define CTL_P1003_1B_ASYNCHRONOUS_IO		1	/* boolean */
sl@0
   514
#define CTL_P1003_1B_MAPPED_FILES		2	/* boolean */
sl@0
   515
#define CTL_P1003_1B_MEMLOCK			3	/* boolean */
sl@0
   516
#define CTL_P1003_1B_MEMLOCK_RANGE		4	/* boolean */
sl@0
   517
#define CTL_P1003_1B_MEMORY_PROTECTION		5	/* boolean */
sl@0
   518
#define CTL_P1003_1B_MESSAGE_PASSING		6	/* boolean */
sl@0
   519
#define CTL_P1003_1B_PRIORITIZED_IO		7	/* boolean */
sl@0
   520
#define CTL_P1003_1B_PRIORITY_SCHEDULING	8	/* boolean */
sl@0
   521
#define CTL_P1003_1B_REALTIME_SIGNALS		9	/* boolean */
sl@0
   522
#define CTL_P1003_1B_SEMAPHORES			10	/* boolean */
sl@0
   523
#define CTL_P1003_1B_FSYNC			11	/* boolean */
sl@0
   524
#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS	12	/* boolean */
sl@0
   525
#define CTL_P1003_1B_SYNCHRONIZED_IO		13	/* boolean */
sl@0
   526
#define CTL_P1003_1B_TIMERS			14	/* boolean */
sl@0
   527
#define CTL_P1003_1B_AIO_LISTIO_MAX		15	/* int */
sl@0
   528
#define CTL_P1003_1B_AIO_MAX			16	/* int */
sl@0
   529
#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX		17	/* int */
sl@0
   530
#define CTL_P1003_1B_DELAYTIMER_MAX		18	/* int */
sl@0
   531
#define CTL_P1003_1B_MQ_OPEN_MAX		19	/* int */
sl@0
   532
#define CTL_P1003_1B_PAGESIZE			20	/* int */
sl@0
   533
#define CTL_P1003_1B_RTSIG_MAX			21	/* int */
sl@0
   534
#define CTL_P1003_1B_SEM_NSEMS_MAX		22	/* int */
sl@0
   535
#define CTL_P1003_1B_SEM_VALUE_MAX		23	/* int */
sl@0
   536
#define CTL_P1003_1B_SIGQUEUE_MAX		24	/* int */
sl@0
   537
#define CTL_P1003_1B_TIMER_MAX			25	/* int */
sl@0
   538
sl@0
   539
#define CTL_P1003_1B_MAXID		26
sl@0
   540
sl@0
   541
#define	CTL_P1003_1B_NAMES { \
sl@0
   542
	{ 0, 0 }, \
sl@0
   543
	{ "asynchronous_io", CTLTYPE_INT }, \
sl@0
   544
	{ "mapped_files", CTLTYPE_INT }, \
sl@0
   545
	{ "memlock", CTLTYPE_INT }, \
sl@0
   546
	{ "memlock_range", CTLTYPE_INT }, \
sl@0
   547
	{ "memory_protection", CTLTYPE_INT }, \
sl@0
   548
	{ "message_passing", CTLTYPE_INT }, \
sl@0
   549
	{ "prioritized_io", CTLTYPE_INT }, \
sl@0
   550
	{ "priority_scheduling", CTLTYPE_INT }, \
sl@0
   551
	{ "realtime_signals", CTLTYPE_INT }, \
sl@0
   552
	{ "semaphores", CTLTYPE_INT }, \
sl@0
   553
	{ "fsync", CTLTYPE_INT }, \
sl@0
   554
	{ "shared_memory_objects", CTLTYPE_INT }, \
sl@0
   555
	{ "synchronized_io", CTLTYPE_INT }, \
sl@0
   556
	{ "timers", CTLTYPE_INT }, \
sl@0
   557
	{ "aio_listio_max", CTLTYPE_INT }, \
sl@0
   558
	{ "aio_max", CTLTYPE_INT }, \
sl@0
   559
	{ "aio_prio_delta_max", CTLTYPE_INT }, \
sl@0
   560
	{ "delaytimer_max", CTLTYPE_INT }, \
sl@0
   561
	{ "mq_open_max", CTLTYPE_INT }, \
sl@0
   562
	{ "pagesize", CTLTYPE_INT }, \
sl@0
   563
	{ "rtsig_max", CTLTYPE_INT }, \
sl@0
   564
	{ "nsems_max", CTLTYPE_INT }, \
sl@0
   565
	{ "sem_value_max", CTLTYPE_INT }, \
sl@0
   566
	{ "sigqueue_max", CTLTYPE_INT }, \
sl@0
   567
	{ "timer_max", CTLTYPE_INT }, \
sl@0
   568
}
sl@0
   569
sl@0
   570
#ifdef _KERNEL
sl@0
   571
sl@0
   572
/*
sl@0
   573
 * Declare some common oids.
sl@0
   574
 */
sl@0
   575
extern struct sysctl_oid_list sysctl__children;
sl@0
   576
sl@0
   577
extern char	machine[];
sl@0
   578
extern char	osrelease[];
sl@0
   579
extern char	ostype[];
sl@0
   580
extern char	kern_ident[];
sl@0
   581
sl@0
   582
sl@0
   583
#endif	/* _KERNEL */
sl@0
   584
sl@0
   585
#endif	/* !_SYS_SYSCTL_H_ */