osfmk/man/task_info.html
Function - Return per-task information according to specified flavor.
**kern\_return\_t task\_info**** (task\_t **task,** task\_flavor\_t **flavor,** task\_info\_t **task\_info,** mach\_msg\_type\_number\_t **task\_info\_count** );**
task[in task send right] The port for the task for which the information is to be returned.
flavor[in scalar] The type of information to be returned. Valid values are:
TASK_BASIC_INFO Returns basic information about the task, such as the task's suspend count and number of resident pages. The structure returned is task_basic_info.
TASK_THREAD_TIMES_INFO Returns system and user space run-times for live threads. The structure returned is task_thread_times_info.
TASK_SCHED_FIFO_INFO Returns default FIFO scheduling policy attributes to be assigned to new threads. The structure returned is policy_fifo_base.
TASK_SCHED_RR_INFO Returns default round-robin scheduling policy attributes to be assigned to new threads. The structure returned is policy_rr_base.
TASK_SCHED_TIMESHARE_INFO Returns default timeshare scheduling policy attributes to be assigned to new threads. The structure returned is policy_timeshare_base.
TASK_SECURITY_TOKEN Returns the security token for the task. The value returned is of type security_token_t.
TASK_AUDIT_TOKEN Returns the security token for the task. The value returned is of type audit_token_t.
TASK_USER_DATA Returns user-specified information previously established via the task_set_info interface. The structure returned is task_user_data.
task_info[out structure] Information about the specified task.
task_info_count[in/out scalar] On input, the maximum size of the buffer; on output, the size returned (in natural-sized units).
The task_info function returns an information structure of type flavor.
At any given time, a task has one default scheduling policy assigned to it (as returned by TASK_BASIC_INFO ). As such, only one of the scheduling flavors will return valid information.
KERN_INVALID_POLICY A request was made for the default scheduling policy attributes for the task but the requested policy is not the task's default policy.
Functions: task_get_special_port, task_set_special_port, task_set_info, task_threads, thread_info, thread_get_state, thread_set_state.
Data Structures: task_basic_info, policy_timeshare_info, policy_fifo_info, policy_rr_info, task_thread_times_info.