Skip to content
BSD syscall#538

svc · unix #538

task_inspect_for_pid

Returns an inspect-flavor task port for the given PID — finer-grained query access than name but stricter than read.

Prototype

int task_inspect_for_pid(mach_port_name_t target_tport, int pid, mach_port_name_t *t);

Returns: int

Arguments

NameTypeDirDescription
target_tportmach_port_name_t-
pidint-
tmach_port_name_t-

Version history

XNU tagmacOS#
xnu-7195.50.7.100.1macOS 11.0 Big Sur538
xnu-8019.41.5macOS 12.0 Monterey538
xnu-8792.41.9macOS 13.0 Ventura538
xnu-10002.1.13macOS 14.0 Sonoma538
xnu-11215.1.10macOS 15.0 Sequoia538
xnu-11417.101.15macOS 15.4 Sequoia538
xnu-12377.1.9macOS 26.0 Tahoe538
xnu-10002.41.9538
xnu-10002.61.3538
xnu-10002.81.5538
xnu-10063.101.15538
xnu-10063.121.3538
xnu-10063.141.1538
xnu-11215.41.3538
xnu-11215.61.5538
xnu-11215.81.4538
xnu-11417.121.6538
xnu-11417.140.69538
xnu-12377.101.15538
xnu-12377.41.6538
xnu-12377.61.12538
xnu-12377.81.4538
xnu-7195.101.1538
xnu-7195.121.3538
xnu-7195.141.2538
xnu-7195.60.75538
xnu-7195.81.3538
xnu-8019.61.5538
xnu-8019.80.24538
xnu-8020.101.4538
xnu-8020.121.3538
xnu-8020.140.41538
xnu-8792.61.2538
xnu-8792.81.2538
xnu-8796.101.5538
xnu-8796.121.2538
xnu-8796.141.3538

Notes

The inspect flavor sits between name and read in the macOS 11.3 port hierarchy: it grants the task_inspect interfaces (task_inspect_basic_counts_info, task_inspect_extmod_info) and thread inspection beyond what name allows, but no memory reads. Profilers like Instruments use inspect ports to gather CPU and energy counters without triggering SIP's read-port denial. Authorization is identical to read flavor.

Detection

ES_EVENT_TYPE_NOTIFY_GET_TASK_INSPECT and its AUTH counterpart are available on macOS 11.3+. Outside that, only the DTrace mach_trap provider sees the call.

Related APIs

task_for_pidtask_name_for_pidtask_read_for_pidtask_inspect