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