]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/proc_info.h
e8ca29c4f11aeee50789cc6b967918f06041c3de
[apple/xnu.git] / bsd / sys / proc_info.h
1 /*
2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
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>
40 #include <net/if.h>
41 #include <net/route.h>
42 #include <netinet/in.h>
43 #include <netinet/tcp.h>
44 #include <mach/machine.h>
45
46 __BEGIN_DECLS
47
48
49 #define PROC_ALL_PIDS 1
50 #define PROC_PGRP_ONLY 2
51 #define PROC_TTY_ONLY 3
52 #define PROC_UID_ONLY 4
53 #define PROC_RUID_ONLY 5
54 #define PROC_PPID_ONLY 6
55
56 struct proc_bsdinfo {
57 uint32_t pbi_flags; /* 64bit; emulated etc */
58 uint32_t pbi_status;
59 uint32_t pbi_xstatus;
60 uint32_t pbi_pid;
61 uint32_t pbi_ppid;
62 uid_t pbi_uid;
63 gid_t pbi_gid;
64 uid_t pbi_ruid;
65 gid_t pbi_rgid;
66 uid_t pbi_svuid;
67 gid_t pbi_svgid;
68 uint32_t rfu_1; /* reserved */
69 char pbi_comm[MAXCOMLEN];
70 char pbi_name[2*MAXCOMLEN]; /* empty if no name is registered */
71 uint32_t pbi_nfiles;
72 uint32_t pbi_pgid;
73 uint32_t pbi_pjobc;
74 uint32_t e_tdev; /* controlling tty dev */
75 uint32_t e_tpgid; /* tty process group id */
76 int32_t pbi_nice;
77 uint64_t pbi_start_tvsec;
78 uint64_t pbi_start_tvusec;
79 };
80
81
82 struct proc_bsdshortinfo {
83 uint32_t pbsi_pid; /* process id */
84 uint32_t pbsi_ppid; /* process parent id */
85 uint32_t pbsi_pgid; /* process perp id */
86 uint32_t pbsi_status; /* p_stat value, SZOMB, SRUN, etc */
87 char pbsi_comm[MAXCOMLEN]; /* upto 16 characters of process name */
88 uint32_t pbsi_flags; /* 64bit; emulated etc */
89 uid_t pbsi_uid; /* current uid on process */
90 gid_t pbsi_gid; /* current gid on process */
91 uid_t pbsi_ruid; /* current ruid on process */
92 gid_t pbsi_rgid; /* current tgid on process */
93 uid_t pbsi_svuid; /* current svuid on process */
94 gid_t pbsi_svgid; /* current svgid on process */
95 uint32_t pbsi_rfu; /* reserved for future use*/
96 };
97
98
99 #ifdef PRIVATE
100 struct proc_uniqidentifierinfo {
101 uint8_t p_uuid[16]; /* UUID of the main executable */
102 uint64_t p_uniqueid; /* 64 bit unique identifier for process */
103 uint64_t p_puniqueid; /* unique identifier for process's parent */
104 uint64_t p_reserve2; /* reserved for future use */
105 uint64_t p_reserve3; /* reserved for future use */
106 uint64_t p_reserve4; /* reserved for future use */
107 };
108
109
110 struct proc_bsdinfowithuniqid {
111 struct proc_bsdinfo pbsd;
112 struct proc_uniqidentifierinfo p_uniqidentifier;
113 };
114
115 struct proc_archinfo {
116 cpu_type_t p_cputype;
117 cpu_subtype_t p_cpusubtype;
118 };
119
120 struct proc_pidcoalitioninfo {
121 uint64_t coalition_id;
122 uint64_t reserved1;
123 uint64_t reserved2;
124 uint64_t reserved3;
125 };
126
127 #endif
128
129
130 /* pbi_flags values */
131 #define PROC_FLAG_SYSTEM 1 /* System process */
132 #define PROC_FLAG_TRACED 2 /* process currently being traced, possibly by gdb */
133 #define PROC_FLAG_INEXIT 4 /* process is working its way in exit() */
134 #define PROC_FLAG_PPWAIT 8
135 #define PROC_FLAG_LP64 0x10 /* 64bit process */
136 #define PROC_FLAG_SLEADER 0x20 /* The process is the session leader */
137 #define PROC_FLAG_CTTY 0x40 /* process has a control tty */
138 #define PROC_FLAG_CONTROLT 0x80 /* Has a controlling terminal */
139 #define PROC_FLAG_THCWD 0x100 /* process has a thread with cwd */
140 /* process control bits for resource starvation */
141 #define PROC_FLAG_PC_THROTTLE 0x200 /* In resource starvation situations, this process is to be throttled */
142 #define PROC_FLAG_PC_SUSP 0x400 /* In resource starvation situations, this process is to be suspended */
143 #define PROC_FLAG_PC_KILL 0x600 /* In resource starvation situations, this process is to be terminated */
144 #define PROC_FLAG_PC_MASK 0x600
145 /* process action bits for resource starvation */
146 #define PROC_FLAG_PA_THROTTLE 0x800 /* The process is currently throttled due to resource starvation */
147 #define PROC_FLAG_PA_SUSP 0x1000 /* The process is currently suspended due to resource starvation */
148 #define PROC_FLAG_PSUGID 0x2000 /* process has set privileges since last exec */
149 #define PROC_FLAG_EXEC 0x4000 /* process has called exec */
150 #ifdef PRIVATE
151 #define PROC_FLAG_DARWINBG 0x8000 /* process in darwin background */
152 #define PROC_FLAG_EXT_DARWINBG 0x10000 /* process in darwin background - external enforcement */
153 #define PROC_FLAG_IOS_APPLEDAEMON 0x20000 /* Process is apple daemon */
154 #define PROC_FLAG_DELAYIDLESLEEP 0x40000 /* Process is marked to delay idle sleep on disk IO */
155 #define PROC_FLAG_IOS_IMPPROMOTION 0x80000 /* Process is daemon which receives importane donation */
156 #define PROC_FLAG_ADAPTIVE 0x100000 /* Process is adaptive */
157 #define PROC_FLAG_ADAPTIVE_IMPORTANT 0x200000 /* Process is adaptive, and is currently important */
158 #define PROC_FLAG_IMPORTANCE_DONOR 0x400000 /* Process is marked as an importance donor */
159 #define PROC_FLAG_SUPPRESSED 0x800000 /* Process is suppressed */
160 #define PROC_FLAG_APPLICATION 0x1000000 /* Process is an application */
161 #define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */
162 #endif
163
164
165 struct proc_taskinfo {
166 uint64_t pti_virtual_size; /* virtual memory size (bytes) */
167 uint64_t pti_resident_size; /* resident memory size (bytes) */
168 uint64_t pti_total_user; /* total time */
169 uint64_t pti_total_system;
170 uint64_t pti_threads_user; /* existing threads only */
171 uint64_t pti_threads_system;
172 int32_t pti_policy; /* default policy for new threads */
173 int32_t pti_faults; /* number of page faults */
174 int32_t pti_pageins; /* number of actual pageins */
175 int32_t pti_cow_faults; /* number of copy-on-write faults */
176 int32_t pti_messages_sent; /* number of messages sent */
177 int32_t pti_messages_received; /* number of messages received */
178 int32_t pti_syscalls_mach; /* number of mach system calls */
179 int32_t pti_syscalls_unix; /* number of unix system calls */
180 int32_t pti_csw; /* number of context switches */
181 int32_t pti_threadnum; /* number of threads in the task */
182 int32_t pti_numrunning; /* number of running threads */
183 int32_t pti_priority; /* task priority*/
184 };
185
186 struct proc_taskallinfo {
187 struct proc_bsdinfo pbsd;
188 struct proc_taskinfo ptinfo;
189 };
190
191 #define MAXTHREADNAMESIZE 64
192
193 struct proc_threadinfo {
194 uint64_t pth_user_time; /* user run time */
195 uint64_t pth_system_time; /* system run time */
196 int32_t pth_cpu_usage; /* scaled cpu usage percentage */
197 int32_t pth_policy; /* scheduling policy in effect */
198 int32_t pth_run_state; /* run state (see below) */
199 int32_t pth_flags; /* various flags (see below) */
200 int32_t pth_sleep_time; /* number of seconds that thread */
201 int32_t pth_curpri; /* cur priority*/
202 int32_t pth_priority; /* priority*/
203 int32_t pth_maxpriority; /* max priority*/
204 char pth_name[MAXTHREADNAMESIZE]; /* thread name, if any */
205 };
206
207 struct proc_regioninfo {
208 uint32_t pri_protection;
209 uint32_t pri_max_protection;
210 uint32_t pri_inheritance;
211 uint32_t pri_flags; /* shared, external pager, is submap */
212 uint64_t pri_offset;
213 uint32_t pri_behavior;
214 uint32_t pri_user_wired_count;
215 uint32_t pri_user_tag;
216 uint32_t pri_pages_resident;
217 uint32_t pri_pages_shared_now_private;
218 uint32_t pri_pages_swapped_out;
219 uint32_t pri_pages_dirtied;
220 uint32_t pri_ref_count;
221 uint32_t pri_shadow_depth;
222 uint32_t pri_share_mode;
223 uint32_t pri_private_pages_resident;
224 uint32_t pri_shared_pages_resident;
225 uint32_t pri_obj_id;
226 uint32_t pri_depth;
227 uint64_t pri_address;
228 uint64_t pri_size;
229 };
230
231 #define PROC_REGION_SUBMAP 1
232 #define PROC_REGION_SHARED 2
233
234 #define SM_COW 1
235 #define SM_PRIVATE 2
236 #define SM_EMPTY 3
237 #define SM_SHARED 4
238 #define SM_TRUESHARED 5
239 #define SM_PRIVATE_ALIASED 6
240 #define SM_SHARED_ALIASED 7
241 #define SM_LARGE_PAGE 8
242
243
244 /*
245 * Thread run states (state field).
246 */
247
248 #define TH_STATE_RUNNING 1 /* thread is running normally */
249 #define TH_STATE_STOPPED 2 /* thread is stopped */
250 #define TH_STATE_WAITING 3 /* thread is waiting normally */
251 #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible
252 wait */
253 #define TH_STATE_HALTED 5 /* thread is halted at a
254 clean point */
255
256 /*
257 * Thread flags (flags field).
258 */
259 #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */
260 #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */
261
262
263 struct proc_workqueueinfo {
264 uint32_t pwq_nthreads; /* total number of workqueue threads */
265 uint32_t pwq_runthreads; /* total number of running workqueue threads */
266 uint32_t pwq_blockedthreads; /* total number of blocked workqueue threads */
267 uint32_t pwq_state;
268 };
269
270 /*
271 * workqueue state (pwq_state field)
272 */
273 #define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT 0x1
274 #define WQ_EXCEEDED_TOTAL_THREAD_LIMIT 0x2
275
276
277 struct proc_fileinfo {
278 uint32_t fi_openflags;
279 uint32_t fi_status;
280 off_t fi_offset;
281 int32_t fi_type;
282 uint32_t fi_guardflags;
283 };
284
285 /* stats flags in proc_fileinfo */
286 #define PROC_FP_SHARED 1 /* shared by more than one fd */
287 #define PROC_FP_CLEXEC 2 /* close on exec */
288 #define PROC_FP_GUARDED 4 /* guarded fd */
289
290 #define PROC_FI_GUARD_CLOSE (1u << 0)
291 #define PROC_FI_GUARD_DUP (1u << 1)
292 #define PROC_FI_GUARD_SOCKET_IPC (1u << 2)
293 #define PROC_FI_GUARD_FILEPORT (1u << 3)
294
295 /*
296 * A copy of stat64 with static sized fields.
297 */
298 struct vinfo_stat {
299 uint32_t vst_dev; /* [XSI] ID of device containing file */
300 uint16_t vst_mode; /* [XSI] Mode of file (see below) */
301 uint16_t vst_nlink; /* [XSI] Number of hard links */
302 uint64_t vst_ino; /* [XSI] File serial number */
303 uid_t vst_uid; /* [XSI] User ID of the file */
304 gid_t vst_gid; /* [XSI] Group ID of the file */
305 int64_t vst_atime; /* [XSI] Time of last access */
306 int64_t vst_atimensec; /* nsec of last access */
307 int64_t vst_mtime; /* [XSI] Last data modification time */
308 int64_t vst_mtimensec; /* last data modification nsec */
309 int64_t vst_ctime; /* [XSI] Time of last status change */
310 int64_t vst_ctimensec; /* nsec of last status change */
311 int64_t vst_birthtime; /* File creation time(birth) */
312 int64_t vst_birthtimensec; /* nsec of File creation time */
313 off_t vst_size; /* [XSI] file size, in bytes */
314 int64_t vst_blocks; /* [XSI] blocks allocated for file */
315 int32_t vst_blksize; /* [XSI] optimal blocksize for I/O */
316 uint32_t vst_flags; /* user defined flags for file */
317 uint32_t vst_gen; /* file generation number */
318 uint32_t vst_rdev; /* [XSI] Device ID */
319 int64_t vst_qspare[2]; /* RESERVED: DO NOT USE! */
320 };
321
322 struct vnode_info {
323 struct vinfo_stat vi_stat;
324 int vi_type;
325 int vi_pad;
326 fsid_t vi_fsid;
327 };
328
329 struct vnode_info_path {
330 struct vnode_info vip_vi;
331 char vip_path[MAXPATHLEN]; /* tail end of it */
332 };
333
334 struct vnode_fdinfo {
335 struct proc_fileinfo pfi;
336 struct vnode_info pvi;
337 };
338
339 struct vnode_fdinfowithpath {
340 struct proc_fileinfo pfi;
341 struct vnode_info_path pvip;
342 };
343
344 struct proc_regionwithpathinfo {
345 struct proc_regioninfo prp_prinfo;
346 struct vnode_info_path prp_vip;
347 };
348
349 struct proc_vnodepathinfo {
350 struct vnode_info_path pvi_cdir;
351 struct vnode_info_path pvi_rdir;
352 };
353
354 struct proc_threadwithpathinfo {
355 struct proc_threadinfo pt;
356 struct vnode_info_path pvip;
357 };
358
359 /*
360 * Socket
361 */
362
363
364 /*
365 * IPv4 and IPv6 Sockets
366 */
367
368 #define INI_IPV4 0x1
369 #define INI_IPV6 0x2
370
371 struct in4in6_addr {
372 u_int32_t i46a_pad32[3];
373 struct in_addr i46a_addr4;
374 };
375
376 struct in_sockinfo {
377 int insi_fport; /* foreign port */
378 int insi_lport; /* local port */
379 uint64_t insi_gencnt; /* generation count of this instance */
380 uint32_t insi_flags; /* generic IP/datagram flags */
381 uint32_t insi_flow;
382
383 uint8_t insi_vflag; /* ini_IPV4 or ini_IPV6 */
384 uint8_t insi_ip_ttl; /* time to live proto */
385 uint32_t rfu_1; /* reserved */
386 /* protocol dependent part */
387 union {
388 struct in4in6_addr ina_46;
389 struct in6_addr ina_6;
390 } insi_faddr; /* foreign host table entry */
391 union {
392 struct in4in6_addr ina_46;
393 struct in6_addr ina_6;
394 } insi_laddr; /* local host table entry */
395 struct {
396 u_char in4_tos; /* type of service */
397 } insi_v4;
398 struct {
399 uint8_t in6_hlim;
400 int in6_cksum;
401 u_short in6_ifindex;
402 short in6_hops;
403 } insi_v6;
404 };
405
406 /*
407 * TCP Sockets
408 */
409
410 #define TSI_T_REXMT 0 /* retransmit */
411 #define TSI_T_PERSIST 1 /* retransmit persistence */
412 #define TSI_T_KEEP 2 /* keep alive */
413 #define TSI_T_2MSL 3 /* 2*msl quiet time timer */
414 #define TSI_T_NTIMERS 4
415
416 #define TSI_S_CLOSED 0 /* closed */
417 #define TSI_S_LISTEN 1 /* listening for connection */
418 #define TSI_S_SYN_SENT 2 /* active, have sent syn */
419 #define TSI_S_SYN_RECEIVED 3 /* have send and received syn */
420 #define TSI_S_ESTABLISHED 4 /* established */
421 #define TSI_S__CLOSE_WAIT 5 /* rcvd fin, waiting for close */
422 #define TSI_S_FIN_WAIT_1 6 /* have closed, sent fin */
423 #define TSI_S_CLOSING 7 /* closed xchd FIN; await FIN ACK */
424 #define TSI_S_LAST_ACK 8 /* had fin and close; await FIN ACK */
425 #define TSI_S_FIN_WAIT_2 9 /* have closed, fin is acked */
426 #define TSI_S_TIME_WAIT 10 /* in 2*msl quiet wait after close */
427 #define TSI_S_RESERVED 11 /* pseudo state: reserved */
428
429 struct tcp_sockinfo {
430 struct in_sockinfo tcpsi_ini;
431 int tcpsi_state;
432 int tcpsi_timer[TSI_T_NTIMERS];
433 int tcpsi_mss;
434 uint32_t tcpsi_flags;
435 uint32_t rfu_1; /* reserved */
436 uint64_t tcpsi_tp; /* opaque handle of TCP protocol control block */
437 };
438
439 /*
440 * Unix Domain Sockets
441 */
442
443
444 struct un_sockinfo {
445 uint64_t unsi_conn_so; /* opaque handle of connected socket */
446 uint64_t unsi_conn_pcb; /* opaque handle of connected protocol control block */
447 union {
448 struct sockaddr_un ua_sun;
449 char ua_dummy[SOCK_MAXADDRLEN];
450 } unsi_addr; /* bound address */
451 union {
452 struct sockaddr_un ua_sun;
453 char ua_dummy[SOCK_MAXADDRLEN];
454 } unsi_caddr; /* address of socket connected to */
455 };
456
457 /*
458 * PF_NDRV Sockets
459 */
460
461 struct ndrv_info {
462 uint32_t ndrvsi_if_family;
463 uint32_t ndrvsi_if_unit;
464 char ndrvsi_if_name[IF_NAMESIZE];
465 };
466
467 /*
468 * Kernel Event Sockets
469 */
470
471 struct kern_event_info {
472 uint32_t kesi_vendor_code_filter;
473 uint32_t kesi_class_filter;
474 uint32_t kesi_subclass_filter;
475 };
476
477 /*
478 * Kernel Control Sockets
479 */
480
481 struct kern_ctl_info {
482 uint32_t kcsi_id;
483 uint32_t kcsi_reg_unit;
484 uint32_t kcsi_flags; /* support flags */
485 uint32_t kcsi_recvbufsize; /* request more than the default buffer size */
486 uint32_t kcsi_sendbufsize; /* request more than the default buffer size */
487 uint32_t kcsi_unit;
488 char kcsi_name[MAX_KCTL_NAME]; /* unique nke identifier, provided by DTS */
489 };
490
491 /* soi_state */
492
493 #define SOI_S_NOFDREF 0x0001 /* no file table ref any more */
494 #define SOI_S_ISCONNECTED 0x0002 /* socket connected to a peer */
495 #define SOI_S_ISCONNECTING 0x0004 /* in process of connecting to peer */
496 #define SOI_S_ISDISCONNECTING 0x0008 /* in process of disconnecting */
497 #define SOI_S_CANTSENDMORE 0x0010 /* can't send more data to peer */
498 #define SOI_S_CANTRCVMORE 0x0020 /* can't receive more data from peer */
499 #define SOI_S_RCVATMARK 0x0040 /* at mark on input */
500 #define SOI_S_PRIV 0x0080 /* privileged for broadcast, raw... */
501 #define SOI_S_NBIO 0x0100 /* non-blocking ops */
502 #define SOI_S_ASYNC 0x0200 /* async i/o notify */
503 #define SOI_S_INCOMP 0x0800 /* Unaccepted, incomplete connection */
504 #define SOI_S_COMP 0x1000 /* unaccepted, complete connection */
505 #define SOI_S_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
506 #define SOI_S_DRAINING 0x4000 /* close waiting for blocked system calls to drain */
507
508 struct sockbuf_info {
509 uint32_t sbi_cc;
510 uint32_t sbi_hiwat; /* SO_RCVBUF, SO_SNDBUF */
511 uint32_t sbi_mbcnt;
512 uint32_t sbi_mbmax;
513 uint32_t sbi_lowat;
514 short sbi_flags;
515 short sbi_timeo;
516 };
517
518 enum {
519 SOCKINFO_GENERIC = 0,
520 SOCKINFO_IN = 1,
521 SOCKINFO_TCP = 2,
522 SOCKINFO_UN = 3,
523 SOCKINFO_NDRV = 4,
524 SOCKINFO_KERN_EVENT = 5,
525 SOCKINFO_KERN_CTL = 6
526 };
527
528 struct socket_info {
529 struct vinfo_stat soi_stat;
530 uint64_t soi_so; /* opaque handle of socket */
531 uint64_t soi_pcb; /* opaque handle of protocol control block */
532 int soi_type;
533 int soi_protocol;
534 int soi_family;
535 short soi_options;
536 short soi_linger;
537 short soi_state;
538 short soi_qlen;
539 short soi_incqlen;
540 short soi_qlimit;
541 short soi_timeo;
542 u_short soi_error;
543 uint32_t soi_oobmark;
544 struct sockbuf_info soi_rcv;
545 struct sockbuf_info soi_snd;
546 int soi_kind;
547 uint32_t rfu_1; /* reserved */
548 union {
549 struct in_sockinfo pri_in; /* SOCKINFO_IN */
550 struct tcp_sockinfo pri_tcp; /* SOCKINFO_TCP */
551 struct un_sockinfo pri_un; /* SOCKINFO_UN */
552 struct ndrv_info pri_ndrv; /* SOCKINFO_NDRV */
553 struct kern_event_info pri_kern_event; /* SOCKINFO_KERN_EVENT */
554 struct kern_ctl_info pri_kern_ctl; /* SOCKINFO_KERN_CTL */
555 } soi_proto;
556 };
557
558 struct socket_fdinfo {
559 struct proc_fileinfo pfi;
560 struct socket_info psi;
561 };
562
563
564
565 struct psem_info {
566 struct vinfo_stat psem_stat;
567 char psem_name[MAXPATHLEN];
568 };
569
570 struct psem_fdinfo {
571 struct proc_fileinfo pfi;
572 struct psem_info pseminfo;
573 };
574
575
576
577 struct pshm_info {
578 struct vinfo_stat pshm_stat;
579 uint64_t pshm_mappaddr;
580 char pshm_name[MAXPATHLEN];
581 };
582
583 struct pshm_fdinfo {
584 struct proc_fileinfo pfi;
585 struct pshm_info pshminfo;
586 };
587
588
589 struct pipe_info {
590 struct vinfo_stat pipe_stat;
591 uint64_t pipe_handle;
592 uint64_t pipe_peerhandle;
593 int pipe_status;
594 int rfu_1; /* reserved */
595 };
596
597 struct pipe_fdinfo {
598 struct proc_fileinfo pfi;
599 struct pipe_info pipeinfo;
600 };
601
602
603 struct kqueue_info {
604 struct vinfo_stat kq_stat;
605 uint32_t kq_state;
606 uint32_t rfu_1; /* reserved */
607 };
608 #define PROC_KQUEUE_SELECT 1
609 #define PROC_KQUEUE_SLEEP 2
610
611 struct kqueue_fdinfo {
612 struct proc_fileinfo pfi;
613 struct kqueue_info kqueueinfo;
614 };
615
616 struct appletalk_info {
617 struct vinfo_stat atalk_stat;
618 };
619
620 struct appletalk_fdinfo {
621 struct proc_fileinfo pfi;
622 struct appletalk_info appletalkinfo;
623 };
624
625
626
627 /* defns of process file desc type */
628 #define PROX_FDTYPE_ATALK 0
629 #define PROX_FDTYPE_VNODE 1
630 #define PROX_FDTYPE_SOCKET 2
631 #define PROX_FDTYPE_PSHM 3
632 #define PROX_FDTYPE_PSEM 4
633 #define PROX_FDTYPE_KQUEUE 5
634 #define PROX_FDTYPE_PIPE 6
635 #define PROX_FDTYPE_FSEVENTS 7
636
637 struct proc_fdinfo {
638 int32_t proc_fd;
639 uint32_t proc_fdtype;
640 };
641
642 struct proc_fileportinfo {
643 uint32_t proc_fileport;
644 uint32_t proc_fdtype;
645 };
646
647 /* Flavors for proc_pidinfo() */
648 #define PROC_PIDLISTFDS 1
649 #define PROC_PIDLISTFD_SIZE (sizeof(struct proc_fdinfo))
650
651 #define PROC_PIDTASKALLINFO 2
652 #define PROC_PIDTASKALLINFO_SIZE (sizeof(struct proc_taskallinfo))
653
654 #define PROC_PIDTBSDINFO 3
655 #define PROC_PIDTBSDINFO_SIZE (sizeof(struct proc_bsdinfo))
656
657 #define PROC_PIDTASKINFO 4
658 #define PROC_PIDTASKINFO_SIZE (sizeof(struct proc_taskinfo))
659
660 #define PROC_PIDTHREADINFO 5
661 #define PROC_PIDTHREADINFO_SIZE (sizeof(struct proc_threadinfo))
662
663 #define PROC_PIDLISTTHREADS 6
664 #define PROC_PIDLISTTHREADS_SIZE (2* sizeof(uint32_t))
665
666
667 #define PROC_PIDREGIONINFO 7
668 #define PROC_PIDREGIONINFO_SIZE (sizeof(struct proc_regioninfo))
669
670 #define PROC_PIDREGIONPATHINFO 8
671 #define PROC_PIDREGIONPATHINFO_SIZE (sizeof(struct proc_regionwithpathinfo))
672
673 #define PROC_PIDVNODEPATHINFO 9
674 #define PROC_PIDVNODEPATHINFO_SIZE (sizeof(struct proc_vnodepathinfo))
675
676 #define PROC_PIDTHREADPATHINFO 10
677 #define PROC_PIDTHREADPATHINFO_SIZE (sizeof(struct proc_threadwithpathinfo))
678
679 #define PROC_PIDPATHINFO 11
680 #define PROC_PIDPATHINFO_SIZE (MAXPATHLEN)
681 #define PROC_PIDPATHINFO_MAXSIZE (4*MAXPATHLEN)
682
683 #define PROC_PIDWORKQUEUEINFO 12
684 #define PROC_PIDWORKQUEUEINFO_SIZE (sizeof(struct proc_workqueueinfo))
685
686 #define PROC_PIDT_SHORTBSDINFO 13
687 #define PROC_PIDT_SHORTBSDINFO_SIZE (sizeof(struct proc_bsdshortinfo))
688
689 #define PROC_PIDLISTFILEPORTS 14
690 #define PROC_PIDLISTFILEPORTS_SIZE (sizeof(struct proc_fileportinfo))
691
692 #define PROC_PIDTHREADID64INFO 15
693 #define PROC_PIDTHREADID64INFO_SIZE (sizeof(struct proc_threadinfo))
694
695 #define PROC_PID_RUSAGE 16
696 #define PROC_PID_RUSAGE_SIZE 0
697
698 #ifdef PRIVATE
699 #define PROC_PIDUNIQIDENTIFIERINFO 17
700 #define PROC_PIDUNIQIDENTIFIERINFO_SIZE \
701 (sizeof(struct proc_uniqidentifierinfo))
702
703 #define PROC_PIDT_BSDINFOWITHUNIQID 18
704 #define PROC_PIDT_BSDINFOWITHUNIQID_SIZE \
705 (sizeof(struct proc_bsdinfowithuniqid))
706
707 #define PROC_PIDARCHINFO 19
708 #define PROC_PIDARCHINFO_SIZE \
709 (sizeof(struct proc_archinfo))
710
711 #define PROC_PIDCOALITIONINFO 20
712 #define PROC_PIDCOALITIONINFO_SIZE (sizeof(struct proc_pidcoalitioninfo))
713
714 #define PROC_PIDNOTEEXIT 21
715 #define PROC_PIDNOTEEXIT_SIZE (sizeof(uint32_t))
716
717 #define PROC_PIDREGIONPATHINFO2 22
718 #define PROC_PIDREGIONPATHINFO2_SIZE (sizeof(struct proc_regionwithpathinfo))
719
720 #define PROC_PIDREGIONPATHINFO3 23
721 #define PROC_PIDREGIONPATHINFO3_SIZE (sizeof(struct proc_regionwithpathinfo))
722
723 #endif
724
725 /* Flavors for proc_pidfdinfo */
726
727 #define PROC_PIDFDVNODEINFO 1
728 #define PROC_PIDFDVNODEINFO_SIZE (sizeof(struct vnode_fdinfo))
729
730 #define PROC_PIDFDVNODEPATHINFO 2
731 #define PROC_PIDFDVNODEPATHINFO_SIZE (sizeof(struct vnode_fdinfowithpath))
732
733 #define PROC_PIDFDSOCKETINFO 3
734 #define PROC_PIDFDSOCKETINFO_SIZE (sizeof(struct socket_fdinfo))
735
736 #define PROC_PIDFDPSEMINFO 4
737 #define PROC_PIDFDPSEMINFO_SIZE (sizeof(struct psem_fdinfo))
738
739 #define PROC_PIDFDPSHMINFO 5
740 #define PROC_PIDFDPSHMINFO_SIZE (sizeof(struct pshm_fdinfo))
741
742 #define PROC_PIDFDPIPEINFO 6
743 #define PROC_PIDFDPIPEINFO_SIZE (sizeof(struct pipe_fdinfo))
744
745 #define PROC_PIDFDKQUEUEINFO 7
746 #define PROC_PIDFDKQUEUEINFO_SIZE (sizeof(struct kqueue_fdinfo))
747
748 #define PROC_PIDFDATALKINFO 8
749 #define PROC_PIDFDATALKINFO_SIZE (sizeof(struct appletalk_fdinfo))
750
751 /* Flavors for proc_pidfileportinfo */
752
753 #define PROC_PIDFILEPORTVNODEPATHINFO 2 /* out: vnode_fdinfowithpath */
754 #define PROC_PIDFILEPORTVNODEPATHINFO_SIZE \
755 PROC_PIDFDVNODEPATHINFO_SIZE
756
757 #define PROC_PIDFILEPORTSOCKETINFO 3 /* out: socket_fdinfo */
758 #define PROC_PIDFILEPORTSOCKETINFO_SIZE PROC_PIDFDSOCKETINFO_SIZE
759
760 #define PROC_PIDFILEPORTPSHMINFO 5 /* out: pshm_fdinfo */
761 #define PROC_PIDFILEPORTPSHMINFO_SIZE PROC_PIDFDPSHMINFO_SIZE
762
763 #define PROC_PIDFILEPORTPIPEINFO 6 /* out: pipe_fdinfo */
764 #define PROC_PIDFILEPORTPIPEINFO_SIZE PROC_PIDFDPIPEINFO_SIZE
765
766 /* used for proc_setcontrol */
767 #define PROC_SELFSET_PCONTROL 1
768
769 #define PROC_SELFSET_THREADNAME 2
770 #define PROC_SELFSET_THREADNAME_SIZE (MAXTHREADNAMESIZE -1)
771
772 #define PROC_SELFSET_VMRSRCOWNER 3
773
774 #define PROC_SELFSET_DELAYIDLESLEEP 4
775
776 /* used for proc_dirtycontrol */
777 #define PROC_DIRTYCONTROL_TRACK 1
778 #define PROC_DIRTYCONTROL_SET 2
779 #define PROC_DIRTYCONTROL_GET 3
780 #define PROC_DIRTYCONTROL_CLEAR 4
781
782 /* proc_track_dirty() flags */
783 #define PROC_DIRTY_TRACK 0x1
784 #define PROC_DIRTY_ALLOW_IDLE_EXIT 0x2
785 #define PROC_DIRTY_DEFER 0x4
786 #define PROC_DIRTY_LAUNCH_IN_PROGRESS 0x8
787
788 /* proc_get_dirty() flags */
789 #define PROC_DIRTY_TRACKED 0x1
790 #define PROC_DIRTY_ALLOWS_IDLE_EXIT 0x2
791 #define PROC_DIRTY_IS_DIRTY 0x4
792 #define PROC_DIRTY_LAUNCH_IS_IN_PROGRESS 0x8
793
794 #ifdef PRIVATE
795
796 /* Flavors for proc_pidoriginatorinfo */
797 #define PROC_PIDORIGINATOR_UUID 0x1
798 #define PROC_PIDORIGINATOR_UUID_SIZE (sizeof(uuid_t))
799
800 #define PROC_PIDORIGINATOR_BGSTATE 0x2
801 #define PROC_PIDORIGINATOR_BGSTATE_SIZE (sizeof(uint32_t))
802
803 /* __proc_info() call numbers */
804 #define PROC_INFO_CALL_LISTPIDS 0x1
805 #define PROC_INFO_CALL_PIDINFO 0x2
806 #define PROC_INFO_CALL_PIDFDINFO 0x3
807 #define PROC_INFO_CALL_KERNMSGBUF 0x4
808 #define PROC_INFO_CALL_SETCONTROL 0x5
809 #define PROC_INFO_CALL_PIDFILEPORTINFO 0x6
810 #define PROC_INFO_CALL_TERMINATE 0x7
811 #define PROC_INFO_CALL_DIRTYCONTROL 0x8
812 #define PROC_INFO_CALL_PIDRUSAGE 0x9
813 #define PROC_INFO_CALL_PIDORIGINATORINFO 0xa
814
815 #endif /* PRIVATE */
816
817 #ifdef XNU_KERNEL_PRIVATE
818 #ifndef pshmnode
819 struct pshmnode;
820 #endif
821
822 #ifndef psemnode
823 struct psemnode ;
824 #endif
825
826 #ifndef pipe
827 struct pipe;
828 #endif
829
830 extern int fill_socketinfo(socket_t so, struct socket_info *si);
831 extern int fill_pshminfo(struct pshmnode * pshm, struct pshm_info * pinfo);
832 extern int fill_pseminfo(struct psemnode * psem, struct psem_info * pinfo);
833 extern int fill_pipeinfo(struct pipe * cpipe, struct pipe_info * pinfo);
834 extern int fill_kqueueinfo(struct kqueue * kq, struct kqueue_info * kinfo);
835 extern int fill_procworkqueue(proc_t, struct proc_workqueueinfo *);
836 #endif /* XNU_KERNEL_PRIVATE */
837
838 __END_DECLS
839
840 #endif /*_SYS_PROC_INFO_H */