Annotation of sys/sys/sysctl.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: sysctl.h,v 1.91 2007/04/12 22:14:15 tedu Exp $ */
2: /* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd 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. Neither the name of the University nor the names of its contributors
20: * may be used to endorse or promote products derived from this software
21: * without specific prior written permission.
22: *
23: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33: * SUCH DAMAGE.
34: *
35: * @(#)sysctl.h 8.2 (Berkeley) 3/30/95
36: */
37:
38: #ifndef _SYS_SYSCTL_H_
39: #define _SYS_SYSCTL_H_
40:
41: /*
42: * These are for the eproc structure defined below.
43: */
44: #ifndef _KERNEL
45: #include <sys/time.h>
46: #include <sys/ucred.h>
47: #include <sys/proc.h>
48: #include <sys/resource.h>
49: #endif
50:
51: #include <sys/resourcevar.h> /* XXX */
52:
53: #include <uvm/uvm_extern.h>
54:
55: /*
56: * Definitions for sysctl call. The sysctl call uses a hierarchical name
57: * for objects that can be examined or modified. The name is expressed as
58: * a sequence of integers. Like a file path name, the meaning of each
59: * component depends on its place in the hierarchy. The top-level and kern
60: * identifiers are defined here, and other identifiers are defined in the
61: * respective subsystem header files.
62: */
63:
64: #define CTL_MAXNAME 12 /* largest number of components supported */
65:
66: /*
67: * Each subsystem defined by sysctl defines a list of variables
68: * for that subsystem. Each name is either a node with further
69: * levels defined below it, or it is a leaf of some particular
70: * type given below. Each sysctl level defines a set of name/type
71: * pairs to be used by sysctl(1) in manipulating the subsystem.
72: */
73: struct ctlname {
74: char *ctl_name; /* subsystem name */
75: int ctl_type; /* type of name */
76: };
77: #define CTLTYPE_NODE 1 /* name is a node */
78: #define CTLTYPE_INT 2 /* name describes an integer */
79: #define CTLTYPE_STRING 3 /* name describes a string */
80: #define CTLTYPE_QUAD 4 /* name describes a 64-bit number */
81: #define CTLTYPE_STRUCT 5 /* name describes a structure */
82:
83: /*
84: * Top-level identifiers
85: */
86: #define CTL_UNSPEC 0 /* unused */
87: #define CTL_KERN 1 /* "high kernel": proc, limits */
88: #define CTL_VM 2 /* virtual memory */
89: #define CTL_FS 3 /* file system, mount type is next */
90: #define CTL_NET 4 /* network, see socket.h */
91: #define CTL_DEBUG 5 /* debugging parameters */
92: #define CTL_HW 6 /* generic cpu/io */
93: #define CTL_MACHDEP 7 /* machine dependent */
94: #define CTL_USER 8 /* user-level */
95: #define CTL_DDB 9 /* DDB user interface, see db_var.h */
96: #define CTL_VFS 10 /* VFS sysctl's */
97: #define CTL_MAXID 11 /* number of valid top-level ids */
98:
99: #define CTL_NAMES { \
100: { 0, 0 }, \
101: { "kern", CTLTYPE_NODE }, \
102: { "vm", CTLTYPE_NODE }, \
103: { "fs", 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: { "vfs", CTLTYPE_NODE }, \
111: }
112:
113: /*
114: * CTL_KERN identifiers
115: */
116: #define KERN_OSTYPE 1 /* string: system version */
117: #define KERN_OSRELEASE 2 /* string: system release */
118: #define KERN_OSREV 3 /* int: system revision */
119: #define KERN_VERSION 4 /* string: compile time info */
120: #define KERN_MAXVNODES 5 /* int: max vnodes */
121: #define KERN_MAXPROC 6 /* int: max processes */
122: #define KERN_MAXFILES 7 /* int: max open files */
123: #define KERN_ARGMAX 8 /* int: max arguments to exec */
124: #define KERN_SECURELVL 9 /* int: system security level */
125: #define KERN_HOSTNAME 10 /* string: hostname */
126: #define KERN_HOSTID 11 /* int: host identifier */
127: #define KERN_CLOCKRATE 12 /* struct: struct clockinfo */
128: #define KERN_VNODE 13 /* struct: vnode structures */
129: #define KERN_PROC 14 /* struct: process entries */
130: #define KERN_FILE 15 /* struct: file entries */
131: #define KERN_PROF 16 /* node: kernel profiling info */
132: #define KERN_POSIX1 17 /* int: POSIX.1 version */
133: #define KERN_NGROUPS 18 /* int: # of supplemental group ids */
134: #define KERN_JOB_CONTROL 19 /* int: is job control available */
135: #define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */
136: #define KERN_BOOTTIME 21 /* struct: time kernel was booted */
137: #define KERN_DOMAINNAME 22 /* string: (YP) domainname */
138: #define KERN_MAXPARTITIONS 23 /* int: number of partitions/disk */
139: #define KERN_RAWPARTITION 24 /* int: raw partition number */
140: /*define gap 25 */
141: /*define gap 26 */
142: #define KERN_OSVERSION 27 /* string: kernel build version */
143: #define KERN_SOMAXCONN 28 /* int: listen queue maximum */
144: #define KERN_SOMINCONN 29 /* int: half-open controllable param */
145: #define KERN_USERMOUNT 30 /* int: users may mount filesystems */
146: #define KERN_RND 31 /* struct: rnd(4) statistics */
147: #define KERN_NOSUIDCOREDUMP 32 /* int: no setuid coredumps ever */
148: #define KERN_FSYNC 33 /* int: file synchronization support */
149: #define KERN_SYSVMSG 34 /* int: SysV message queue suppoprt */
150: #define KERN_SYSVSEM 35 /* int: SysV semaphore support */
151: #define KERN_SYSVSHM 36 /* int: SysV shared memory support */
152: #define KERN_ARND 37 /* int: random integer from arc4rnd */
153: #define KERN_MSGBUFSIZE 38 /* int: size of message buffer */
154: #define KERN_MALLOCSTATS 39 /* node: malloc statistics */
155: #define KERN_CPTIME 40 /* array: cp_time */
156: #define KERN_NCHSTATS 41 /* struct: vfs cache statistics */
157: #define KERN_FORKSTAT 42 /* struct: fork statistics */
158: #define KERN_NSELCOLL 43 /* int: select(2) collisions */
159: #define KERN_TTY 44 /* node: tty information */
160: #define KERN_CCPU 45 /* int: ccpu */
161: #define KERN_FSCALE 46 /* int: fscale */
162: #define KERN_NPROCS 47 /* int: number of processes */
163: #define KERN_MSGBUF 48 /* message buffer, KERN_MSGBUFSIZE */
164: #define KERN_POOL 49 /* struct: pool information */
165: #define KERN_STACKGAPRANDOM 50 /* int: stackgap_random */
166: #define KERN_SYSVIPC_INFO 51 /* struct: SysV sem/shm/msg info */
167: #define KERN_USERCRYPTO 52 /* int: usercrypto */
168: #define KERN_CRYPTODEVALLOWSOFT 53 /* int: cryptodevallowsoft */
169: #define KERN_SPLASSERT 54 /* int: splassert */
170: #define KERN_PROC_ARGS 55 /* node: proc args and env */
171: #define KERN_NFILES 56 /* int: number of open files */
172: #define KERN_TTYCOUNT 57 /* int: number of tty devices */
173: #define KERN_NUMVNODES 58 /* int: number of vnodes in use */
174: #define KERN_MBSTAT 59 /* struct: mbuf statistics */
175: #define KERN_USERASYMCRYPTO 60 /* int: usercrypto */
176: #define KERN_SEMINFO 61 /* struct: SysV struct seminfo */
177: #define KERN_SHMINFO 62 /* struct: SysV struct shminfo */
178: #define KERN_INTRCNT 63 /* node: interrupt counters */
179: #define KERN_WATCHDOG 64 /* node: watchdog */
180: #define KERN_EMUL 65 /* node: emuls */
181: #define KERN_PROC2 66 /* struct: process entries */
182: #define KERN_MAXCLUSTERS 67 /* number of mclusters */
183: #define KERN_EVCOUNT 68 /* node: event counters */
184: #define KERN_TIMECOUNTER 69 /* node: timecounter */
185: #define KERN_MAXLOCKSPERUID 70 /* int: locks per uid */
186: #define KERN_CPTIME2 71 /* array: cp_time2 */
187: #define KERN_MAXID 72 /* number of valid kern ids */
188:
189: #define CTL_KERN_NAMES { \
190: { 0, 0 }, \
191: { "ostype", CTLTYPE_STRING }, \
192: { "osrelease", CTLTYPE_STRING }, \
193: { "osrevision", CTLTYPE_INT }, \
194: { "version", CTLTYPE_STRING }, \
195: { "maxvnodes", CTLTYPE_INT }, \
196: { "maxproc", CTLTYPE_INT }, \
197: { "maxfiles", CTLTYPE_INT }, \
198: { "argmax", CTLTYPE_INT }, \
199: { "securelevel", CTLTYPE_INT }, \
200: { "hostname", CTLTYPE_STRING }, \
201: { "hostid", CTLTYPE_INT }, \
202: { "clockrate", CTLTYPE_STRUCT }, \
203: { "vnode", CTLTYPE_STRUCT }, \
204: { "proc", CTLTYPE_STRUCT }, \
205: { "file", CTLTYPE_STRUCT }, \
206: { "profiling", CTLTYPE_NODE }, \
207: { "posix1version", CTLTYPE_INT }, \
208: { "ngroups", CTLTYPE_INT }, \
209: { "job_control", CTLTYPE_INT }, \
210: { "saved_ids", CTLTYPE_INT }, \
211: { "boottime", CTLTYPE_STRUCT }, \
212: { "domainname", CTLTYPE_STRING }, \
213: { "maxpartitions", CTLTYPE_INT }, \
214: { "rawpartition", CTLTYPE_INT }, \
215: { "gap", 0 }, \
216: { "gap", 0 }, \
217: { "osversion", CTLTYPE_STRING }, \
218: { "somaxconn", CTLTYPE_INT }, \
219: { "sominconn", CTLTYPE_INT }, \
220: { "usermount", CTLTYPE_INT }, \
221: { "random", CTLTYPE_STRUCT }, \
222: { "nosuidcoredump", CTLTYPE_INT }, \
223: { "fsync", CTLTYPE_INT }, \
224: { "sysvmsg", CTLTYPE_INT }, \
225: { "sysvsem", CTLTYPE_INT }, \
226: { "sysvshm", CTLTYPE_INT }, \
227: { "arandom", CTLTYPE_INT }, \
228: { "msgbufsize", CTLTYPE_INT }, \
229: { "malloc", CTLTYPE_NODE }, \
230: { "cp_time", CTLTYPE_STRUCT }, \
231: { "nchstats", CTLTYPE_STRUCT }, \
232: { "forkstat", CTLTYPE_STRUCT }, \
233: { "nselcoll", CTLTYPE_INT }, \
234: { "tty", CTLTYPE_NODE }, \
235: { "ccpu", CTLTYPE_INT }, \
236: { "fscale", CTLTYPE_INT }, \
237: { "nprocs", CTLTYPE_INT }, \
238: { "msgbuf", CTLTYPE_STRUCT }, \
239: { "pool", CTLTYPE_NODE }, \
240: { "stackgap_random", CTLTYPE_INT }, \
241: { "sysvipc_info", CTLTYPE_INT }, \
242: { "usercrypto", CTLTYPE_INT }, \
243: { "cryptodevallowsoft", CTLTYPE_INT }, \
244: { "splassert", CTLTYPE_INT }, \
245: { "procargs", CTLTYPE_NODE }, \
246: { "nfiles", CTLTYPE_INT }, \
247: { "ttycount", CTLTYPE_INT }, \
248: { "numvnodes", CTLTYPE_INT }, \
249: { "mbstat", CTLTYPE_STRUCT }, \
250: { "userasymcrypto", CTLTYPE_INT }, \
251: { "seminfo", CTLTYPE_STRUCT }, \
252: { "shminfo", CTLTYPE_STRUCT }, \
253: { "intrcnt", CTLTYPE_NODE }, \
254: { "watchdog", CTLTYPE_NODE }, \
255: { "emul", CTLTYPE_NODE }, \
256: { "proc2", CTLTYPE_STRUCT }, \
257: { "maxclusters", CTLTYPE_INT }, \
258: { "evcount", CTLTYPE_NODE }, \
259: { "timecounter", CTLTYPE_NODE }, \
260: { "maxlocksperuid", CTLTYPE_INT }, \
261: { "cp_time2", CTLTYPE_STRUCT }, \
262: }
263:
264: /*
265: * KERN_EMUL subtypes.
266: */
267: #define KERN_EMUL_NUM 0
268: /* Fourth level sysctl names */
269: #define KERN_EMUL_NAME 0
270: #define KERN_EMUL_ENABLED 1
271:
272:
273: /*
274: * KERN_PROC subtypes
275: */
276: #define KERN_PROC_ALL 0 /* everything but kernel threads */
277: #define KERN_PROC_PID 1 /* by process id */
278: #define KERN_PROC_PGRP 2 /* by process group id */
279: #define KERN_PROC_SESSION 3 /* by session of pid */
280: #define KERN_PROC_TTY 4 /* by controlling tty */
281: #define KERN_PROC_UID 5 /* by effective uid */
282: #define KERN_PROC_RUID 6 /* by real uid */
283: #define KERN_PROC_KTHREAD 7 /* also return kernel threads */
284:
285: /*
286: * KERN_SYSVIPC_INFO subtypes
287: */
288: #define KERN_SYSVIPC_MSG_INFO 1 /* msginfo and msqid_ds */
289: #define KERN_SYSVIPC_SEM_INFO 2 /* seminfo and semid_ds */
290: #define KERN_SYSVIPC_SHM_INFO 3 /* shminfo and shmid_ds */
291:
292: /*
293: * KERN_PROC_ARGS subtypes
294: */
295: #define KERN_PROC_ARGV 1
296: #define KERN_PROC_NARGV 2
297: #define KERN_PROC_ENV 3
298: #define KERN_PROC_NENV 4
299:
300: /*
301: * KERN_PROC subtype ops return arrays of augmented proc structures:
302: */
303: struct kinfo_proc {
304: struct proc kp_proc; /* proc structure */
305: struct eproc {
306: struct proc *e_paddr; /* address of proc */
307: struct session *e_sess; /* session pointer */
308: struct pcred e_pcred; /* process credentials */
309: struct ucred e_ucred; /* current credentials */
310: struct vmspace e_vm; /* address space */
311: struct pstats e_pstats; /* process stats */
312: int e_pstats_valid; /* pstats valid? */
313: pid_t e_ppid; /* parent process id */
314: pid_t e_pgid; /* process group id */
315: short e_jobc; /* job control counter */
316: dev_t e_tdev; /* controlling tty dev */
317: pid_t e_tpgid; /* tty process group id */
318: struct session *e_tsess; /* tty session pointer */
319: #define WMESGLEN 7
320: char e_wmesg[WMESGLEN+1]; /* wchan message */
321: segsz_t e_xsize; /* text size */
322: short e_xrssize; /* text rss */
323: short e_xccount; /* text references */
324: short e_xswrss;
325: long e_flag;
326: #define EPROC_CTTY 0x01 /* controlling tty vnode active */
327: #define EPROC_SLEADER 0x02 /* session leader */
328: char e_login[MAXLOGNAME]; /* setlogin() name */
329: #define EMULNAMELEN 7
330: char e_emul[EMULNAMELEN+1]; /* syscall emulation name */
331: rlim_t e_maxrss;
332: struct plimit *e_limit;
333: } kp_eproc;
334: };
335:
336: /*
337: * KERN_PROC2 subtype ops return arrays of relatively fixed size
338: * structures of process info. Use 8 byte alignment, and new
339: * elements should only be added to the end of this structure so
340: * binary compatibility can be preserved.
341: */
342: #define KI_NGROUPS 16
343: #define KI_MAXCOMLEN 24 /* extra for 8 byte alignment */
344: #define KI_WMESGLEN 8
345: #define KI_MAXLOGNAME 32
346: #define KI_EMULNAMELEN 8
347:
348: #define KI_NOCPU (~(u_int64_t)0)
349:
350: struct kinfo_proc2 {
351: u_int64_t p_forw; /* PTR: linked run/sleep queue. */
352: u_int64_t p_back;
353: u_int64_t p_paddr; /* PTR: address of proc */
354:
355: u_int64_t p_addr; /* PTR: Kernel virtual addr of u-area */
356: u_int64_t p_fd; /* PTR: Ptr to open files structure. */
357: u_int64_t p_stats; /* PTR: Accounting/statistics */
358: u_int64_t p_limit; /* PTR: Process limits. */
359: u_int64_t p_vmspace; /* PTR: Address space. */
360: u_int64_t p_sigacts; /* PTR: Signal actions, state */
361: u_int64_t p_sess; /* PTR: session pointer */
362: u_int64_t p_tsess; /* PTR: tty session pointer */
363: u_int64_t p_ru; /* PTR: Exit information. XXX */
364:
365: int32_t p_eflag; /* LONG: extra kinfo_proc2 flags */
366: int32_t p_exitsig; /* INT: signal to sent to parent on exit */
367: int32_t p_flag; /* INT: P_* flags. */
368:
369: int32_t p_pid; /* PID_T: Process identifier. */
370: int32_t p_ppid; /* PID_T: Parent process id */
371: int32_t p_sid; /* PID_T: session id */
372: int32_t p__pgid; /* PID_T: process group id */
373: /* XXX: <sys/proc.h> hijacks p_pgid */
374: int32_t p_tpgid; /* PID_T: tty process group id */
375:
376: u_int32_t p_uid; /* UID_T: effective user id */
377: u_int32_t p_ruid; /* UID_T: real user id */
378: u_int32_t p_gid; /* GID_T: effective group id */
379: u_int32_t p_rgid; /* GID_T: real group id */
380:
381: u_int32_t p_groups[KI_NGROUPS]; /* GID_T: groups */
382: int16_t p_ngroups; /* SHORT: number of groups */
383:
384: int16_t p_jobc; /* SHORT: job control counter */
385: u_int32_t p_tdev; /* DEV_T: controlling tty dev */
386:
387: u_int32_t p_estcpu; /* U_INT: Time averaged value of p_cpticks. */
388: u_int32_t p_rtime_sec; /* STRUCT TIMEVAL: Real time. */
389: u_int32_t p_rtime_usec; /* STRUCT TIMEVAL: Real time. */
390: int32_t p_cpticks; /* INT: Ticks of cpu time. */
391: u_int32_t p_pctcpu; /* FIXPT_T: %cpu for this process during p_swtime */
392: u_int32_t p_swtime; /* U_INT: Time swapped in or out. */
393: u_int32_t p_slptime; /* U_INT: Time since last blocked. */
394: int32_t p_schedflags; /* INT: PSCHED_* flags */
395:
396: u_int64_t p_uticks; /* U_QUAD_T: Statclock hits in user mode. */
397: u_int64_t p_sticks; /* U_QUAD_T: Statclock hits in system mode. */
398: u_int64_t p_iticks; /* U_QUAD_T: Statclock hits processing intr. */
399:
400: u_int64_t p_tracep; /* PTR: Trace to vnode or file */
401: int32_t p_traceflag; /* INT: Kernel trace points. */
402:
403: int32_t p_holdcnt; /* INT: If non-zero, don't swap. */
404:
405: int32_t p_siglist; /* INT: Signals arrived but not delivered. */
406: u_int32_t p_sigmask; /* SIGSET_T: Current signal mask. */
407: u_int32_t p_sigignore; /* SIGSET_T: Signals being ignored. */
408: u_int32_t p_sigcatch; /* SIGSET_T: Signals being caught by user. */
409:
410: int8_t p_stat; /* CHAR: S* process status (from LWP). */
411: u_int8_t p_priority; /* U_CHAR: Process priority. */
412: u_int8_t p_usrpri; /* U_CHAR: User-priority based on p_cpu and p_nice. */
413: u_int8_t p_nice; /* U_CHAR: Process "nice" value. */
414:
415: u_int16_t p_xstat; /* U_SHORT: Exit status for wait; also stop signal. */
416: u_int16_t p_acflag; /* U_SHORT: Accounting flags. */
417:
418: char p_comm[KI_MAXCOMLEN];
419:
420: char p_wmesg[KI_WMESGLEN]; /* wchan message */
421: u_int64_t p_wchan; /* PTR: sleep address. */
422:
423: char p_login[KI_MAXLOGNAME]; /* setlogin() name */
424:
425: int32_t p_vm_rssize; /* SEGSZ_T: current resident set size in pages */
426: int32_t p_vm_tsize; /* SEGSZ_T: text size (pages) */
427: int32_t p_vm_dsize; /* SEGSZ_T: data size (pages) */
428: int32_t p_vm_ssize; /* SEGSZ_T: stack size (pages) */
429:
430: int64_t p_uvalid; /* CHAR: following p_u* members from struct user are valid */
431: /* XXX 64 bits for alignment */
432: u_int32_t p_ustart_sec; /* STRUCT TIMEVAL: starting time. */
433: u_int32_t p_ustart_usec; /* STRUCT TIMEVAL: starting time. */
434:
435: u_int32_t p_uutime_sec; /* STRUCT TIMEVAL: user time. */
436: u_int32_t p_uutime_usec; /* STRUCT TIMEVAL: user time. */
437: u_int32_t p_ustime_sec; /* STRUCT TIMEVAL: system time. */
438: u_int32_t p_ustime_usec; /* STRUCT TIMEVAL: system time. */
439:
440: u_int64_t p_uru_maxrss; /* LONG: max resident set size. */
441: u_int64_t p_uru_ixrss; /* LONG: integral shared memory size. */
442: u_int64_t p_uru_idrss; /* LONG: integral unshared data ". */
443: u_int64_t p_uru_isrss; /* LONG: integral unshared stack ". */
444: u_int64_t p_uru_minflt; /* LONG: page reclaims. */
445: u_int64_t p_uru_majflt; /* LONG: page faults. */
446: u_int64_t p_uru_nswap; /* LONG: swaps. */
447: u_int64_t p_uru_inblock; /* LONG: block input operations. */
448: u_int64_t p_uru_oublock; /* LONG: block output operations. */
449: u_int64_t p_uru_msgsnd; /* LONG: messages sent. */
450: u_int64_t p_uru_msgrcv; /* LONG: messages received. */
451: u_int64_t p_uru_nsignals; /* LONG: signals received. */
452: u_int64_t p_uru_nvcsw; /* LONG: voluntary context switches. */
453: u_int64_t p_uru_nivcsw; /* LONG: involuntary ". */
454:
455: u_int32_t p_uctime_sec; /* STRUCT TIMEVAL: child u+s time. */
456: u_int32_t p_uctime_usec; /* STRUCT TIMEVAL: child u+s time. */
457: u_int64_t p_realflag; /* INT: P_* flags (not including LWPs). */
458: u_int32_t p_svuid; /* UID_T: saved user id */
459: u_int32_t p_svgid; /* GID_T: saved group id */
460: char p_emul[KI_EMULNAMELEN]; /* syscall emulation name */
461: u_int64_t p_rlim_rss_cur; /* RLIM_T: soft limit for rss */
462: u_int64_t p_cpuid; /* LONG: CPU id */
463: u_int64_t p_vm_map_size; /* VSIZE_T: virtual size */
464: };
465:
466: /*
467: * KERN_INTRCNT
468: */
469: #define KERN_INTRCNT_NUM 1 /* int: # intrcnt */
470: #define KERN_INTRCNT_CNT 2 /* node: intrcnt */
471: #define KERN_INTRCNT_NAME 3 /* node: names */
472: #define KERN_INTRCNT_VECTOR 4 /* node: interrupt vector # */
473: #define KERN_INTRCNT_MAXID 5
474:
475: #define CTL_KERN_INTRCNT_NAMES { \
476: { 0, 0 }, \
477: { "nintrcnt", CTLTYPE_INT }, \
478: { "intrcnt", CTLTYPE_NODE }, \
479: { "intrname", CTLTYPE_NODE }, \
480: }
481:
482: /*
483: * KERN_WATCHDOG
484: */
485: #define KERN_WATCHDOG_PERIOD 1 /* int: watchdog period */
486: #define KERN_WATCHDOG_AUTO 2 /* int: automatic tickle */
487: #define KERN_WATCHDOG_MAXID 3
488:
489: #define CTL_KERN_WATCHDOG_NAMES { \
490: { 0, 0 }, \
491: { "period", CTLTYPE_INT }, \
492: { "auto", CTLTYPE_INT }, \
493: }
494:
495: /*
496: * KERN_TIMECOUNTER
497: */
498: #define KERN_TIMECOUNTER_TICK 1 /* int: number of revolutions */
499: #define KERN_TIMECOUNTER_TIMESTEPWARNINGS 2 /* int: log a warning when time changes */
500: #define KERN_TIMECOUNTER_HARDWARE 3 /* string: tick hardware used */
501: #define KERN_TIMECOUNTER_CHOICE 4 /* string: tick hardware used */
502: #define KERN_TIMECOUNTER_MAXID 5
503:
504: #define CTL_KERN_TIMECOUNTER_NAMES { \
505: { 0, 0 }, \
506: { "tick", CTLTYPE_INT }, \
507: { "timestepwarnings", CTLTYPE_INT }, \
508: { "hardware", CTLTYPE_STRING }, \
509: { "choice", CTLTYPE_STRING }, \
510: }
511:
512: /*
513: * CTL_FS identifiers
514: */
515: #define FS_POSIX 1 /* POSIX flags */
516: #define FS_MAXID 2
517:
518: #define CTL_FS_NAMES { \
519: { 0, 0 }, \
520: { "posix", CTLTYPE_NODE }, \
521: }
522:
523: /*
524: * CTL_FS identifiers
525: */
526: #define FS_POSIX_SETUID 1 /* int: always clear SGID/SUID bit when owner change */
527: #define FS_POSIX_MAXID 2
528:
529: #define CTL_FS_POSIX_NAMES { \
530: { 0, 0 }, \
531: { "setuid", CTLTYPE_INT }, \
532: }
533:
534: /*
535: * CTL_HW identifiers
536: */
537: #define HW_MACHINE 1 /* string: machine class */
538: #define HW_MODEL 2 /* string: specific machine model */
539: #define HW_NCPU 3 /* int: number of cpus */
540: #define HW_BYTEORDER 4 /* int: machine byte order */
541: #define HW_PHYSMEM 5 /* int: total memory */
542: #define HW_USERMEM 6 /* int: non-kernel memory */
543: #define HW_PAGESIZE 7 /* int: software page size */
544: #define HW_DISKNAMES 8 /* strings: disk drive names */
545: #define HW_DISKSTATS 9 /* struct: diskstats[] */
546: #define HW_DISKCOUNT 10 /* int: number of disks */
547: #define HW_SENSORS 11 /* node: hardware monitors */
548: #define HW_CPUSPEED 12 /* get CPU frequency */
549: #define HW_SETPERF 13 /* set CPU performance % */
550: #define HW_VENDOR 14 /* string: vendor name */
551: #define HW_PRODUCT 15 /* string: product name */
552: #define HW_VERSION 16 /* string: hardware version */
553: #define HW_SERIALNO 17 /* string: hardware serial number */
554: #define HW_UUID 18 /* string: universal unique id */
555: #define HW_MAXID 19 /* number of valid hw ids */
556:
557: #define CTL_HW_NAMES { \
558: { 0, 0 }, \
559: { "machine", CTLTYPE_STRING }, \
560: { "model", CTLTYPE_STRING }, \
561: { "ncpu", CTLTYPE_INT }, \
562: { "byteorder", CTLTYPE_INT }, \
563: { "physmem", CTLTYPE_INT }, \
564: { "usermem", CTLTYPE_INT }, \
565: { "pagesize", CTLTYPE_INT }, \
566: { "disknames", CTLTYPE_STRING }, \
567: { "diskstats", CTLTYPE_STRUCT }, \
568: { "diskcount", CTLTYPE_INT }, \
569: { "sensors", CTLTYPE_NODE}, \
570: { "cpuspeed", CTLTYPE_INT }, \
571: { "setperf", CTLTYPE_INT }, \
572: { "vendor", CTLTYPE_STRING }, \
573: { "product", CTLTYPE_STRING }, \
574: { "version", CTLTYPE_STRING }, \
575: { "serialno", CTLTYPE_STRING }, \
576: { "uuid", CTLTYPE_STRING }, \
577: }
578:
579: /*
580: * CTL_USER definitions
581: */
582: #define USER_CS_PATH 1 /* string: _CS_PATH */
583: #define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */
584: #define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */
585: #define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */
586: #define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */
587: #define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */
588: #define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */
589: #define USER_LINE_MAX 8 /* int: LINE_MAX */
590: #define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */
591: #define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */
592: #define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */
593: #define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */
594: #define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */
595: #define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */
596: #define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */
597: #define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */
598: #define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */
599: #define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */
600: #define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */
601: #define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
602: #define USER_MAXID 21 /* number of valid user ids */
603:
604: #define CTL_USER_NAMES { \
605: { 0, 0 }, \
606: { "cs_path", CTLTYPE_STRING }, \
607: { "bc_base_max", CTLTYPE_INT }, \
608: { "bc_dim_max", CTLTYPE_INT }, \
609: { "bc_scale_max", CTLTYPE_INT }, \
610: { "bc_string_max", CTLTYPE_INT }, \
611: { "coll_weights_max", CTLTYPE_INT }, \
612: { "expr_nest_max", CTLTYPE_INT }, \
613: { "line_max", CTLTYPE_INT }, \
614: { "re_dup_max", CTLTYPE_INT }, \
615: { "posix2_version", CTLTYPE_INT }, \
616: { "posix2_c_bind", CTLTYPE_INT }, \
617: { "posix2_c_dev", CTLTYPE_INT }, \
618: { "posix2_char_term", CTLTYPE_INT }, \
619: { "posix2_fort_dev", CTLTYPE_INT }, \
620: { "posix2_fort_run", CTLTYPE_INT }, \
621: { "posix2_localedef", CTLTYPE_INT }, \
622: { "posix2_sw_dev", CTLTYPE_INT }, \
623: { "posix2_upe", CTLTYPE_INT }, \
624: { "stream_max", CTLTYPE_INT }, \
625: { "tzname_max", CTLTYPE_INT }, \
626: }
627:
628: /*
629: * CTL_DEBUG definitions
630: *
631: * Second level identifier specifies which debug variable.
632: * Third level identifier specifies which structure component.
633: */
634: #define CTL_DEBUG_NAME 0 /* string: variable name */
635: #define CTL_DEBUG_VALUE 1 /* int: variable value */
636: #define CTL_DEBUG_MAXID 20
637:
638: #ifdef _KERNEL
639: #ifdef DEBUG
640: /*
641: * CTL_DEBUG variables.
642: *
643: * These are declared as separate variables so that they can be
644: * individually initialized at the location of their associated
645: * variable. The loader prevents multiple use by issuing errors
646: * if a variable is initialized in more than one place. They are
647: * aggregated into an array in debug_sysctl(), so that it can
648: * conveniently locate them when querried. If more debugging
649: * variables are added, they must also be declared here and also
650: * entered into the array.
651: */
652: struct ctldebug {
653: char *debugname; /* name of debugging variable */
654: int *debugvar; /* pointer to debugging variable */
655: };
656: extern struct ctldebug debug0, debug1, debug2, debug3, debug4;
657: extern struct ctldebug debug5, debug6, debug7, debug8, debug9;
658: extern struct ctldebug debug10, debug11, debug12, debug13, debug14;
659: extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
660: #endif /* DEBUG */
661:
662: /*
663: * Internal sysctl function calling convention:
664: *
665: * (*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen);
666: *
667: * The name parameter points at the next component of the name to be
668: * interpreted. The namelen parameter is the number of integers in
669: * the name.
670: */
671: typedef int (sysctlfn)(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
672:
673: int sysctl_int(void *, size_t *, void *, size_t, int *);
674: int sysctl_int_lower(void *, size_t *, void *, size_t, int *);
675: int sysctl_rdint(void *, size_t *, void *, int);
676: int sysctl_int_arr(int **, int *, u_int, void *, size_t *, void *, size_t);
677: int sysctl_quad(void *, size_t *, void *, size_t, int64_t *);
678: int sysctl_rdquad(void *, size_t *, void *, int64_t);
679: int sysctl_string(void *, size_t *, void *, size_t, char *, int);
680: int sysctl_tstring(void *, size_t *, void *, size_t, char *, int);
681: int sysctl__string(void *, size_t *, void *, size_t, char *, int, int);
682: int sysctl_rdstring(void *, size_t *, void *, const char *);
683: int sysctl_rdstruct(void *, size_t *, void *, const void *, int);
684: int sysctl_struct(void *, size_t *, void *, size_t, void *, int);
685: int sysctl_file(char *, size_t *);
686: int sysctl_doproc(int *, u_int, char *, size_t *);
687: struct radix_node;
688: struct walkarg;
689: int sysctl_dumpentry(struct radix_node *, void *);
690: int sysctl_iflist(int, struct walkarg *);
691: int sysctl_rtable(int *, u_int, void *, size_t *, void *, size_t);
692: int sysctl_clockrate(char *, size_t *);
693: int sysctl_vnode(char *, size_t *, struct proc *);
694: #ifdef GPROF
695: int sysctl_doprof(int *, u_int, void *, size_t *, void *, size_t);
696: #endif
697: int sysctl_dopool(int *, u_int, char *, size_t *);
698:
699: void fill_eproc(struct proc *, struct eproc *);
700: void fill_kproc2(struct proc *, struct kinfo_proc2 *);
701:
702: int kern_sysctl(int *, u_int, void *, size_t *, void *, size_t,
703: struct proc *);
704: int hw_sysctl(int *, u_int, void *, size_t *, void *, size_t,
705: struct proc *);
706: #ifdef DEBUG
707: int debug_sysctl(int *, u_int, void *, size_t *, void *, size_t,
708: struct proc *);
709: #endif
710: int vm_sysctl(int *, u_int, void *, size_t *, void *, size_t,
711: struct proc *);
712: int fs_sysctl(int *, u_int, void *, size_t *, void *, size_t,
713: struct proc *);
714: int fs_posix_sysctl(int *, u_int, void *, size_t *, void *, size_t,
715: struct proc *);
716: int net_sysctl(int *, u_int, void *, size_t *, void *, size_t,
717: struct proc *);
718: int cpu_sysctl(int *, u_int, void *, size_t *, void *, size_t,
719: struct proc *);
720: int vfs_sysctl(int *, u_int, void *, size_t *, void *, size_t,
721: struct proc *);
722: int sysctl_sysvipc(int *, u_int, void *, size_t *);
723: int sysctl_wdog(int *, u_int, void *, size_t *, void *, size_t);
724:
725: extern int (*cpu_cpuspeed)(int *);
726: extern void (*cpu_setperf)(int);
727:
728: int bpf_sysctl(int *, u_int, void *, size_t *, void *, size_t);
729:
730: #else /* !_KERNEL */
731: #include <sys/cdefs.h>
732:
733: __BEGIN_DECLS
734: int sysctl(int *, u_int, void *, size_t *, void *, size_t);
735: __END_DECLS
736: #endif /* _KERNEL */
737: #endif /* !_SYS_SYSCTL_H_ */
CVSweb