/[gxemul]/upstream/0.4.4/src/include/sysctl_netbsd.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /upstream/0.4.4/src/include/sysctl_netbsd.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (show annotations)
Mon Oct 8 16:21:26 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 27751 byte(s)
0.4.4
1 /* gxemul: $Id: sysctl_netbsd.h,v 1.3 2005/03/05 12:34:03 debug Exp $ */
2 /* $NetBSD: sysctl.h,v 1.74 2002/03/20 00:23:46 christos Exp $ */
3
4 /*
5 * Copyright (c) 1989, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Mike Karels at Berkeley Software Design, Inc.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)sysctl.h 8.1 (Berkeley) 6/2/93
40 */
41
42 #ifndef NETBSD_SYS_SYSCTL_H_
43 #define NETBSD_SYS_SYSCTL_H_
44
45 /*
46 * These are for the eproc structure defined below.
47 */
48 /* #include <sys/time.h>
49 #include <sys/ucred.h>
50 #include <sys/proc.h>
51 #include <uvm/uvm_extern.h> */
52
53 /*
54 * Definitions for sysctl call. The sysctl call uses a hierarchical name
55 * for objects that can be examined or modified. The name is expressed as
56 * a sequence of integers. Like a file path name, the meaning of each
57 * component depends on its place in the hierarchy. The top-level and kern
58 * identifiers are defined here, and other identifiers are defined in the
59 * respective subsystem header files.
60 */
61
62 #define CTL_MAXNAME 12 /* largest number of components supported */
63
64 /*
65 * Each subsystem defined by sysctl defines a list of variables
66 * for that subsystem. Each name is either a node with further
67 * levels defined below it, or it is a leaf of some particular
68 * type given below. Each sysctl level defines a set of name/type
69 * pairs to be used by sysctl(1) in manipulating the subsystem.
70 */
71 struct ctlname {
72 const char *ctl_name; /* subsystem name */
73 int ctl_type; /* type of name */
74 };
75 #define CTLTYPE_NODE 1 /* name is a node */
76 #define CTLTYPE_INT 2 /* name describes an integer */
77 #define CTLTYPE_STRING 3 /* name describes a string */
78 #define CTLTYPE_QUAD 4 /* name describes a 64-bit number */
79 #define CTLTYPE_STRUCT 5 /* name describes a structure */
80
81 /*
82 * Top-level identifiers
83 */
84 #define CTL_UNSPEC 0 /* unused */
85 #define CTL_KERN 1 /* "high kernel": proc, limits */
86 #define CTL_VM 2 /* virtual memory */
87 #define CTL_VFS 3 /* file system, mount type is next */
88 #define CTL_NET 4 /* network, see socket.h */
89 #define CTL_DEBUG 5 /* debugging parameters */
90 #define CTL_HW 6 /* generic cpu/io */
91 #define CTL_MACHDEP 7 /* machine dependent */
92 #define CTL_USER 8 /* user-level */
93 #define CTL_DDB 9 /* in-kernel debugger */
94 #define CTL_PROC 10 /* per-proc attr */
95 #define CTL_VENDOR 11 /* vendor-specific data */
96 #define CTL_EMUL 12 /* emulation-specific data */
97 #define CTL_MAXID 13 /* number of valid top-level ids */
98
99 #define CTL_NAMES { \
100 { 0, 0 }, \
101 { "kern", CTLTYPE_NODE }, \
102 { "vm", CTLTYPE_NODE }, \
103 { "vfs", CTLTYPE_NODE }, \
104 { "net", CTLTYPE_NODE }, \
105 { "debug", CTLTYPE_NODE }, \
106 { "hw", CTLTYPE_NODE }, \
107 { "machdep", CTLTYPE_NODE }, \
108 { "user", CTLTYPE_NODE }, \
109 { "ddb", CTLTYPE_NODE }, \
110 { "proc", CTLTYPE_NODE }, \
111 { "vendor", CTLTYPE_NODE }, \
112 { "emul", CTLTYPE_NODE }, \
113 }
114
115 /*
116 * The "vendor" toplevel name is to be used by vendors who wish to
117 * have their own private MIB tree. If you do that, please use
118 * vendor.<yourname>.*
119 */
120
121 /*
122 * CTL_KERN identifiers
123 */
124 #define KERN_OSTYPE 1 /* string: system version */
125 #define KERN_OSRELEASE 2 /* string: system release */
126 #define KERN_OSREV 3 /* int: system revision */
127 #define KERN_VERSION 4 /* string: compile time info */
128 #define KERN_MAXVNODES 5 /* int: max vnodes */
129 #define KERN_MAXPROC 6 /* int: max processes */
130 #define KERN_MAXFILES 7 /* int: max open files */
131 #define KERN_ARGMAX 8 /* int: max arguments to exec */
132 #define KERN_SECURELVL 9 /* int: system security level */
133 #define KERN_HOSTNAME 10 /* string: hostname */
134 #define KERN_HOSTID 11 /* int: host identifier */
135 #define KERN_CLOCKRATE 12 /* struct: struct clockrate */
136 #define KERN_VNODE 13 /* struct: vnode structures */
137 #define KERN_PROC 14 /* struct: process entries */
138 #define KERN_FILE 15 /* struct: file entries */
139 #define KERN_PROF 16 /* node: kernel profiling info */
140 #define KERN_POSIX1 17 /* int: POSIX.1 version */
141 #define KERN_NGROUPS 18 /* int: # of supplemental group ids */
142 #define KERN_JOB_CONTROL 19 /* int: is job control available */
143 #define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */
144 #define KERN_BOOTTIME 21 /* struct: time kernel was booted */
145 #define KERN_DOMAINNAME 22 /* string: (YP) domainname */
146 #define KERN_MAXPARTITIONS 23 /* int: number of partitions/disk */
147 #define KERN_RAWPARTITION 24 /* int: raw partition number */
148 #define KERN_NTPTIME 25 /* struct: extended-precision time */
149 #define KERN_TIMEX 26 /* struct: ntp timekeeping state */
150 #define KERN_AUTONICETIME 27 /* int: proc time before autonice */
151 #define KERN_AUTONICEVAL 28 /* int: auto nice value */
152 #define KERN_RTC_OFFSET 29 /* int: offset of rtc from gmt */
153 #define KERN_ROOT_DEVICE 30 /* string: root device */
154 #define KERN_MSGBUFSIZE 31 /* int: max # of chars in msg buffer */
155 #define KERN_FSYNC 32 /* int: file synchronization support */
156 #define KERN_SYSVMSG 33 /* int: SysV message queue suppoprt */
157 #define KERN_SYSVSEM 34 /* int: SysV semaphore support */
158 #define KERN_SYSVSHM 35 /* int: SysV shared memory support */
159 #define KERN_OLDSHORTCORENAME 36 /* old, unimplemented */
160 #define KERN_SYNCHRONIZED_IO 37 /* int: POSIX synchronized I/O */
161 #define KERN_IOV_MAX 38 /* int: max iovec's for readv(2) etc. */
162 #define KERN_MBUF 39 /* node: mbuf parameters */
163 #define KERN_MAPPED_FILES 40 /* int: POSIX memory mapped files */
164 #define KERN_MEMLOCK 41 /* int: POSIX memory locking */
165 #define KERN_MEMLOCK_RANGE 42 /* int: POSIX memory range locking */
166 #define KERN_MEMORY_PROTECTION 43 /* int: POSIX memory protections */
167 #define KERN_LOGIN_NAME_MAX 44 /* int: max length login name + NUL */
168 #define KERN_DEFCORENAME 45 /* old: sort core name format */
169 #define KERN_LOGSIGEXIT 46 /* int: log signalled processes */
170 #define KERN_PROC2 47 /* struct: process entries */
171 #define KERN_PROC_ARGS 48 /* struct: process argv/env */
172 #define KERN_FSCALE 49 /* int: fixpt FSCALE */
173 #define KERN_CCPU 50 /* int: fixpt ccpu */
174 #define KERN_CP_TIME 51 /* struct: cpu time counters */
175 #define KERN_SYSVIPC_INFO 52 /* number of valid kern ids */
176 #define KERN_MSGBUF 53 /* kernel message buffer */
177 #define KERN_CONSDEV 54 /* dev_t: console terminal device */
178 #define KERN_MAXPTYS 55 /* int: maximum number of ptys */
179 #define KERN_PIPE 56 /* node: pipe limits */
180 #define KERN_MAXPHYS 57 /* int: kernel value of MAXPHYS */
181 #define KERN_SBMAX 58 /* int: max socket buffer size */
182 #define KERN_TKSTAT 59 /* tty in/out counters */
183 #define KERN_MONOTONIC_CLOCK 60 /* int: POSIX monotonic clock */
184 #define KERN_MAXID 61 /* number of valid kern ids */
185
186 #define CTL_KERN_NAMES { \
187 { 0, 0 }, \
188 { "ostype", CTLTYPE_STRING }, \
189 { "osrelease", CTLTYPE_STRING }, \
190 { "osrevision", CTLTYPE_INT }, \
191 { "version", CTLTYPE_STRING }, \
192 { "maxvnodes", CTLTYPE_INT }, \
193 { "maxproc", CTLTYPE_INT }, \
194 { "maxfiles", CTLTYPE_INT }, \
195 { "argmax", CTLTYPE_INT }, \
196 { "securelevel", CTLTYPE_INT }, \
197 { "hostname", CTLTYPE_STRING }, \
198 { "hostid", CTLTYPE_INT }, \
199 { "clockrate", CTLTYPE_STRUCT }, \
200 { "vnode", CTLTYPE_STRUCT }, \
201 { "proc", CTLTYPE_STRUCT }, \
202 { "file", CTLTYPE_STRUCT }, \
203 { "profiling", CTLTYPE_NODE }, \
204 { "posix1version", CTLTYPE_INT }, \
205 { "ngroups", CTLTYPE_INT }, \
206 { "job_control", CTLTYPE_INT }, \
207 { "saved_ids", CTLTYPE_INT }, \
208 { "boottime", CTLTYPE_STRUCT }, \
209 { "domainname", CTLTYPE_STRING }, \
210 { "maxpartitions", CTLTYPE_INT }, \
211 { "rawpartition", CTLTYPE_INT }, \
212 { "ntptime", CTLTYPE_STRUCT }, \
213 { "timex", CTLTYPE_STRUCT }, \
214 { "autonicetime", CTLTYPE_INT }, \
215 { "autoniceval", CTLTYPE_INT }, \
216 { "rtc_offset", CTLTYPE_INT }, \
217 { "root_device", CTLTYPE_STRING }, \
218 { "msgbufsize", CTLTYPE_INT }, \
219 { "fsync", CTLTYPE_INT }, \
220 { "sysvmsg", CTLTYPE_INT }, \
221 { "sysvsem", CTLTYPE_INT }, \
222 { "sysvshm", CTLTYPE_INT }, \
223 { 0, 0 }, \
224 { "synchronized_io", CTLTYPE_INT }, \
225 { "iov_max", CTLTYPE_INT }, \
226 { "mbuf", CTLTYPE_NODE }, \
227 { "mapped_files", CTLTYPE_INT }, \
228 { "memlock", CTLTYPE_INT }, \
229 { "memlock_range", CTLTYPE_INT }, \
230 { "memory_protection", CTLTYPE_INT }, \
231 { "login_name_max", CTLTYPE_INT }, \
232 { "defcorename", CTLTYPE_STRING }, \
233 { "logsigexit", CTLTYPE_INT }, \
234 { "proc2", CTLTYPE_STRUCT }, \
235 { "proc_args", CTLTYPE_STRING }, \
236 { "fscale", CTLTYPE_INT }, \
237 { "ccpu", CTLTYPE_INT }, \
238 { "cp_time", CTLTYPE_STRUCT }, \
239 { "sysvipc_info", CTLTYPE_STRUCT }, \
240 { "msgbuf", CTLTYPE_STRUCT }, \
241 { "consdev", CTLTYPE_STRUCT }, \
242 { "maxptys", CTLTYPE_INT }, \
243 { "pipe", CTLTYPE_NODE }, \
244 { "maxphys", CTLTYPE_INT }, \
245 { "sbmax", CTLTYPE_INT }, \
246 { "tkstat", CTLTYPE_NODE }, \
247 { "monotonic_clock", CTLTYPE_INT }, \
248 }
249
250 /*
251 * KERN_PROC subtypes
252 */
253 #define KERN_PROC_ALL 0 /* everything */
254 #define KERN_PROC_PID 1 /* by process id */
255 #define KERN_PROC_PGRP 2 /* by process group id */
256 #define KERN_PROC_SESSION 3 /* by session of pid */
257 #define KERN_PROC_TTY 4 /* by controlling tty */
258 #define KERN_PROC_UID 5 /* by effective uid */
259 #define KERN_PROC_RUID 6 /* by real uid */
260 #define KERN_PROC_GID 7 /* by effective gid */
261 #define KERN_PROC_RGID 8 /* by real gid */
262
263 /*
264 * KERN_PROC_TTY sub-subtypes
265 */
266 #define KERN_PROC_TTY_NODEV NODEV /* no controlling tty */
267 #define KERN_PROC_TTY_REVOKE ((dev_t)-2) /* revoked tty */
268
269 /*
270 * KERN_PROC subtype ops return arrays of augmented proc structures:
271 */
272 #if 0
273 /* Not in gxemul */
274 struct kinfo_proc {
275 struct proc kp_proc; /* proc structure */
276 struct eproc {
277 struct proc *e_paddr; /* address of proc */
278 struct session *e_sess; /* session pointer */
279 struct pcred e_pcred; /* process credentials */
280 struct ucred e_ucred; /* current credentials */
281 struct vmspace e_vm; /* address space */
282 pid_t e_ppid; /* parent process id */
283 pid_t e_pgid; /* process group id */
284 short e_jobc; /* job control counter */
285 dev_t e_tdev; /* controlling tty dev */
286 pid_t e_tpgid; /* tty process group id */
287 struct session *e_tsess; /* tty session pointer */
288 #define WMESGLEN 8
289 char e_wmesg[WMESGLEN]; /* wchan message */
290 segsz_t e_xsize; /* text size */
291 short e_xrssize; /* text rss */
292 short e_xccount; /* text references */
293 short e_xswrss;
294 long e_flag;
295 #define EPROC_CTTY 0x01 /* controlling tty vnode active */
296 #define EPROC_SLEADER 0x02 /* session leader */
297 char e_login[MAXLOGNAME]; /* setlogin() name */
298 pid_t e_sid; /* session id */
299 long e_spare[3];
300 } kp_eproc;
301 };
302 #endif
303
304 /*
305 * KERN_PROC2 subtype ops return arrays of relatively fixed size
306 * structures of process info. Use 8 byte alignment, and new
307 * elements should only be added to the end of this structure so
308 * binary compatibility can be preserved.
309 */
310 #define KI_NGROUPS 16
311 #define KI_MAXCOMLEN 24 /* extra for 8 byte alignment */
312 #define KI_WMESGLEN 8
313 #define KI_MAXLOGNAME 24 /* extra for 8 byte alignment */
314
315 #define KI_NOCPU (~(u_int64_t)0)
316
317 typedef struct {
318 u_int32_t __bits[4];
319 } ki_sigset_t;
320
321 #if 0
322 /* Not in gxemul */
323 struct kinfo_proc2 {
324 u_int64_t p_forw; /* PTR: linked run/sleep queue. */
325 u_int64_t p_back;
326 u_int64_t p_paddr; /* PTR: address of proc */
327
328 u_int64_t p_addr; /* PTR: Kernel virtual addr of u-area */
329 u_int64_t p_fd; /* PTR: Ptr to open files structure. */
330 u_int64_t p_cwdi; /* PTR: cdir/rdir/cmask info */
331 u_int64_t p_stats; /* PTR: Accounting/statistics */
332 u_int64_t p_limit; /* PTR: Process limits. */
333 u_int64_t p_vmspace; /* PTR: Address space. */
334 u_int64_t p_sigacts; /* PTR: Signal actions, state */
335 u_int64_t p_sess; /* PTR: session pointer */
336 u_int64_t p_tsess; /* PTR: tty session pointer */
337 u_int64_t p_ru; /* PTR: Exit information. XXX */
338
339 int32_t p_eflag; /* LONG: extra kinfo_proc2 flags */
340 int32_t p_exitsig; /* INT: signal to sent to parent on exit */
341 int32_t p_flag; /* INT: P_* flags. */
342
343 int32_t p_pid; /* PID_T: Process identifier. */
344 int32_t p_ppid; /* PID_T: Parent process id */
345 int32_t p_sid; /* PID_T: session id */
346 int32_t p__pgid; /* PID_T: process group id */
347 /* XXX: <sys/proc.h> hijacks p_pgid */
348 int32_t p_tpgid; /* PID_T: tty process group id */
349
350 u_int32_t p_uid; /* UID_T: effective user id */
351 u_int32_t p_ruid; /* UID_T: real user id */
352 u_int32_t p_gid; /* GID_T: effective group id */
353 u_int32_t p_rgid; /* GID_T: real group id */
354
355 u_int32_t p_groups[KI_NGROUPS]; /* GID_T: groups */
356 int16_t p_ngroups; /* SHORT: number of groups */
357
358 int16_t p_jobc; /* SHORT: job control counter */
359 u_int32_t p_tdev; /* DEV_T: controlling tty dev */
360
361 u_int32_t p_estcpu; /* U_INT: Time averaged value of p_cpticks. */
362 u_int32_t p_rtime_sec; /* STRUCT TIMEVAL: Real time. */
363 u_int32_t p_rtime_usec; /* STRUCT TIMEVAL: Real time. */
364 int32_t p_cpticks; /* INT: Ticks of cpu time. */
365 u_int32_t p_pctcpu; /* FIXPT_T: %cpu for this process during p_swtime */
366 u_int32_t p_swtime; /* U_INT: Time swapped in or out. */
367 u_int32_t p_slptime; /* U_INT: Time since last blocked. */
368 int32_t p_schedflags; /* INT: PSCHED_* flags */
369
370 u_int64_t p_uticks; /* U_QUAD_T: Statclock hits in user mode. */
371 u_int64_t p_sticks; /* U_QUAD_T: Statclock hits in system mode. */
372 u_int64_t p_iticks; /* U_QUAD_T: Statclock hits processing intr. */
373
374 u_int64_t p_tracep; /* PTR: Trace to vnode or file */
375 int32_t p_traceflag; /* INT: Kernel trace points. */
376
377 int32_t p_holdcnt; /* INT: If non-zero, don't swap. */
378
379 ki_sigset_t p_siglist; /* SIGSET_T: Signals arrived but not delivered. */
380 ki_sigset_t p_sigmask; /* SIGSET_T: Current signal mask. */
381 ki_sigset_t p_sigignore; /* SIGSET_T: Signals being ignored. */
382 ki_sigset_t p_sigcatch; /* SIGSET_T: Signals being caught by user. */
383
384 int8_t p_stat; /* CHAR: S* process status. */
385 u_int8_t p_priority; /* U_CHAR: Process priority. */
386 u_int8_t p_usrpri; /* U_CHAR: User-priority based on p_cpu and p_nice. */
387 u_int8_t p_nice; /* U_CHAR: Process "nice" value. */
388
389 u_int16_t p_xstat; /* U_SHORT: Exit status for wait; also stop signal. */
390 u_int16_t p_acflag; /* U_SHORT: Accounting flags. */
391
392 char p_comm[KI_MAXCOMLEN];
393
394 char p_wmesg[KI_WMESGLEN]; /* wchan message */
395 u_int64_t p_wchan; /* PTR: sleep address. */
396
397 char p_login[KI_MAXLOGNAME]; /* setlogin() name */
398
399 int32_t p_vm_rssize; /* SEGSZ_T: current resident set size in pages */
400 int32_t p_vm_tsize; /* SEGSZ_T: text size (pages) */
401 int32_t p_vm_dsize; /* SEGSZ_T: data size (pages) */
402 int32_t p_vm_ssize; /* SEGSZ_T: stack size (pages) */
403
404 int64_t p_uvalid; /* CHAR: following p_u* members from struct user are valid */
405 /* XXX 64 bits for alignment */
406 u_int32_t p_ustart_sec; /* STRUCT TIMEVAL: starting time. */
407 u_int32_t p_ustart_usec; /* STRUCT TIMEVAL: starting time. */
408
409 u_int32_t p_uutime_sec; /* STRUCT TIMEVAL: user time. */
410 u_int32_t p_uutime_usec; /* STRUCT TIMEVAL: user time. */
411 u_int32_t p_ustime_sec; /* STRUCT TIMEVAL: system time. */
412 u_int32_t p_ustime_usec; /* STRUCT TIMEVAL: system time. */
413
414 u_int64_t p_uru_maxrss; /* LONG: max resident set size. */
415 u_int64_t p_uru_ixrss; /* LONG: integral shared memory size. */
416 u_int64_t p_uru_idrss; /* LONG: integral unshared data ". */
417 u_int64_t p_uru_isrss; /* LONG: integral unshared stack ". */
418 u_int64_t p_uru_minflt; /* LONG: page reclaims. */
419 u_int64_t p_uru_majflt; /* LONG: page faults. */
420 u_int64_t p_uru_nswap; /* LONG: swaps. */
421 u_int64_t p_uru_inblock; /* LONG: block input operations. */
422 u_int64_t p_uru_oublock; /* LONG: block output operations. */
423 u_int64_t p_uru_msgsnd; /* LONG: messages sent. */
424 u_int64_t p_uru_msgrcv; /* LONG: messages received. */
425 u_int64_t p_uru_nsignals; /* LONG: signals received. */
426 u_int64_t p_uru_nvcsw; /* LONG: voluntary context switches. */
427 u_int64_t p_uru_nivcsw; /* LONG: involuntary ". */
428
429 u_int32_t p_uctime_sec; /* STRUCT TIMEVAL: child u+s time. */
430 u_int32_t p_uctime_usec; /* STRUCT TIMEVAL: child u+s time. */
431 u_int64_t p_cpuid; /* LONG: cpu id */
432 };
433 #endif
434
435 /*
436 * KERN_PROC_ARGS subtypes
437 */
438 #define KERN_PROC_ARGV 1 /* argv */
439 #define KERN_PROC_NARGV 2 /* number of strings in above */
440 #define KERN_PROC_ENV 3 /* environ */
441 #define KERN_PROC_NENV 4 /* number of strings in above */
442
443 /*
444 * KERN_SYSVIPC_INFO subtypes
445 */
446 #define KERN_SYSVIPC_MSG_INFO 1 /* msginfo and msqid_ds */
447 #define KERN_SYSVIPC_SEM_INFO 2 /* seminfo and semid_ds */
448 #define KERN_SYSVIPC_SHM_INFO 3 /* shminfo and shmid_ds */
449
450 /*
451 * tty counter sysctl variables
452 */
453 #define KERN_TKSTAT_NIN 1 /* total input character */
454 #define KERN_TKSTAT_NOUT 2 /* total output character */
455 #define KERN_TKSTAT_CANCC 3 /* canonical input character */
456 #define KERN_TKSTAT_RAWCC 4 /* raw input character */
457 #define KERN_TKSTAT_MAXID 5 /* number of valid TKSTAT ids */
458
459 #define KERN_TKSTAT_NAMES { \
460 { 0, 0 }, \
461 { "nin", CTLTYPE_QUAD }, \
462 { "nout", CTLTYPE_QUAD }, \
463 { "cancc", CTLTYPE_QUAD }, \
464 { "rawcc", CTLTYPE_QUAD }, \
465 }
466
467
468 /*
469 * CTL_HW identifiers
470 */
471 #define HW_MACHINE 1 /* string: machine class */
472 #define HW_MODEL 2 /* string: specific machine model */
473 #define HW_NCPU 3 /* int: number of cpus */
474 #define HW_BYTEORDER 4 /* int: machine byte order */
475 #define HW_PHYSMEM 5 /* int: total memory */
476 #define HW_USERMEM 6 /* int: non-kernel memory */
477 #define HW_PAGESIZE 7 /* int: software page size */
478 #define HW_DISKNAMES 8 /* string: disk drive names */
479 #define HW_DISKSTATS 9 /* struct: diskstats[] */
480 #define HW_MACHINE_ARCH 10 /* string: machine architecture */
481 #define HW_ALIGNBYTES 11 /* int: ALIGNBYTES for the kernel */
482 #define HW_CNMAGIC 12 /* string: console magic sequence(s) */
483 #define HW_MAXID 13 /* number of valid hw ids */
484
485 #define CTL_HW_NAMES { \
486 { 0, 0 }, \
487 { "machine", CTLTYPE_STRING }, \
488 { "model", CTLTYPE_STRING }, \
489 { "ncpu", CTLTYPE_INT }, \
490 { "byteorder", CTLTYPE_INT }, \
491 { "physmem", CTLTYPE_INT }, \
492 { "usermem", CTLTYPE_INT }, \
493 { "pagesize", CTLTYPE_INT }, \
494 { "disknames", CTLTYPE_STRING }, \
495 { "diskstats", CTLTYPE_STRUCT }, \
496 { "machine_arch", CTLTYPE_STRING }, \
497 { "alignbytes", CTLTYPE_INT }, \
498 { "cnmagic", CTLTYPE_STRING }, \
499 }
500
501 /*
502 * CTL_USER definitions
503 */
504 #define USER_CS_PATH 1 /* string: _CS_PATH */
505 #define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */
506 #define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */
507 #define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */
508 #define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */
509 #define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */
510 #define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */
511 #define USER_LINE_MAX 8 /* int: LINE_MAX */
512 #define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */
513 #define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */
514 #define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */
515 #define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */
516 #define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */
517 #define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */
518 #define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */
519 #define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */
520 #define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */
521 #define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */
522 #define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */
523 #define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
524 #define USER_MAXID 21 /* number of valid user ids */
525
526 #define CTL_USER_NAMES { \
527 { 0, 0 }, \
528 { "cs_path", CTLTYPE_STRING }, \
529 { "bc_base_max", CTLTYPE_INT }, \
530 { "bc_dim_max", CTLTYPE_INT }, \
531 { "bc_scale_max", CTLTYPE_INT }, \
532 { "bc_string_max", CTLTYPE_INT }, \
533 { "coll_weights_max", CTLTYPE_INT }, \
534 { "expr_nest_max", CTLTYPE_INT }, \
535 { "line_max", CTLTYPE_INT }, \
536 { "re_dup_max", CTLTYPE_INT }, \
537 { "posix2_version", CTLTYPE_INT }, \
538 { "posix2_c_bind", CTLTYPE_INT }, \
539 { "posix2_c_dev", CTLTYPE_INT }, \
540 { "posix2_char_term", CTLTYPE_INT }, \
541 { "posix2_fort_dev", CTLTYPE_INT }, \
542 { "posix2_fort_run", CTLTYPE_INT }, \
543 { "posix2_localedef", CTLTYPE_INT }, \
544 { "posix2_sw_dev", CTLTYPE_INT }, \
545 { "posix2_upe", CTLTYPE_INT }, \
546 { "stream_max", CTLTYPE_INT }, \
547 { "tzname_max", CTLTYPE_INT }, \
548 }
549
550 /*
551 * CTL_DDB definitions
552 */
553 #define DDBCTL_RADIX 1 /* int: Input and output radix */
554 #define DDBCTL_MAXOFF 2 /* int: max symbol offset */
555 #define DDBCTL_MAXWIDTH 3 /* int: width of the display line */
556 #define DDBCTL_LINES 4 /* int: number of display lines */
557 #define DDBCTL_TABSTOPS 5 /* int: tab width */
558 #define DDBCTL_ONPANIC 6 /* int: DDB on panic if non-zero */
559 #define DDBCTL_FROMCONSOLE 7 /* int: DDB via console if non-zero */
560 #define DDBCTL_MAXID 8 /* number of valid DDB ids */
561
562 #define CTL_DDB_NAMES { \
563 { 0, 0 }, \
564 { "radix", CTLTYPE_INT }, \
565 { "maxoff", CTLTYPE_INT }, \
566 { "maxwidth", CTLTYPE_INT }, \
567 { "lines", CTLTYPE_INT }, \
568 { "tabstops", CTLTYPE_INT }, \
569 { "onpanic", CTLTYPE_INT }, \
570 { "fromconsole", CTLTYPE_INT }, \
571 }
572
573 /*
574 * CTL_DEBUG definitions
575 *
576 * Second level identifier specifies which debug variable.
577 * Third level identifier specifies which stucture component.
578 */
579 #define CTL_DEBUG_NAME 0 /* string: variable name */
580 #define CTL_DEBUG_VALUE 1 /* int: variable value */
581 #define CTL_DEBUG_MAXID 20
582
583 /*
584 * CTL_PROC subtype. Either a PID, or a magic value for the current proc.
585 */
586
587 #define PROC_CURPROC (~((u_int)1 << 31))
588
589 /*
590 * CTL_PROC tree: either corename (string), or a limit
591 * (rlimit.<type>.{hard,soft}, int).
592 */
593 #define PROC_PID_CORENAME 1
594 #define PROC_PID_LIMIT 2
595 #define PROC_PID_MAXID 3
596
597 #define PROC_PID_NAMES { \
598 { 0, 0 }, \
599 { "corename", CTLTYPE_STRING }, \
600 { "rlimit", CTLTYPE_NODE }, \
601 }
602
603 /* Limit types from <sys/resources.h> */
604 #define PROC_PID_LIMIT_CPU (RLIMIT_CPU+1)
605 #define PROC_PID_LIMIT_FSIZE (RLIMIT_FSIZE+1)
606 #define PROC_PID_LIMIT_DATA (RLIMIT_DATA+1)
607 #define PROC_PID_LIMIT_STACK (RLIMIT_STACK+1)
608 #define PROC_PID_LIMIT_CORE (RLIMIT_CORE+1)
609 #define PROC_PID_LIMIT_RSS (RLIMIT_RSS+1)
610 #define PROC_PID_LIMIT_MEMLOCK (RLIMIT_MEMLOCK+1)
611 #define PROC_PID_LIMIT_NPROC (RLIMIT_NPROC+1)
612 #define PROC_PID_LIMIT_NOFILE (RLIMIT_NOFILE+1)
613 #define PROC_PID_LIMIT_MAXID 10
614
615 #define PROC_PID_LIMIT_NAMES { \
616 { 0, 0 }, \
617 { "cputime", CTLTYPE_NODE }, \
618 { "filesize", CTLTYPE_NODE }, \
619 { "datasize", CTLTYPE_NODE }, \
620 { "stacksize", CTLTYPE_NODE }, \
621 { "coredumpsize", CTLTYPE_NODE }, \
622 { "memoryuse", CTLTYPE_NODE }, \
623 { "memorylocked", CTLTYPE_NODE }, \
624 { "maxproc", CTLTYPE_NODE }, \
625 { "descriptors", CTLTYPE_NODE }, \
626 }
627 /* for each type, either hard or soft value */
628 #define PROC_PID_LIMIT_TYPE_SOFT 1
629 #define PROC_PID_LIMIT_TYPE_HARD 2
630 #define PROC_PID_LIMIT_TYPE_MAXID 3
631
632 #define PROC_PID_LIMIT_TYPE_NAMES { \
633 {0, 0}, \
634 { "soft", CTLTYPE_QUAD }, \
635 { "hard", CTLTYPE_QUAD }, \
636 }
637
638 /*
639 * CTL_EMUL definitions
640 *
641 * Second level identifier specifies which emulation variable.
642 * Subsequent levels are specified in the emulations themselves.
643 */
644 #define EMUL_LINUX 1
645
646 #define EMUL_MAXID 2
647 #define CTL_EMUL_NAMES { \
648 { 0, 0 }, \
649 { "linux", CTLTYPE_NODE }, \
650 }
651
652 #ifdef _KERNEL
653 /*
654 * CTL_DEBUG variables.
655 *
656 * These are declared as separate variables so that they can be
657 * individually initialized at the location of their associated
658 * variable. The loader prevents multiple use by issuing errors
659 * if a variable is initialized in more than one place. They are
660 * aggregated into an array in debug_sysctl(), so that it can
661 * conveniently locate them when querried. If more debugging
662 * variables are added, they must also be declared here and also
663 * entered into the array.
664 */
665 struct ctldebug {
666 char *debugname; /* name of debugging variable */
667 int *debugvar; /* pointer to debugging variable */
668 };
669 #ifdef DEBUG
670 extern struct ctldebug debug0, debug1, debug2, debug3, debug4;
671 extern struct ctldebug debug5, debug6, debug7, debug8, debug9;
672 extern struct ctldebug debug10, debug11, debug12, debug13, debug14;
673 extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
674 #endif /* DEBUG */
675
676 /*
677 * Internal sysctl function calling convention:
678 *
679 * (*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen);
680 *
681 * The name parameter points at the next component of the name to be
682 * interpreted. The namelen parameter is the number of integers in
683 * the name.
684 */
685 typedef int (sysctlfn)
686 (int *, u_int, void *, size_t *, void *, size_t, struct proc *);
687
688 int sysctl_int(void *, size_t *, void *, size_t, int *);
689 int sysctl_rdint(void *, size_t *, void *, int);
690 int sysctl_quad(void *, size_t *, void *, size_t, quad_t *);
691 int sysctl_rdquad(void *, size_t *, void *, quad_t);
692 int sysctl_string(void *, size_t *, void *, size_t, char *, int);
693 int sysctl_rdstring(void *, size_t *, void *, const char *);
694 int sysctl_struct(void *, size_t *, void *, size_t, void *, int);
695 int sysctl_rdstruct(void *, size_t *, void *, const void *, int);
696 int sysctl_rdminstruct(void *, size_t *, void *, const void *, int);
697 int sysctl_clockrate(void *, size_t *);
698 int sysctl_disknames(void *, size_t *);
699 int sysctl_diskstats(int *, u_int, void *, size_t *);
700 int sysctl_vnode(char *, size_t *, struct proc *);
701 int sysctl_ntptime(void *, size_t *);
702 #ifdef GPROF
703 int sysctl_doprof(int *, u_int, void *, size_t *, void *, size_t);
704 #endif
705 int sysctl_dombuf(int *, u_int, void *, size_t *, void *, size_t);
706
707 void fill_eproc(struct proc *, struct eproc *);
708
709 int kern_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
710 int hw_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
711 int proc_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
712 #ifdef DEBUG
713 int debug_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
714 #endif
715 int net_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
716 int cpu_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
717 int emul_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
718
719 /* ddb_sysctl() declared in ddb_var.h */
720
721 void sysctl_init(void);
722
723 #ifdef __SYSCTL_PRIVATE
724 extern struct lock sysctl_memlock;
725 #endif
726
727 #else /* !_KERNEL */
728 /* #include <sys/cdefs.h> */
729
730 /* __BEGIN_DECLS
731 int sysctl __P((int *, u_int, void *, size_t *, const void *, size_t));
732 __END_DECLS */
733 #endif /* _KERNEL */
734 #endif /* !NETBSD_SYS_SYSCTL_H_ */

  ViewVC Help
Powered by ViewVC 1.1.26