| 1 | /*	$OpenBSD: sysctl.h,v 1.248 2026/04/16 14:47:24 deraadt 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 | #include <sys/syslimits.h> |
| 42 | #include <uvm/uvmexp.h> |
| 43 | |
| 44 | /* |
| 45 | * Definitions for sysctl call. The sysctl call uses a hierarchical name |
| 46 | * for objects that can be examined or modified. The name is expressed as |
| 47 | * a sequence of integers. Like a file path name, the meaning of each |
| 48 | * component depends on its place in the hierarchy. The top-level and kern |
| 49 | * identifiers are defined here, and other identifiers are defined in the |
| 50 | * respective subsystem header files. |
| 51 | */ |
| 52 | |
| 53 | #define	CTL_MAXNAME	12	/* largest number of components supported */ |
| 54 | |
| 55 | /* |
| 56 | * Each subsystem defined by sysctl defines a list of variables |
| 57 | * for that subsystem. Each name is either a node with further |
| 58 | * levels defined below it, or it is a leaf of some particular |
| 59 | * type given below. Each sysctl level defines a set of name/type |
| 60 | * pairs to be used by sysctl(1) in manipulating the subsystem. |
| 61 | */ |
| 62 | struct ctlname { |
| 63 | 	char	*ctl_name;	/* subsystem name */ |
| 64 | 	int	ctl_type;	/* type of name */ |
| 65 | }; |
| 66 | #define	CTLTYPE_NODE	1	/* name is a node */ |
| 67 | #define	CTLTYPE_INT	2	/* name describes an integer */ |
| 68 | #define	CTLTYPE_STRING	3	/* name describes a string */ |
| 69 | #define	CTLTYPE_QUAD	4	/* name describes a 64-bit number */ |
| 70 | #define	CTLTYPE_STRUCT	5	/* name describes a structure */ |
| 71 | |
| 72 | /* |
| 73 | * Top-level identifiers |
| 74 | */ |
| 75 | #define	CTL_UNSPEC	0		/* unused */ |
| 76 | #define	CTL_KERN	1		/* "high kernel": proc, limits */ |
| 77 | #define	CTL_VM		2		/* virtual memory */ |
| 78 | /* gap for CTL_FS	3		*/ |
| 79 | #define	CTL_NET		4		/* network, see socket.h */ |
| 80 | #define	CTL_DEBUG	5		/* debugging parameters */ |
| 81 | #define	CTL_HW		6		/* generic cpu/io */ |
| 82 | #define	CTL_MACHDEP	7		/* machine dependent */ |
| 83 | /*define gap		8		 was CTL_USER: removed 2013-04 */ |
| 84 | #define	CTL_DDB		9		/* DDB user interface, see db_var.h */ |
| 85 | #define	CTL_VFS		10		/* VFS sysctl's */ |
| 86 | #define	CTL_MAXID	11		/* number of valid top-level ids */ |
| 87 | |
| 88 | #define	CTL_NAMES { \ |
| 89 | 	{ 0, 0 }, \ |
| 90 | 	{ "kern", CTLTYPE_NODE }, \ |
| 91 | 	{ "vm", CTLTYPE_NODE }, \ |
| 92 | 	{ "gap", 0 }, \ |
| 93 | 	{ "net", CTLTYPE_NODE }, \ |
| 94 | 	{ "debug", CTLTYPE_NODE }, \ |
| 95 | 	{ "hw", CTLTYPE_NODE }, \ |
| 96 | 	{ "machdep", CTLTYPE_NODE }, \ |
| 97 | 	{ "gap", 0 }, \ |
| 98 | 	{ "ddb", CTLTYPE_NODE }, \ |
| 99 | 	{ "vfs", CTLTYPE_NODE }, \ |
| 100 | } |
| 101 | |
| 102 | /* |
| 103 | * CTL_KERN identifiers |
| 104 | */ |
| 105 | #define	KERN_OSTYPE	 	 1	/* string: system version */ |
| 106 | #define	KERN_OSRELEASE	 	 2	/* string: system release */ |
| 107 | #define	KERN_OSREV	 	 3	/* int: system revision */ |
| 108 | #define	KERN_VERSION	 	 4	/* string: compile time info */ |
| 109 | #define	KERN_MAXVNODES	 	 5	/* int: max vnodes */ |
| 110 | #define	KERN_MAXPROC	 	 6	/* int: max processes */ |
| 111 | #define	KERN_MAXFILES	 	 7	/* int: max open files */ |
| 112 | #define	KERN_ARGMAX	 	 8	/* int: max arguments to exec */ |
| 113 | #define	KERN_SECURELVL	 	 9	/* int: system security level */ |
| 114 | #define	KERN_HOSTNAME		10	/* string: hostname */ |
| 115 | #define	KERN_HOSTID		11	/* int: host identifier */ |
| 116 | #define	KERN_CLOCKRATE		12	/* struct: struct clockinfo */ |
| 117 | /* was KERN_DNSJACKPORT		13	*/ |
| 118 | /* was KERN_PROC		14	*/ |
| 119 | /* was KERN_FILE		15	*/ |
| 120 | #define	KERN_PROF		16	/* node: kernel profiling info */ |
| 121 | #define	KERN_POSIX1		17	/* int: POSIX.1 version */ |
| 122 | #define	KERN_NGROUPS		18	/* int: # of supplemental group ids */ |
| 123 | #define	KERN_JOB_CONTROL	19	/* int: is job control available */ |
| 124 | #define	KERN_SAVED_IDS		20	/* int: saved set-user/group-ID */ |
| 125 | #define	KERN_BOOTTIME		21	/* struct: time kernel was booted */ |
| 126 | #define	KERN_DOMAINNAME		22	/* string: (YP) domainname */ |
| 127 | #define	KERN_MAXPARTITIONS	23	/* int: number of partitions/disk */ |
| 128 | #define	KERN_RAWPARTITION	24	/* int: raw partition number */ |
| 129 | #define	KERN_MAXTHREAD	 	25	/* int: max threads */ |
| 130 | #define	KERN_NTHREADS		26	/* int: number of threads */ |
| 131 | #define	KERN_OSVERSION		27	/* string: kernel build version */ |
| 132 | #define	KERN_SOMAXCONN		28	/* int: listen queue maximum */ |
| 133 | #define	KERN_SOMINCONN		29	/* int: half-open controllable param */ |
| 134 | /* was KERN_USERMOUNT		30	*/ |
| 135 | /* was KERN_RND	31			*/ |
| 136 | #define	KERN_NOSUIDCOREDUMP	32	/* int: no setuid coredumps ever */ |
| 137 | #define	KERN_FSYNC		33	/* int: file synchronization support */ |
| 138 | #define	KERN_SYSVMSG		34	/* int: SysV message queue support */ |
| 139 | #define	KERN_SYSVSEM		35	/* int: SysV semaphore support */ |
| 140 | #define	KERN_SYSVSHM		36	/* int: SysV shared memory support */ |
| 141 | /* was KERN_ARND		37	*/ |
| 142 | #define	KERN_MSGBUFSIZE		38	/* int: size of message buffer */ |
| 143 | #define KERN_MALLOCSTATS	39	/* node: malloc statistics */ |
| 144 | #define KERN_CPTIME		40	/* array: cp_time */ |
| 145 | #define KERN_NCHSTATS		41	/* struct: vfs cache statistics */ |
| 146 | #define KERN_FORKSTAT		42	/* struct: fork statistics */ |
| 147 | /* was KERN_NSELCOLL		43	*/ |
| 148 | #define KERN_TTY		44	/* node: tty information */ |
| 149 | #define	KERN_CCPU		45	/* int: ccpu */ |
| 150 | #define	KERN_FSCALE		46	/* int: fscale */ |
| 151 | #define	KERN_NPROCS		47	/* int: number of processes */ |
| 152 | #define	KERN_MSGBUF		48	/* message buffer, KERN_MSGBUFSIZE */ |
| 153 | #define	KERN_POOL		49	/* struct: pool information */ |
| 154 | #define	KERN_STACKGAPRANDOM	50	/* int: stackgap_random */ |
| 155 | #define	KERN_SYSVIPC_INFO	51	/* struct: SysV sem/shm/msg info */ |
| 156 | #define KERN_ALLOWKMEM		52	/* int: allowkmem */ |
| 157 | #define KERN_WITNESSWATCH	53	/* int: witnesswatch */ |
| 158 | #define KERN_SPLASSERT		54	/* int: splassert */ |
| 159 | #define KERN_PROC_ARGS		55	/* node: proc args and env */ |
| 160 | #define	KERN_NFILES		56	/* int: number of open files */ |
| 161 | #define	KERN_TTYCOUNT		57	/* int: number of tty devices */ |
| 162 | #define KERN_NUMVNODES		58	/* int: number of vnodes in use */ |
| 163 | #define	KERN_MBSTAT		59	/* struct: mbuf statistics */ |
| 164 | #define	KERN_WITNESS		60	/* node: witness */ |
| 165 | #define	KERN_SEMINFO		61	/* struct: SysV struct seminfo */ |
| 166 | #define	KERN_SHMINFO		62	/* struct: SysV struct shminfo */ |
| 167 | #define KERN_INTRCNT		63	/* node: interrupt counters */ |
| 168 | #define	KERN_WATCHDOG		64	/* node: watchdog */ |
| 169 | #define	KERN_ALLOWDT		65	/* int: allowdt */ |
| 170 | #define	KERN_PROC		66	/* struct: process entries */ |
| 171 | #define	KERN_MAXCLUSTERS	67	/* number of mclusters */ |
| 172 | #define KERN_EVCOUNT		68	/* node: event counters */ |
| 173 | #define	KERN_TIMECOUNTER	69	/* node: timecounter */ |
| 174 | #define	KERN_MAXLOCKSPERUID	70	/* int: locks per uid */ |
| 175 | #define	KERN_CPTIME2		71	/* array: cp_time2 */ |
| 176 | #define	KERN_CACHEPCT		72	/* buffer cache % of physmem */ |
| 177 | #define	KERN_FILE		73	/* struct: file entries */ |
| 178 | #define	KERN_WXABORT		74	/* int: w^x sigabrt & core */ |
| 179 | #define	KERN_CONSDEV		75	/* dev_t: console terminal device */ |
| 180 | #define	KERN_NETLIVELOCKS	76	/* int: number of network livelocks */ |
| 181 | #define	KERN_POOL_DEBUG		77	/* int: enable pool_debug */ |
| 182 | #define	KERN_PROC_CWD		78 /* node: proc cwd */ |
| 183 | #define	KERN_PROC_NOBROADCASTKILL 79	/* node: proc no broadcast kill */ |
| 184 | #define	KERN_PROC_VMMAP		80 /* node: proc vmmap */ |
| 185 | #define	KERN_GLOBAL_PTRACE	81	/* allow ptrace globally */ |
| 186 | #define	KERN_CONSBUFSIZE	82	/* int: console message buffer size */ |
| 187 | #define	KERN_CONSBUF		83	/* console message buffer */ |
| 188 | #define	KERN_AUDIO		84	/* struct: audio properties */ |
| 189 | #define	KERN_CPUSTATS		85	/* struct: cpu statistics */ |
| 190 | #define	KERN_PFSTATUS		86	/* struct: pf status and stats */ |
| 191 | #define	KERN_TIMEOUT_STATS	87	/* struct: timeout status and stats */ |
| 192 | #define	KERN_UTC_OFFSET		88	/* int: adjust RTC time to UTC */ |
| 193 | #define	KERN_VIDEO		89	/* struct: video properties */ |
| 194 | #define	KERN_CLOCKINTR		90	/* node: clockintr */ |
| 195 | #define	KERN_AUTOCONF_SERIAL	91	/* int: kernel device tree state serial */ |
| 196 | #define	KERN_MAXID		92	/* number of valid kern ids */ |
| 197 | |
| 198 | #define	CTL_KERN_NAMES { \ |
| 199 | 	{ 0, 0 }, \ |
| 200 | 	{ "ostype", CTLTYPE_STRING }, \ |
| 201 | 	{ "osrelease", CTLTYPE_STRING }, \ |
| 202 | 	{ "osrevision", CTLTYPE_INT }, \ |
| 203 | 	{ "version", CTLTYPE_STRING }, \ |
| 204 | 	{ "maxvnodes", CTLTYPE_INT }, \ |
| 205 | 	{ "maxproc", CTLTYPE_INT }, \ |
| 206 | 	{ "maxfiles", CTLTYPE_INT }, \ |
| 207 | 	{ "argmax", CTLTYPE_INT }, \ |
| 208 | 	{ "securelevel", CTLTYPE_INT }, \ |
| 209 | 	{ "hostname", CTLTYPE_STRING }, \ |
| 210 | 	{ "hostid", CTLTYPE_INT }, \ |
| 211 | 	{ "clockrate", CTLTYPE_STRUCT }, \ |
| 212 | 	{ "gap", 0 }, \ |
| 213 | 	{ "gap", 0 }, \ |
| 214 | 	{ "gap", 0 }, \ |
| 215 | 	{ "profiling", CTLTYPE_NODE }, \ |
| 216 | 	{ "posix1version", CTLTYPE_INT }, \ |
| 217 | 	{ "ngroups", CTLTYPE_INT }, \ |
| 218 | 	{ "job_control", CTLTYPE_INT }, \ |
| 219 | 	{ "saved_ids", CTLTYPE_INT }, \ |
| 220 | 	{ "boottime", CTLTYPE_STRUCT }, \ |
| 221 | 	{ "domainname", CTLTYPE_STRING }, \ |
| 222 | 	{ "maxpartitions", CTLTYPE_INT }, \ |
| 223 | 	{ "rawpartition", CTLTYPE_INT }, \ |
| 224 | 	{ "maxthread", CTLTYPE_INT }, \ |
| 225 | 	{ "nthreads", CTLTYPE_INT }, \ |
| 226 | 	{ "osversion", CTLTYPE_STRING }, \ |
| 227 | 	{ "somaxconn", CTLTYPE_INT }, \ |
| 228 | 	{ "sominconn", CTLTYPE_INT }, \ |
| 229 | 	{ "gap", 0 }, \ |
| 230 | 	{ "gap", 0 }, \ |
| 231 | 	{ "nosuidcoredump", CTLTYPE_INT }, \ |
| 232 | 	{ "fsync", CTLTYPE_INT }, \ |
| 233 | 	{ "sysvmsg", CTLTYPE_INT }, \ |
| 234 | 	{ "sysvsem", CTLTYPE_INT }, \ |
| 235 | 	{ "sysvshm", CTLTYPE_INT }, \ |
| 236 | 	{ "gap", 0 }, \ |
| 237 | 	{ "msgbufsize", CTLTYPE_INT }, \ |
| 238 | 	{ "malloc", CTLTYPE_NODE }, \ |
| 239 | 	{ "cp_time", CTLTYPE_STRUCT }, \ |
| 240 | 	{ "nchstats", CTLTYPE_STRUCT }, \ |
| 241 | 	{ "forkstat", CTLTYPE_STRUCT }, \ |
| 242 | 	{ "gap", 0 }, \ |
| 243 | 	{ "tty", CTLTYPE_NODE }, \ |
| 244 | 	{ "ccpu", CTLTYPE_INT }, \ |
| 245 | 	{ "fscale", CTLTYPE_INT }, \ |
| 246 | 	{ "nprocs", CTLTYPE_INT }, \ |
| 247 | 	{ "msgbuf", CTLTYPE_STRUCT }, \ |
| 248 | 	{ "pool", CTLTYPE_NODE }, \ |
| 249 | 	{ "stackgap_random", CTLTYPE_INT }, \ |
| 250 | 	{ "sysvipc_info", CTLTYPE_INT }, \ |
| 251 | 	{ "allowkmem", CTLTYPE_INT }, \ |
| 252 | 	{ "witnesswatch", CTLTYPE_INT }, \ |
| 253 | 	{ "splassert", CTLTYPE_INT }, \ |
| 254 | 	{ "procargs", CTLTYPE_NODE }, \ |
| 255 | 	{ "nfiles", CTLTYPE_INT }, \ |
| 256 | 	{ "ttycount", CTLTYPE_INT }, \ |
| 257 | 	{ "numvnodes", CTLTYPE_INT }, \ |
| 258 | 	{ "mbstat", CTLTYPE_STRUCT }, \ |
| 259 | 	{ "witness", CTLTYPE_NODE }, \ |
| 260 | 	{ "seminfo", CTLTYPE_STRUCT }, \ |
| 261 | 	{ "shminfo", CTLTYPE_STRUCT }, \ |
| 262 | 	{ "intrcnt", CTLTYPE_NODE }, \ |
| 263 | 	{ "watchdog", CTLTYPE_NODE }, \ |
| 264 | 	{ "allowdt", CTLTYPE_INT }, \ |
| 265 | 	{ "proc", CTLTYPE_STRUCT }, \ |
| 266 | 	{ "maxclusters", CTLTYPE_INT }, \ |
| 267 | 	{ "evcount", CTLTYPE_NODE }, \ |
| 268 | 	{ "timecounter", CTLTYPE_NODE }, \ |
| 269 | 	{ "maxlocksperuid", CTLTYPE_INT }, \ |
| 270 | 	{ "cp_time2", CTLTYPE_STRUCT }, \ |
| 271 | 	{ "bufcachepercent", CTLTYPE_INT }, \ |
| 272 | 	{ "file", CTLTYPE_STRUCT }, \ |
| 273 | 	{ "wxabort", CTLTYPE_INT }, \ |
| 274 | 	{ "consdev", CTLTYPE_STRUCT }, \ |
| 275 | 	{ "netlivelocks", CTLTYPE_INT }, \ |
| 276 | 	{ "pool_debug", CTLTYPE_INT }, \ |
| 277 | 	{ "proc_cwd", CTLTYPE_NODE }, \ |
| 278 | 	{ "proc_nobroadcastkill", CTLTYPE_NODE }, \ |
| 279 | 	{ "proc_vmmap", CTLTYPE_NODE }, \ |
| 280 | 	{ "global_ptrace", CTLTYPE_INT }, \ |
| 281 | 	{ "consbufsize", CTLTYPE_INT }, \ |
| 282 | 	{ "consbuf", CTLTYPE_STRUCT }, \ |
| 283 | 	{ "audio", CTLTYPE_STRUCT }, \ |
| 284 | 	{ "cpustats", CTLTYPE_STRUCT }, \ |
| 285 | 	{ "pfstatus", CTLTYPE_STRUCT }, \ |
| 286 | 	{ "timeout_stats", CTLTYPE_STRUCT }, \ |
| 287 | 	{ "utc_offset", CTLTYPE_INT }, \ |
| 288 | 	{ "video", CTLTYPE_STRUCT }, \ |
| 289 | 	{ "clockintr", CTLTYPE_NODE }, \ |
| 290 | 	{ "autoconf_serial", CTLTYPE_INT }, \ |
| 291 | } |
| 292 | |
| 293 | /* |
| 294 | * KERN_PROC subtypes |
| 295 | */ |
| 296 | #define	KERN_PROC_ALL		0	/* everything but kernel threads */ |
| 297 | #define	KERN_PROC_PID		1	/* by process id */ |
| 298 | #define	KERN_PROC_PGRP		2	/* by process group id */ |
| 299 | #define	KERN_PROC_SESSION	3	/* by session of pid */ |
| 300 | #define	KERN_PROC_TTY		4	/* by controlling tty */ |
| 301 | #define	KERN_PROC_UID		5	/* by effective uid */ |
| 302 | #define	KERN_PROC_RUID		6	/* by real uid */ |
| 303 | #define	KERN_PROC_KTHREAD	7	/* also return kernel threads */ |
| 304 | #define	KERN_PROC_SHOW_THREADS	0x40000000/* also return normal threads */ |
| 305 | |
| 306 | /* |
| 307 | * KERN_SYSVIPC_INFO subtypes |
| 308 | */ |
| 309 | #define KERN_SYSVIPC_MSG_INFO	1	/* msginfo and msqid_ds */ |
| 310 | #define KERN_SYSVIPC_SEM_INFO	2	/* seminfo and semid_ds */ |
| 311 | #define KERN_SYSVIPC_SHM_INFO	3	/* shminfo and shmid_ds */ |
| 312 | |
| 313 | /* |
| 314 | * KERN_PROC_ARGS subtypes |
| 315 | */ |
| 316 | #define KERN_PROC_ARGV		1 |
| 317 | #define KERN_PROC_NARGV		2 |
| 318 | #define KERN_PROC_ENV		3 |
| 319 | #define KERN_PROC_NENV		4 |
| 320 | |
| 321 | /* |
| 322 | * KERN_AUDIO |
| 323 | */ |
| 324 | #define KERN_AUDIO_RECORD	1 |
| 325 | #define KERN_AUDIO_KBDCONTROL	2 |
| 326 | #define KERN_AUDIO_MAXID	3 |
| 327 | |
| 328 | #define CTL_KERN_AUDIO_NAMES { \ |
| 329 | 	{ 0, 0 }, \ |
| 330 | 	{ "record", CTLTYPE_INT }, \ |
| 331 | 	{ "kbdcontrol", CTLTYPE_INT }, \ |
| 332 | } |
| 333 | |
| 334 | /* |
| 335 | * KERN_VIDEO |
| 336 | */ |
| 337 | #define KERN_VIDEO_RECORD	1 |
| 338 | #define KERN_VIDEO_MAXID	2 |
| 339 | |
| 340 | #define CTL_KERN_VIDEO_NAMES { \ |
| 341 | 	{ 0, 0 }, \ |
| 342 | 	{ "record", CTLTYPE_INT }, \ |
| 343 | } |
| 344 | |
| 345 | /* |
| 346 | * KERN_WITNESS |
| 347 | */ |
| 348 | #define	KERN_WITNESS_WATCH	1	/* int: operating mode */ |
| 349 | #define	KERN_WITNESS_LOCKTRACE	2	/* int: stack trace saving mode */ |
| 350 | #define	KERN_WITNESS_MAXID	3 |
| 351 | |
| 352 | #define	CTL_KERN_WITNESS_NAMES { \ |
| 353 | 	{ 0, 0 }, \ |
| 354 | 	{ "watch", CTLTYPE_INT }, \ |
| 355 | 	{ "locktrace", CTLTYPE_INT }, \ |
| 356 | } |
| 357 | |
| 358 | /* |
| 359 | * KERN_PROC subtype ops return arrays of relatively fixed size |
| 360 | * structures of process info. Use 8 byte alignment, and new |
| 361 | * elements should only be added to the end of this structure so |
| 362 | * binary compatibility can be preserved. |
| 363 | */ |
| 364 | #define	KI_NGROUPS	16 |
| 365 | #define	KI_MAXCOMLEN	_MAXCOMLEN	/* includes NUL */ |
| 366 | #define	KI_WMESGLEN	8 |
| 367 | #define	KI_MAXLOGNAME	32 |
| 368 | #define	KI_EMULNAMELEN	8 |
| 369 | |
| 370 | #define KI_NOCPU	(~(u_int64_t)0) |
| 371 | |
| 372 | struct kinfo_proc { |
| 373 | 	u_int64_t p_forw;		/* PTR: linked run/sleep queue. */ |
| 374 | 	u_int64_t p_back; |
| 375 | 	u_int64_t p_paddr;		/* PTR: address of proc */ |
| 376 | |
| 377 | 	u_int64_t p_addr;		/* PTR: Kernel virtual addr of u-area */ |
| 378 | 	u_int64_t p_fd;			/* PTR: Ptr to open files structure. */ |
| 379 | 	u_int64_t p_stats;		/* unused, always zero. */ |
| 380 | 	u_int64_t p_limit;		/* PTR: Process limits. */ |
| 381 | 	u_int64_t p_vmspace;		/* PTR: Address space. */ |
| 382 | 	u_int64_t p_sigacts;		/* PTR: Signal actions, state */ |
| 383 | 	u_int64_t p_sess;		/* PTR: session pointer */ |
| 384 | 	u_int64_t p_tsess;		/* PTR: tty session pointer */ |
| 385 | 	u_int64_t p_ru;			/* PTR: Exit information. XXX */ |
| 386 | |
| 387 | 	int32_t	p_eflag;		/* LONG: extra kinfo_proc flags */ |
| 388 | #define	EPROC_CTTY	0x01	/* controlling tty vnode active */ |
| 389 | #define	EPROC_SLEADER	0x02	/* session leader */ |
| 390 | #define	EPROC_UNVEIL	0x04	/* has unveil settings */ |
| 391 | #define	EPROC_LKUNVEIL	0x08	/* unveil is locked */ |
| 392 | 	int32_t	p_exitsig;		/* unused, always zero. */ |
| 393 | 	int32_t	p_flag;			/* INT: P_* flags. */ |
| 394 | |
| 395 | 	int32_t	p_pid;			/* PID_T: Process identifier. */ |
| 396 | 	int32_t	p_ppid;			/* PID_T: Parent process id */ |
| 397 | 	int32_t	p_sid;			/* PID_T: session id */ |
| 398 | 	int32_t	p__pgid;		/* PID_T: process group id */ |
| 399 | 					/* XXX: <sys/proc.h> hijacks p_pgid */ |
| 400 | 	int32_t	p_tpgid;		/* PID_T: tty process group id */ |
| 401 | |
| 402 | 	u_int32_t p_uid;		/* UID_T: effective user id */ |
| 403 | 	u_int32_t p_ruid;		/* UID_T: real user id */ |
| 404 | 	u_int32_t p_gid;		/* GID_T: effective group id */ |
| 405 | 	u_int32_t p_rgid;		/* GID_T: real group id */ |
| 406 | |
| 407 | 	u_int32_t p_groups[KI_NGROUPS];	/* GID_T: groups */ |
| 408 | 	int16_t	p_ngroups;		/* SHORT: number of groups */ |
| 409 | |
| 410 | 	int16_t	p_jobc;			/* SHORT: job control counter */ |
| 411 | 	u_int32_t p_tdev;		/* DEV_T: controlling tty dev */ |
| 412 | |
| 413 | 	u_int32_t p_estcpu;		/* U_INT: Time averaged value of p_cpticks. */ |
| 414 | 	u_int32_t p_rtime_sec;		/* STRUCT TIMEVAL: Real time. */ |
| 415 | 	u_int32_t p_rtime_usec;		/* STRUCT TIMEVAL: Real time. */ |
| 416 | 	int32_t	p_cpticks;		/* INT: Ticks of cpu time. */ |
| 417 | 	u_int32_t p_pctcpu;		/* FIXPT_T: %cpu for this process */ |
| 418 | 	u_int32_t p_swtime;		/* unused, always zero */ |
| 419 | 	u_int32_t p_slptime;		/* U_INT: Time since last blocked. */ |
| 420 | 	int32_t	p_schedflags;		/* INT: PSCHED_* flags */ |
| 421 | |
| 422 | 	u_int64_t p_uticks;		/* U_QUAD_T: Statclock hits in user mode. */ |
| 423 | 	u_int64_t p_sticks;		/* U_QUAD_T: Statclock hits in system mode. */ |
| 424 | 	u_int64_t p_iticks;		/* U_QUAD_T: Statclock hits processing intr. */ |
| 425 | |
| 426 | 	u_int64_t p_tracep;		/* PTR: Trace to vnode or file */ |
| 427 | 	int32_t	p_traceflag;		/* INT: Kernel trace points. */ |
| 428 | |
| 429 | 	int32_t p_holdcnt;		/* INT: If non-zero, don't swap. */ |
| 430 | |
| 431 | 	int32_t p_siglist;		/* INT: Signals arrived but not delivered. */ |
| 432 | 	u_int32_t p_sigmask;		/* SIGSET_T: Current signal mask. */ |
| 433 | 	u_int32_t p_sigignore;		/* SIGSET_T: Signals being ignored. */ |
| 434 | 	u_int32_t p_sigcatch;		/* SIGSET_T: Signals being caught by user. */ |
| 435 | |
| 436 | 	int8_t	p_stat;			/* CHAR: S* process status (from LWP). */ |
| 437 | 	u_int8_t p_priority;		/* U_CHAR: Process priority. */ |
| 438 | 	u_int8_t p_usrpri;		/* U_CHAR: User-priority based on p_estcpu and ps_nice. */ |
| 439 | 	u_int8_t p_nice;		/* U_CHAR: Process "nice" value. */ |
| 440 | |
| 441 | 	u_int16_t p_xstat;		/* U_SHORT: Exit status for wait; also stop signal. */ |
| 442 | 	u_int16_t p_spare;		/* U_SHORT: unused */ |
| 443 | |
| 444 | 	char	p_comm[KI_MAXCOMLEN]; |
| 445 | |
| 446 | 	char	p_wmesg[KI_WMESGLEN];	/* wchan message */ |
| 447 | 	u_int64_t p_wchan;		/* PTR: sleep address. */ |
| 448 | |
| 449 | 	char	p_login[KI_MAXLOGNAME];	/* setlogin() name */ |
| 450 | |
| 451 | 	int32_t	p_vm_rssize;		/* SEGSZ_T: current resident set size in pages */ |
| 452 | 	int32_t	p_vm_tsize;		/* SEGSZ_T: text size (pages) */ |
| 453 | 	int32_t	p_vm_dsize;		/* SEGSZ_T: data size (pages) */ |
| 454 | 	int32_t	p_vm_ssize;		/* SEGSZ_T: stack size (pages) */ |
| 455 | |
| 456 | 	int64_t	p_uvalid;		/* CHAR: following p_u* members from struct user are valid */ |
| 457 | 					/* XXX 64 bits for alignment */ |
| 458 | 	u_int64_t p_ustart_sec;		/* STRUCT TIMEVAL: starting time. */ |
| 459 | 	u_int32_t p_ustart_usec;	/* STRUCT TIMEVAL: starting time. */ |
| 460 | |
| 461 | 	u_int32_t p_uutime_sec;		/* STRUCT TIMEVAL: user time. */ |
| 462 | 	u_int32_t p_uutime_usec;	/* STRUCT TIMEVAL: user time. */ |
| 463 | 	u_int32_t p_ustime_sec;		/* STRUCT TIMEVAL: system time. */ |
| 464 | 	u_int32_t p_ustime_usec;	/* STRUCT TIMEVAL: system time. */ |
| 465 | |
| 466 | 	u_int64_t p_uru_maxrss;		/* LONG: max resident set size. */ |
| 467 | 	u_int64_t p_uru_ixrss;		/* LONG: integral shared memory size. */ |
| 468 | 	u_int64_t p_uru_idrss;		/* LONG: integral unshared data ". */ |
| 469 | 	u_int64_t p_uru_isrss;		/* LONG: integral unshared stack ". */ |
| 470 | 	u_int64_t p_uru_minflt;		/* LONG: page reclaims. */ |
| 471 | 	u_int64_t p_uru_majflt;		/* LONG: page faults. */ |
| 472 | 	u_int64_t p_uru_nswap;		/* LONG: swaps. */ |
| 473 | 	u_int64_t p_uru_inblock;	/* LONG: block input operations. */ |
| 474 | 	u_int64_t p_uru_oublock;	/* LONG: block output operations. */ |
| 475 | 	u_int64_t p_uru_msgsnd;		/* LONG: messages sent. */ |
| 476 | 	u_int64_t p_uru_msgrcv;		/* LONG: messages received. */ |
| 477 | 	u_int64_t p_uru_nsignals;	/* LONG: signals received. */ |
| 478 | 	u_int64_t p_uru_nvcsw;		/* LONG: voluntary context switches. */ |
| 479 | 	u_int64_t p_uru_nivcsw;		/* LONG: involuntary ". */ |
| 480 | |
| 481 | 	u_int32_t p_uctime_sec;		/* STRUCT TIMEVAL: child u+s time. */ |
| 482 | 	u_int32_t p_uctime_usec;	/* STRUCT TIMEVAL: child u+s time. */ |
| 483 | 	u_int32_t p_psflags;		/* UINT: PS_* flags on the process. */ |
| 484 | 	u_int32_t p_acflag;		/* UINT: Accounting flags. */ |
| 485 | 	u_int32_t p_svuid;		/* UID_T: saved user id */ |
| 486 | 	u_int32_t p_svgid;		/* GID_T: saved group id */ |
| 487 | 	char p_emul[KI_EMULNAMELEN];	/* syscall emulation name */ |
| 488 | 	u_int64_t p_rlim_rss_cur;	/* RLIM_T: soft limit for rss */ |
| 489 | 	u_int64_t p_cpuid;		/* LONG: CPU id */ |
| 490 | 	u_int64_t p_vm_map_size;	/* VSIZE_T: virtual size */ |
| 491 | 	int32_t p_tid;		/* PID_T: Thread identifier. */ |
| 492 | 	u_int32_t p_rtableid;		/* U_INT: Routing table identifier. */ |
| 493 | |
| 494 | 	u_int64_t p_pledge;		/* U_INT64_T: Pledge flags. */ |
| 495 | 	char	p_name[KI_MAXCOMLEN];	/* thread name */ |
| 496 | }; |
| 497 | |
| 498 | /* |
| 499 | * VM address range entry, matching struct vm_map_entry. Useful for |
| 500 | * debuggers to know process's addresses. |
| 501 | * |
| 502 | * To iterate entries, set the last kve_end as the base address into |
| 503 | * kve_start. |
| 504 | */ |
| 505 | struct kinfo_vmentry { |
| 506 | 	u_long kve_start;		/* vaddr_t */ |
| 507 | 	u_long kve_end;			/* vaddr_t */ |
| 508 | 	u_long kve_guard;		/* vsize_t */ |
| 509 | 	u_long kve_fspace;		/* vsize_t */ |
| 510 | 	u_long kve_fspace_augment;	/* vsize_t */ |
| 511 | 	u_int64_t kve_offset;		/* voff_t */ |
| 512 | 	int kve_wired_count; |
| 513 | 	int kve_etype; |
| 514 | 	int kve_protection; |
| 515 | 	int kve_max_protection; |
| 516 | 	int kve_advice; |
| 517 | 	int kve_inheritance; |
| 518 | 	u_int8_t kve_flags;		/* u_int8_t */ |
| 519 | }; |
| 520 | |
| 521 | /* keep in sync with UVM_ET_* */ |
| 522 | #define KVE_ET_OBJ		0x00000001 |
| 523 | #define KVE_ET_SUBMAP		0x00000002 |
| 524 | #define KVE_ET_COPYONWRITE 	0x00000004 |
| 525 | #define KVE_ET_NEEDSCOPY	0x00000008 |
| 526 | #define KVE_ET_HOLE		0x00000010 |
| 527 | #define KVE_ET_NOFAULT		0x00000020 |
| 528 | #define KVE_ET_STACK		0x00000040 |
| 529 | #define KVE_ET_WC		0x00000080 |
| 530 | #define KVE_ET_CONCEAL		0x00000100 |
| 531 | #define KVE_ET_SYSCALL		0x00000200 |
| 532 | #define KVE_ET_FREEMAPPED	0x00000800 |
| 533 | |
| 534 | #define KVE_PROT_NONE		0x00000000 |
| 535 | #define KVE_PROT_READ		0x00000001 |
| 536 | #define KVE_PROT_WRITE		0x00000002 |
| 537 | #define KVE_PROT_EXEC		0x00000004 |
| 538 | |
| 539 | #define KVE_ADV_NORMAL		0x00000000 |
| 540 | #define KVE_ADV_RANDOM		0x00000001 |
| 541 | #define KVE_ADV_SEQUENTIAL	0x00000002 |
| 542 | |
| 543 | #define KVE_INH_SHARE		0x00000000 |
| 544 | #define KVE_INH_COPY		0x00000010 |
| 545 | #define KVE_INH_NONE		0x00000020 |
| 546 | #define KVE_INH_ZERO		0x00000030 |
| 547 | |
| 548 | #define KVE_F_STATIC		0x01 |
| 549 | #define KVE_F_KMEM		0x02 |
| 550 | |
| 551 | #if defined(_KERNEL) || defined(_LIBKVM) |
| 552 | |
| 553 | /* |
| 554 | * Macros for filling in the bulk of a kinfo_proc structure, used |
| 555 | * in the kernel to implement the KERN_PROC sysctl and in userland |
| 556 | * in libkvm to implement reading from kernel crashes. The macro |
| 557 | * arguments are all pointers; by name they are: |
| 558 | *	kp - target kinfo_proc structure |
| 559 | *	copy_str - a function or macro invoked as copy_str(dst,src,maxlen) |
| 560 | *	 that has strlcpy or memcpy semantics; the destination is |
| 561 | *	 pre-filled with zeros; for libkvm, src is a kvm address |
| 562 | *	p - source struct proc |
| 563 | *	pr - source struct process |
| 564 | *	uc - source struct ucreds |
| 565 | *	pg - source struct pgrp |
| 566 | *	paddr - kernel address of the source struct proc |
| 567 | *	praddr - kernel address of the source struct process |
| 568 | *	sess - source struct session |
| 569 | *	vm - source struct vmspace |
| 570 | *	lim - source struct plimits |
| 571 | *	sa - source struct sigacts |
| 572 | * There are some members that are not handled by these macros |
| 573 | * because they're too painful to generalize: p_sid, p_tdev, |
| 574 | * p_tpgid, p_tsess, p_vm_rssize, p_u[us]time_{sec,usec}, p_cpuid |
| 575 | */ |
| 576 | |
| 577 | #if defined(_KERNEL) |
| 578 | #define PR_LOCK(pr)	mtx_enter(&(pr)->ps_mtx) |
| 579 | #define PR_UNLOCK(pr)	mtx_leave(&(pr)->ps_mtx) |
| 580 | #else |
| 581 | #define PR_LOCK(pr)	/* nothing */ |
| 582 | #define PR_UNLOCK(pr)	/* nothing */ |
| 583 | #endif |
| 584 | |
| 585 | #define _getcompatprio(_p)						\ |
| 586 | 	((_p)->p_stat == SRUN ? (_p)->p_runpri : 			\ |
| 587 | 	 ((_p)->p_stat == SSLEEP) ? (_p)->p_slppri : (_p)->p_usrpri) |
| 588 | |
| 589 | #define PTRTOINT64(_x)	((u_int64_t)(u_long)(_x)) |
| 590 | |
| 591 | #define	_FILL_KPROC_MIN(a,b) (((a)<(b))?(a):(b)) |
| 592 | |
| 593 | #define FILL_KPROC(kp, copy_str, p, pr, uc, pg, paddr, \ |
| 594 | praddr, sess, vm, lim, sa, tu, isthread, show_addresses) \ |
| 595 | do {									\ |
| 596 | 	memset((kp), 0, sizeof(*(kp)));					\ |
| 597 | 									\ |
| 598 | 	if (show_addresses) {						\ |
| 599 | 		(kp)->p_paddr = PTRTOINT64(paddr);			\ |
| 600 | 		(kp)->p_fd = PTRTOINT64((pr)->ps_fd);			\ |
| 601 | 		(kp)->p_limit = PTRTOINT64((pr)->ps_limit);		\ |
| 602 | 		(kp)->p_vmspace = PTRTOINT64((pr)->ps_vmspace);		\ |
| 603 | 		(kp)->p_sigacts = PTRTOINT64((pr)->ps_sigacts);		\ |
| 604 | 		(kp)->p_sess = PTRTOINT64((pg)->pg_session);		\ |
| 605 | 		(kp)->p_ru = PTRTOINT64((pr)->ps_ru);			\ |
| 606 | 	}								\ |
| 607 | 	(kp)->p_stats = 0;						\ |
| 608 | 	(kp)->p_exitsig = 0;						\ |
| 609 | 	(kp)->p_flag = (p)->p_flag;					\ |
| 610 | 	(kp)->p_pid = (pr)->ps_pid;					\ |
| 611 | 	(kp)->p_psflags = (pr)->ps_flags;				\ |
| 612 | 									\ |
| 613 | 	(kp)->p__pgid = (pg)->pg_id;					\ |
| 614 | 									\ |
| 615 | 	(kp)->p_uid = (uc)->cr_uid;					\ |
| 616 | 	(kp)->p_ruid = (uc)->cr_ruid;					\ |
| 617 | 	(kp)->p_gid = (uc)->cr_gid;					\ |
| 618 | 	(kp)->p_rgid = (uc)->cr_rgid;					\ |
| 619 | 	(kp)->p_svuid = (uc)->cr_svuid;					\ |
| 620 | 	(kp)->p_svgid = (uc)->cr_svgid;					\ |
| 621 | 									\ |
| 622 | 	memcpy((kp)->p_groups, (uc)->cr_groups,				\ |
| 623 | 	 _FILL_KPROC_MIN(sizeof((kp)->p_groups), sizeof((uc)->cr_groups))); \ |
| 624 | 	(kp)->p_ngroups = (uc)->cr_ngroups;				\ |
| 625 | 									\ |
| 626 | 	(kp)->p_jobc = (pg)->pg_jobc;					\ |
| 627 | 									\ |
| 628 | 	(kp)->p_estcpu = (p)->p_estcpu;					\ |
| 629 | 	if (isthread) {							\ |
| 630 | 		(kp)->p_tid = (p)->p_tid + THREAD_PID_OFFSET;		\ |
| 631 | 		strlcpy((kp)->p_name, (p)->p_name, sizeof((kp)->p_name)); \ |
| 632 | 	} else {							\ |
| 633 | 		(kp)->p_tid = -1;					\ |
| 634 | 	}								\ |
| 635 | 	(kp)->p_rtime_sec = (tu)->tu_runtime.tv_sec;			\ |
| 636 | 	(kp)->p_rtime_usec = (tu)->tu_runtime.tv_nsec/1000;		\ |
| 637 | 	(kp)->p_uticks = (tu)->tu_uticks;				\ |
| 638 | 	(kp)->p_sticks = (tu)->tu_sticks;				\ |
| 639 | 	(kp)->p_iticks = (tu)->tu_iticks;				\ |
| 640 | 	(kp)->p_cpticks = (p)->p_cpticks;				\ |
| 641 | 									\ |
| 642 | 	if (show_addresses)						\ |
| 643 | 		(kp)->p_tracep = PTRTOINT64((pr)->ps_tracevp);		\ |
| 644 | 	(kp)->p_traceflag = (pr)->ps_traceflag;				\ |
| 645 | 									\ |
| 646 | 	(kp)->p_siglist = (p)->p_siglist | (pr)->ps_siglist;		\ |
| 647 | 	(kp)->p_sigmask = (p)->p_sigmask;				\ |
| 648 | 									\ |
| 649 | 	PR_LOCK(pr);							\ |
| 650 | 	(kp)->p_ppid = (pr)->ps_ppid;					\ |
| 651 | 	(kp)->p_sigignore = (sa) ? (sa)->ps_sigignore : 0;		\ |
| 652 | 	(kp)->p_sigcatch = (sa) ? (sa)->ps_sigcatch : 0;		\ |
| 653 | 									\ |
| 654 | 	if (lim)							\ |
| 655 | 		(kp)->p_rlim_rss_cur =					\ |
| 656 | 		 (lim)->pl_rlimit[RLIMIT_RSS].rlim_cur;		\ |
| 657 | 	PR_UNLOCK(pr);							\ |
| 658 | 									\ |
| 659 | 	(kp)->p_stat = (p)->p_stat;					\ |
| 660 | 	(kp)->p_nice = (pr)->ps_nice;					\ |
| 661 | 									\ |
| 662 | 	(kp)->p_xstat = W_EXITCODE((pr)->ps_xexit, (pr)->ps_xsig);	\ |
| 663 | 	(kp)->p_acflag = (pr)->ps_acflag;				\ |
| 664 | 	(kp)->p_pledge = (pr)->ps_pledge;				\ |
| 665 | 									\ |
| 666 | 	strlcpy((kp)->p_emul, "native", sizeof((kp)->p_emul));		\ |
| 667 | 	strlcpy((kp)->p_comm, (pr)->ps_comm, sizeof((kp)->p_comm));	\ |
| 668 | 	strlcpy((kp)->p_login, (sess)->s_login,				\ |
| 669 | 	 _FILL_KPROC_MIN(sizeof((kp)->p_login), sizeof((sess)->s_login))); \ |
| 670 | 									\ |
| 671 | 	if ((sess)->s_ttyvp)						\ |
| 672 | 		(kp)->p_eflag |= EPROC_CTTY;				\ |
| 673 | 	if ((pr)->ps_uvpaths)						\ |
| 674 | 		(kp)->p_eflag |= EPROC_UNVEIL;				\ |
| 675 | 	if ((pr)->ps_uvdone ||						\ |
| 676 | 	 (((pr)->ps_flags & PS_PLEDGE) &&				\ |
| 677 | 	 ((pr)->ps_pledge & PLEDGE_UNVEIL) == 0))			\ |
| 678 | 		(kp)->p_eflag |= EPROC_LKUNVEIL;			\ |
| 679 | 									\ |
| 680 | 	if (((pr)->ps_flags & (PS_EMBRYO | PS_ZOMBIE)) == 0) {		\ |
| 681 | 		if ((vm) != NULL) {					\ |
| 682 | 			(kp)->p_vm_rssize = (vm)->vm_rssize;		\ |
| 683 | 			(kp)->p_vm_tsize = (vm)->vm_tsize;		\ |
| 684 | 			(kp)->p_vm_dsize = (vm)->vm_dused;		\ |
| 685 | 			(kp)->p_vm_ssize = (vm)->vm_ssize;		\ |
| 686 | 		}							\ |
| 687 | 		(kp)->p_stat = (p)->p_stat;				\ |
| 688 | 		(kp)->p_slptime = (p)->p_slptime;			\ |
| 689 | 		(kp)->p_holdcnt = 1;					\ |
| 690 | 		(kp)->p_priority = _getcompatprio(p);			\ |
| 691 | 		(kp)->p_usrpri = (p)->p_usrpri;				\ |
| 692 | 		if ((p)->p_wchan && (p)->p_wmesg)			\ |
| 693 | 			copy_str((kp)->p_wmesg, (p)->p_wmesg,		\ |
| 694 | 			 sizeof((kp)->p_wmesg));			\ |
| 695 | 		if (show_addresses) {					\ |
| 696 | 			(kp)->p_wchan = PTRTOINT64((p)->p_wchan);	\ |
| 697 | 			(kp)->p_addr = PTRTOINT64((p)->p_addr);		\ |
| 698 | 		}							\ |
| 699 | 	}								\ |
| 700 | 									\ |
| 701 | 	if (((pr)->ps_flags & PS_ZOMBIE) == 0) {			\ |
| 702 | 		struct timeval __tv;					\ |
| 703 | 									\ |
| 704 | 		(kp)->p_uvalid = 1;					\ |
| 705 | 									\ |
| 706 | 		(kp)->p_uru_maxrss = (p)->p_ru.ru_maxrss;		\ |
| 707 | 		(kp)->p_uru_ixrss = (p)->p_ru.ru_ixrss;			\ |
| 708 | 		(kp)->p_uru_idrss = (p)->p_ru.ru_idrss;			\ |
| 709 | 		(kp)->p_uru_isrss = (p)->p_ru.ru_isrss;			\ |
| 710 | 		(kp)->p_uru_minflt = (p)->p_ru.ru_minflt;		\ |
| 711 | 		(kp)->p_uru_majflt = (p)->p_ru.ru_majflt;		\ |
| 712 | 		(kp)->p_uru_nswap = (p)->p_ru.ru_nswap;			\ |
| 713 | 		(kp)->p_uru_inblock = (p)->p_ru.ru_inblock;		\ |
| 714 | 		(kp)->p_uru_oublock = (p)->p_ru.ru_oublock;		\ |
| 715 | 		(kp)->p_uru_msgsnd = (p)->p_ru.ru_msgsnd;		\ |
| 716 | 		(kp)->p_uru_msgrcv = (p)->p_ru.ru_msgrcv;		\ |
| 717 | 		(kp)->p_uru_nsignals = (p)->p_ru.ru_nsignals;		\ |
| 718 | 		(kp)->p_uru_nvcsw = (p)->p_ru.ru_nvcsw;			\ |
| 719 | 		(kp)->p_uru_nivcsw = (p)->p_ru.ru_nivcsw;		\ |
| 720 | 									\ |
| 721 | 		timeradd(&(pr)->ps_cru.ru_utime,			\ |
| 722 | 			 &(pr)->ps_cru.ru_stime, &__tv);		\ |
| 723 | 		(kp)->p_uctime_sec = __tv.tv_sec;			\ |
| 724 | 		(kp)->p_uctime_usec = __tv.tv_usec;			\ |
| 725 | 	}								\ |
| 726 | 									\ |
| 727 | 	(kp)->p_cpuid = KI_NOCPU;					\ |
| 728 | 	(kp)->p_rtableid = (pr)->ps_rtableid;				\ |
| 729 | } while (0) |
| 730 | |
| 731 | #endif /* defined(_KERNEL) || defined(_LIBKVM) */ |
| 732 | |
| 733 | |
| 734 | /* |
| 735 | * kern.file returns an array of these structures, which are designed |
| 736 | * both to be immune to 32/64 bit emulation issues and to |
| 737 | * provide backwards compatibility. The order differs slightly from |
| 738 | * that of the real struct file, and some fields are taken from other |
| 739 | * structures (struct vnode, struct proc) in order to make the file |
| 740 | * information more useful. |
| 741 | */ |
| 742 | #define	KERN_FILE_BYFILE	1 |
| 743 | #define	KERN_FILE_BYPID		2 |
| 744 | #define	KERN_FILE_BYUID		3 |
| 745 | #define	KERN_FILESLOP		10 |
| 746 | |
| 747 | #define KERN_FILE_TEXT		-1 |
| 748 | #define KERN_FILE_CDIR		-2 |
| 749 | #define KERN_FILE_RDIR		-3 |
| 750 | #define KERN_FILE_TRACE		-4 |
| 751 | |
| 752 | #define KI_MNAMELEN		96	/* rounded up from 90 */ |
| 753 | #define KI_UNPPATHLEN		104 |
| 754 | |
| 755 | struct kinfo_file { |
| 756 | 	uint64_t	f_fileaddr;	/* PTR: address of struct file */ |
| 757 | 	uint32_t	f_flag;		/* UINT: flags (see fcntl.h) */ |
| 758 | 	uint32_t	f_iflags;	/* UINT: internal flags */ |
| 759 | 	uint32_t	f_type;		/* INT: descriptor type */ |
| 760 | 	uint32_t	f_count;	/* UINT: reference count */ |
| 761 | 	uint32_t	f_msgcount;	/* UINT: references from msg queue */ |
| 762 | 	uint32_t	f_usecount;	/* INT: number active users */ |
| 763 | 	uint64_t	f_ucred;	/* PTR: creds for descriptor */ |
| 764 | 	uint32_t	f_uid;		/* UID_T: descriptor credentials */ |
| 765 | 	uint32_t	f_gid;		/* GID_T: descriptor credentials */ |
| 766 | 	uint64_t	f_ops;		/* PTR: address of fileops */ |
| 767 | 	uint64_t	f_offset;	/* OFF_T: offset */ |
| 768 | 	uint64_t	f_data;		/* PTR: descriptor data */ |
| 769 | 	uint64_t	f_rxfer;	/* UINT64: number of read xfers */ |
| 770 | 	uint64_t	f_rwfer;	/* UINT64: number of write xfers */ |
| 771 | 	uint64_t	f_seek;		/* UINT64: number of seek operations */ |
| 772 | 	uint64_t	f_rbytes;	/* UINT64: total bytes read */ |
| 773 | 	uint64_t	f_wbytes;	/* UINT64: total bytes written */ |
| 774 | |
| 775 | 	/* information about the vnode associated with this file */ |
| 776 | 	uint64_t	v_un;		/* PTR: socket, specinfo, etc */ |
| 777 | 	uint32_t	v_type;		/* ENUM: vnode type */ |
| 778 | 	uint32_t	v_tag;		/* ENUM: type of underlying data */ |
| 779 | 	uint32_t	v_flag;		/* UINT: vnode flags */ |
| 780 | 	uint32_t	va_rdev;	/* DEV_T: raw device */ |
| 781 | 	uint64_t	v_data;		/* PTR: private data for fs */ |
| 782 | 	uint64_t	v_mount;	/* PTR: mount info for fs */ |
| 783 | 	uint64_t	va_fileid;	/* LONG: file id */ |
| 784 | 	uint64_t	va_size;	/* UINT64_T: file size in bytes */ |
| 785 | 	uint32_t	va_mode;	/* MODE_T: file access mode and type */ |
| 786 | 	uint32_t	va_fsid;	/* DEV_T: filesystem device */ |
| 787 | 	char		f_mntonname[KI_MNAMELEN]; |
| 788 | |
| 789 | 	/* socket information */ |
| 790 | 	uint32_t	so_type;	/* SHORT: socket type */ |
| 791 | 	uint32_t	so_state;	/* SHORT: socket state */ |
| 792 | 	uint64_t	so_pcb;		/* PTR: socket pcb */ |
| 793 | 					/* for non-root: -1 if not NULL */ |
| 794 | 	uint32_t	so_protocol;	/* SHORT: socket protocol type */ |
| 795 | 	uint32_t	so_family;	/* INT: socket domain family */ |
| 796 | 	uint64_t	inp_ppcb;	/* PTR: pointer to per-protocol pcb */ |
| 797 | 	uint32_t	inp_lport;	/* SHORT: local inet port */ |
| 798 | 	uint32_t	inp_laddru[4];	/* STRUCT: local inet addr */ |
| 799 | 	uint32_t	inp_fport;	/* SHORT: foreign inet port */ |
| 800 | 	uint32_t	inp_faddru[4];	/* STRUCT: foreign inet addr */ |
| 801 | 	uint64_t	unp_conn;	/* PTR: connected socket cntrl block */ |
| 802 | |
| 803 | 	/* pipe information */ |
| 804 | 	uint64_t	pipe_peer;	/* PTR: link with other direction */ |
| 805 | 	uint32_t	pipe_state;	/* UINT: pipe status info */ |
| 806 | |
| 807 | 	/* kqueue information */ |
| 808 | 	uint32_t	kq_count;	/* INT: number of pending events */ |
| 809 | 	uint32_t	kq_state;	/* INT: kqueue status information */ |
| 810 | |
| 811 | 	uint32_t	__unused1;	/* INT: unused */ |
| 812 | |
| 813 | 	/* process information when retrieved via KERN_FILE_BY[PU]ID */ |
| 814 | 	uint32_t	p_pid;		/* PID_T: process id */ |
| 815 | 	int32_t		fd_fd;		/* INT: descriptor number */ |
| 816 | 	uint32_t	fd_ofileflags;	/* CHAR: open file flags */ |
| 817 | 	uint32_t	p_uid;		/* UID_T: process credentials */ |
| 818 | 	uint32_t	p_gid;		/* GID_T: process credentials */ |
| 819 | 	uint32_t	p_tid;		/* PID_T: thread id */ |
| 820 | 	char		p_comm[KI_MAXCOMLEN]; |
| 821 | |
| 822 | 	/* more socket information */ |
| 823 | 	uint32_t	inp_rtableid;	/* UINT: Routing table identifier. */ |
| 824 | 	uint64_t	so_splice;	/* PTR: f_data of spliced socket */ |
| 825 | 	int64_t		so_splicelen;	/* OFF_T: already spliced count or */ |
| 826 | 					/* -1 if this is target of splice */ |
| 827 | 	uint64_t	so_rcv_cc;	/* LONG: chars in receive buf */ |
| 828 | 	uint64_t	so_snd_cc;	/* LONG: chars in send buf */ |
| 829 | 	uint64_t	unp_refs;	/* PTR: connected sockets */ |
| 830 | 	uint64_t	unp_nextref;	/* PTR: link to next connected socket */ |
| 831 | 	uint64_t	unp_addr;	/* PTR: address of the socket address */ |
| 832 | 	char		unp_path[KI_UNPPATHLEN]; |
| 833 | 	uint32_t	inp_proto;	/* CHAR: raw protocol id */ |
| 834 | 	uint32_t	t_state;	/* SHORT: tcp state */ |
| 835 | 	uint64_t	t_rcv_wnd;	/* ULONG: tcp receive window */ |
| 836 | 	uint64_t	t_snd_wnd;	/* ULONG: tcp send window */ |
| 837 | 	uint64_t	t_snd_cwnd;	/* ULONG: congestion-controlled win */ |
| 838 | |
| 839 | 	uint32_t	va_nlink;	/* NLINK_T: number of references to file */ |
| 840 | }; |
| 841 | |
| 842 | /* |
| 843 | * KERN_INTRCNT |
| 844 | */ |
| 845 | #define KERN_INTRCNT_NUM	1	/* int: # intrcnt */ |
| 846 | #define KERN_INTRCNT_CNT	2	/* node: intrcnt */ |
| 847 | #define KERN_INTRCNT_NAME	3	/* node: names */ |
| 848 | #define KERN_INTRCNT_VECTOR	4	/* node: interrupt vector # */ |
| 849 | #define KERN_INTRCNT_MAXID	5 |
| 850 | |
| 851 | #define CTL_KERN_INTRCNT_NAMES { \ |
| 852 | 	{ 0, 0 }, \ |
| 853 | 	{ "nintrcnt", CTLTYPE_INT }, \ |
| 854 | 	{ "intrcnt", CTLTYPE_NODE }, \ |
| 855 | 	{ "intrname", CTLTYPE_NODE }, \ |
| 856 | } |
| 857 | |
| 858 | /* |
| 859 | * KERN_WATCHDOG |
| 860 | */ |
| 861 | #define KERN_WATCHDOG_PERIOD	1	/* int: watchdog period */ |
| 862 | #define KERN_WATCHDOG_AUTO	2	/* int: automatic tickle */ |
| 863 | #define KERN_WATCHDOG_MAXID	3 |
| 864 | |
| 865 | #define CTL_KERN_WATCHDOG_NAMES { \ |
| 866 | 	{ 0, 0 }, \ |
| 867 | 	{ "period", CTLTYPE_INT }, \ |
| 868 | 	{ "auto", CTLTYPE_INT }, \ |
| 869 | } |
| 870 | |
| 871 | /* |
| 872 | * KERN_TIMECOUNTER |
| 873 | */ |
| 874 | #define KERN_TIMECOUNTER_TICK		1	/* int: number of revolutions */ |
| 875 | #define KERN_TIMECOUNTER_TIMESTEPWARNINGS 2	/* int: log a warning when time changes */ |
| 876 | #define KERN_TIMECOUNTER_HARDWARE	3	/* string: tick hardware used */ |
| 877 | #define KERN_TIMECOUNTER_CHOICE		4	/* string: tick hardware used */ |
| 878 | #define KERN_TIMECOUNTER_MAXID		5 |
| 879 | |
| 880 | #define CTL_KERN_TIMECOUNTER_NAMES { \ |
| 881 | 	{ 0, 0 }, \ |
| 882 | 	{ "tick", CTLTYPE_INT }, \ |
| 883 | 	{ "timestepwarnings", CTLTYPE_INT }, \ |
| 884 | 	{ "hardware", CTLTYPE_STRING }, \ |
| 885 | 	{ "choice", CTLTYPE_STRING }, \ |
| 886 | } |
| 887 | |
| 888 | /* |
| 889 | * KERN_CLOCKINTR |
| 890 | */ |
| 891 | #define KERN_CLOCKINTR_STATS		1	/* struct: stats */ |
| 892 | #define KERN_CLOCKINTR_MAXID		2 |
| 893 | |
| 894 | #define CTL_KERN_CLOCKINTR_NAMES { \ |
| 895 | 	{ 0, 0 }, \ |
| 896 | 	{ "stats", CTLTYPE_STRUCT }, \ |
| 897 | } |
| 898 | |
| 899 | /* |
| 900 | * CTL_HW identifiers |
| 901 | */ |
| 902 | #define	HW_MACHINE		 1	/* string: machine class */ |
| 903 | #define	HW_MODEL		 2	/* string: specific machine model */ |
| 904 | #define	HW_NCPU			 3	/* int: number of configured cpus */ |
| 905 | #define	HW_BYTEORDER		 4	/* int: machine byte order */ |
| 906 | #define	HW_PHYSMEM		 5	/* int: total memory */ |
| 907 | #define	HW_USERMEM		 6	/* int: non-kernel memory */ |
| 908 | #define	HW_PAGESIZE		 7	/* int: software page size */ |
| 909 | #define	HW_DISKNAMES		 8	/* strings: disk drive names */ |
| 910 | #define	HW_DISKSTATS		 9	/* struct: diskstats[] */ |
| 911 | #define	HW_DISKCOUNT		10	/* int: number of disks */ |
| 912 | #define	HW_SENSORS		11	/* node: hardware monitors */ |
| 913 | #define	HW_CPUSPEED		12	/* get CPU frequency */ |
| 914 | #define	HW_SETPERF		13	/* set CPU performance % */ |
| 915 | #define	HW_VENDOR		14	/* string: vendor name */ |
| 916 | #define	HW_PRODUCT		15	/* string: product name */ |
| 917 | #define	HW_VERSION		16	/* string: hardware version */ |
| 918 | #define	HW_SERIALNO		17	/* string: hardware serial number */ |
| 919 | #define	HW_UUID			18	/* string: universal unique id */ |
| 920 | #define	HW_PHYSMEM64		19	/* quad: total memory */ |
| 921 | #define	HW_USERMEM64		20	/* quad: non-kernel memory */ |
| 922 | #define	HW_NCPUFOUND		21	/* int: number of cpus found */ |
| 923 | #define	HW_ALLOWPOWERDOWN	22	/* allow power button shutdown */ |
| 924 | #define	HW_PERFPOLICY		23	/* set performance policy */ |
| 925 | #define	HW_SMT			24	/* int: enable SMT/HT/CMT */ |
| 926 | #define	HW_NCPUONLINE		25	/* int: number of cpus being used */ |
| 927 | #define	HW_POWER		26	/* int: machine has wall-power */ |
| 928 | #define	HW_BATTERY		27	/* node: battery */ |
| 929 | #define	HW_UCOMNAMES		28	/* strings: ucom names */ |
| 930 | #define	HW_BLOCKCPU		29	/* string: cpu types to block */ |
| 931 | #define	HW_MAXID		30	/* number of valid hw ids */ |
| 932 | |
| 933 | #define	CTL_HW_NAMES { \ |
| 934 | 	{ 0, 0 }, \ |
| 935 | 	{ "machine", CTLTYPE_STRING }, \ |
| 936 | 	{ "model", CTLTYPE_STRING }, \ |
| 937 | 	{ "ncpu", CTLTYPE_INT }, \ |
| 938 | 	{ "byteorder", CTLTYPE_INT }, \ |
| 939 | 	{ "gap", 0 }, \ |
| 940 | 	{ "gap", 0 }, \ |
| 941 | 	{ "pagesize", CTLTYPE_INT }, \ |
| 942 | 	{ "disknames", CTLTYPE_STRING }, \ |
| 943 | 	{ "diskstats", CTLTYPE_STRUCT }, \ |
| 944 | 	{ "diskcount", CTLTYPE_INT }, \ |
| 945 | 	{ "sensors", CTLTYPE_NODE}, \ |
| 946 | 	{ "cpuspeed", CTLTYPE_INT }, \ |
| 947 | 	{ "setperf", CTLTYPE_INT }, \ |
| 948 | 	{ "vendor", CTLTYPE_STRING }, \ |
| 949 | 	{ "product", CTLTYPE_STRING }, \ |
| 950 | 	{ "version", CTLTYPE_STRING }, \ |
| 951 | 	{ "serialno", CTLTYPE_STRING }, \ |
| 952 | 	{ "uuid", CTLTYPE_STRING }, \ |
| 953 | 	{ "physmem", CTLTYPE_QUAD }, \ |
| 954 | 	{ "usermem", CTLTYPE_QUAD }, \ |
| 955 | 	{ "ncpufound", CTLTYPE_INT }, \ |
| 956 | 	{ "allowpowerdown", CTLTYPE_INT }, \ |
| 957 | 	{ "perfpolicy", CTLTYPE_STRING }, \ |
| 958 | 	{ "smt", CTLTYPE_INT }, \ |
| 959 | 	{ "ncpuonline", CTLTYPE_INT }, \ |
| 960 | 	{ "power", CTLTYPE_INT }, \ |
| 961 | 	{ "battery", CTLTYPE_NODE }, \ |
| 962 | 	{ "ucomnames", CTLTYPE_STRING }, \ |
| 963 | 	{ "blockcpu", CTLTYPE_STRING }, \ |
| 964 | } |
| 965 | |
| 966 | /* |
| 967 | * HW_BATTERY |
| 968 | */ |
| 969 | #define	HW_BATTERY_CHARGEMODE	1	/* int: battery charging mode */ |
| 970 | #define	HW_BATTERY_CHARGESTART	2	/* int: battery start charge percent */ |
| 971 | #define	HW_BATTERY_CHARGESTOP	3	/* int: battery stop charge percent */ |
| 972 | #define	HW_BATTERY_MAXID	4 |
| 973 | |
| 974 | #define CTL_HW_BATTERY_NAMES { \ |
| 975 | 	{ 0, 0 }, \ |
| 976 | 	{ "chargemode", CTLTYPE_INT }, \ |
| 977 | 	{ "chargestart", CTLTYPE_INT }, \ |
| 978 | 	{ "chargestop", CTLTYPE_INT }, \ |
| 979 | } |
| 980 | |
| 981 | /* |
| 982 | * CTL_DEBUG definitions |
| 983 | * |
| 984 | * Second level identifier specifies which debug variable. |
| 985 | * Third level identifier specifies which structure component. |
| 986 | */ |
| 987 | #define	CTL_DEBUG_NAME		0	/* string: variable name */ |
| 988 | #define	CTL_DEBUG_VALUE		1	/* int: variable value */ |
| 989 | #define	CTL_DEBUG_MAXID		20 |
| 990 | |
| 991 | #ifdef	_KERNEL |
| 992 | #ifdef DEBUG_SYSCTL |
| 993 | /* |
| 994 | * CTL_DEBUG variables. |
| 995 | * |
| 996 | * These are declared as separate variables so that they can be |
| 997 | * individually initialized at the location of their associated |
| 998 | * variable. The loader prevents multiple use by issuing errors |
| 999 | * if a variable is initialized in more than one place. They are |
| 1000 | * aggregated into an array in debug_sysctl(), so that it can |
| 1001 | * conveniently locate them when queried. If more debugging |
| 1002 | * variables are added, they must also be declared here and also |
| 1003 | * entered into the array. |
| 1004 | */ |
| 1005 | struct ctldebug { |
| 1006 | 	char	*debugname;	/* name of debugging variable */ |
| 1007 | 	int	*debugvar;	/* pointer to debugging variable */ |
| 1008 | }; |
| 1009 | #endif	/* DEBUG_SYSCTL */ |
| 1010 | |
| 1011 | /* |
| 1012 | * Exported sysctl variable with valid bounds. Both bounds are inclusive to |
| 1013 | * allow full range of values. |
| 1014 | */ |
| 1015 | struct sysctl_bounded_args { |
| 1016 | 	int mib; /* identifier shared with userspace as a CTL_ #define */ |
| 1017 | 	int *var; /* never NULL */ |
| 1018 | 	int minimum; /* checking is disabled if minimum == maximum */ |
| 1019 | 	int maximum; /* read-only variable if minimum > maximum */ |
| 1020 | }; |
| 1021 | |
| 1022 | /* Special case minimum,maximum marker for sysctl_bounded_args. */ |
| 1023 | #define SYSCTL_INT_READONLY	1,0 |
| 1024 | |
| 1025 | /* |
| 1026 | * Internal sysctl function calling convention: |
| 1027 | * |
| 1028 | *	(*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen); |
| 1029 | * |
| 1030 | * The name parameter points at the next component of the name to be |
| 1031 | * interpreted. The namelen parameter is the number of integers in |
| 1032 | * the name. |
| 1033 | */ |
| 1034 | typedef int (sysctlfn)(int *, u_int, void *, size_t *, void *, size_t, struct proc *); |
| 1035 | |
| 1036 | extern struct rwlock sysctl_lock; |
| 1037 | |
| 1038 | int sysctl_vslock(void *, size_t); |
| 1039 | void sysctl_vsunlock(void *, size_t); |
| 1040 | |
| 1041 | int sysctl_int_lower(void *, size_t *, void *, size_t, int *); |
| 1042 | int sysctl_int(void *, size_t *, void *, size_t, int *); |
| 1043 | int sysctl_rdint(void *, size_t *, void *, int); |
| 1044 | int sysctl_securelevel_int(void *, size_t *, void *, size_t, int *); |
| 1045 | int sysctl_int_bounded(void *, size_t *, void *, size_t, int *, int, int); |
| 1046 | int sysctl_bounded_arr(const struct sysctl_bounded_args *, u_int, |
| 1047 | int *, u_int, void *, size_t *, void *, size_t); |
| 1048 | int sysctl_rdquad(void *, size_t *, void *, int64_t); |
| 1049 | int sysctl_string(void *, size_t *, void *, size_t, char *, size_t); |
| 1050 | int sysctl_tstring(void *, size_t *, void *, size_t, char *, size_t); |
| 1051 | int sysctl__string(void *, size_t *, void *, size_t, char *, size_t, int); |
| 1052 | int sysctl_rdstring(void *, size_t *, void *, const char *); |
| 1053 | int sysctl_rdstruct(void *, size_t *, void *, const void *, size_t); |
| 1054 | int sysctl_struct(void *, size_t *, void *, size_t, void *, size_t); |
| 1055 | int sysctl_file(int *, u_int, char *, size_t *, struct proc *); |
| 1056 | int sysctl_doproc(int *, u_int, char *, size_t *); |
| 1057 | struct mbuf_queue; |
| 1058 | int sysctl_mq(int *, u_int, void *, size_t *, void *, size_t, |
| 1059 | struct mbuf_queue *); |
| 1060 | struct rtentry; |
| 1061 | int sysctl_dumpentry(const struct rtentry *, void *, unsigned int); |
| 1062 | int sysctl_rtable(int *, u_int, void *, size_t *, void *, size_t); |
| 1063 | int sysctl_clockrate(char *, size_t *, void *); |
| 1064 | #if defined(GPROF) || defined(DDBPROF) |
| 1065 | int sysctl_doprof(int *, u_int, void *, size_t *, void *, size_t); |
| 1066 | #endif |
| 1067 | int sysctl_dopool(int *, u_int, char *, size_t *); |
| 1068 | |
| 1069 | int kern_sysctl(int *, u_int, void *, size_t *, void *, size_t, |
| 1070 | 		 struct proc *); |
| 1071 | int hw_sysctl(int *, u_int, void *, size_t *, void *, size_t, |
| 1072 | 		 struct proc *); |
| 1073 | #ifdef DEBUG_SYSCTL |
| 1074 | int debug_sysctl(int *, u_int, void *, size_t *, void *, size_t, |
| 1075 | 		 struct proc *); |
| 1076 | #endif |
| 1077 | int net_sysctl(int *, u_int, void *, size_t *, void *, size_t, |
| 1078 | 		 struct proc *); |
| 1079 | int cpu_sysctl(int *, u_int, void *, size_t *, void *, size_t, |
| 1080 | 		 struct proc *); |
| 1081 | int vfs_sysctl(int *, u_int, void *, size_t *, void *, size_t, |
| 1082 | 		 struct proc *); |
| 1083 | int sysctl_sysvipc(int *, u_int, void *, size_t *); |
| 1084 | int sysctl_wdog(int *, u_int, void *, size_t *, void *, size_t); |
| 1085 | |
| 1086 | extern int (*cpu_cpuspeed)(int *); |
| 1087 | extern void (*cpu_setperf)(int); |
| 1088 | |
| 1089 | int net_ifiq_sysctl(int *, u_int, void *, size_t *, void *, size_t); |
| 1090 | int bpf_sysctl(int *, u_int, void *, size_t *, void *, size_t); |
| 1091 | int pflow_sysctl(int *, u_int, void *, size_t *, void *, size_t); |
| 1092 | int pipex_sysctl(int *, u_int, void *, size_t *, void *, size_t); |
| 1093 | int mpls_sysctl(int *, u_int, void *, size_t *, void *, size_t); |
| 1094 | int pf_sysctl(void *, size_t *, void *, size_t); |
| 1095 | int uipc_sysctl(int *, u_int, void *, size_t *, void *, size_t); |
| 1096 | |
| 1097 | #else	/* !_KERNEL */ |
| 1098 | |
| 1099 | __BEGIN_DECLS |
| 1100 | int	sysctl(const int *, u_int, void *, size_t *, void *, size_t); |
| 1101 | __END_DECLS |
| 1102 | #endif	/* _KERNEL */ |
| 1103 | #endif	/* !_SYS_SYSCTL_H_ */ |