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