Next: , Previous: Scheduling, Up: Thread Interface


7.1.7 Thread Special Ports

— Function: kern_return_t thread_get_special_port (thread_t thread, int which_port, mach_port_t *special_port)

The function thread_get_special_port returns send rights to one of a set of special ports for the thread specified by thread.

The possible values for which_port are THREAD_KERNEL_PORT and THREAD_EXCEPTION_PORT. A thread also has access to its task's special ports.

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

— Function: kern_return_t thread_get_kernel_port (thread_t thread, mach_port_t *kernel_port)

The function thread_get_kernel_port is equivalent to the function thread_get_special_port with the which_port argument set to THREAD_KERNEL_PORT.

— Function: kern_return_t thread_get_exception_port (thread_t thread, mach_port_t *exception_port)

The function thread_get_exception_port is equivalent to the function thread_get_special_port with the which_port argument set to THREAD_EXCEPTION_PORT.

— Function: kern_return_t thread_set_special_port (thread_t thread, int which_port, mach_port_t special_port)

The function thread_set_special_port sets one of a set of special ports for the thread specified by thread.

The possible values for which_port are THREAD_KERNEL_PORT and THREAD_EXCEPTION_PORT. A thread also has access to its task's special ports.

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

— Function: kern_return_t thread_set_kernel_port (thread_t thread, mach_port_t kernel_port)

The function thread_set_kernel_port is equivalent to the function thread_set_special_port with the which_port argument set to THREAD_KERNEL_PORT.

— Function: kern_return_t thread_set_exception_port (thread_t thread, mach_port_t exception_port)

The function thread_set_exception_port is equivalent to the function thread_set_special_port with the which_port argument set to THREAD_EXCEPTION_PORT.