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