2 * Copyright (c) 2005-2017 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 #ifndef _SYS_PROC_INFO_H
30 #define _SYS_PROC_INFO_H
32 #include <sys/cdefs.h>
33 #include <sys/param.h>
34 #include <sys/types.h>
36 #include <sys/mount.h>
37 #include <sys/socket.h>
39 #include <sys/kern_control.h>
40 #include <sys/event.h>
42 #include <net/route.h>
43 #include <netinet/in.h>
44 #include <netinet/tcp.h>
45 #include <mach/machine.h>
46 #include <uuid/uuid.h>
49 #include <mach/coalition.h> /* COALITION_NUM_TYPES */
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
64 uint32_t pbi_flags
; /* 64bit; emulated etc */
75 uint32_t rfu_1
; /* reserved */
76 char pbi_comm
[MAXCOMLEN
];
77 char pbi_name
[2*MAXCOMLEN
]; /* empty if no name is registered */
81 uint32_t e_tdev
; /* controlling tty dev */
82 uint32_t e_tpgid
; /* tty process group id */
84 uint64_t pbi_start_tvsec
;
85 uint64_t pbi_start_tvusec
;
89 struct proc_bsdshortinfo
{
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 */
95 uint32_t pbsi_flags
; /* 64bit; emulated etc */
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*/
107 struct proc_uniqidentifierinfo
{
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 */
111 uint64_t p_reserve2
; /* reserved for future use */
112 uint64_t p_reserve3
; /* reserved for future use */
113 uint64_t p_reserve4
; /* reserved for future use */
117 struct proc_bsdinfowithuniqid
{
118 struct proc_bsdinfo pbsd
;
119 struct proc_uniqidentifierinfo p_uniqidentifier
;
122 struct proc_archinfo
{
123 cpu_type_t p_cputype
;
124 cpu_subtype_t p_cpusubtype
;
127 struct proc_pidcoalitioninfo
{
128 uint64_t coalition_id
[COALITION_NUM_TYPES
];
134 struct proc_originatorinfo
{
135 uuid_t originator_uuid
; /* UUID of the originator process */
136 pid_t originator_pid
; /* pid of the originator process */
145 /* pbi_flags values */
146 #define PROC_FLAG_SYSTEM 1 /* System process */
147 #define PROC_FLAG_TRACED 2 /* process currently being traced, possibly by gdb */
148 #define PROC_FLAG_INEXIT 4 /* process is working its way in exit() */
149 #define PROC_FLAG_PPWAIT 8
150 #define PROC_FLAG_LP64 0x10 /* 64bit process */
151 #define PROC_FLAG_SLEADER 0x20 /* The process is the session leader */
152 #define PROC_FLAG_CTTY 0x40 /* process has a control tty */
153 #define PROC_FLAG_CONTROLT 0x80 /* Has a controlling terminal */
154 #define PROC_FLAG_THCWD 0x100 /* process has a thread with cwd */
155 /* process control bits for resource starvation */
156 #define PROC_FLAG_PC_THROTTLE 0x200 /* In resource starvation situations, this process is to be throttled */
157 #define PROC_FLAG_PC_SUSP 0x400 /* In resource starvation situations, this process is to be suspended */
158 #define PROC_FLAG_PC_KILL 0x600 /* In resource starvation situations, this process is to be terminated */
159 #define PROC_FLAG_PC_MASK 0x600
160 /* process action bits for resource starvation */
161 #define PROC_FLAG_PA_THROTTLE 0x800 /* The process is currently throttled due to resource starvation */
162 #define PROC_FLAG_PA_SUSP 0x1000 /* The process is currently suspended due to resource starvation */
163 #define PROC_FLAG_PSUGID 0x2000 /* process has set privileges since last exec */
164 #define PROC_FLAG_EXEC 0x4000 /* process has called exec */
166 #define PROC_FLAG_DARWINBG 0x8000 /* process in darwin background */
167 #define PROC_FLAG_EXT_DARWINBG 0x10000 /* process in darwin background - external enforcement */
168 #define PROC_FLAG_IOS_APPLEDAEMON 0x20000 /* Process is apple daemon */
169 #define PROC_FLAG_DELAYIDLESLEEP 0x40000 /* Process is marked to delay idle sleep on disk IO */
170 #define PROC_FLAG_IOS_IMPPROMOTION 0x80000 /* Process is daemon which receives importane donation */
171 #define PROC_FLAG_ADAPTIVE 0x100000 /* Process is adaptive */
172 #define PROC_FLAG_ADAPTIVE_IMPORTANT 0x200000 /* Process is adaptive, and is currently important */
173 #define PROC_FLAG_IMPORTANCE_DONOR 0x400000 /* Process is marked as an importance donor */
174 #define PROC_FLAG_SUPPRESSED 0x800000 /* Process is suppressed */
175 #define PROC_FLAG_APPLICATION 0x1000000 /* Process is an application */
176 #define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */
180 struct proc_taskinfo
{
181 uint64_t pti_virtual_size
; /* virtual memory size (bytes) */
182 uint64_t pti_resident_size
; /* resident memory size (bytes) */
183 uint64_t pti_total_user
; /* total time */
184 uint64_t pti_total_system
;
185 uint64_t pti_threads_user
; /* existing threads only */
186 uint64_t pti_threads_system
;
187 int32_t pti_policy
; /* default policy for new threads */
188 int32_t pti_faults
; /* number of page faults */
189 int32_t pti_pageins
; /* number of actual pageins */
190 int32_t pti_cow_faults
; /* number of copy-on-write faults */
191 int32_t pti_messages_sent
; /* number of messages sent */
192 int32_t pti_messages_received
; /* number of messages received */
193 int32_t pti_syscalls_mach
; /* number of mach system calls */
194 int32_t pti_syscalls_unix
; /* number of unix system calls */
195 int32_t pti_csw
; /* number of context switches */
196 int32_t pti_threadnum
; /* number of threads in the task */
197 int32_t pti_numrunning
; /* number of running threads */
198 int32_t pti_priority
; /* task priority*/
201 struct proc_taskallinfo
{
202 struct proc_bsdinfo pbsd
;
203 struct proc_taskinfo ptinfo
;
206 #define MAXTHREADNAMESIZE 64
208 struct proc_threadinfo
{
209 uint64_t pth_user_time
; /* user run time */
210 uint64_t pth_system_time
; /* system run time */
211 int32_t pth_cpu_usage
; /* scaled cpu usage percentage */
212 int32_t pth_policy
; /* scheduling policy in effect */
213 int32_t pth_run_state
; /* run state (see below) */
214 int32_t pth_flags
; /* various flags (see below) */
215 int32_t pth_sleep_time
; /* number of seconds that thread */
216 int32_t pth_curpri
; /* cur priority*/
217 int32_t pth_priority
; /* priority*/
218 int32_t pth_maxpriority
; /* max priority*/
219 char pth_name
[MAXTHREADNAMESIZE
]; /* thread name, if any */
222 struct proc_regioninfo
{
223 uint32_t pri_protection
;
224 uint32_t pri_max_protection
;
225 uint32_t pri_inheritance
;
226 uint32_t pri_flags
; /* shared, external pager, is submap */
228 uint32_t pri_behavior
;
229 uint32_t pri_user_wired_count
;
230 uint32_t pri_user_tag
;
231 uint32_t pri_pages_resident
;
232 uint32_t pri_pages_shared_now_private
;
233 uint32_t pri_pages_swapped_out
;
234 uint32_t pri_pages_dirtied
;
235 uint32_t pri_ref_count
;
236 uint32_t pri_shadow_depth
;
237 uint32_t pri_share_mode
;
238 uint32_t pri_private_pages_resident
;
239 uint32_t pri_shared_pages_resident
;
242 uint64_t pri_address
;
246 #define PROC_REGION_SUBMAP 1
247 #define PROC_REGION_SHARED 2
253 #define SM_TRUESHARED 5
254 #define SM_PRIVATE_ALIASED 6
255 #define SM_SHARED_ALIASED 7
256 #define SM_LARGE_PAGE 8
260 * Thread run states (state field).
263 #define TH_STATE_RUNNING 1 /* thread is running normally */
264 #define TH_STATE_STOPPED 2 /* thread is stopped */
265 #define TH_STATE_WAITING 3 /* thread is waiting normally */
266 #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible
268 #define TH_STATE_HALTED 5 /* thread is halted at a
272 * Thread flags (flags field).
274 #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */
275 #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */
278 struct proc_workqueueinfo
{
279 uint32_t pwq_nthreads
; /* total number of workqueue threads */
280 uint32_t pwq_runthreads
; /* total number of running workqueue threads */
281 uint32_t pwq_blockedthreads
; /* total number of blocked workqueue threads */
286 * workqueue state (pwq_state field)
288 #define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT 0x1
289 #define WQ_EXCEEDED_TOTAL_THREAD_LIMIT 0x2
290 #define WQ_FLAGS_AVAILABLE 0x4
292 struct proc_fileinfo
{
293 uint32_t fi_openflags
;
297 uint32_t fi_guardflags
;
300 /* stats flags in proc_fileinfo */
301 #define PROC_FP_SHARED 1 /* shared by more than one fd */
302 #define PROC_FP_CLEXEC 2 /* close on exec */
303 #define PROC_FP_GUARDED 4 /* guarded fd */
304 #define PROC_FP_CLFORK 8 /* close on fork */
306 #define PROC_FI_GUARD_CLOSE (1u << 0)
307 #define PROC_FI_GUARD_DUP (1u << 1)
308 #define PROC_FI_GUARD_SOCKET_IPC (1u << 2)
309 #define PROC_FI_GUARD_FILEPORT (1u << 3)
311 struct proc_exitreasonbasicinfo
{
312 uint32_t beri_namespace
;
315 uint32_t beri_reason_buf_size
;
316 } __attribute__((packed
));
318 struct proc_exitreasoninfo
{
319 uint32_t eri_namespace
;
322 uint32_t eri_reason_buf_size
;
323 uint64_t eri_kcd_buf
;
324 } __attribute__((packed
));
327 * A copy of stat64 with static sized fields.
330 uint32_t vst_dev
; /* [XSI] ID of device containing file */
331 uint16_t vst_mode
; /* [XSI] Mode of file (see below) */
332 uint16_t vst_nlink
; /* [XSI] Number of hard links */
333 uint64_t vst_ino
; /* [XSI] File serial number */
334 uid_t vst_uid
; /* [XSI] User ID of the file */
335 gid_t vst_gid
; /* [XSI] Group ID of the file */
336 int64_t vst_atime
; /* [XSI] Time of last access */
337 int64_t vst_atimensec
; /* nsec of last access */
338 int64_t vst_mtime
; /* [XSI] Last data modification time */
339 int64_t vst_mtimensec
; /* last data modification nsec */
340 int64_t vst_ctime
; /* [XSI] Time of last status change */
341 int64_t vst_ctimensec
; /* nsec of last status change */
342 int64_t vst_birthtime
; /* File creation time(birth) */
343 int64_t vst_birthtimensec
; /* nsec of File creation time */
344 off_t vst_size
; /* [XSI] file size, in bytes */
345 int64_t vst_blocks
; /* [XSI] blocks allocated for file */
346 int32_t vst_blksize
; /* [XSI] optimal blocksize for I/O */
347 uint32_t vst_flags
; /* user defined flags for file */
348 uint32_t vst_gen
; /* file generation number */
349 uint32_t vst_rdev
; /* [XSI] Device ID */
350 int64_t vst_qspare
[2]; /* RESERVED: DO NOT USE! */
354 struct vinfo_stat vi_stat
;
360 struct vnode_info_path
{
361 struct vnode_info vip_vi
;
362 char vip_path
[MAXPATHLEN
]; /* tail end of it */
365 struct vnode_fdinfo
{
366 struct proc_fileinfo pfi
;
367 struct vnode_info pvi
;
370 struct vnode_fdinfowithpath
{
371 struct proc_fileinfo pfi
;
372 struct vnode_info_path pvip
;
375 struct proc_regionwithpathinfo
{
376 struct proc_regioninfo prp_prinfo
;
377 struct vnode_info_path prp_vip
;
380 struct proc_vnodepathinfo
{
381 struct vnode_info_path pvi_cdir
;
382 struct vnode_info_path pvi_rdir
;
385 struct proc_threadwithpathinfo
{
386 struct proc_threadinfo pt
;
387 struct vnode_info_path pvip
;
396 * IPv4 and IPv6 Sockets
403 u_int32_t i46a_pad32
[3];
404 struct in_addr i46a_addr4
;
408 int insi_fport
; /* foreign port */
409 int insi_lport
; /* local port */
410 uint64_t insi_gencnt
; /* generation count of this instance */
411 uint32_t insi_flags
; /* generic IP/datagram flags */
414 uint8_t insi_vflag
; /* ini_IPV4 or ini_IPV6 */
415 uint8_t insi_ip_ttl
; /* time to live proto */
416 uint32_t rfu_1
; /* reserved */
417 /* protocol dependent part */
419 struct in4in6_addr ina_46
;
420 struct in6_addr ina_6
;
421 } insi_faddr
; /* foreign host table entry */
423 struct in4in6_addr ina_46
;
424 struct in6_addr ina_6
;
425 } insi_laddr
; /* local host table entry */
427 u_char in4_tos
; /* type of service */
441 #define TSI_T_REXMT 0 /* retransmit */
442 #define TSI_T_PERSIST 1 /* retransmit persistence */
443 #define TSI_T_KEEP 2 /* keep alive */
444 #define TSI_T_2MSL 3 /* 2*msl quiet time timer */
445 #define TSI_T_NTIMERS 4
447 #define TSI_S_CLOSED 0 /* closed */
448 #define TSI_S_LISTEN 1 /* listening for connection */
449 #define TSI_S_SYN_SENT 2 /* active, have sent syn */
450 #define TSI_S_SYN_RECEIVED 3 /* have send and received syn */
451 #define TSI_S_ESTABLISHED 4 /* established */
452 #define TSI_S__CLOSE_WAIT 5 /* rcvd fin, waiting for close */
453 #define TSI_S_FIN_WAIT_1 6 /* have closed, sent fin */
454 #define TSI_S_CLOSING 7 /* closed xchd FIN; await FIN ACK */
455 #define TSI_S_LAST_ACK 8 /* had fin and close; await FIN ACK */
456 #define TSI_S_FIN_WAIT_2 9 /* have closed, fin is acked */
457 #define TSI_S_TIME_WAIT 10 /* in 2*msl quiet wait after close */
458 #define TSI_S_RESERVED 11 /* pseudo state: reserved */
460 struct tcp_sockinfo
{
461 struct in_sockinfo tcpsi_ini
;
463 int tcpsi_timer
[TSI_T_NTIMERS
];
465 uint32_t tcpsi_flags
;
466 uint32_t rfu_1
; /* reserved */
467 uint64_t tcpsi_tp
; /* opaque handle of TCP protocol control block */
471 * Unix Domain Sockets
476 uint64_t unsi_conn_so
; /* opaque handle of connected socket */
477 uint64_t unsi_conn_pcb
; /* opaque handle of connected protocol control block */
479 struct sockaddr_un ua_sun
;
480 char ua_dummy
[SOCK_MAXADDRLEN
];
481 } unsi_addr
; /* bound address */
483 struct sockaddr_un ua_sun
;
484 char ua_dummy
[SOCK_MAXADDRLEN
];
485 } unsi_caddr
; /* address of socket connected to */
493 uint32_t ndrvsi_if_family
;
494 uint32_t ndrvsi_if_unit
;
495 char ndrvsi_if_name
[IF_NAMESIZE
];
499 * Kernel Event Sockets
502 struct kern_event_info
{
503 uint32_t kesi_vendor_code_filter
;
504 uint32_t kesi_class_filter
;
505 uint32_t kesi_subclass_filter
;
509 * Kernel Control Sockets
512 struct kern_ctl_info
{
514 uint32_t kcsi_reg_unit
;
515 uint32_t kcsi_flags
; /* support flags */
516 uint32_t kcsi_recvbufsize
; /* request more than the default buffer size */
517 uint32_t kcsi_sendbufsize
; /* request more than the default buffer size */
519 char kcsi_name
[MAX_KCTL_NAME
]; /* unique nke identifier, provided by DTS */
524 #define SOI_S_NOFDREF 0x0001 /* no file table ref any more */
525 #define SOI_S_ISCONNECTED 0x0002 /* socket connected to a peer */
526 #define SOI_S_ISCONNECTING 0x0004 /* in process of connecting to peer */
527 #define SOI_S_ISDISCONNECTING 0x0008 /* in process of disconnecting */
528 #define SOI_S_CANTSENDMORE 0x0010 /* can't send more data to peer */
529 #define SOI_S_CANTRCVMORE 0x0020 /* can't receive more data from peer */
530 #define SOI_S_RCVATMARK 0x0040 /* at mark on input */
531 #define SOI_S_PRIV 0x0080 /* privileged for broadcast, raw... */
532 #define SOI_S_NBIO 0x0100 /* non-blocking ops */
533 #define SOI_S_ASYNC 0x0200 /* async i/o notify */
534 #define SOI_S_INCOMP 0x0800 /* Unaccepted, incomplete connection */
535 #define SOI_S_COMP 0x1000 /* unaccepted, complete connection */
536 #define SOI_S_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
537 #define SOI_S_DRAINING 0x4000 /* close waiting for blocked system calls to drain */
539 struct sockbuf_info
{
541 uint32_t sbi_hiwat
; /* SO_RCVBUF, SO_SNDBUF */
550 SOCKINFO_GENERIC
= 0,
555 SOCKINFO_KERN_EVENT
= 5,
556 SOCKINFO_KERN_CTL
= 6
560 struct vinfo_stat soi_stat
;
561 uint64_t soi_so
; /* opaque handle of socket */
562 uint64_t soi_pcb
; /* opaque handle of protocol control block */
574 uint32_t soi_oobmark
;
575 struct sockbuf_info soi_rcv
;
576 struct sockbuf_info soi_snd
;
578 uint32_t rfu_1
; /* reserved */
580 struct in_sockinfo pri_in
; /* SOCKINFO_IN */
581 struct tcp_sockinfo pri_tcp
; /* SOCKINFO_TCP */
582 struct un_sockinfo pri_un
; /* SOCKINFO_UN */
583 struct ndrv_info pri_ndrv
; /* SOCKINFO_NDRV */
584 struct kern_event_info pri_kern_event
; /* SOCKINFO_KERN_EVENT */
585 struct kern_ctl_info pri_kern_ctl
; /* SOCKINFO_KERN_CTL */
589 struct socket_fdinfo
{
590 struct proc_fileinfo pfi
;
591 struct socket_info psi
;
597 struct vinfo_stat psem_stat
;
598 char psem_name
[MAXPATHLEN
];
602 struct proc_fileinfo pfi
;
603 struct psem_info pseminfo
;
609 struct vinfo_stat pshm_stat
;
610 uint64_t pshm_mappaddr
;
611 char pshm_name
[MAXPATHLEN
];
615 struct proc_fileinfo pfi
;
616 struct pshm_info pshminfo
;
621 struct vinfo_stat pipe_stat
;
622 uint64_t pipe_handle
;
623 uint64_t pipe_peerhandle
;
625 int rfu_1
; /* reserved */
629 struct proc_fileinfo pfi
;
630 struct pipe_info pipeinfo
;
635 struct vinfo_stat kq_stat
;
637 uint32_t rfu_1
; /* reserved */
640 struct kqueue_dyninfo
{
641 struct kqueue_info kqdi_info
;
642 uint64_t kqdi_servicer
;
644 uint32_t kqdi_sync_waiters
;
645 uint8_t kqdi_sync_waiter_qos
;
646 uint8_t kqdi_async_qos
;
647 uint16_t kqdi_request_state
;
648 uint8_t kqdi_events_qos
;
649 uint8_t _kqdi_reserved0
[7];
650 uint64_t _kqdi_reserved1
[4];
653 /* keep in sync with KQ_* in sys/eventvar.h */
654 #define PROC_KQUEUE_SELECT 0x01
655 #define PROC_KQUEUE_SLEEP 0x02
656 #define PROC_KQUEUE_32 0x08
657 #define PROC_KQUEUE_64 0x10
658 #define PROC_KQUEUE_QOS 0x20
661 struct kevent_extinfo
{
662 struct kevent_qos_s kqext_kev
;
663 uint64_t kqext_sdata
;
666 uint64_t kqext_reserved
[2];
670 struct kqueue_fdinfo
{
671 struct proc_fileinfo pfi
;
672 struct kqueue_info kqueueinfo
;
675 struct appletalk_info
{
676 struct vinfo_stat atalk_stat
;
679 struct appletalk_fdinfo
{
680 struct proc_fileinfo pfi
;
681 struct appletalk_info appletalkinfo
;
686 /* defns of process file desc type */
687 #define PROX_FDTYPE_ATALK 0
688 #define PROX_FDTYPE_VNODE 1
689 #define PROX_FDTYPE_SOCKET 2
690 #define PROX_FDTYPE_PSHM 3
691 #define PROX_FDTYPE_PSEM 4
692 #define PROX_FDTYPE_KQUEUE 5
693 #define PROX_FDTYPE_PIPE 6
694 #define PROX_FDTYPE_FSEVENTS 7
695 #define PROX_FDTYPE_NETPOLICY 9
699 uint32_t proc_fdtype
;
702 struct proc_fileportinfo
{
703 uint32_t proc_fileport
;
704 uint32_t proc_fdtype
;
708 /* Flavors for proc_pidinfo() */
709 #define PROC_PIDLISTFDS 1
710 #define PROC_PIDLISTFD_SIZE (sizeof(struct proc_fdinfo))
712 #define PROC_PIDTASKALLINFO 2
713 #define PROC_PIDTASKALLINFO_SIZE (sizeof(struct proc_taskallinfo))
715 #define PROC_PIDTBSDINFO 3
716 #define PROC_PIDTBSDINFO_SIZE (sizeof(struct proc_bsdinfo))
718 #define PROC_PIDTASKINFO 4
719 #define PROC_PIDTASKINFO_SIZE (sizeof(struct proc_taskinfo))
721 #define PROC_PIDTHREADINFO 5
722 #define PROC_PIDTHREADINFO_SIZE (sizeof(struct proc_threadinfo))
724 #define PROC_PIDLISTTHREADS 6
725 #define PROC_PIDLISTTHREADS_SIZE (2* sizeof(uint32_t))
728 #define PROC_PIDREGIONINFO 7
729 #define PROC_PIDREGIONINFO_SIZE (sizeof(struct proc_regioninfo))
731 #define PROC_PIDREGIONPATHINFO 8
732 #define PROC_PIDREGIONPATHINFO_SIZE (sizeof(struct proc_regionwithpathinfo))
734 #define PROC_PIDVNODEPATHINFO 9
735 #define PROC_PIDVNODEPATHINFO_SIZE (sizeof(struct proc_vnodepathinfo))
737 #define PROC_PIDTHREADPATHINFO 10
738 #define PROC_PIDTHREADPATHINFO_SIZE (sizeof(struct proc_threadwithpathinfo))
740 #define PROC_PIDPATHINFO 11
741 #define PROC_PIDPATHINFO_SIZE (MAXPATHLEN)
742 #define PROC_PIDPATHINFO_MAXSIZE (4*MAXPATHLEN)
744 #define PROC_PIDWORKQUEUEINFO 12
745 #define PROC_PIDWORKQUEUEINFO_SIZE (sizeof(struct proc_workqueueinfo))
747 #define PROC_PIDT_SHORTBSDINFO 13
748 #define PROC_PIDT_SHORTBSDINFO_SIZE (sizeof(struct proc_bsdshortinfo))
750 #define PROC_PIDLISTFILEPORTS 14
751 #define PROC_PIDLISTFILEPORTS_SIZE (sizeof(struct proc_fileportinfo))
753 #define PROC_PIDTHREADID64INFO 15
754 #define PROC_PIDTHREADID64INFO_SIZE (sizeof(struct proc_threadinfo))
756 #define PROC_PID_RUSAGE 16
757 #define PROC_PID_RUSAGE_SIZE 0
760 #define PROC_PIDUNIQIDENTIFIERINFO 17
761 #define PROC_PIDUNIQIDENTIFIERINFO_SIZE \
762 (sizeof(struct proc_uniqidentifierinfo))
764 #define PROC_PIDT_BSDINFOWITHUNIQID 18
765 #define PROC_PIDT_BSDINFOWITHUNIQID_SIZE \
766 (sizeof(struct proc_bsdinfowithuniqid))
768 #define PROC_PIDARCHINFO 19
769 #define PROC_PIDARCHINFO_SIZE \
770 (sizeof(struct proc_archinfo))
772 #define PROC_PIDCOALITIONINFO 20
773 #define PROC_PIDCOALITIONINFO_SIZE (sizeof(struct proc_pidcoalitioninfo))
775 #define PROC_PIDNOTEEXIT 21
776 #define PROC_PIDNOTEEXIT_SIZE (sizeof(uint32_t))
778 #define PROC_PIDREGIONPATHINFO2 22
779 #define PROC_PIDREGIONPATHINFO2_SIZE (sizeof(struct proc_regionwithpathinfo))
781 #define PROC_PIDREGIONPATHINFO3 23
782 #define PROC_PIDREGIONPATHINFO3_SIZE (sizeof(struct proc_regionwithpathinfo))
784 #define PROC_PIDEXITREASONINFO 24
785 #define PROC_PIDEXITREASONINFO_SIZE (sizeof(struct proc_exitreasoninfo))
787 #define PROC_PIDEXITREASONBASICINFO 25
788 #define PROC_PIDEXITREASONBASICINFOSIZE (sizeof(struct proc_exitreasonbasicinfo))
790 #define PROC_PIDLISTUPTRS 26
791 #define PROC_PIDLISTUPTRS_SIZE (sizeof(uint64_t))
793 #define PROC_PIDLISTDYNKQUEUES 27
794 #define PROC_PIDLISTDYNKQUEUES_SIZE (sizeof(kqueue_id_t))
798 /* Flavors for proc_pidfdinfo */
800 #define PROC_PIDFDVNODEINFO 1
801 #define PROC_PIDFDVNODEINFO_SIZE (sizeof(struct vnode_fdinfo))
803 #define PROC_PIDFDVNODEPATHINFO 2
804 #define PROC_PIDFDVNODEPATHINFO_SIZE (sizeof(struct vnode_fdinfowithpath))
806 #define PROC_PIDFDSOCKETINFO 3
807 #define PROC_PIDFDSOCKETINFO_SIZE (sizeof(struct socket_fdinfo))
809 #define PROC_PIDFDPSEMINFO 4
810 #define PROC_PIDFDPSEMINFO_SIZE (sizeof(struct psem_fdinfo))
812 #define PROC_PIDFDPSHMINFO 5
813 #define PROC_PIDFDPSHMINFO_SIZE (sizeof(struct pshm_fdinfo))
815 #define PROC_PIDFDPIPEINFO 6
816 #define PROC_PIDFDPIPEINFO_SIZE (sizeof(struct pipe_fdinfo))
818 #define PROC_PIDFDKQUEUEINFO 7
819 #define PROC_PIDFDKQUEUEINFO_SIZE (sizeof(struct kqueue_fdinfo))
821 #define PROC_PIDFDATALKINFO 8
822 #define PROC_PIDFDATALKINFO_SIZE (sizeof(struct appletalk_fdinfo))
825 #define PROC_PIDFDKQUEUE_EXTINFO 9
826 #define PROC_PIDFDKQUEUE_EXTINFO_SIZE (sizeof(struct kevent_extinfo))
827 #define PROC_PIDFDKQUEUE_KNOTES_MAX (1024 * 128)
828 #define PROC_PIDDYNKQUEUES_MAX (1024 * 128)
832 /* Flavors for proc_pidfileportinfo */
834 #define PROC_PIDFILEPORTVNODEPATHINFO 2 /* out: vnode_fdinfowithpath */
835 #define PROC_PIDFILEPORTVNODEPATHINFO_SIZE \
836 PROC_PIDFDVNODEPATHINFO_SIZE
838 #define PROC_PIDFILEPORTSOCKETINFO 3 /* out: socket_fdinfo */
839 #define PROC_PIDFILEPORTSOCKETINFO_SIZE PROC_PIDFDSOCKETINFO_SIZE
841 #define PROC_PIDFILEPORTPSHMINFO 5 /* out: pshm_fdinfo */
842 #define PROC_PIDFILEPORTPSHMINFO_SIZE PROC_PIDFDPSHMINFO_SIZE
844 #define PROC_PIDFILEPORTPIPEINFO 6 /* out: pipe_fdinfo */
845 #define PROC_PIDFILEPORTPIPEINFO_SIZE PROC_PIDFDPIPEINFO_SIZE
847 /* used for proc_setcontrol */
848 #define PROC_SELFSET_PCONTROL 1
850 #define PROC_SELFSET_THREADNAME 2
851 #define PROC_SELFSET_THREADNAME_SIZE (MAXTHREADNAMESIZE -1)
853 #define PROC_SELFSET_VMRSRCOWNER 3
855 #define PROC_SELFSET_DELAYIDLESLEEP 4
857 /* used for proc_dirtycontrol */
858 #define PROC_DIRTYCONTROL_TRACK 1
859 #define PROC_DIRTYCONTROL_SET 2
860 #define PROC_DIRTYCONTROL_GET 3
861 #define PROC_DIRTYCONTROL_CLEAR 4
863 /* proc_track_dirty() flags */
864 #define PROC_DIRTY_TRACK 0x1
865 #define PROC_DIRTY_ALLOW_IDLE_EXIT 0x2
866 #define PROC_DIRTY_DEFER 0x4
867 #define PROC_DIRTY_LAUNCH_IN_PROGRESS 0x8
869 /* proc_get_dirty() flags */
870 #define PROC_DIRTY_TRACKED 0x1
871 #define PROC_DIRTY_ALLOWS_IDLE_EXIT 0x2
872 #define PROC_DIRTY_IS_DIRTY 0x4
873 #define PROC_DIRTY_LAUNCH_IS_IN_PROGRESS 0x8
877 /* Flavors for proc_pidoriginatorinfo */
878 #define PROC_PIDORIGINATOR_UUID 0x1
879 #define PROC_PIDORIGINATOR_UUID_SIZE (sizeof(uuid_t))
881 #define PROC_PIDORIGINATOR_BGSTATE 0x2
882 #define PROC_PIDORIGINATOR_BGSTATE_SIZE (sizeof(uint32_t))
884 #define PROC_PIDORIGINATOR_PID_UUID 0x3
885 #define PROC_PIDORIGINATOR_PID_UUID_SIZE (sizeof(struct proc_originatorinfo))
887 /* Flavors for proc_listcoalitions */
888 #define LISTCOALITIONS_ALL_COALS 1
889 #define LISTCOALITIONS_ALL_COALS_SIZE (sizeof(struct procinfo_coalinfo))
891 #define LISTCOALITIONS_SINGLE_TYPE 2
892 #define LISTCOALITIONS_SINGLE_TYPE_SIZE (sizeof(struct procinfo_coalinfo))
894 /* reasons for proc_can_use_foreground_hw */
895 #define PROC_FGHW_OK 0 /* pid may use foreground HW */
896 #define PROC_FGHW_DAEMON_OK 1
897 #define PROC_FGHW_DAEMON_LEADER 10 /* pid is in a daemon coalition */
898 #define PROC_FGHW_LEADER_NONUI 11 /* coalition leader is in a non-focal state */
899 #define PROC_FGHW_LEADER_BACKGROUND 12 /* coalition leader is in a background state */
900 #define PROC_FGHW_DAEMON_NO_VOUCHER 13 /* pid is a daemon with no adopted voucher */
901 #define PROC_FGHW_NO_VOUCHER_ATTR 14 /* pid has adopted a voucher with no bank/originator attribute */
902 #define PROC_FGHW_NO_ORIGINATOR 15 /* pid has adopted a voucher for a process that's gone away */
903 #define PROC_FGHW_ORIGINATOR_BACKGROUND 16 /* pid has adopted a voucher for an app that's in the background */
904 #define PROC_FGHW_VOUCHER_ERROR 98 /* error in voucher / originator callout */
905 #define PROC_FGHW_ERROR 99 /* syscall parameter/permissions error */
907 /* flavors for proc_piddynkqueueinfo */
909 #define PROC_PIDDYNKQUEUE_INFO 0
910 #define PROC_PIDDYNKQUEUE_INFO_SIZE (sizeof(struct kqueue_dyninfo))
911 #define PROC_PIDDYNKQUEUE_EXTINFO 1
912 #define PROC_PIDDYNKQUEUE_EXTINFO_SIZE (sizeof(struct kevent_extinfo))
915 /* __proc_info() call numbers */
916 #define PROC_INFO_CALL_LISTPIDS 0x1
917 #define PROC_INFO_CALL_PIDINFO 0x2
918 #define PROC_INFO_CALL_PIDFDINFO 0x3
919 #define PROC_INFO_CALL_KERNMSGBUF 0x4
920 #define PROC_INFO_CALL_SETCONTROL 0x5
921 #define PROC_INFO_CALL_PIDFILEPORTINFO 0x6
922 #define PROC_INFO_CALL_TERMINATE 0x7
923 #define PROC_INFO_CALL_DIRTYCONTROL 0x8
924 #define PROC_INFO_CALL_PIDRUSAGE 0x9
925 #define PROC_INFO_CALL_PIDORIGINATORINFO 0xa
926 #define PROC_INFO_CALL_LISTCOALITIONS 0xb
927 #define PROC_INFO_CALL_CANUSEFGHW 0xc
928 #define PROC_INFO_CALL_PIDDYNKQUEUEINFO 0xd
932 #ifdef XNU_KERNEL_PRIVATE
945 extern int fill_socketinfo(socket_t so
, struct socket_info
*si
);
946 extern int fill_pshminfo(struct pshmnode
* pshm
, struct pshm_info
* pinfo
);
947 extern int fill_pseminfo(struct psemnode
* psem
, struct psem_info
* pinfo
);
948 extern int fill_pipeinfo(struct pipe
* cpipe
, struct pipe_info
* pinfo
);
949 extern int fill_kqueueinfo(struct kqueue
* kq
, struct kqueue_info
* kinfo
);
950 extern int pid_kqueue_extinfo(proc_t
, struct kqueue
* kq
, user_addr_t buffer
,
951 uint32_t buffersize
, int32_t * retval
);
952 extern int pid_kqueue_udatainfo(proc_t p
, struct kqueue
*kq
, uint64_t *buf
,
954 extern int pid_kqueue_listdynamickqueues(proc_t p
, user_addr_t ubuf
,
955 uint32_t bufsize
, int32_t *retval
);
956 extern int pid_dynamickqueue_extinfo(proc_t p
, kqueue_id_t kq_id
,
957 user_addr_t ubuf
, uint32_t bufsize
, int32_t *retval
);
958 extern int fill_procworkqueue(proc_t
, struct proc_workqueueinfo
*);
959 extern boolean_t
workqueue_get_pwq_exceeded(void *v
, boolean_t
*exceeded_total
,
960 boolean_t
*exceeded_constrained
);
961 extern uint32_t workqueue_get_pwq_state_kdp(void *proc
);
963 #endif /* XNU_KERNEL_PRIVATE */
967 #endif /*_SYS_PROC_INFO_H */