osfmk/man/task_set_special_port.html
Function - Set the indicated special port.
**kern\_return\_t task\_set\_special\_port**** (task\_t **task,** int **which\_port,** mach\_port\_t **special\_port** ); ****Macro forms:**** kern\_return\_t task\_set\_bootstrap\_port****(task\_t**task, **int** which\_port, **mach\_port\_t** special\_port**);****kern\_return\_t task\_set\_kernel\_port****(task\_t**task, **int** which\_port, **mach\_port\_t** special\_port**);****kern\_return\_t task\_set\_host\_name\_port****(task\_t**task, **mach\_port\_t** special\_port**);**
task[in task send right] The port for the task for which to set the port.
which_port[in scalar] The special port to be set. Valid values are:
TASK_BOOTSTRAP_PORT [bootstrap send right] The task's bootstrap port. Used to send messages requesting return of other system service ports.
TASK_KERNEL_PORT [task-self send right] The task's kernel port. Used by the kernel to receive messages to manipulate the task. This is the movable task port and different from the one returned by mach_task_self (immovable). Setting this special port does not change the identity of the kernel port that names the task; this simply changes the value returned as the kernel special port.
TASK_HOST_NAME_PORT [host-self send right] The task's host self port. Used by the task to request information about its containing host. This is the port returned by mach_host_self. Setting this special port does not change the identity of the kernel port that names the host; this simply changes the value returned as the host special port.
TASK_WIRED_LEDGER_PORT [ledger send right] The resource ledger from which the task draws its wired kernel memory. Setting this special port does not change the ledger from which the task draws its resources; this simply changes the value returned as the ledger special port.
TASK_PAGED_LEDGER_PORT [ledger send right] The resource ledger from which the task draws its default memory managed memory. Setting this special port does not change the ledger from which the task draws its resources; this simply changes the value returned as the ledger special port.
special_port[in task-special send right] The value for the port.
The task_set_special_port function sets a special port belonging to task.
The current implementation does not support the TASK_HOST_NAME_PORT features associated with this interface.
Only generic errors apply.
Functions: task_create, task_get_special_port, mach_task_self, thread_get_special_port, thread_set_special_port, mach_host_self.