]>
Commit | Line | Data |
---|---|---|
0c530ab8 | 1 | /* |
f427ee49 | 2 | * Copyright (c) 2005-2020 Apple Computer, Inc. All rights reserved. |
0c530ab8 | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
0a7de745 | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
0a7de745 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
0a7de745 | 17 | * |
2d21ac55 A |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
0c530ab8 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
0a7de745 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
0c530ab8 A |
27 | */ |
28 | ||
29 | #ifndef _SYS_PROC_INFO_H | |
30 | #define _SYS_PROC_INFO_H | |
31 | ||
32 | #include <sys/cdefs.h> | |
33 | #include <sys/param.h> | |
34 | #include <sys/types.h> | |
35 | #include <sys/stat.h> | |
36 | #include <sys/mount.h> | |
37 | #include <sys/socket.h> | |
38 | #include <sys/un.h> | |
39 | #include <sys/kern_control.h> | |
3e170ce0 | 40 | #include <sys/event.h> |
0c530ab8 A |
41 | #include <net/if.h> |
42 | #include <net/route.h> | |
43 | #include <netinet/in.h> | |
44 | #include <netinet/tcp.h> | |
fe8ab488 | 45 | #include <mach/machine.h> |
39037602 | 46 | #include <uuid/uuid.h> |
0c530ab8 | 47 | |
3e170ce0 A |
48 | #ifdef PRIVATE |
49 | #include <mach/coalition.h> /* COALITION_NUM_TYPES */ | |
50 | #endif | |
51 | ||
0c530ab8 A |
52 | __BEGIN_DECLS |
53 | ||
54 | ||
0a7de745 A |
55 | #define PROC_ALL_PIDS 1 |
56 | #define PROC_PGRP_ONLY 2 | |
57 | #define PROC_TTY_ONLY 3 | |
58 | #define PROC_UID_ONLY 4 | |
59 | #define PROC_RUID_ONLY 5 | |
60 | #define PROC_PPID_ONLY 6 | |
61 | #define PROC_KDBG_ONLY 7 | |
0c530ab8 A |
62 | |
63 | struct proc_bsdinfo { | |
0a7de745 A |
64 | uint32_t pbi_flags; /* 64bit; emulated etc */ |
65 | uint32_t pbi_status; | |
66 | uint32_t pbi_xstatus; | |
67 | uint32_t pbi_pid; | |
68 | uint32_t pbi_ppid; | |
69 | uid_t pbi_uid; | |
70 | gid_t pbi_gid; | |
71 | uid_t pbi_ruid; | |
72 | gid_t pbi_rgid; | |
73 | uid_t pbi_svuid; | |
74 | gid_t pbi_svgid; | |
75 | uint32_t rfu_1; /* reserved */ | |
76 | char pbi_comm[MAXCOMLEN]; | |
77 | char pbi_name[2 * MAXCOMLEN]; /* empty if no name is registered */ | |
78 | uint32_t pbi_nfiles; | |
79 | uint32_t pbi_pgid; | |
80 | uint32_t pbi_pjobc; | |
81 | uint32_t e_tdev; /* controlling tty dev */ | |
82 | uint32_t e_tpgid; /* tty process group id */ | |
83 | int32_t pbi_nice; | |
84 | uint64_t pbi_start_tvsec; | |
85 | uint64_t pbi_start_tvusec; | |
0c530ab8 A |
86 | }; |
87 | ||
88 | ||
6d2010ae | 89 | struct proc_bsdshortinfo { |
0a7de745 A |
90 | uint32_t pbsi_pid; /* process id */ |
91 | uint32_t pbsi_ppid; /* process parent id */ | |
92 | uint32_t pbsi_pgid; /* process perp id */ | |
93 | uint32_t pbsi_status; /* p_stat value, SZOMB, SRUN, etc */ | |
94 | char pbsi_comm[MAXCOMLEN]; /* upto 16 characters of process name */ | |
6d2010ae | 95 | uint32_t pbsi_flags; /* 64bit; emulated etc */ |
0a7de745 A |
96 | uid_t pbsi_uid; /* current uid on process */ |
97 | gid_t pbsi_gid; /* current gid on process */ | |
98 | uid_t pbsi_ruid; /* current ruid on process */ | |
99 | gid_t pbsi_rgid; /* current tgid on process */ | |
100 | uid_t pbsi_svuid; /* current svuid on process */ | |
101 | gid_t pbsi_svgid; /* current svgid on process */ | |
102 | uint32_t pbsi_rfu; /* reserved for future use*/ | |
6d2010ae A |
103 | }; |
104 | ||
0c530ab8 | 105 | |
39236c6e A |
106 | #ifdef PRIVATE |
107 | struct proc_uniqidentifierinfo { | |
0a7de745 A |
108 | uint8_t p_uuid[16]; /* UUID of the main executable */ |
109 | uint64_t p_uniqueid; /* 64 bit unique identifier for process */ | |
110 | uint64_t p_puniqueid; /* unique identifier for process's parent */ | |
f427ee49 A |
111 | int32_t p_idversion; /* pid version */ |
112 | uint32_t p_reserve2; /* reserved for future use */ | |
0a7de745 A |
113 | uint64_t p_reserve3; /* reserved for future use */ |
114 | uint64_t p_reserve4; /* reserved for future use */ | |
39236c6e A |
115 | }; |
116 | ||
117 | ||
118 | struct proc_bsdinfowithuniqid { | |
119 | struct proc_bsdinfo pbsd; | |
120 | struct proc_uniqidentifierinfo p_uniqidentifier; | |
121 | }; | |
fe8ab488 A |
122 | |
123 | struct proc_archinfo { | |
0a7de745 A |
124 | cpu_type_t p_cputype; |
125 | cpu_subtype_t p_cpusubtype; | |
fe8ab488 A |
126 | }; |
127 | ||
128 | struct proc_pidcoalitioninfo { | |
3e170ce0 | 129 | uint64_t coalition_id[COALITION_NUM_TYPES]; |
fe8ab488 A |
130 | uint64_t reserved1; |
131 | uint64_t reserved2; | |
132 | uint64_t reserved3; | |
133 | }; | |
134 | ||
3e170ce0 A |
135 | struct proc_originatorinfo { |
136 | uuid_t originator_uuid; /* UUID of the originator process */ | |
137 | pid_t originator_pid; /* pid of the originator process */ | |
138 | uint64_t p_reserve2; | |
139 | uint64_t p_reserve3; | |
140 | uint64_t p_reserve4; | |
141 | }; | |
142 | ||
cb323159 A |
143 | struct proc_ipctableinfo { |
144 | uint32_t table_size; | |
145 | uint32_t table_free; | |
146 | }; | |
147 | ||
39236c6e A |
148 | #endif |
149 | ||
150 | ||
0c530ab8 | 151 | /* pbi_flags values */ |
0a7de745 A |
152 | #define PROC_FLAG_SYSTEM 1 /* System process */ |
153 | #define PROC_FLAG_TRACED 2 /* process currently being traced, possibly by gdb */ | |
154 | #define PROC_FLAG_INEXIT 4 /* process is working its way in exit() */ | |
155 | #define PROC_FLAG_PPWAIT 8 | |
156 | #define PROC_FLAG_LP64 0x10 /* 64bit process */ | |
157 | #define PROC_FLAG_SLEADER 0x20 /* The process is the session leader */ | |
158 | #define PROC_FLAG_CTTY 0x40 /* process has a control tty */ | |
159 | #define PROC_FLAG_CONTROLT 0x80 /* Has a controlling terminal */ | |
160 | #define PROC_FLAG_THCWD 0x100 /* process has a thread with cwd */ | |
b0d623f7 | 161 | /* process control bits for resource starvation */ |
0a7de745 A |
162 | #define PROC_FLAG_PC_THROTTLE 0x200 /* In resource starvation situations, this process is to be throttled */ |
163 | #define PROC_FLAG_PC_SUSP 0x400 /* In resource starvation situations, this process is to be suspended */ | |
164 | #define PROC_FLAG_PC_KILL 0x600 /* In resource starvation situations, this process is to be terminated */ | |
165 | #define PROC_FLAG_PC_MASK 0x600 | |
b0d623f7 | 166 | /* process action bits for resource starvation */ |
0a7de745 A |
167 | #define PROC_FLAG_PA_THROTTLE 0x800 /* The process is currently throttled due to resource starvation */ |
168 | #define PROC_FLAG_PA_SUSP 0x1000 /* The process is currently suspended due to resource starvation */ | |
169 | #define PROC_FLAG_PSUGID 0x2000 /* process has set privileges since last exec */ | |
170 | #define PROC_FLAG_EXEC 0x4000 /* process has called exec */ | |
6d2010ae | 171 | #ifdef PRIVATE |
0a7de745 A |
172 | #define PROC_FLAG_DARWINBG 0x8000 /* process in darwin background */ |
173 | #define PROC_FLAG_EXT_DARWINBG 0x10000 /* process in darwin background - external enforcement */ | |
174 | #define PROC_FLAG_IOS_APPLEDAEMON 0x20000 /* Process is apple daemon */ | |
175 | #define PROC_FLAG_DELAYIDLESLEEP 0x40000 /* Process is marked to delay idle sleep on disk IO */ | |
176 | #define PROC_FLAG_IOS_IMPPROMOTION 0x80000 /* Process is daemon which receives importane donation */ | |
39236c6e A |
177 | #define PROC_FLAG_ADAPTIVE 0x100000 /* Process is adaptive */ |
178 | #define PROC_FLAG_ADAPTIVE_IMPORTANT 0x200000 /* Process is adaptive, and is currently important */ | |
179 | #define PROC_FLAG_IMPORTANCE_DONOR 0x400000 /* Process is marked as an importance donor */ | |
180 | #define PROC_FLAG_SUPPRESSED 0x800000 /* Process is suppressed */ | |
0a7de745 A |
181 | #define PROC_FLAG_APPLICATION 0x1000000 /* Process is an application */ |
182 | #define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */ | |
6d2010ae | 183 | #endif |
0c530ab8 A |
184 | |
185 | ||
186 | struct proc_taskinfo { | |
0a7de745 A |
187 | uint64_t pti_virtual_size; /* virtual memory size (bytes) */ |
188 | uint64_t pti_resident_size; /* resident memory size (bytes) */ | |
189 | uint64_t pti_total_user; /* total time */ | |
190 | uint64_t pti_total_system; | |
191 | uint64_t pti_threads_user; /* existing threads only */ | |
192 | uint64_t pti_threads_system; | |
193 | int32_t pti_policy; /* default policy for new threads */ | |
194 | int32_t pti_faults; /* number of page faults */ | |
195 | int32_t pti_pageins; /* number of actual pageins */ | |
196 | int32_t pti_cow_faults; /* number of copy-on-write faults */ | |
197 | int32_t pti_messages_sent; /* number of messages sent */ | |
198 | int32_t pti_messages_received; /* number of messages received */ | |
199 | int32_t pti_syscalls_mach; /* number of mach system calls */ | |
200 | int32_t pti_syscalls_unix; /* number of unix system calls */ | |
201 | int32_t pti_csw; /* number of context switches */ | |
202 | int32_t pti_threadnum; /* number of threads in the task */ | |
203 | int32_t pti_numrunning; /* number of running threads */ | |
204 | int32_t pti_priority; /* task priority*/ | |
0c530ab8 A |
205 | }; |
206 | ||
207 | struct proc_taskallinfo { | |
0a7de745 A |
208 | struct proc_bsdinfo pbsd; |
209 | struct proc_taskinfo ptinfo; | |
0c530ab8 A |
210 | }; |
211 | ||
b0d623f7 | 212 | #define MAXTHREADNAMESIZE 64 |
0c530ab8 A |
213 | |
214 | struct proc_threadinfo { | |
0a7de745 A |
215 | uint64_t pth_user_time; /* user run time */ |
216 | uint64_t pth_system_time; /* system run time */ | |
217 | int32_t pth_cpu_usage; /* scaled cpu usage percentage */ | |
218 | int32_t pth_policy; /* scheduling policy in effect */ | |
219 | int32_t pth_run_state; /* run state (see below) */ | |
220 | int32_t pth_flags; /* various flags (see below) */ | |
221 | int32_t pth_sleep_time; /* number of seconds that thread */ | |
222 | int32_t pth_curpri; /* cur priority*/ | |
223 | int32_t pth_priority; /* priority*/ | |
224 | int32_t pth_maxpriority; /* max priority*/ | |
225 | char pth_name[MAXTHREADNAMESIZE]; /* thread name, if any */ | |
0c530ab8 A |
226 | }; |
227 | ||
228 | struct proc_regioninfo { | |
0a7de745 A |
229 | uint32_t pri_protection; |
230 | uint32_t pri_max_protection; | |
231 | uint32_t pri_inheritance; | |
232 | uint32_t pri_flags; /* shared, external pager, is submap */ | |
233 | uint64_t pri_offset; | |
234 | uint32_t pri_behavior; | |
235 | uint32_t pri_user_wired_count; | |
236 | uint32_t pri_user_tag; | |
237 | uint32_t pri_pages_resident; | |
238 | uint32_t pri_pages_shared_now_private; | |
239 | uint32_t pri_pages_swapped_out; | |
240 | uint32_t pri_pages_dirtied; | |
241 | uint32_t pri_ref_count; | |
242 | uint32_t pri_shadow_depth; | |
243 | uint32_t pri_share_mode; | |
244 | uint32_t pri_private_pages_resident; | |
245 | uint32_t pri_shared_pages_resident; | |
246 | uint32_t pri_obj_id; | |
247 | uint32_t pri_depth; | |
248 | uint64_t pri_address; | |
249 | uint64_t pri_size; | |
250 | }; | |
251 | ||
252 | #define PROC_REGION_SUBMAP 1 | |
253 | #define PROC_REGION_SHARED 2 | |
0c530ab8 A |
254 | |
255 | #define SM_COW 1 | |
256 | #define SM_PRIVATE 2 | |
257 | #define SM_EMPTY 3 | |
258 | #define SM_SHARED 4 | |
259 | #define SM_TRUESHARED 5 | |
260 | #define SM_PRIVATE_ALIASED 6 | |
261 | #define SM_SHARED_ALIASED 7 | |
6d2010ae | 262 | #define SM_LARGE_PAGE 8 |
0c530ab8 A |
263 | |
264 | ||
265 | /* | |
266 | * Thread run states (state field). | |
267 | */ | |
268 | ||
0a7de745 A |
269 | #define TH_STATE_RUNNING 1 /* thread is running normally */ |
270 | #define TH_STATE_STOPPED 2 /* thread is stopped */ | |
271 | #define TH_STATE_WAITING 3 /* thread is waiting normally */ | |
272 | #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible | |
273 | * wait */ | |
274 | #define TH_STATE_HALTED 5 /* thread is halted at a | |
275 | * clean point */ | |
0c530ab8 A |
276 | |
277 | /* | |
278 | * Thread flags (flags field). | |
279 | */ | |
0a7de745 A |
280 | #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */ |
281 | #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */ | |
0c530ab8 A |
282 | |
283 | ||
b0d623f7 | 284 | struct proc_workqueueinfo { |
0a7de745 A |
285 | uint32_t pwq_nthreads; /* total number of workqueue threads */ |
286 | uint32_t pwq_runthreads; /* total number of running workqueue threads */ | |
287 | uint32_t pwq_blockedthreads; /* total number of blocked workqueue threads */ | |
288 | uint32_t pwq_state; | |
b0d623f7 | 289 | }; |
0c530ab8 | 290 | |
6d2010ae A |
291 | /* |
292 | * workqueue state (pwq_state field) | |
293 | */ | |
39037602 A |
294 | #define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT 0x1 |
295 | #define WQ_EXCEEDED_TOTAL_THREAD_LIMIT 0x2 | |
296 | #define WQ_FLAGS_AVAILABLE 0x4 | |
6d2010ae | 297 | |
0c530ab8 | 298 | struct proc_fileinfo { |
0a7de745 A |
299 | uint32_t fi_openflags; |
300 | uint32_t fi_status; | |
301 | off_t fi_offset; | |
302 | int32_t fi_type; | |
303 | uint32_t fi_guardflags; | |
0c530ab8 A |
304 | }; |
305 | ||
2d21ac55 | 306 | /* stats flags in proc_fileinfo */ |
0a7de745 A |
307 | #define PROC_FP_SHARED 1 /* shared by more than one fd */ |
308 | #define PROC_FP_CLEXEC 2 /* close on exec */ | |
309 | #define PROC_FP_GUARDED 4 /* guarded fd */ | |
310 | #define PROC_FP_CLFORK 8 /* close on fork */ | |
39236c6e | 311 | |
0a7de745 A |
312 | #define PROC_FI_GUARD_CLOSE (1u << 0) |
313 | #define PROC_FI_GUARD_DUP (1u << 1) | |
314 | #define PROC_FI_GUARD_SOCKET_IPC (1u << 2) | |
315 | #define PROC_FI_GUARD_FILEPORT (1u << 3) | |
2d21ac55 | 316 | |
39037602 | 317 | struct proc_exitreasonbasicinfo { |
0a7de745 A |
318 | uint32_t beri_namespace; |
319 | uint64_t beri_code; | |
320 | uint64_t beri_flags; | |
321 | uint32_t beri_reason_buf_size; | |
39037602 A |
322 | } __attribute__((packed)); |
323 | ||
324 | struct proc_exitreasoninfo { | |
0a7de745 A |
325 | uint32_t eri_namespace; |
326 | uint64_t eri_code; | |
327 | uint64_t eri_flags; | |
328 | uint32_t eri_reason_buf_size; | |
329 | uint64_t eri_kcd_buf; | |
39037602 A |
330 | } __attribute__((packed)); |
331 | ||
2d21ac55 A |
332 | /* |
333 | * A copy of stat64 with static sized fields. | |
334 | */ | |
335 | struct vinfo_stat { | |
0a7de745 A |
336 | uint32_t vst_dev; /* [XSI] ID of device containing file */ |
337 | uint16_t vst_mode; /* [XSI] Mode of file (see below) */ | |
338 | uint16_t vst_nlink; /* [XSI] Number of hard links */ | |
339 | uint64_t vst_ino; /* [XSI] File serial number */ | |
340 | uid_t vst_uid; /* [XSI] User ID of the file */ | |
341 | gid_t vst_gid; /* [XSI] Group ID of the file */ | |
342 | int64_t vst_atime; /* [XSI] Time of last access */ | |
343 | int64_t vst_atimensec; /* nsec of last access */ | |
344 | int64_t vst_mtime; /* [XSI] Last data modification time */ | |
345 | int64_t vst_mtimensec; /* last data modification nsec */ | |
346 | int64_t vst_ctime; /* [XSI] Time of last status change */ | |
347 | int64_t vst_ctimensec; /* nsec of last status change */ | |
348 | int64_t vst_birthtime; /* File creation time(birth) */ | |
349 | int64_t vst_birthtimensec; /* nsec of File creation time */ | |
350 | off_t vst_size; /* [XSI] file size, in bytes */ | |
351 | int64_t vst_blocks; /* [XSI] blocks allocated for file */ | |
352 | int32_t vst_blksize; /* [XSI] optimal blocksize for I/O */ | |
353 | uint32_t vst_flags; /* user defined flags for file */ | |
354 | uint32_t vst_gen; /* file generation number */ | |
355 | uint32_t vst_rdev; /* [XSI] Device ID */ | |
356 | int64_t vst_qspare[2]; /* RESERVED: DO NOT USE! */ | |
2d21ac55 | 357 | }; |
0c530ab8 A |
358 | |
359 | struct vnode_info { | |
0a7de745 A |
360 | struct vinfo_stat vi_stat; |
361 | int vi_type; | |
362 | int vi_pad; | |
363 | fsid_t vi_fsid; | |
0c530ab8 A |
364 | }; |
365 | ||
366 | struct vnode_info_path { | |
0a7de745 A |
367 | struct vnode_info vip_vi; |
368 | char vip_path[MAXPATHLEN]; /* tail end of it */ | |
0c530ab8 A |
369 | }; |
370 | ||
371 | struct vnode_fdinfo { | |
0a7de745 A |
372 | struct proc_fileinfo pfi; |
373 | struct vnode_info pvi; | |
0c530ab8 A |
374 | }; |
375 | ||
376 | struct vnode_fdinfowithpath { | |
0a7de745 A |
377 | struct proc_fileinfo pfi; |
378 | struct vnode_info_path pvip; | |
0c530ab8 A |
379 | }; |
380 | ||
0c530ab8 | 381 | struct proc_regionwithpathinfo { |
0a7de745 A |
382 | struct proc_regioninfo prp_prinfo; |
383 | struct vnode_info_path prp_vip; | |
0c530ab8 A |
384 | }; |
385 | ||
cb323159 A |
386 | struct proc_regionpath { |
387 | uint64_t prpo_addr; | |
388 | uint64_t prpo_regionlength; | |
389 | char prpo_path[MAXPATHLEN]; | |
390 | }; | |
391 | ||
0c530ab8 | 392 | struct proc_vnodepathinfo { |
0a7de745 A |
393 | struct vnode_info_path pvi_cdir; |
394 | struct vnode_info_path pvi_rdir; | |
0c530ab8 A |
395 | }; |
396 | ||
2d21ac55 | 397 | struct proc_threadwithpathinfo { |
0a7de745 A |
398 | struct proc_threadinfo pt; |
399 | struct vnode_info_path pvip; | |
2d21ac55 | 400 | }; |
0c530ab8 A |
401 | |
402 | /* | |
0a7de745 | 403 | * Socket |
0c530ab8 A |
404 | */ |
405 | ||
406 | ||
407 | /* | |
408 | * IPv4 and IPv6 Sockets | |
409 | */ | |
410 | ||
411 | #define INI_IPV4 0x1 | |
412 | #define INI_IPV6 0x2 | |
413 | ||
414 | struct in4in6_addr { | |
0a7de745 A |
415 | u_int32_t i46a_pad32[3]; |
416 | struct in_addr i46a_addr4; | |
0c530ab8 A |
417 | }; |
418 | ||
419 | struct in_sockinfo { | |
0a7de745 A |
420 | int insi_fport; /* foreign port */ |
421 | int insi_lport; /* local port */ | |
422 | uint64_t insi_gencnt; /* generation count of this instance */ | |
423 | uint32_t insi_flags; /* generic IP/datagram flags */ | |
424 | uint32_t insi_flow; | |
425 | ||
426 | uint8_t insi_vflag; /* ini_IPV4 or ini_IPV6 */ | |
427 | uint8_t insi_ip_ttl; /* time to live proto */ | |
428 | uint32_t rfu_1; /* reserved */ | |
0c530ab8 A |
429 | /* protocol dependent part */ |
430 | union { | |
0a7de745 A |
431 | struct in4in6_addr ina_46; |
432 | struct in6_addr ina_6; | |
433 | } insi_faddr; /* foreign host table entry */ | |
0c530ab8 | 434 | union { |
0a7de745 A |
435 | struct in4in6_addr ina_46; |
436 | struct in6_addr ina_6; | |
437 | } insi_laddr; /* local host table entry */ | |
0c530ab8 | 438 | struct { |
0a7de745 A |
439 | u_char in4_tos; /* type of service */ |
440 | } insi_v4; | |
0c530ab8 | 441 | struct { |
0a7de745 A |
442 | uint8_t in6_hlim; |
443 | int in6_cksum; | |
444 | u_short in6_ifindex; | |
445 | short in6_hops; | |
446 | } insi_v6; | |
0c530ab8 A |
447 | }; |
448 | ||
449 | /* | |
450 | * TCP Sockets | |
451 | */ | |
452 | ||
0a7de745 A |
453 | #define TSI_T_REXMT 0 /* retransmit */ |
454 | #define TSI_T_PERSIST 1 /* retransmit persistence */ | |
455 | #define TSI_T_KEEP 2 /* keep alive */ | |
456 | #define TSI_T_2MSL 3 /* 2*msl quiet time timer */ | |
457 | #define TSI_T_NTIMERS 4 | |
458 | ||
459 | #define TSI_S_CLOSED 0 /* closed */ | |
460 | #define TSI_S_LISTEN 1 /* listening for connection */ | |
461 | #define TSI_S_SYN_SENT 2 /* active, have sent syn */ | |
462 | #define TSI_S_SYN_RECEIVED 3 /* have send and received syn */ | |
463 | #define TSI_S_ESTABLISHED 4 /* established */ | |
464 | #define TSI_S__CLOSE_WAIT 5 /* rcvd fin, waiting for close */ | |
465 | #define TSI_S_FIN_WAIT_1 6 /* have closed, sent fin */ | |
466 | #define TSI_S_CLOSING 7 /* closed xchd FIN; await FIN ACK */ | |
467 | #define TSI_S_LAST_ACK 8 /* had fin and close; await FIN ACK */ | |
468 | #define TSI_S_FIN_WAIT_2 9 /* have closed, fin is acked */ | |
469 | #define TSI_S_TIME_WAIT 10 /* in 2*msl quiet wait after close */ | |
470 | #define TSI_S_RESERVED 11 /* pseudo state: reserved */ | |
0c530ab8 A |
471 | |
472 | struct tcp_sockinfo { | |
0a7de745 A |
473 | struct in_sockinfo tcpsi_ini; |
474 | int tcpsi_state; | |
475 | int tcpsi_timer[TSI_T_NTIMERS]; | |
476 | int tcpsi_mss; | |
477 | uint32_t tcpsi_flags; | |
478 | uint32_t rfu_1; /* reserved */ | |
479 | uint64_t tcpsi_tp; /* opaque handle of TCP protocol control block */ | |
0c530ab8 A |
480 | }; |
481 | ||
482 | /* | |
483 | * Unix Domain Sockets | |
484 | */ | |
485 | ||
486 | ||
487 | struct un_sockinfo { | |
0a7de745 A |
488 | uint64_t unsi_conn_so; /* opaque handle of connected socket */ |
489 | uint64_t unsi_conn_pcb; /* opaque handle of connected protocol control block */ | |
0c530ab8 | 490 | union { |
0a7de745 A |
491 | struct sockaddr_un ua_sun; |
492 | char ua_dummy[SOCK_MAXADDRLEN]; | |
493 | } unsi_addr; /* bound address */ | |
0c530ab8 | 494 | union { |
0a7de745 A |
495 | struct sockaddr_un ua_sun; |
496 | char ua_dummy[SOCK_MAXADDRLEN]; | |
497 | } unsi_caddr; /* address of socket connected to */ | |
0c530ab8 A |
498 | }; |
499 | ||
500 | /* | |
501 | * PF_NDRV Sockets | |
502 | */ | |
503 | ||
504 | struct ndrv_info { | |
0a7de745 A |
505 | uint32_t ndrvsi_if_family; |
506 | uint32_t ndrvsi_if_unit; | |
507 | char ndrvsi_if_name[IF_NAMESIZE]; | |
0c530ab8 A |
508 | }; |
509 | ||
510 | /* | |
511 | * Kernel Event Sockets | |
512 | */ | |
513 | ||
514 | struct kern_event_info { | |
0a7de745 A |
515 | uint32_t kesi_vendor_code_filter; |
516 | uint32_t kesi_class_filter; | |
517 | uint32_t kesi_subclass_filter; | |
518 | }; | |
0c530ab8 A |
519 | |
520 | /* | |
521 | * Kernel Control Sockets | |
522 | */ | |
523 | ||
524 | struct kern_ctl_info { | |
0a7de745 A |
525 | uint32_t kcsi_id; |
526 | uint32_t kcsi_reg_unit; | |
527 | uint32_t kcsi_flags; /* support flags */ | |
528 | uint32_t kcsi_recvbufsize; /* request more than the default buffer size */ | |
529 | uint32_t kcsi_sendbufsize; /* request more than the default buffer size */ | |
530 | uint32_t kcsi_unit; | |
531 | char kcsi_name[MAX_KCTL_NAME]; /* unique nke identifier, provided by DTS */ | |
0c530ab8 A |
532 | }; |
533 | ||
f427ee49 A |
534 | /* |
535 | * VSock Sockets | |
536 | */ | |
537 | ||
538 | struct vsock_sockinfo { | |
539 | uint32_t local_cid; | |
540 | uint32_t local_port; | |
541 | uint32_t remote_cid; | |
542 | uint32_t remote_port; | |
543 | }; | |
544 | ||
0c530ab8 A |
545 | /* soi_state */ |
546 | ||
0a7de745 A |
547 | #define SOI_S_NOFDREF 0x0001 /* no file table ref any more */ |
548 | #define SOI_S_ISCONNECTED 0x0002 /* socket connected to a peer */ | |
549 | #define SOI_S_ISCONNECTING 0x0004 /* in process of connecting to peer */ | |
550 | #define SOI_S_ISDISCONNECTING 0x0008 /* in process of disconnecting */ | |
551 | #define SOI_S_CANTSENDMORE 0x0010 /* can't send more data to peer */ | |
552 | #define SOI_S_CANTRCVMORE 0x0020 /* can't receive more data from peer */ | |
553 | #define SOI_S_RCVATMARK 0x0040 /* at mark on input */ | |
554 | #define SOI_S_PRIV 0x0080 /* privileged for broadcast, raw... */ | |
555 | #define SOI_S_NBIO 0x0100 /* non-blocking ops */ | |
556 | #define SOI_S_ASYNC 0x0200 /* async i/o notify */ | |
557 | #define SOI_S_INCOMP 0x0800 /* Unaccepted, incomplete connection */ | |
558 | #define SOI_S_COMP 0x1000 /* unaccepted, complete connection */ | |
559 | #define SOI_S_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ | |
560 | #define SOI_S_DRAINING 0x4000 /* close waiting for blocked system calls to drain */ | |
0c530ab8 A |
561 | |
562 | struct sockbuf_info { | |
0a7de745 A |
563 | uint32_t sbi_cc; |
564 | uint32_t sbi_hiwat; /* SO_RCVBUF, SO_SNDBUF */ | |
565 | uint32_t sbi_mbcnt; | |
566 | uint32_t sbi_mbmax; | |
567 | uint32_t sbi_lowat; | |
568 | short sbi_flags; | |
569 | short sbi_timeo; | |
0c530ab8 A |
570 | }; |
571 | ||
572 | enum { | |
0a7de745 A |
573 | SOCKINFO_GENERIC = 0, |
574 | SOCKINFO_IN = 1, | |
575 | SOCKINFO_TCP = 2, | |
576 | SOCKINFO_UN = 3, | |
577 | SOCKINFO_NDRV = 4, | |
578 | SOCKINFO_KERN_EVENT = 5, | |
f427ee49 A |
579 | SOCKINFO_KERN_CTL = 6, |
580 | SOCKINFO_VSOCK = 7, | |
0c530ab8 A |
581 | }; |
582 | ||
583 | struct socket_info { | |
0a7de745 A |
584 | struct vinfo_stat soi_stat; |
585 | uint64_t soi_so; /* opaque handle of socket */ | |
586 | uint64_t soi_pcb; /* opaque handle of protocol control block */ | |
587 | int soi_type; | |
588 | int soi_protocol; | |
589 | int soi_family; | |
590 | short soi_options; | |
591 | short soi_linger; | |
592 | short soi_state; | |
593 | short soi_qlen; | |
594 | short soi_incqlen; | |
595 | short soi_qlimit; | |
596 | short soi_timeo; | |
597 | u_short soi_error; | |
598 | uint32_t soi_oobmark; | |
599 | struct sockbuf_info soi_rcv; | |
600 | struct sockbuf_info soi_snd; | |
601 | int soi_kind; | |
602 | uint32_t rfu_1; /* reserved */ | |
0c530ab8 | 603 | union { |
0a7de745 A |
604 | struct in_sockinfo pri_in; /* SOCKINFO_IN */ |
605 | struct tcp_sockinfo pri_tcp; /* SOCKINFO_TCP */ | |
606 | struct un_sockinfo pri_un; /* SOCKINFO_UN */ | |
607 | struct ndrv_info pri_ndrv; /* SOCKINFO_NDRV */ | |
608 | struct kern_event_info pri_kern_event; /* SOCKINFO_KERN_EVENT */ | |
609 | struct kern_ctl_info pri_kern_ctl; /* SOCKINFO_KERN_CTL */ | |
f427ee49 | 610 | struct vsock_sockinfo pri_vsock; /* SOCKINFO_VSOCK */ |
0a7de745 | 611 | } soi_proto; |
0c530ab8 A |
612 | }; |
613 | ||
614 | struct socket_fdinfo { | |
0a7de745 A |
615 | struct proc_fileinfo pfi; |
616 | struct socket_info psi; | |
0c530ab8 A |
617 | }; |
618 | ||
619 | ||
620 | ||
621 | struct psem_info { | |
0a7de745 A |
622 | struct vinfo_stat psem_stat; |
623 | char psem_name[MAXPATHLEN]; | |
0c530ab8 A |
624 | }; |
625 | ||
626 | struct psem_fdinfo { | |
0a7de745 A |
627 | struct proc_fileinfo pfi; |
628 | struct psem_info pseminfo; | |
0c530ab8 A |
629 | }; |
630 | ||
631 | ||
632 | ||
633 | struct pshm_info { | |
0a7de745 A |
634 | struct vinfo_stat pshm_stat; |
635 | uint64_t pshm_mappaddr; | |
636 | char pshm_name[MAXPATHLEN]; | |
0c530ab8 A |
637 | }; |
638 | ||
639 | struct pshm_fdinfo { | |
0a7de745 A |
640 | struct proc_fileinfo pfi; |
641 | struct pshm_info pshminfo; | |
0c530ab8 A |
642 | }; |
643 | ||
644 | ||
645 | struct pipe_info { | |
0a7de745 A |
646 | struct vinfo_stat pipe_stat; |
647 | uint64_t pipe_handle; | |
648 | uint64_t pipe_peerhandle; | |
649 | int pipe_status; | |
650 | int rfu_1; /* reserved */ | |
0c530ab8 A |
651 | }; |
652 | ||
653 | struct pipe_fdinfo { | |
0a7de745 A |
654 | struct proc_fileinfo pfi; |
655 | struct pipe_info pipeinfo; | |
0c530ab8 A |
656 | }; |
657 | ||
658 | ||
659 | struct kqueue_info { | |
0a7de745 A |
660 | struct vinfo_stat kq_stat; |
661 | uint32_t kq_state; | |
662 | uint32_t rfu_1; /* reserved */ | |
0c530ab8 | 663 | }; |
3e170ce0 | 664 | |
5ba3f43e A |
665 | struct kqueue_dyninfo { |
666 | struct kqueue_info kqdi_info; | |
667 | uint64_t kqdi_servicer; | |
668 | uint64_t kqdi_owner; | |
669 | uint32_t kqdi_sync_waiters; | |
670 | uint8_t kqdi_sync_waiter_qos; | |
671 | uint8_t kqdi_async_qos; | |
672 | uint16_t kqdi_request_state; | |
673 | uint8_t kqdi_events_qos; | |
0a7de745 A |
674 | uint8_t kqdi_pri; |
675 | uint8_t kqdi_pol; | |
676 | uint8_t kqdi_cpupercent; | |
d9a64523 | 677 | uint8_t _kqdi_reserved0[4]; |
5ba3f43e A |
678 | uint64_t _kqdi_reserved1[4]; |
679 | }; | |
680 | ||
3e170ce0 | 681 | /* keep in sync with KQ_* in sys/eventvar.h */ |
0a7de745 A |
682 | #define PROC_KQUEUE_SELECT 0x01 |
683 | #define PROC_KQUEUE_SLEEP 0x02 | |
684 | #define PROC_KQUEUE_32 0x08 | |
685 | #define PROC_KQUEUE_64 0x10 | |
686 | #define PROC_KQUEUE_QOS 0x20 | |
3e170ce0 A |
687 | |
688 | #ifdef PRIVATE | |
689 | struct kevent_extinfo { | |
690 | struct kevent_qos_s kqext_kev; | |
691 | uint64_t kqext_sdata; | |
692 | int kqext_status; | |
693 | int kqext_sfflags; | |
694 | uint64_t kqext_reserved[2]; | |
695 | }; | |
696 | #endif /* PRIVATE */ | |
0c530ab8 A |
697 | |
698 | struct kqueue_fdinfo { | |
0a7de745 A |
699 | struct proc_fileinfo pfi; |
700 | struct kqueue_info kqueueinfo; | |
0c530ab8 A |
701 | }; |
702 | ||
703 | struct appletalk_info { | |
0a7de745 | 704 | struct vinfo_stat atalk_stat; |
0c530ab8 A |
705 | }; |
706 | ||
707 | struct appletalk_fdinfo { | |
0a7de745 A |
708 | struct proc_fileinfo pfi; |
709 | struct appletalk_info appletalkinfo; | |
0c530ab8 A |
710 | }; |
711 | ||
a39ff7e2 | 712 | typedef uint64_t proc_info_udata_t; |
0c530ab8 A |
713 | |
714 | /* defns of process file desc type */ | |
0a7de745 A |
715 | #define PROX_FDTYPE_ATALK 0 |
716 | #define PROX_FDTYPE_VNODE 1 | |
717 | #define PROX_FDTYPE_SOCKET 2 | |
718 | #define PROX_FDTYPE_PSHM 3 | |
719 | #define PROX_FDTYPE_PSEM 4 | |
720 | #define PROX_FDTYPE_KQUEUE 5 | |
721 | #define PROX_FDTYPE_PIPE 6 | |
722 | #define PROX_FDTYPE_FSEVENTS 7 | |
723 | #define PROX_FDTYPE_NETPOLICY 9 | |
0c530ab8 A |
724 | |
725 | struct proc_fdinfo { | |
0a7de745 A |
726 | int32_t proc_fd; |
727 | uint32_t proc_fdtype; | |
0c530ab8 A |
728 | }; |
729 | ||
6d2010ae | 730 | struct proc_fileportinfo { |
0a7de745 A |
731 | uint32_t proc_fileport; |
732 | uint32_t proc_fdtype; | |
6d2010ae A |
733 | }; |
734 | ||
39037602 | 735 | |
b0d623f7 | 736 | /* Flavors for proc_pidinfo() */ |
0a7de745 A |
737 | #define PROC_PIDLISTFDS 1 |
738 | #define PROC_PIDLISTFD_SIZE (sizeof(struct proc_fdinfo)) | |
0c530ab8 | 739 | |
0a7de745 A |
740 | #define PROC_PIDTASKALLINFO 2 |
741 | #define PROC_PIDTASKALLINFO_SIZE (sizeof(struct proc_taskallinfo)) | |
0c530ab8 | 742 | |
0a7de745 A |
743 | #define PROC_PIDTBSDINFO 3 |
744 | #define PROC_PIDTBSDINFO_SIZE (sizeof(struct proc_bsdinfo)) | |
0c530ab8 | 745 | |
0a7de745 A |
746 | #define PROC_PIDTASKINFO 4 |
747 | #define PROC_PIDTASKINFO_SIZE (sizeof(struct proc_taskinfo)) | |
0c530ab8 | 748 | |
0a7de745 A |
749 | #define PROC_PIDTHREADINFO 5 |
750 | #define PROC_PIDTHREADINFO_SIZE (sizeof(struct proc_threadinfo)) | |
0c530ab8 | 751 | |
0a7de745 A |
752 | #define PROC_PIDLISTTHREADS 6 |
753 | #define PROC_PIDLISTTHREADS_SIZE (2* sizeof(uint32_t)) | |
0c530ab8 | 754 | |
0a7de745 A |
755 | #define PROC_PIDREGIONINFO 7 |
756 | #define PROC_PIDREGIONINFO_SIZE (sizeof(struct proc_regioninfo)) | |
0c530ab8 | 757 | |
0a7de745 A |
758 | #define PROC_PIDREGIONPATHINFO 8 |
759 | #define PROC_PIDREGIONPATHINFO_SIZE (sizeof(struct proc_regionwithpathinfo)) | |
0c530ab8 | 760 | |
0a7de745 A |
761 | #define PROC_PIDVNODEPATHINFO 9 |
762 | #define PROC_PIDVNODEPATHINFO_SIZE (sizeof(struct proc_vnodepathinfo)) | |
0c530ab8 | 763 | |
0a7de745 A |
764 | #define PROC_PIDTHREADPATHINFO 10 |
765 | #define PROC_PIDTHREADPATHINFO_SIZE (sizeof(struct proc_threadwithpathinfo)) | |
2d21ac55 | 766 | |
0a7de745 A |
767 | #define PROC_PIDPATHINFO 11 |
768 | #define PROC_PIDPATHINFO_SIZE (MAXPATHLEN) | |
769 | #define PROC_PIDPATHINFO_MAXSIZE (4*MAXPATHLEN) | |
2d21ac55 | 770 | |
0a7de745 A |
771 | #define PROC_PIDWORKQUEUEINFO 12 |
772 | #define PROC_PIDWORKQUEUEINFO_SIZE (sizeof(struct proc_workqueueinfo)) | |
0c530ab8 | 773 | |
0a7de745 A |
774 | #define PROC_PIDT_SHORTBSDINFO 13 |
775 | #define PROC_PIDT_SHORTBSDINFO_SIZE (sizeof(struct proc_bsdshortinfo)) | |
6d2010ae | 776 | |
0a7de745 A |
777 | #define PROC_PIDLISTFILEPORTS 14 |
778 | #define PROC_PIDLISTFILEPORTS_SIZE (sizeof(struct proc_fileportinfo)) | |
6d2010ae | 779 | |
0a7de745 A |
780 | #define PROC_PIDTHREADID64INFO 15 |
781 | #define PROC_PIDTHREADID64INFO_SIZE (sizeof(struct proc_threadinfo)) | |
316670eb | 782 | |
0a7de745 A |
783 | #define PROC_PID_RUSAGE 16 |
784 | #define PROC_PID_RUSAGE_SIZE 0 | |
39236c6e A |
785 | |
786 | #ifdef PRIVATE | |
0a7de745 | 787 | #define PROC_PIDUNIQIDENTIFIERINFO 17 |
39236c6e | 788 | #define PROC_PIDUNIQIDENTIFIERINFO_SIZE \ |
0a7de745 | 789 | (sizeof(struct proc_uniqidentifierinfo)) |
39236c6e | 790 | |
0a7de745 | 791 | #define PROC_PIDT_BSDINFOWITHUNIQID 18 |
39236c6e | 792 | #define PROC_PIDT_BSDINFOWITHUNIQID_SIZE \ |
0a7de745 | 793 | (sizeof(struct proc_bsdinfowithuniqid)) |
fe8ab488 | 794 | |
0a7de745 A |
795 | #define PROC_PIDARCHINFO 19 |
796 | #define PROC_PIDARCHINFO_SIZE \ | |
797 | (sizeof(struct proc_archinfo)) | |
fe8ab488 | 798 | |
0a7de745 A |
799 | #define PROC_PIDCOALITIONINFO 20 |
800 | #define PROC_PIDCOALITIONINFO_SIZE (sizeof(struct proc_pidcoalitioninfo)) | |
fe8ab488 | 801 | |
0a7de745 A |
802 | #define PROC_PIDNOTEEXIT 21 |
803 | #define PROC_PIDNOTEEXIT_SIZE (sizeof(uint32_t)) | |
fe8ab488 | 804 | |
0a7de745 A |
805 | #define PROC_PIDREGIONPATHINFO2 22 |
806 | #define PROC_PIDREGIONPATHINFO2_SIZE (sizeof(struct proc_regionwithpathinfo)) | |
fe8ab488 | 807 | |
0a7de745 A |
808 | #define PROC_PIDREGIONPATHINFO3 23 |
809 | #define PROC_PIDREGIONPATHINFO3_SIZE (sizeof(struct proc_regionwithpathinfo)) | |
fe8ab488 | 810 | |
0a7de745 A |
811 | #define PROC_PIDEXITREASONINFO 24 |
812 | #define PROC_PIDEXITREASONINFO_SIZE (sizeof(struct proc_exitreasoninfo)) | |
39037602 | 813 | |
0a7de745 A |
814 | #define PROC_PIDEXITREASONBASICINFO 25 |
815 | #define PROC_PIDEXITREASONBASICINFOSIZE (sizeof(struct proc_exitreasonbasicinfo)) | |
39037602 | 816 | |
5ba3f43e A |
817 | #define PROC_PIDLISTUPTRS 26 |
818 | #define PROC_PIDLISTUPTRS_SIZE (sizeof(uint64_t)) | |
819 | ||
820 | #define PROC_PIDLISTDYNKQUEUES 27 | |
821 | #define PROC_PIDLISTDYNKQUEUES_SIZE (sizeof(kqueue_id_t)) | |
822 | ||
0a7de745 A |
823 | #define PROC_PIDLISTTHREADIDS 28 |
824 | #define PROC_PIDLISTTHREADIDS_SIZE (2* sizeof(uint32_t)) | |
39236c6e | 825 | |
0a7de745 | 826 | #define PROC_PIDVMRTFAULTINFO 29 |
d9a64523 | 827 | #define PROC_PIDVMRTFAULTINFO_SIZE (7 * sizeof(uint64_t)) |
cb323159 A |
828 | |
829 | #define PROC_PIDPLATFORMINFO 30 | |
830 | #define PROC_PIDPLATFORMINFO_SIZE (sizeof(uint32_t)) | |
831 | ||
832 | #define PROC_PIDREGIONPATH 31 | |
833 | #define PROC_PIDREGIONPATH_SIZE (sizeof(struct proc_regionpath)) | |
834 | ||
835 | #define PROC_PIDIPCTABLEINFO 32 | |
836 | #define PROC_PIDIPCTABLEINFO_SIZE (sizeof(struct proc_ipctableinfo)) | |
837 | ||
d9a64523 | 838 | #endif /* PRIVATE */ |
b0d623f7 | 839 | /* Flavors for proc_pidfdinfo */ |
0c530ab8 | 840 | |
0a7de745 A |
841 | #define PROC_PIDFDVNODEINFO 1 |
842 | #define PROC_PIDFDVNODEINFO_SIZE (sizeof(struct vnode_fdinfo)) | |
0c530ab8 | 843 | |
0a7de745 A |
844 | #define PROC_PIDFDVNODEPATHINFO 2 |
845 | #define PROC_PIDFDVNODEPATHINFO_SIZE (sizeof(struct vnode_fdinfowithpath)) | |
0c530ab8 | 846 | |
0a7de745 A |
847 | #define PROC_PIDFDSOCKETINFO 3 |
848 | #define PROC_PIDFDSOCKETINFO_SIZE (sizeof(struct socket_fdinfo)) | |
0c530ab8 | 849 | |
0a7de745 A |
850 | #define PROC_PIDFDPSEMINFO 4 |
851 | #define PROC_PIDFDPSEMINFO_SIZE (sizeof(struct psem_fdinfo)) | |
0c530ab8 | 852 | |
0a7de745 A |
853 | #define PROC_PIDFDPSHMINFO 5 |
854 | #define PROC_PIDFDPSHMINFO_SIZE (sizeof(struct pshm_fdinfo)) | |
0c530ab8 | 855 | |
0a7de745 A |
856 | #define PROC_PIDFDPIPEINFO 6 |
857 | #define PROC_PIDFDPIPEINFO_SIZE (sizeof(struct pipe_fdinfo)) | |
0c530ab8 | 858 | |
0a7de745 A |
859 | #define PROC_PIDFDKQUEUEINFO 7 |
860 | #define PROC_PIDFDKQUEUEINFO_SIZE (sizeof(struct kqueue_fdinfo)) | |
0c530ab8 | 861 | |
0a7de745 A |
862 | #define PROC_PIDFDATALKINFO 8 |
863 | #define PROC_PIDFDATALKINFO_SIZE (sizeof(struct appletalk_fdinfo)) | |
0c530ab8 | 864 | |
3e170ce0 | 865 | #ifdef PRIVATE |
0a7de745 A |
866 | #define PROC_PIDFDKQUEUE_EXTINFO 9 |
867 | #define PROC_PIDFDKQUEUE_EXTINFO_SIZE (sizeof(struct kevent_extinfo)) | |
868 | #define PROC_PIDFDKQUEUE_KNOTES_MAX (1024 * 128) | |
869 | #define PROC_PIDDYNKQUEUES_MAX (1024 * 128) | |
3e170ce0 A |
870 | #endif /* PRIVATE */ |
871 | ||
39037602 | 872 | |
6d2010ae A |
873 | /* Flavors for proc_pidfileportinfo */ |
874 | ||
0a7de745 A |
875 | #define PROC_PIDFILEPORTVNODEPATHINFO 2 /* out: vnode_fdinfowithpath */ |
876 | #define PROC_PIDFILEPORTVNODEPATHINFO_SIZE \ | |
877 | PROC_PIDFDVNODEPATHINFO_SIZE | |
6d2010ae | 878 | |
0a7de745 A |
879 | #define PROC_PIDFILEPORTSOCKETINFO 3 /* out: socket_fdinfo */ |
880 | #define PROC_PIDFILEPORTSOCKETINFO_SIZE PROC_PIDFDSOCKETINFO_SIZE | |
6d2010ae | 881 | |
0a7de745 A |
882 | #define PROC_PIDFILEPORTPSHMINFO 5 /* out: pshm_fdinfo */ |
883 | #define PROC_PIDFILEPORTPSHMINFO_SIZE PROC_PIDFDPSHMINFO_SIZE | |
6d2010ae | 884 | |
0a7de745 A |
885 | #define PROC_PIDFILEPORTPIPEINFO 6 /* out: pipe_fdinfo */ |
886 | #define PROC_PIDFILEPORTPIPEINFO_SIZE PROC_PIDFDPIPEINFO_SIZE | |
6d2010ae | 887 | |
b0d623f7 | 888 | /* used for proc_setcontrol */ |
0a7de745 | 889 | #define PROC_SELFSET_PCONTROL 1 |
0c530ab8 | 890 | |
0a7de745 A |
891 | #define PROC_SELFSET_THREADNAME 2 |
892 | #define PROC_SELFSET_THREADNAME_SIZE (MAXTHREADNAMESIZE -1) | |
6d2010ae | 893 | |
0a7de745 | 894 | #define PROC_SELFSET_VMRSRCOWNER 3 |
6d2010ae | 895 | |
0a7de745 | 896 | #define PROC_SELFSET_DELAYIDLESLEEP 4 |
316670eb A |
897 | |
898 | /* used for proc_dirtycontrol */ | |
899 | #define PROC_DIRTYCONTROL_TRACK 1 | |
900 | #define PROC_DIRTYCONTROL_SET 2 | |
901 | #define PROC_DIRTYCONTROL_GET 3 | |
fe8ab488 | 902 | #define PROC_DIRTYCONTROL_CLEAR 4 |
316670eb A |
903 | |
904 | /* proc_track_dirty() flags */ | |
905 | #define PROC_DIRTY_TRACK 0x1 | |
906 | #define PROC_DIRTY_ALLOW_IDLE_EXIT 0x2 | |
39236c6e | 907 | #define PROC_DIRTY_DEFER 0x4 |
fe8ab488 | 908 | #define PROC_DIRTY_LAUNCH_IN_PROGRESS 0x8 |
d9a64523 | 909 | #define PROC_DIRTY_DEFER_ALWAYS 0x10 |
316670eb A |
910 | |
911 | /* proc_get_dirty() flags */ | |
912 | #define PROC_DIRTY_TRACKED 0x1 | |
913 | #define PROC_DIRTY_ALLOWS_IDLE_EXIT 0x2 | |
39236c6e | 914 | #define PROC_DIRTY_IS_DIRTY 0x4 |
fe8ab488 | 915 | #define PROC_DIRTY_LAUNCH_IS_IN_PROGRESS 0x8 |
39236c6e | 916 | |
a39ff7e2 | 917 | /* Flavors for proc_udata_info */ |
0a7de745 A |
918 | #define PROC_UDATA_INFO_GET 1 |
919 | #define PROC_UDATA_INFO_SET 2 | |
a39ff7e2 | 920 | |
39236c6e A |
921 | #ifdef PRIVATE |
922 | ||
fe8ab488 | 923 | /* Flavors for proc_pidoriginatorinfo */ |
0a7de745 A |
924 | #define PROC_PIDORIGINATOR_UUID 0x1 |
925 | #define PROC_PIDORIGINATOR_UUID_SIZE (sizeof(uuid_t)) | |
fe8ab488 | 926 | |
0a7de745 | 927 | #define PROC_PIDORIGINATOR_BGSTATE 0x2 |
fe8ab488 A |
928 | #define PROC_PIDORIGINATOR_BGSTATE_SIZE (sizeof(uint32_t)) |
929 | ||
3e170ce0 A |
930 | #define PROC_PIDORIGINATOR_PID_UUID 0x3 |
931 | #define PROC_PIDORIGINATOR_PID_UUID_SIZE (sizeof(struct proc_originatorinfo)) | |
932 | ||
933 | /* Flavors for proc_listcoalitions */ | |
0a7de745 | 934 | #define LISTCOALITIONS_ALL_COALS 1 |
3e170ce0 A |
935 | #define LISTCOALITIONS_ALL_COALS_SIZE (sizeof(struct procinfo_coalinfo)) |
936 | ||
0a7de745 | 937 | #define LISTCOALITIONS_SINGLE_TYPE 2 |
3e170ce0 A |
938 | #define LISTCOALITIONS_SINGLE_TYPE_SIZE (sizeof(struct procinfo_coalinfo)) |
939 | ||
4bd07ac2 A |
940 | /* reasons for proc_can_use_foreground_hw */ |
941 | #define PROC_FGHW_OK 0 /* pid may use foreground HW */ | |
942 | #define PROC_FGHW_DAEMON_OK 1 | |
943 | #define PROC_FGHW_DAEMON_LEADER 10 /* pid is in a daemon coalition */ | |
944 | #define PROC_FGHW_LEADER_NONUI 11 /* coalition leader is in a non-focal state */ | |
945 | #define PROC_FGHW_LEADER_BACKGROUND 12 /* coalition leader is in a background state */ | |
946 | #define PROC_FGHW_DAEMON_NO_VOUCHER 13 /* pid is a daemon with no adopted voucher */ | |
947 | #define PROC_FGHW_NO_VOUCHER_ATTR 14 /* pid has adopted a voucher with no bank/originator attribute */ | |
948 | #define PROC_FGHW_NO_ORIGINATOR 15 /* pid has adopted a voucher for a process that's gone away */ | |
949 | #define PROC_FGHW_ORIGINATOR_BACKGROUND 16 /* pid has adopted a voucher for an app that's in the background */ | |
950 | #define PROC_FGHW_VOUCHER_ERROR 98 /* error in voucher / originator callout */ | |
951 | #define PROC_FGHW_ERROR 99 /* syscall parameter/permissions error */ | |
952 | ||
5ba3f43e | 953 | /* flavors for proc_piddynkqueueinfo */ |
5ba3f43e A |
954 | #define PROC_PIDDYNKQUEUE_INFO 0 |
955 | #define PROC_PIDDYNKQUEUE_INFO_SIZE (sizeof(struct kqueue_dyninfo)) | |
956 | #define PROC_PIDDYNKQUEUE_EXTINFO 1 | |
957 | #define PROC_PIDDYNKQUEUE_EXTINFO_SIZE (sizeof(struct kevent_extinfo)) | |
5ba3f43e | 958 | |
39236c6e | 959 | /* __proc_info() call numbers */ |
5ba3f43e A |
960 | #define PROC_INFO_CALL_LISTPIDS 0x1 |
961 | #define PROC_INFO_CALL_PIDINFO 0x2 | |
962 | #define PROC_INFO_CALL_PIDFDINFO 0x3 | |
963 | #define PROC_INFO_CALL_KERNMSGBUF 0x4 | |
964 | #define PROC_INFO_CALL_SETCONTROL 0x5 | |
965 | #define PROC_INFO_CALL_PIDFILEPORTINFO 0x6 | |
966 | #define PROC_INFO_CALL_TERMINATE 0x7 | |
967 | #define PROC_INFO_CALL_DIRTYCONTROL 0x8 | |
968 | #define PROC_INFO_CALL_PIDRUSAGE 0x9 | |
fe8ab488 | 969 | #define PROC_INFO_CALL_PIDORIGINATORINFO 0xa |
5ba3f43e A |
970 | #define PROC_INFO_CALL_LISTCOALITIONS 0xb |
971 | #define PROC_INFO_CALL_CANUSEFGHW 0xc | |
972 | #define PROC_INFO_CALL_PIDDYNKQUEUEINFO 0xd | |
a39ff7e2 | 973 | #define PROC_INFO_CALL_UDATA_INFO 0xe |
f427ee49 A |
974 | |
975 | /* __proc_info_extended_id() flags */ | |
976 | #define PIF_COMPARE_IDVERSION 0x01 | |
977 | #define PIF_COMPARE_UNIQUEID 0x02 | |
978 | ||
39236c6e | 979 | #endif /* PRIVATE */ |
316670eb | 980 | |
f427ee49 A |
981 | #ifdef KERNEL_PRIVATE |
982 | extern int proc_fdlist(proc_t p, struct proc_fdinfo *buf, size_t *count); | |
983 | #endif | |
984 | ||
0c530ab8 | 985 | #ifdef XNU_KERNEL_PRIVATE |
b0d623f7 A |
986 | #ifndef pshmnode |
987 | struct pshmnode; | |
988 | #endif | |
989 | ||
990 | #ifndef psemnode | |
0a7de745 | 991 | struct psemnode; |
b0d623f7 A |
992 | #endif |
993 | ||
994 | #ifndef pipe | |
995 | struct pipe; | |
996 | #endif | |
997 | ||
0c530ab8 A |
998 | extern int fill_socketinfo(socket_t so, struct socket_info *si); |
999 | extern int fill_pshminfo(struct pshmnode * pshm, struct pshm_info * pinfo); | |
1000 | extern int fill_pseminfo(struct psemnode * psem, struct psem_info * pinfo); | |
1001 | extern int fill_pipeinfo(struct pipe * cpipe, struct pipe_info * pinfo); | |
1002 | extern int fill_kqueueinfo(struct kqueue * kq, struct kqueue_info * kinfo); | |
39037602 | 1003 | extern int pid_kqueue_extinfo(proc_t, struct kqueue * kq, user_addr_t buffer, |
0a7de745 | 1004 | uint32_t buffersize, int32_t * retval); |
39037602 | 1005 | extern int pid_kqueue_udatainfo(proc_t p, struct kqueue *kq, uint64_t *buf, |
0a7de745 | 1006 | uint32_t bufsize); |
5ba3f43e | 1007 | extern int pid_kqueue_listdynamickqueues(proc_t p, user_addr_t ubuf, |
0a7de745 | 1008 | uint32_t bufsize, int32_t *retval); |
5ba3f43e | 1009 | extern int pid_dynamickqueue_extinfo(proc_t p, kqueue_id_t kq_id, |
0a7de745 | 1010 | user_addr_t ubuf, uint32_t bufsize, int32_t *retval); |
b0d623f7 | 1011 | extern int fill_procworkqueue(proc_t, struct proc_workqueueinfo *); |
39037602 | 1012 | extern boolean_t workqueue_get_pwq_exceeded(void *v, boolean_t *exceeded_total, |
0a7de745 | 1013 | boolean_t *exceeded_constrained); |
39037602 A |
1014 | extern uint32_t workqueue_get_pwq_state_kdp(void *proc); |
1015 | ||
0c530ab8 A |
1016 | #endif /* XNU_KERNEL_PRIVATE */ |
1017 | ||
0c530ab8 A |
1018 | __END_DECLS |
1019 | ||
1020 | #endif /*_SYS_PROC_INFO_H */ |