#include <kern/task.h>
kern/task.h
functioncurrent_task
__pure2 extern task_t current_task(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Returns the task to which the current (calling) thread belongs. No reference is taken; the result is stable only as long as the caller runs in that task's context.
functiontask_is_driver
extern bool task_is_driver(task_t task)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task_policy.c
Returns true if the task's requested policy apptype is TASK_APPTYPE_DRIVER, i.e. the task is a DriverKit driver (dext) host process. Returns false for a NULL task.
macroTF_NONE
#define TF_NONE 0
macroTWF_NONE
#define TWF_NONE 0
macroTRW_LRETURNWAIT
#define TRW_LRETURNWAIT 0x01
task is waiting for fork/posix_spawn/exec to complete
macroTRW_LRETURNWAITER
#define TRW_LRETURNWAITER 0x02
task is waiting for TRW_LRETURNWAIT to get cleared
macroTCRW_CLEAR_FINAL_WAIT
#define TCRW_CLEAR_FINAL_WAIT 0x2
macroTCRW_CLEAR_EXEC_COMPLETE
#define TCRW_CLEAR_EXEC_COMPLETE 0x4
macroTCRW_CLEAR_ALL_WAIT
#define TCRW_CLEAR_ALL_WAIT (TCRW_CLEAR_INITIAL_WAIT | TCRW_CLEAR_FINAL_WAIT)
macroTPF_NONE
#define TPF_NONE 0
variablekernel_task
extern task_t kernel_task
functiontask_name_deallocate_mig
extern void task_name_deallocate_mig(task_name_t task_name)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Drops a reference on a task name obtained from the MIG layer (task name ports carry no control rights); the reference is accounted to the MIG reference group. Equivalent to task_deallocate on the underlying task.
functiontask_policy_set_deallocate_mig
extern void task_policy_set_deallocate_mig(task_policy_set_t task_policy_set)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Drops a reference on a task acquired through a task policy-set right in the MIG layer; the reference is accounted to the MIG reference group.
functiontask_policy_get_deallocate_mig
extern void task_policy_get_deallocate_mig(task_policy_get_t task_policy_get)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Drops a reference on a task acquired through a task policy-get right in the MIG layer; the reference is accounted to the MIG reference group.
functiontask_inspect_deallocate_mig
extern void task_inspect_deallocate_mig(task_inspect_t task_inspect)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Drops a task inspection reference obtained from the MIG layer (from a task inspect port); the reference is accounted to the MIG reference group.
functiontask_read_deallocate_mig
extern void task_read_deallocate_mig(task_read_t task_read)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Drops a reference obtained from a task read port in the MIG layer; the reference is accounted to the MIG reference group.
functiontask_suspension_token_deallocate
extern void task_suspension_token_deallocate(task_suspension_token_t token)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Drops a reference on a task suspension token (the object produced by task_suspend2/convert_port_to_task_suspension_token). Equivalent to task_deallocate on the underlying task.
functiontask_self_region_footprint
extern boolean_t task_self_region_footprint(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Returns whether vm_region-style queries issued by the current task on itself report footprint information (the task_region_footprint flag, or the system-wide vm_region_footprint override on DEVELOPMENT/DEBUG kernels).
functiontask_self_region_footprint_set
extern void task_self_region_footprint_set(boolean_t newval)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Sets or clears the current task's task_region_footprint flag, controlling whether the task's own vm_region-style queries report footprint information. Takes the task lock.
functiontask_self_region_info_flags
extern int task_self_region_info_flags(void)
VM_REGION_INFO_FLAGS defined in vm_region.h
functiontask_self_region_info_flags_set
extern kern_return_t task_self_region_info_flags_set(int newval)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Sets the current task's region info flags, which modify the task's own vm_region-style queries. Returns KERN_INVALID_ARGUMENT if newval does not fit in the flags bitfield, else KERN_SUCCESS.
functiontask_ledgers_footprint
extern void task_ledgers_footprint( ledger_t ledger, ledger_amount_t *ledger_resident, ledger_amount_t *ledger_compressed )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Returns through ledger_resident and ledger_compressed the resident and compressed amounts of memory counted in a task's footprint due to specific ledger entries: purgeable non-volatile memory and the tagged, media and graphics footprint ledgers. Network-tagged memory is not counted.
functiontask_set_memory_ownership_transfer
extern void task_set_memory_ownership_transfer(task_t task, boolean_t value)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/task.c
Sets or clears the task's task_can_transfer_memory_ownership flag, permitting the task to transfer ownership of purgeable/accounted memory (mach_memory_entry_ownership). Takes the task lock.
functiontask_set_ast_synthesize_async_fault_mach_exception
void task_set_ast_synthesize_async_fault_mach_exception(task_t task)
Must be callable from IOKit as it sometimes has need to asynchronously
terminate tasks. Takes the task lock.