1 module tango.sys.freebsd.consts.sysctl;
2 
3 
4 /*
5  * Definitions for sysctl call.  The sysctl call uses a hierarchical name
6  * for objects that can be examined or modified.  The name is expressed as
7  * a sequence of integers.  Like a file path name, the meaning of each
8  * component depends on its place in the hierarchy.  The top-level and kern
9  * identifiers are defined here, and other identifiers are defined in the
10  * respective subsystem header files.
11  */
12 
13 
14 
15 /*
16  * Each subsystem defined by sysctl defines a list of variables
17  * for that subsystem. Each name is either a node with further
18  * levels defined below it, or it is a leaf of some particular
19  * type given below. Each sysctl level defines a set of name/type
20  * pairs to be used by sysctl(8) in manipulating the subsystem.
21  */
22 struct ctlname {
23     char* ctl_name; /* subsystem name */
24     int ctl_type; /* type of name */
25 };
26 
27 enum SysCtl {
28     CTL_MAXNAME = 24,    /* largest number of components supported */
29 
30     CTLTYPE = 0xf,    /* Mask for the type */
31     CTLTYPE_NODE = 1,    /* name is a node */
32     CTLTYPE_INT = 2,    /* name describes an integer */
33     CTLTYPE_STRING = 3,    /* name describes a string */
34     CTLTYPE_QUAD = 4,    /* name describes a 64-bit number */
35     CTLTYPE_OPAQUE = 5,    /* name describes a structure */
36     CTLTYPE_STRUCT = CTLTYPE_OPAQUE,    /* name describes a structure */
37     CTLTYPE_UINT = 6,    /* name describes an unsigned integer */
38     CTLTYPE_LONG = 7,    /* name describes a long */
39     CTLTYPE_ULONG = 8,    /* name describes an unsigned long */
40 
41     CTLFLAG_RD = 0x80000000,    /* Allow reads of variable */
42     CTLFLAG_WR = 0x40000000,    /* Allow writes to the variable */
43     CTLFLAG_RW = (CTLFLAG_RD|CTLFLAG_WR),
44     CTLFLAG_NOLOCK = 0x20000000,    /* XXX Don't Lock */
45     CTLFLAG_ANYBODY = 0x10000000,    /* All users can set this var */
46     CTLFLAG_SECURE = 0x08000000,    /* Permit set only if securelevel<=0 */
47     CTLFLAG_PRISON = 0x04000000,    /* Prisoned roots can fiddle */
48     CTLFLAG_DYN = 0x02000000,    /* Dynamic oid - can be freed */
49     CTLFLAG_SKIP = 0x01000000,    /* Skip this sysctl when listing */
50     CTLMASK_SECURE = 0x00F00000,    /* Secure level */
51     CTLFLAG_TUN = 0x00080000,    /* Tunable variable */
52     CTLFLAG_MPSAFE = 0x00040000,    /* Handler is MP safe */
53     CTLFLAG_RDTUN = (CTLFLAG_RD|CTLFLAG_TUN),
54 
55 /*
56  * Secure level.   Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.  
57  *
58  * Secure when the securelevel is raised to at least N.
59  */
60     CTLSHIFT_SECURE = 20,
61     CTLFLAG_SECURE1 = (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE)),
62     CTLFLAG_SECURE2 = (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE)),
63     CTLFLAG_SECURE3 = (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE)),
64 
65 /*
66  * USE THIS instead of a hardwired number from the categories below
67  * to get dynamically assigned sysctl entries using the linker-set
68  * technology. This is the way nearly all new sysctl variables should
69  * be implemented.
70  * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
71  */ 
72     OID_AUTO = (-1),
73 
74 /*
75  * The starting number for dynamically-assigned entries.  WARNING!
76  * ALL static sysctl entries should have numbers LESS than this!
77  */
78     CTL_AUTO_START = 0x100,
79 
80 /*
81  * Top-level identifiers
82  */
83     CTL_UNSPEC = 0,	 /* unused */
84     CTL_KERN = 1,	 /* "high kernel": proc, limits */
85     CTL_VM = 2,	 /* virtual memory */
86     CTL_VFS = 3,	 /* filesystem, mount type is next */
87     CTL_NET = 4,	 /* network, see socket.h */
88     CTL_DEBUG = 5,	 /* debugging parameters */
89     CTL_HW = 6,	 /* generic cpu/io */
90     CTL_MACHDEP = 7,	 /* machine dependent */
91     CTL_USER = 8,	 /* user-level */
92     CTL_P1003_1B = 9,	 /* POSIX 1003.1B */
93     CTL_MAXID = 10,	 /* number of valid top-level ids */
94 
95 
96 /*
97  * CTL_KERN identifiers
98  */
99     KERN_OSTYPE = 1,    /* string: system version */
100     KERN_OSRELEASE = 2,    /* string: system release */
101     KERN_OSREV = 3,    /* int: system revision */
102     KERN_VERSION = 4,    /* string: compile time info */
103     KERN_MAXVNODES =  5,    /* int: max vnodes */
104     KERN_MAXPROC = 6,    /* int: max processes */
105     KERN_MAXFILES = 7,    /* int: max open files */
106     KERN_ARGMAX = 8,    /* int: max arguments to exec */
107     KERN_SECURELVL = 9,    /* int: system security level */
108     KERN_HOSTNAME = 10,    /* string: hostname */
109     KERN_HOSTID = 11,    /* int: host identifier */
110     KERN_CLOCKRATE = 12,    /* struct: struct clockrate */
111     KERN_VNODE = 13,    /* struct: vnode structures */
112     KERN_PROC = 14,    /* struct: process entries */
113     KERN_FILE = 15,    /* struct: file entries */
114     KERN_PROF = 16,    /* node: kernel profiling info */
115     KERN_POSIX1 = 17,    /* int: POSIX.1 version */
116     KERN_NGROUPS = 18,    /* int: # of supplemental group ids */
117     KERN_JOB_CONTROL = 19,    /* int: is job control available */
118     KERN_SAVED_IDS = 20,    /* int: saved set-user/group-ID */
119     KERN_BOOTTIME = 21,    /* struct: time kernel was booted */
120     KERN_NISDOMAINNAME = 22,    /* string: YP domain name */
121     KERN_UPDATEINTERVAL = 23,    /* int: update process sleep time */
122     KERN_OSRELDATE = 24,    /* int: kernel release date */
123     KERN_NTP_PLL = 25,    /* node: NTP PLL control */
124     KERN_BOOTFILE = 26,    /* string: name of booted kernel */
125     KERN_MAXFILESPERPROC = 27,    /* int: max open files per proc */
126     KERN_MAXPROCPERUID = 28,    /* int: max processes per uid */
127     KERN_DUMPDEV = 29,    /* struct cdev *: device to dump on */
128     KERN_IPC = 30,    /* node: anything related to IPC */
129     KERN_DUMMY = 31,    /* unused */
130     KERN_PS_STRINGS = 32,    /* int: address of PS_STRINGS */
131     KERN_USRSTACK	 = 33,    /* int: address of USRSTACK */
132     KERN_LOGSIGEXIT = 34,    /* int: do we log sigexit procs? */
133     KERN_IOV_MAX = 35,    /* int: value of UIO_MAXIOV */
134     KERN_HOSTUUID = 36,    /* string: host UUID identifier */
135     KERN_ARND = 37,    /* int: from arc4rand() */
136     KERN_MAXID = 38,    /* number of valid kern ids */
137 
138 /*
139  * KERN_PROC subtypes
140  */
141     KERN_PROC_ALL = 0,    /* everything */
142     KERN_PROC_PID = 1,    /* by process id */
143     KERN_PROC_PGRP = 2,    /* by process group id */
144     KERN_PROC_SESSION = 3,    /* by session of pid */
145     KERN_PROC_TTY = 4,    /* by controlling tty */
146     KERN_PROC_UID = 5,    /* by effective uid */
147     KERN_PROC_RUID = 6,    /* by real uid */
148     KERN_PROC_ARGS = 7,    /* get/set arguments/proctitle */
149     KERN_PROC_PROC = 8,    /* only return procs */
150     KERN_PROC_SV_NAME = 9,    /* get syscall vector name */
151     KERN_PROC_RGID = 10,    /* by real group id */
152     KERN_PROC_GID = 11,    /* by effective group id */
153     KERN_PROC_PATHNAME = 12,    /* path to executable */
154     KERN_PROC_OVMMAP = 13,    /* Old VM map entries for process */
155     KERN_PROC_OFILEDESC = 14,    /* Old file descriptors for process */
156     KERN_PROC_KSTACK = 15,    /* Kernel stacks for process */
157     KERN_PROC_INC_THREAD = 0x10,    /*
158 					 * modifier for pid, pgrp, tty,
159 					 * uid, ruid, gid, rgid and proc
160 					 * This effectively uses 16-31
161 					 */
162     KERN_PROC_VMMAP = 32,    /* VM map entries for process */
163     KERN_PROC_FILEDESC = 33,    /* File descriptors for process */
164 
165 /*
166  * KERN_IPC identifiers
167  */
168     KIPC_MAXSOCKBUF = 1,    /* int: max size of a socket buffer */
169     KIPC_SOCKBUF_WASTE = 2,    /* int: wastage factor in sockbuf */
170     KIPC_SOMAXCONN = 3,    /* int: max length of connection q */
171     KIPC_MAX_LINKHDR = 4,    /* int: max length of link header */
172     KIPC_MAX_PROTOHDR = 5,    /* int: max length of network header */
173     KIPC_MAX_HDR = 6,    /* int: max total length of headers */
174     KIPC_MAX_DATALEN = 7,    /* int: max length of data? */
175 
176 /*
177  * CTL_HW identifiers
178  */
179     HW_MACHINE = 1,	 /* string: machine class */
180     HW_MODEL	= 2,	 /* string: specific machine model */
181     HW_NCPU = 3,	 /* int: number of cpus */
182     HW_BYTEORDER = 4,	 /* int: machine byte order */
183     HW_PHYSMEM	= 5,	 /* int: total memory */
184     HW_USERMEM = 6,	 /* int: non-kernel memory */
185     HW_PAGESIZE = 7,	 /* int: software page size */
186     HW_DISKNAMES = 8,	 /* strings: disk drive names */
187     HW_DISKSTATS = 9,	 /* struct: diskstats[] */
188     HW_FLOATINGPT = 10,	 /* int: has HW floating point? */
189     HW_MACHINE_ARCH = 11,	 /* string: machine architecture */
190     HW_REALMEM = 12,	 /* int: 'real' memory */
191     HW_MAXID = 13,	 /* number of valid hw ids */
192 
193 /*
194  * CTL_USER definitions
195  */
196     USER_CS_PATH = 1,    /* string: _CS_PATH */
197     USER_BC_BASE_MAX	= 2,    /* int: BC_BASE_MAX */
198     USER_BC_DIM_MAX = 3,    /* int: BC_DIM_MAX */
199     USER_BC_SCALE_MAX = 4,    /* int: BC_SCALE_MAX */
200     USER_BC_STRING_MAX = 5,    /* int: BC_STRING_MAX */
201     USER_COLL_WEIGHTS_MAX = 6,    /* int: COLL_WEIGHTS_MAX */
202     USER_EXPR_NEST_MAX = 7,    /* int: EXPR_NEST_MAX */
203     USER_LINE_MAX = 8,    /* int: LINE_MAX */
204     USER_RE_DUP_MAX = 9,    /* int: RE_DUP_MAX */
205     USER_POSIX2_VERSION = 10,    /* int: POSIX2_VERSION */
206     USER_POSIX2_C_BIND = 11,    /* int: POSIX2_C_BIND */
207     USER_POSIX2_C_DEV = 12,    /* int: POSIX2_C_DEV */
208     USER_POSIX2_CHAR_TERM = 13,    /* int: POSIX2_CHAR_TERM */
209     USER_POSIX2_FORT_DEV = 14,    /* int: POSIX2_FORT_DEV */
210     USER_POSIX2_FORT_RUN = 15,    /* int: POSIX2_FORT_RUN */
211     USER_POSIX2_LOCALEDEF = 16,    /* int: POSIX2_LOCALEDEF */
212     USER_POSIX2_SW_DEV = 17,    /* int: POSIX2_SW_DEV */
213     USER_POSIX2_UPE = 18,    /* int: POSIX2_UPE */
214     USER_STREAM_MAX = 19,    /* int: POSIX2_STREAM_MAX */
215     USER_TZNAME_MAX = 20,    /* int: POSIX2_TZNAME_MAX */
216     USER_MAXID = 21,    /* number of valid user ids */
217 }
218 
219 
220 int sysctl(int*, uint , void* , size_t* , void* , size_t);
221 int sysctlbyname(in char* , void* , size_t* , void* , size_t);
222 int sysctlnametomib(in char* , int* , size_t*);