## task_get_special_port

Function - Return a send write to the indicated special port.

### SYNOPSIS

    kern_return_t   task_get_special_port
                    (task_t                                    task,
                     int                                 which_port,
                     task                              special_port);

    Macro Forms:

    kern_return_t   task_get_bootstrap_port
                    (task_t                                    task,
                     task                              special_port);

    kern_return_t   task_get_kernel_port
                    (task_t                                    task,
                     task                              special_port);

    kern_return_t   task_get_host_name_port
                    (task_t                                    task,
                     task                              special_port);

### PARAMETERS

task
  [in task send right] The port for the task for which to return the port's send right.

which_port
  [in scalar] The special port for which the send right is requested. Valid values are:

  TASK_KERNEL_PORT
    [task-self send right] The port used to control this task. Used to send messages that affect the task. This is the port returned by mach_task_self.

  TASK_BOOTSTRAP_PORT
    [bootstrap send right] The task's bootstrap port. Used to send messages requesting return of other system service ports.

  TASK_HOST_NAME_PORT
    [host-self send right] The port used to request information of the containing host. This is the port returned by mach_host_self.

  TASK_WIRED_LEDGER_PORT
    [ledger send right] The port naming the source from which this task draws its wired kernel memory.

  TASK_PAGED_LEDGER_PORT
    [ledger send right] The port naming the source from which this task draws its default memory managed memory.

special_port
  [out task-special send right] The returned value for the port.

### DESCRIPTION

The task_get_special_port function returns a send right for a special port belonging to task.

If one task has a send right for the kernel port of another task, it can use the port to perform kernel operations for the other task. Send rights for a kernel port normally are held only by the task to which the port belongs, or by the task's parent task. Using the mach_msg function, however, any task can pass a send right for its kernel port to another task.

### NOTES

The current implementation does not support the TASK_HOST_NAME_PORT features associated with this interface.

### RETURN VALUES

Only generic errors apply.

### RELATED INFORMATION

Functions: mach_task_self, task_create, task_set_special_port, thread_get_special_port, thread_set_special_port, mach_host_self.