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