sysctl.h revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Karels at Berkeley Software Design, Inc.
*
* Portions copyright (c) 1999, 2000
* Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
*
* This product includes software developed by the University of
* California, Berkeley, Intel Corporation, and its contributors.
*
* 4. Neither the name of University, Intel Corporation, or their respective
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS, INTEL CORPORATION AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS,
* INTEL CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
* $Id: sysctl.h,v 1.1.1.1 2006/05/30 06:13:00 hhzhou Exp $
*/
#ifndef _SYS_SYSCTL_H_
#define _SYS_SYSCTL_H_
/*
* Definitions for sysctl call. The sysctl call uses a hierarchical name
* for objects that can be examined or modified. The name is expressed as
* a sequence of integers. Like a file path name, the meaning of each
* component depends on its place in the hierarchy. The top-level and kern
* identifiers are defined here, and other identifiers are defined in the
* respective subsystem header files.
*/
/*
* Each subsystem defined by sysctl defines a list of variables
* for that subsystem. Each name is either a node with further
* levels defined below it, or it is a leaf of some particular
* pairs to be used by sysctl(1) in manipulating the subsystem.
*/
struct ctlname {
char *ctl_name; /* subsystem name */
int ctl_type; /* type of name */
};
/*
* USE THIS instead of a hardwired number from the categories below
* to get dynamically assigned sysctl entries using the linker-set
* technology. This is the way nearly all new sysctl variables should
* be implemented.
* e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
*/
#define OID_AUTO (-1)
#ifdef KERNEL
struct sysctl_req *req)
/*
* This describes the access space for a sysctl request. This is needed
* so that we can use the interface from the kernel or from user-space.
*/
struct sysctl_req {
struct proc *p;
int lock;
void *oldptr;
void *newptr;
};
#ifndef _ORG_FREEBSD_
/*
* Pseudo sysctl call through ioctl(2) interface
*/
struct pseudo_sysctl {
int *name;
struct sysctl_req req;
};
#endif
/*
* This describes one "oid" in the MIB tree. Potentially more nodes can
* be hidden behind it, expanded by the handler.
*/
struct sysctl_oid {
int oid_number;
int oid_kind;
void *oid_arg1;
int oid_arg2;
const char *oid_name;
int (*oid_handler) SYSCTL_HANDLER_ARGS;
const char *oid_fmt;
};
#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
#ifdef _ORG_FREEBSD_
/* This constructs a "raw" MIB oid. */
/* This constructs a node from which other oids can hang. */
#else
#endif
/* Oid for a string. len can be 0 to indicate '\0' termination. */
/* Oid for an int. If ptr is NULL, val is returned. */
/* Oid for a long. The pointer must be non NULL. */
/* Oid for an opaque object. Specified by a pointer and a length. */
/* Oid for a struct. Specified by a pointer and a type. */
/* Oid for a procedure. Specified by a pointer and an arg. */
#endif /* KERNEL */
/*
* Top-level identifiers
*/
#define CTL_UNSPEC 0 /* unused */
#define CTL_NAMES { \
{ 0, 0 }, \
{ "kern", CTLTYPE_NODE }, \
{ "vm", CTLTYPE_NODE }, \
{ "vfs", CTLTYPE_NODE }, \
{ "net", CTLTYPE_NODE }, \
{ "debug", CTLTYPE_NODE }, \
{ "hw", CTLTYPE_NODE }, \
{ "machdep", CTLTYPE_NODE }, \
{ "user", CTLTYPE_NODE }, \
{ "p1003_1b", CTLTYPE_NODE }, \
}
/*
* CTL_KERN identifiers
*/
#define CTL_KERN_NAMES { \
{ 0, 0 }, \
{ "ostype", CTLTYPE_STRING }, \
{ "osrelease", CTLTYPE_STRING }, \
{ "osrevision", CTLTYPE_INT }, \
{ "version", CTLTYPE_STRING }, \
{ "maxvnodes", CTLTYPE_INT }, \
{ "maxproc", CTLTYPE_INT }, \
{ "maxfiles", CTLTYPE_INT }, \
{ "argmax", CTLTYPE_INT }, \
{ "securelevel", CTLTYPE_INT }, \
{ "hostname", CTLTYPE_STRING }, \
{ "hostid", CTLTYPE_INT }, \
{ "clockrate", CTLTYPE_STRUCT }, \
{ "vnode", CTLTYPE_STRUCT }, \
{ "proc", CTLTYPE_STRUCT }, \
{ "file", CTLTYPE_STRUCT }, \
{ "profiling", CTLTYPE_NODE }, \
{ "posix1version", CTLTYPE_INT }, \
{ "ngroups", CTLTYPE_INT }, \
{ "job_control", CTLTYPE_INT }, \
{ "saved_ids", CTLTYPE_INT }, \
{ "boottime", CTLTYPE_STRUCT }, \
{ "nisdomainname", CTLTYPE_STRING }, \
{ "update", CTLTYPE_INT }, \
{ "osreldate", CTLTYPE_INT }, \
{ "ntp_pll", CTLTYPE_NODE }, \
{ "bootfile", CTLTYPE_STRING }, \
{ "maxfilesperproc", CTLTYPE_INT }, \
{ "maxprocperuid", CTLTYPE_INT }, \
{ "ipc", CTLTYPE_NODE }, \
{ "dummy", CTLTYPE_INT }, \
{ "ps_strings", CTLTYPE_INT }, \
{ "usrstack", CTLTYPE_INT }, \
{ "logsigexit", CTLTYPE_INT }, \
}
/*
* CTL_VFS identifiers
*/
#define CTL_VFS_NAMES { \
{ "vfsconf", CTLTYPE_STRUCT }, \
}
/*
* KERN_PROC subtypes
*/
#define KERN_PROC_ALL 0 /* everything */
/*
* KERN_IPC identifiers
*/
/*
* CTL_HW identifiers
*/
#define CTL_HW_NAMES { \
{ 0, 0 }, \
{ "machine", CTLTYPE_STRING }, \
{ "model", CTLTYPE_STRING }, \
{ "ncpu", CTLTYPE_INT }, \
{ "byteorder", CTLTYPE_INT }, \
{ "physmem", CTLTYPE_INT }, \
{ "usermem", CTLTYPE_INT }, \
{ "pagesize", CTLTYPE_INT }, \
{ "disknames", CTLTYPE_STRUCT }, \
{ "diskstats", CTLTYPE_STRUCT }, \
{ "floatingpoint", CTLTYPE_INT }, \
}
/*
* CTL_USER definitions
*/
#define CTL_USER_NAMES { \
{ 0, 0 }, \
{ "cs_path", CTLTYPE_STRING }, \
{ "bc_base_max", CTLTYPE_INT }, \
{ "bc_dim_max", CTLTYPE_INT }, \
{ "bc_scale_max", CTLTYPE_INT }, \
{ "bc_string_max", CTLTYPE_INT }, \
{ "coll_weights_max", CTLTYPE_INT }, \
{ "expr_nest_max", CTLTYPE_INT }, \
{ "line_max", CTLTYPE_INT }, \
{ "re_dup_max", CTLTYPE_INT }, \
{ "posix2_version", CTLTYPE_INT }, \
{ "posix2_c_bind", CTLTYPE_INT }, \
{ "posix2_c_dev", CTLTYPE_INT }, \
{ "posix2_char_term", CTLTYPE_INT }, \
{ "posix2_fort_dev", CTLTYPE_INT }, \
{ "posix2_fort_run", CTLTYPE_INT }, \
{ "posix2_localedef", CTLTYPE_INT }, \
{ "posix2_sw_dev", CTLTYPE_INT }, \
{ "posix2_upe", CTLTYPE_INT }, \
{ "stream_max", CTLTYPE_INT }, \
{ "tzname_max", CTLTYPE_INT }, \
}
#define CTL_P1003_1B_MAXID 26
#define CTL_P1003_1B_NAMES { \
{ 0, 0 }, \
{ "asynchronous_io", CTLTYPE_INT }, \
{ "mapped_files", CTLTYPE_INT }, \
{ "memlock", CTLTYPE_INT }, \
{ "memlock_range", CTLTYPE_INT }, \
{ "memory_protection", CTLTYPE_INT }, \
{ "message_passing", CTLTYPE_INT }, \
{ "prioritized_io", CTLTYPE_INT }, \
{ "priority_scheduling", CTLTYPE_INT }, \
{ "realtime_signals", CTLTYPE_INT }, \
{ "semaphores", CTLTYPE_INT }, \
{ "fsync", CTLTYPE_INT }, \
{ "shared_memory_objects", CTLTYPE_INT }, \
{ "synchronized_io", CTLTYPE_INT }, \
{ "timers", CTLTYPE_INT }, \
{ "aio_listio_max", CTLTYPE_INT }, \
{ "aio_max", CTLTYPE_INT }, \
{ "aio_prio_delta_max", CTLTYPE_INT }, \
{ "delaytimer_max", CTLTYPE_INT }, \
{ "mq_open_max", CTLTYPE_INT }, \
{ "pagesize", CTLTYPE_INT }, \
{ "rtsig_max", CTLTYPE_INT }, \
{ "nsems_max", CTLTYPE_INT }, \
{ "sem_value_max", CTLTYPE_INT }, \
{ "sigqueue_max", CTLTYPE_INT }, \
{ "timer_max", CTLTYPE_INT }, \
}
#ifdef KERNEL
extern char machine[];
extern char osrelease[];
extern char ostype[];
void sysctl_order_all(void);
#else /* !KERNEL */
#include <sys/EfiCdefs.h>
#endif /* KERNEL */
#endif /* !_SYS_SYSCTL_H_ */