osfmk/man/task_get_special_port.html
Function - Return a send write to the indicated special port.
**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**);**
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 movable task port and different from the one returned by mach_task_self (immovable).
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.
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.
The current implementation does not support the TASK_HOST_NAME_PORT features associated with this interface.
Only generic errors apply.
Functions: mach_task_self, task_create, task_set_special_port, thread_get_special_port, thread_set_special_port, mach_host_self.