## task_info

Function - Return per-task information according to specified flavor.

### SYNOPSIS

    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);

### PARAMETERS

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).

### DESCRIPTION

The task_info function returns an information structure of type flavor.

### NOTES

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.

### RETURN VALUES

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.

### RELATED INFORMATION

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.