1:
2:
3:
4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36:
37:
38: #ifndef _SYS_SYSCTL_H_
39: #define _SYS_SYSCTL_H_
40:
41: #ifndef _KERNEL
42: #include <sys/proc.h>
43: #include <sys/resource.h>
44: #endif
45:
46: #include <uvm/uvm_extern.h>
47:
48: 49: 50: 51: 52: 53: 54: 55:
56:
57: #define CTL_MAXNAME 12
58:
59: 60: 61: 62: 63: 64: 65:
66: struct ctlname {
67: char *ctl_name;
68: int ctl_type;
69: };
70: #define CTLTYPE_NODE 1
71: #define CTLTYPE_INT 2
72: #define CTLTYPE_STRING 3
73: #define CTLTYPE_QUAD 4
74: #define CTLTYPE_STRUCT 5
75:
76: 77: 78:
79: #define CTL_UNSPEC 0
80: #define CTL_KERN 1
81: #define CTL_VM 2
82: #define CTL_FS 3
83: #define CTL_NET 4
84: #define CTL_DEBUG 5
85: #define CTL_HW 6
86: #define CTL_MACHDEP 7
87: #define CTL_USER 8
88: #define CTL_DDB 9
89: #define CTL_VFS 10
90: #define CTL_MAXID 11
91:
92: #define CTL_NAMES { \
93: { 0, 0 }, \
94: { "kern", CTLTYPE_NODE }, \
95: { "vm", CTLTYPE_NODE }, \
96: { "fs", CTLTYPE_NODE }, \
97: { "net", CTLTYPE_NODE }, \
98: { "debug", CTLTYPE_NODE }, \
99: { "hw", CTLTYPE_NODE }, \
100: { "machdep", CTLTYPE_NODE }, \
101: { "user", CTLTYPE_NODE }, \
102: { "ddb", CTLTYPE_NODE }, \
103: { "vfs", CTLTYPE_NODE }, \
104: }
105:
106: 107: 108:
109: #define KERN_OSTYPE 1
110: #define KERN_OSRELEASE 2
111: #define KERN_OSREV 3
112: #define KERN_VERSION 4
113: #define KERN_MAXVNODES 5
114: #define KERN_MAXPROC 6
115: #define KERN_MAXFILES 7
116: #define KERN_ARGMAX 8
117: #define KERN_SECURELVL 9
118: #define KERN_HOSTNAME 10
119: #define KERN_HOSTID 11
120: #define KERN_CLOCKRATE 12
121: #define KERN_VNODE 13
122:
123: #define KERN_FILE 15
124: #define KERN_PROF 16
125: #define KERN_POSIX1 17
126: #define KERN_NGROUPS 18
127: #define KERN_JOB_CONTROL 19
128: #define KERN_SAVED_IDS 20
129: #define KERN_BOOTTIME 21
130: #define KERN_DOMAINNAME 22
131: #define KERN_MAXPARTITIONS 23
132: #define KERN_RAWPARTITION 24
133:
134:
135: #define KERN_OSVERSION 27
136: #define KERN_SOMAXCONN 28
137: #define KERN_SOMINCONN 29
138: #define KERN_USERMOUNT 30
139: #define KERN_RND 31
140: #define KERN_NOSUIDCOREDUMP 32
141: #define KERN_FSYNC 33
142: #define KERN_SYSVMSG 34
143: #define KERN_SYSVSEM 35
144: #define KERN_SYSVSHM 36
145: #define KERN_ARND 37
146: #define KERN_MSGBUFSIZE 38
147: #define KERN_MALLOCSTATS 39
148: #define KERN_CPTIME 40
149: #define KERN_NCHSTATS 41
150: #define KERN_FORKSTAT 42
151: #define KERN_NSELCOLL 43
152: #define KERN_TTY 44
153: #define KERN_CCPU 45
154: #define KERN_FSCALE 46
155: #define KERN_NPROCS 47
156: #define KERN_MSGBUF 48
157: #define KERN_POOL 49
158: #define KERN_STACKGAPRANDOM 50
159: #define KERN_SYSVIPC_INFO 51
160: #define KERN_USERCRYPTO 52
161: #define KERN_CRYPTODEVALLOWSOFT 53
162: #define KERN_SPLASSERT 54
163: #define KERN_PROC_ARGS 55
164: #define KERN_NFILES 56
165: #define KERN_TTYCOUNT 57
166: #define KERN_NUMVNODES 58
167: #define KERN_MBSTAT 59
168: #define KERN_USERASYMCRYPTO 60
169: #define KERN_SEMINFO 61
170: #define KERN_SHMINFO 62
171: #define KERN_INTRCNT 63
172: #define KERN_WATCHDOG 64
173: #define KERN_EMUL 65
174: #define KERN_PROC 66
175: #define KERN_MAXCLUSTERS 67
176: #define KERN_EVCOUNT 68
177: #define KERN_TIMECOUNTER 69
178: #define KERN_MAXLOCKSPERUID 70
179: #define KERN_CPTIME2 71
180: #define KERN_CACHEPCT 72
181: #define KERN_FILE2 73
182: #define KERN_RTHREADS 74
183: #define KERN_CONSDEV 75
184: #define KERN_NETLIVELOCKS 76
185: #define KERN_POOL_DEBUG 77
186: #define KERN_PROC_CWD 78
187: #define KERN_MAXID 79
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: { "gap", 0 }, \
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: { "proc", CTLTYPE_STRUCT }, \
257: { "maxclusters", CTLTYPE_INT }, \
258: { "evcount", CTLTYPE_NODE }, \
259: { "timecounter", CTLTYPE_NODE }, \
260: { "maxlocksperuid", CTLTYPE_INT }, \
261: { "cp_time2", CTLTYPE_STRUCT }, \
262: { "bufcachepercent", CTLTYPE_INT }, \
263: { "file2", CTLTYPE_STRUCT }, \
264: { "rthreads", CTLTYPE_INT }, \
265: { "consdev", CTLTYPE_STRUCT }, \
266: { "netlivelocks", CTLTYPE_INT }, \
267: { "pool_debug", CTLTYPE_INT }, \
268: { "proc_cwd", CTLTYPE_NODE }, \
269: }
270:
271: 272: 273:
274: #define KERN_EMUL_NUM 0
275:
276: #define KERN_EMUL_NAME 0
277: #define KERN_EMUL_ENABLED 1
278:
279:
280: 281: 282:
283: #define KERN_PROC_ALL 0
284: #define KERN_PROC_PID 1
285: #define KERN_PROC_PGRP 2
286: #define KERN_PROC_SESSION 3
287: #define KERN_PROC_TTY 4
288: #define KERN_PROC_UID 5
289: #define KERN_PROC_RUID 6
290: #define KERN_PROC_KTHREAD 7
291:
292: 293: 294:
295: #define KERN_SYSVIPC_MSG_INFO 1
296: #define KERN_SYSVIPC_SEM_INFO 2
297: #define KERN_SYSVIPC_SHM_INFO 3
298:
299: 300: 301:
302: #define KERN_PROC_ARGV 1
303: #define KERN_PROC_NARGV 2
304: #define KERN_PROC_ENV 3
305: #define KERN_PROC_NENV 4
306:
307: 308: 309: 310: 311: 312:
313: #define KI_NGROUPS 16
314: #define KI_MAXCOMLEN 24
315: #define KI_WMESGLEN 8
316: #define KI_MAXLOGNAME 32
317: #define KI_EMULNAMELEN 8
318:
319: #define KI_NOCPU (~(u_int64_t)0)
320:
321: struct kinfo_proc {
322: u_int64_t p_forw;
323: u_int64_t p_back;
324: u_int64_t p_paddr;
325:
326: u_int64_t p_addr;
327: u_int64_t p_fd;
328: u_int64_t p_stats;
329: u_int64_t p_limit;
330: u_int64_t p_vmspace;
331: u_int64_t p_sigacts;
332: u_int64_t p_sess;
333: u_int64_t p_tsess;
334: u_int64_t p_ru;
335:
336: int32_t p_eflag;
337: #define EPROC_CTTY 0x01
338: #define EPROC_SLEADER 0x02
339: int32_t p_exitsig;
340: int32_t p_flag;
341:
342: int32_t p_pid;
343: int32_t p_ppid;
344: int32_t p_sid;
345: int32_t p__pgid;
346:
347: int32_t p_tpgid;
348:
349: u_int32_t p_uid;
350: u_int32_t p_ruid;
351: u_int32_t p_gid;
352: u_int32_t p_rgid;
353:
354: u_int32_t p_groups[KI_NGROUPS];
355: int16_t p_ngroups;
356:
357: int16_t p_jobc;
358: u_int32_t p_tdev;
359:
360: u_int32_t p_estcpu;
361: u_int32_t p_rtime_sec;
362: u_int32_t p_rtime_usec;
363: int32_t p_cpticks;
364: u_int32_t p_pctcpu;
365: u_int32_t p_swtime;
366: u_int32_t p_slptime;
367: int32_t p_schedflags;
368:
369: u_int64_t p_uticks;
370: u_int64_t p_sticks;
371: u_int64_t p_iticks;
372:
373: u_int64_t p_tracep;
374: int32_t p_traceflag;
375:
376: int32_t p_holdcnt;
377:
378: int32_t p_siglist;
379: u_int32_t p_sigmask;
380: u_int32_t p_sigignore;
381: u_int32_t p_sigcatch;
382:
383: int8_t p_stat;
384: u_int8_t p_priority;
385: u_int8_t p_usrpri;
386: u_int8_t p_nice;
387:
388: u_int16_t p_xstat;
389: u_int16_t p_acflag;
390:
391: char p_comm[KI_MAXCOMLEN];
392:
393: char p_wmesg[KI_WMESGLEN];
394: u_int64_t p_wchan;
395:
396: char p_login[KI_MAXLOGNAME];
397:
398: int32_t p_vm_rssize;
399: int32_t p_vm_tsize;
400: int32_t p_vm_dsize;
401: int32_t p_vm_ssize;
402:
403: int64_t p_uvalid;
404:
405: u_int32_t p_ustart_sec;
406: u_int32_t p_ustart_usec;
407:
408: u_int32_t p_uutime_sec;
409: u_int32_t p_uutime_usec;
410: u_int32_t p_ustime_sec;
411: u_int32_t p_ustime_usec;
412:
413: u_int64_t p_uru_maxrss;
414: u_int64_t p_uru_ixrss;
415: u_int64_t p_uru_idrss;
416: u_int64_t p_uru_isrss;
417: u_int64_t p_uru_minflt;
418: u_int64_t p_uru_majflt;
419: u_int64_t p_uru_nswap;
420: u_int64_t p_uru_inblock;
421: u_int64_t p_uru_oublock;
422: u_int64_t p_uru_msgsnd;
423: u_int64_t p_uru_msgrcv;
424: u_int64_t p_uru_nsignals;
425: u_int64_t p_uru_nvcsw;
426: u_int64_t p_uru_nivcsw;
427:
428: u_int32_t p_uctime_sec;
429: u_int32_t p_uctime_usec;
430: u_int64_t p_realflag;
431: u_int32_t p_svuid;
432: u_int32_t p_svgid;
433: char p_emul[KI_EMULNAMELEN];
434: u_int64_t p_rlim_rss_cur;
435: u_int64_t p_cpuid;
436: u_int64_t p_vm_map_size;
437: int32_t p_tid;
438: u_int32_t p_rtableid;
439: };
440:
441: #if defined(_KERNEL) || defined(_LIBKVM)
442:
443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465:
466:
467: #define PTRTOINT64(_x) ((u_int64_t)(u_long)(_x))
468:
469: #define FILL_KPROC(kp, copy_str, p, pr, pc, uc, pg, paddr, praddr, sess, vm, lim, sa) \
470: do { \
471: memset((kp), 0, sizeof(*(kp))); \
472: \
473: (kp)->p_paddr = PTRTOINT64(paddr); \
474: (kp)->p_fd = PTRTOINT64((p)->p_fd); \
475: (kp)->p_stats = 0; \
476: (kp)->p_limit = PTRTOINT64((pr)->ps_limit); \
477: (kp)->p_vmspace = PTRTOINT64((p)->p_vmspace); \
478: (kp)->p_sigacts = PTRTOINT64((p)->p_sigacts); \
479: (kp)->p_sess = PTRTOINT64((pg)->pg_session); \
480: (kp)->p_ru = PTRTOINT64((pr)->ps_ru); \
481: \
482: (kp)->p_exitsig = (p)->p_exitsig; \
483: (kp)->p_flag = (p)->p_flag | (pr)->ps_flags | P_INMEM; \
484: \
485: (kp)->p__pgid = (pg)->pg_id; \
486: \
487: (kp)->p_uid = (uc)->cr_uid; \
488: (kp)->p_ruid = (pc)->p_ruid; \
489: (kp)->p_gid = (uc)->cr_gid; \
490: (kp)->p_rgid = (pc)->p_rgid; \
491: (kp)->p_svuid = (pc)->p_svuid; \
492: (kp)->p_svgid = (pc)->p_svgid; \
493: \
494: memcpy((kp)->p_groups, (uc)->cr_groups, \
495: MIN(sizeof((kp)->p_groups), sizeof((uc)->cr_groups))); \
496: (kp)->p_ngroups = (uc)->cr_ngroups; \
497: \
498: (kp)->p_jobc = (pg)->pg_jobc; \
499: \
500: (kp)->p_estcpu = (p)->p_estcpu; \
501: (kp)->p_rtime_sec = (pr)->ps_tu.tu_runtime.tv_sec; \
502: (kp)->p_rtime_usec = (pr)->ps_tu.tu_runtime.tv_usec; \
503: (kp)->p_cpticks = (p)->p_cpticks; \
504: (kp)->p_pctcpu = (p)->p_pctcpu; \
505: \
506: (kp)->p_uticks = (p)->p_uticks; \
507: (kp)->p_sticks = (p)->p_sticks; \
508: (kp)->p_iticks = (p)->p_iticks; \
509: \
510: (kp)->p_tracep = PTRTOINT64((pr)->ps_tracevp); \
511: (kp)->p_traceflag = (pr)->ps_traceflag; \
512: \
513: (kp)->p_siglist = (p)->p_siglist; \
514: (kp)->p_sigmask = (p)->p_sigmask; \
515: (kp)->p_sigignore = (sa) ? (sa)->ps_sigignore : 0; \
516: (kp)->p_sigcatch = (sa) ? (sa)->ps_sigcatch : 0; \
517: \
518: (kp)->p_stat = (p)->p_stat; \
519: (kp)->p_nice = (pr)->ps_nice; \
520: \
521: (kp)->p_xstat = (p)->p_xstat; \
522: (kp)->p_acflag = (p)->p_acflag; \
523: \
524: \
525: copy_str((kp)->p_emul, (char *)(p)->p_emul + \
526: offsetof(struct emul, e_name), sizeof((kp)->p_emul)); \
527: strlcpy((kp)->p_comm, (p)->p_comm, sizeof((kp)->p_comm)); \
528: strlcpy((kp)->p_login, (sess)->s_login, \
529: MIN(sizeof((kp)->p_login), sizeof((sess)->s_login))); \
530: \
531: if ((sess)->s_ttyvp) \
532: (kp)->p_eflag |= EPROC_CTTY; \
533: if ((sess)->s_leader == (praddr)) \
534: (kp)->p_eflag |= EPROC_SLEADER; \
535: \
536: if ((p)->p_stat != SIDL && !P_ZOMBIE(p)) { \
537: if ((vm) != NULL) { \
538: (kp)->p_vm_rssize = (vm)->vm_rssize; \
539: (kp)->p_vm_tsize = (vm)->vm_tsize; \
540: (kp)->p_vm_dsize = (vm)->vm_dused; \
541: (kp)->p_vm_ssize = (vm)->vm_ssize; \
542: } \
543: (kp)->p_addr = PTRTOINT64((p)->p_addr); \
544: (kp)->p_stat = (p)->p_stat; \
545: (kp)->p_swtime = (p)->p_swtime; \
546: (kp)->p_slptime = (p)->p_slptime; \
547: (kp)->p_holdcnt = 1; \
548: (kp)->p_priority = (p)->p_priority; \
549: (kp)->p_usrpri = (p)->p_usrpri; \
550: if ((p)->p_wmesg) \
551: copy_str((kp)->p_wmesg, (p)->p_wmesg, \
552: sizeof((kp)->p_wmesg)); \
553: (kp)->p_wchan = PTRTOINT64((p)->p_wchan); \
554: } \
555: \
556: if (lim) \
557: (kp)->p_rlim_rss_cur = \
558: (lim)->pl_rlimit[RLIMIT_RSS].rlim_cur; \
559: \
560: if (!P_ZOMBIE(p)) { \
561: struct timeval tv; \
562: \
563: (kp)->p_uvalid = 1; \
564: \
565: (kp)->p_ustart_sec = (pr)->ps_start.tv_sec; \
566: (kp)->p_ustart_usec = (pr)->ps_start.tv_usec; \
567: \
568: (kp)->p_uru_maxrss = (p)->p_ru.ru_maxrss; \
569: (kp)->p_uru_ixrss = (p)->p_ru.ru_ixrss; \
570: (kp)->p_uru_idrss = (p)->p_ru.ru_idrss; \
571: (kp)->p_uru_isrss = (p)->p_ru.ru_isrss; \
572: (kp)->p_uru_minflt = (p)->p_ru.ru_minflt; \
573: (kp)->p_uru_majflt = (p)->p_ru.ru_majflt; \
574: (kp)->p_uru_nswap = (p)->p_ru.ru_nswap; \
575: (kp)->p_uru_inblock = (p)->p_ru.ru_inblock; \
576: (kp)->p_uru_oublock = (p)->p_ru.ru_oublock; \
577: (kp)->p_uru_msgsnd = (p)->p_ru.ru_msgsnd; \
578: (kp)->p_uru_msgrcv = (p)->p_ru.ru_msgrcv; \
579: (kp)->p_uru_nsignals = (p)->p_ru.ru_nsignals; \
580: (kp)->p_uru_nvcsw = (p)->p_ru.ru_nvcsw; \
581: (kp)->p_uru_nivcsw = (p)->p_ru.ru_nivcsw; \
582: \
583: timeradd(&(pr)->ps_cru.ru_utime, \
584: &(pr)->ps_cru.ru_stime, &tv); \
585: (kp)->p_uctime_sec = tv.tv_sec; \
586: (kp)->p_uctime_usec = tv.tv_usec; \
587: } \
588: \
589: (kp)->p_cpuid = KI_NOCPU; \
590: (kp)->p_tid = (p)->p_pid + THREAD_PID_OFFSET; \
591: (kp)->p_rtableid = (pr)->ps_rtableid; \
592: } while (0)
593:
594: #endif
595:
596:
597: 598: 599: 600: 601: 602: 603: 604:
605: #define KERN_FILE_BYFILE 1
606: #define KERN_FILE_BYPID 2
607: #define KERN_FILE_BYUID 3
608: #define KERN_FILESLOP 10
609:
610: #define KERN_FILE_TEXT -1
611: #define KERN_FILE_CDIR -2
612: #define KERN_FILE_RDIR -3
613: #define KERN_FILE_TRACE -4
614:
615: #define KI_MNAMELEN 96
616:
617: struct kinfo_file2 {
618: uint64_t f_fileaddr;
619: uint32_t f_flag;
620: uint32_t f_iflags;
621: uint32_t f_type;
622: uint32_t f_count;
623: uint32_t f_msgcount;
624: uint32_t f_usecount;
625: uint64_t f_ucred;
626: uint32_t f_uid;
627: uint32_t f_gid;
628: uint64_t f_ops;
629: uint64_t f_offset;
630: uint64_t f_data;
631: uint64_t f_rxfer;
632: uint64_t f_rwfer;
633: uint64_t f_seek;
634: uint64_t f_rbytes;
635: uint64_t f_wbytes;
636:
637:
638: uint64_t v_un;
639: uint32_t v_type;
640: uint32_t v_tag;
641: uint32_t v_flag;
642: uint32_t va_rdev;
643: uint64_t v_data;
644: uint64_t v_mount;
645: uint64_t va_fileid;
646: uint64_t va_size;
647: uint32_t va_mode;
648: uint32_t va_fsid;
649: char f_mntonname[KI_MNAMELEN];
650:
651:
652: uint32_t so_type;
653: uint32_t so_state;
654: uint64_t so_pcb;
655: uint32_t so_protocol;
656: uint32_t so_family;
657: uint64_t inp_ppcb;
658: uint32_t inp_lport;
659: uint32_t inp_laddru[4];
660: uint32_t inp_fport;
661: uint32_t inp_faddru[4];
662: uint64_t unp_conn;
663:
664:
665: uint64_t pipe_peer;
666: uint32_t pipe_state;
667:
668:
669: uint32_t kq_count;
670: uint32_t kq_state;
671:
672:
673: uint32_t str_npolicies;
674:
675:
676: uint32_t p_pid;
677: int32_t fd_fd;
678: uint32_t fd_ofileflags;
679: uint32_t p_uid;
680: uint32_t p_gid;
681: uint32_t p_tid;
682: char p_comm[KI_MAXCOMLEN];
683:
684:
685: uint32_t inp_rtableid;
686: uint64_t so_splice;
687: int64_t so_splicelen;
688:
689: };
690:
691: 692: 693:
694: #define KERN_INTRCNT_NUM 1
695: #define KERN_INTRCNT_CNT 2
696: #define KERN_INTRCNT_NAME 3
697: #define KERN_INTRCNT_VECTOR 4
698: #define KERN_INTRCNT_MAXID 5
699:
700: #define CTL_KERN_INTRCNT_NAMES { \
701: { 0, 0 }, \
702: { "nintrcnt", CTLTYPE_INT }, \
703: { "intrcnt", CTLTYPE_NODE }, \
704: { "intrname", CTLTYPE_NODE }, \
705: }
706:
707: 708: 709:
710: #define KERN_WATCHDOG_PERIOD 1
711: #define KERN_WATCHDOG_AUTO 2
712: #define KERN_WATCHDOG_MAXID 3
713:
714: #define CTL_KERN_WATCHDOG_NAMES { \
715: { 0, 0 }, \
716: { "period", CTLTYPE_INT }, \
717: { "auto", CTLTYPE_INT }, \
718: }
719:
720: 721: 722:
723: #define KERN_TIMECOUNTER_TICK 1
724: #define KERN_TIMECOUNTER_TIMESTEPWARNINGS 2
725: #define KERN_TIMECOUNTER_HARDWARE 3
726: #define KERN_TIMECOUNTER_CHOICE 4
727: #define KERN_TIMECOUNTER_MAXID 5
728:
729: #define CTL_KERN_TIMECOUNTER_NAMES { \
730: { 0, 0 }, \
731: { "tick", CTLTYPE_INT }, \
732: { "timestepwarnings", CTLTYPE_INT }, \
733: { "hardware", CTLTYPE_STRING }, \
734: { "choice", CTLTYPE_STRING }, \
735: }
736:
737: 738: 739:
740: #define FS_POSIX 1
741: #define FS_MAXID 2
742:
743: #define CTL_FS_NAMES { \
744: { 0, 0 }, \
745: { "posix", CTLTYPE_NODE }, \
746: }
747:
748: 749: 750:
751: #define FS_POSIX_SETUID 1
752: #define FS_POSIX_MAXID 2
753:
754: #define CTL_FS_POSIX_NAMES { \
755: { 0, 0 }, \
756: { "setuid", CTLTYPE_INT }, \
757: }
758:
759: 760: 761:
762: #define HW_MACHINE 1
763: #define HW_MODEL 2
764: #define HW_NCPU 3
765: #define HW_BYTEORDER 4
766: #define HW_PHYSMEM 5
767: #define HW_USERMEM 6
768: #define HW_PAGESIZE 7
769: #define HW_DISKNAMES 8
770: #define HW_DISKSTATS 9
771: #define HW_DISKCOUNT 10
772: #define HW_SENSORS 11
773: #define HW_CPUSPEED 12
774: #define HW_SETPERF 13
775: #define HW_VENDOR 14
776: #define HW_PRODUCT 15
777: #define HW_VERSION 16
778: #define HW_SERIALNO 17
779: #define HW_UUID 18
780: #define HW_PHYSMEM64 19
781: #define HW_USERMEM64 20
782: #define HW_NCPUFOUND 21
783: #define HW_ALLOWPOWERDOWN 22
784: #define HW_MAXID 23
785:
786: #define CTL_HW_NAMES { \
787: { 0, 0 }, \
788: { "machine", CTLTYPE_STRING }, \
789: { "model", CTLTYPE_STRING }, \
790: { "ncpu", CTLTYPE_INT }, \
791: { "byteorder", CTLTYPE_INT }, \
792: { "gap", 0 }, \
793: { "gap", 0 }, \
794: { "pagesize", CTLTYPE_INT }, \
795: { "disknames", CTLTYPE_STRING }, \
796: { "diskstats", CTLTYPE_STRUCT }, \
797: { "diskcount", CTLTYPE_INT }, \
798: { "sensors", CTLTYPE_NODE}, \
799: { "cpuspeed", CTLTYPE_INT }, \
800: { "setperf", CTLTYPE_INT }, \
801: { "vendor", CTLTYPE_STRING }, \
802: { "product", CTLTYPE_STRING }, \
803: { "version", CTLTYPE_STRING }, \
804: { "serialno", CTLTYPE_STRING }, \
805: { "uuid", CTLTYPE_STRING }, \
806: { "physmem", CTLTYPE_QUAD }, \
807: { "usermem", CTLTYPE_QUAD }, \
808: { "ncpufound", CTLTYPE_INT }, \
809: { "allowpowerdown", CTLTYPE_INT }, \
810: }
811:
812: 813: 814:
815: #define USER_CS_PATH 1
816: #define USER_BC_BASE_MAX 2
817: #define USER_BC_DIM_MAX 3
818: #define USER_BC_SCALE_MAX 4
819: #define USER_BC_STRING_MAX 5
820: #define USER_COLL_WEIGHTS_MAX 6
821: #define USER_EXPR_NEST_MAX 7
822: #define USER_LINE_MAX 8
823: #define USER_RE_DUP_MAX 9
824: #define USER_POSIX2_VERSION 10
825: #define USER_POSIX2_C_BIND 11
826: #define USER_POSIX2_C_DEV 12
827: #define USER_POSIX2_CHAR_TERM 13
828: #define USER_POSIX2_FORT_DEV 14
829: #define USER_POSIX2_FORT_RUN 15
830: #define USER_POSIX2_LOCALEDEF 16
831: #define USER_POSIX2_SW_DEV 17
832: #define USER_POSIX2_UPE 18
833: #define USER_STREAM_MAX 19
834: #define USER_TZNAME_MAX 20
835: #define USER_MAXID 21
836:
837: #define CTL_USER_NAMES { \
838: { 0, 0 }, \
839: { "cs_path", CTLTYPE_STRING }, \
840: { "bc_base_max", CTLTYPE_INT }, \
841: { "bc_dim_max", CTLTYPE_INT }, \
842: { "bc_scale_max", CTLTYPE_INT }, \
843: { "bc_string_max", CTLTYPE_INT }, \
844: { "coll_weights_max", CTLTYPE_INT }, \
845: { "expr_nest_max", CTLTYPE_INT }, \
846: { "line_max", CTLTYPE_INT }, \
847: { "re_dup_max", CTLTYPE_INT }, \
848: { "posix2_version", CTLTYPE_INT }, \
849: { "posix2_c_bind", CTLTYPE_INT }, \
850: { "posix2_c_dev", CTLTYPE_INT }, \
851: { "posix2_char_term", CTLTYPE_INT }, \
852: { "posix2_fort_dev", CTLTYPE_INT }, \
853: { "posix2_fort_run", CTLTYPE_INT }, \
854: { "posix2_localedef", CTLTYPE_INT }, \
855: { "posix2_sw_dev", CTLTYPE_INT }, \
856: { "posix2_upe", CTLTYPE_INT }, \
857: { "stream_max", CTLTYPE_INT }, \
858: { "tzname_max", CTLTYPE_INT }, \
859: }
860:
861: 862: 863: 864: 865: 866:
867: #define CTL_DEBUG_NAME 0
868: #define CTL_DEBUG_VALUE 1
869: #define CTL_DEBUG_MAXID 20
870:
871: #ifdef _KERNEL
872: #ifdef DEBUG
873: 874: 875: 876: 877: 878: 879: 880: 881: 882: 883: 884:
885: struct ctldebug {
886: char *debugname;
887: int *debugvar;
888: };
889: extern struct ctldebug debug0, debug1, debug2, debug3, debug4;
890: extern struct ctldebug debug5, debug6, debug7, debug8, debug9;
891: extern struct ctldebug debug10, debug11, debug12, debug13, debug14;
892: extern struct ctldebug debug15, debug16, debug17, debug18, debug19;
893: #endif
894:
895: 896: 897: 898: 899: 900: 901: 902: 903:
904: typedef int (sysctlfn)(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
905:
906: int sysctl_int(void *, size_t *, void *, size_t, int *);
907: int sysctl_int_lower(void *, size_t *, void *, size_t, int *);
908: int sysctl_rdint(void *, size_t *, void *, int);
909: int sysctl_int_arr(int **, int *, u_int, void *, size_t *, void *, size_t);
910: int sysctl_quad(void *, size_t *, void *, size_t, int64_t *);
911: int sysctl_rdquad(void *, size_t *, void *, int64_t);
912: int sysctl_string(void *, size_t *, void *, size_t, char *, int);
913: int sysctl_tstring(void *, size_t *, void *, size_t, char *, int);
914: int sysctl__string(void *, size_t *, void *, size_t, char *, int, int);
915: int sysctl_rdstring(void *, size_t *, void *, const char *);
916: int sysctl_rdstruct(void *, size_t *, void *, const void *, int);
917: int sysctl_struct(void *, size_t *, void *, size_t, void *, int);
918: int sysctl_file(char *, size_t *, struct proc *);
919: int sysctl_file2(int *, u_int, char *, size_t *, struct proc *);
920: int sysctl_doproc(int *, u_int, char *, size_t *);
921: struct radix_node;
922: struct walkarg;
923: int sysctl_dumpentry(struct radix_node *, void *, u_int);
924: int sysctl_iflist(int, struct walkarg *);
925: int sysctl_rtable(int *, u_int, void *, size_t *, void *, size_t);
926: int sysctl_clockrate(char *, size_t *, void *);
927: int sysctl_vnode(char *, size_t *, struct proc *);
928: #ifdef GPROF
929: int sysctl_doprof(int *, u_int, void *, size_t *, void *, size_t);
930: #endif
931: int sysctl_dopool(int *, u_int, char *, size_t *);
932:
933: void fill_file2(struct kinfo_file2 *, struct file *, struct filedesc *,
934: int, struct vnode *, struct proc *, struct proc *);
935:
936: void fill_kproc(struct proc *, struct kinfo_proc *);
937:
938: int kern_sysctl(int *, u_int, void *, size_t *, void *, size_t,
939: struct proc *);
940: int hw_sysctl(int *, u_int, void *, size_t *, void *, size_t,
941: struct proc *);
942: #ifdef DEBUG
943: int debug_sysctl(int *, u_int, void *, size_t *, void *, size_t,
944: struct proc *);
945: #endif
946: int vm_sysctl(int *, u_int, void *, size_t *, void *, size_t,
947: struct proc *);
948: int fs_sysctl(int *, u_int, void *, size_t *, void *, size_t,
949: struct proc *);
950: int fs_posix_sysctl(int *, u_int, void *, size_t *, void *, size_t,
951: struct proc *);
952: int net_sysctl(int *, u_int, void *, size_t *, void *, size_t,
953: struct proc *);
954: int cpu_sysctl(int *, u_int, void *, size_t *, void *, size_t,
955: struct proc *);
956: int vfs_sysctl(int *, u_int, void *, size_t *, void *, size_t,
957: struct proc *);
958: int sysctl_sysvipc(int *, u_int, void *, size_t *);
959: int sysctl_wdog(int *, u_int, void *, size_t *, void *, size_t);
960:
961: extern int (*cpu_cpuspeed)(int *);
962: extern void (*cpu_setperf)(int);
963:
964: int bpf_sysctl(int *, u_int, void *, size_t *, void *, size_t);
965: int pflow_sysctl(int *, u_int, void *, size_t *, void *, size_t);
966: int pipex_sysctl(int *, u_int, void *, size_t *, void *, size_t);
967:
968: #else
969: #include <sys/cdefs.h>
970:
971: __BEGIN_DECLS
972: int sysctl(int *, u_int, void *, size_t *, void *, size_t);
973: __END_DECLS
974: #endif
975: #endif