Go to the first, previous, next, last section, table of contents.


Task Special Ports

Function: kern_return_t task_get_special_port (mach_port_t task, int which_port, mach_port_t *special_port)
The function task_get_special_port returns send rights to one of a set of special ports for the task specified by task.

The special ports associated with a task are the kernel port (TASK_KERNEL_PORT), the bootstrap port (TASK_BOOTSTRAP_PORT) and the exception port (TASK_EXCEPTION_PORT). The bootstrap port is a port to which a The bootstrap port is a port to which a thread may send a message requesting other system service ports. This port is not used by the kernel. The task's exception port is the port to which messages are sent by the kernel when an exception occurs and the thread causing the exception has no exception port of its own.

The following macros to call task_get_special_port for a specific port are defined in mach/task_special_ports.h: task_get_exception_port and task_get_bootstrap_port.

The function returns KERN_SUCCESS if the port was returned and KERN_INVALID_ARGUMENT if task is not a task or which_port is an invalid port selector.

Function: kern_return_t task_get_kernel_port (task_t task, mach_port_t *kernel_port)
The function task_get_kernel_port is equivalent to the function task_get_special_port with the which_port argument set to TASK_KERNEL_PORT.

Function: kern_return_t task_get_exception_port (task_t task, mach_port_t *exception_port)
The function task_get_exception_port is equivalent to the function task_get_special_port with the which_port argument set to TASK_EXCEPTION_PORT.

Function: kern_return_t task_get_bootstrap_port (task_t task, mach_port_t *bootstrap_port)
The function task_get_bootstrap_port is equivalent to the function task_get_special_port with the which_port argument set to TASK_BOOTSTRAP_PORT.

Function: kern_return_t task_set_special_port (mach_port_t task, int which_port, mach_port_t special_port)
The function thread_set_special_port sets one of a set of special ports for the task specified by task.

The special ports associated with a task are the kernel port (TASK_KERNEL_PORT), the bootstrap port (TASK_BOOTSTRAP_PORT) and the exception port (TASK_EXCEPTION_PORT). The bootstrap port is a port to which a thread may send a message requesting other system service ports. This port is not used by the kernel. The task's exception port is the port to which messages are sent by the kernel when an exception occurs and the thread causing the exception has no exception port of its own.

The function returns KERN_SUCCESS if the port was set and KERN_INVALID_ARGUMENT if task is not a task or which_port is an invalid port selector.

Function: kern_return_t task_set_kernel_port (task_t task, mach_port_t kernel_port)
The function task_set_kernel_port is equivalent to the function task_set_special_port with the which_port argument set to TASK_KERNEL_PORT.

Function: kern_return_t task_set_exception_port (task_t task, mach_port_t exception_port)
The function task_set_exception_port is equivalent to the function task_set_special_port with the which_port argument set to TASK_EXCEPTION_PORT.

Function: kern_return_t task_set_bootstrap_port (task_t task, mach_port_t bootstrap_port)
The function task_set_bootstrap_port is equivalent to the function task_set_special_port with the which_port argument set to TASK_BOOTSTRAP_PORT.


Go to the first, previous, next, last section, table of contents.