#include <mach/thread_special_ports.h> also included by <mach/mach.h>

mach/thread_special_ports.h

6 macros

macroTHREAD_KERNEL_PORT

#define THREAD_KERNEL_PORT 1
The full thread port for thread.
CMU/MIT Mach reference · manual page · © Carnegie Mellon
[thread-self send right] The port used to name the thread. Used to invoke operations that affect the thread. This is the port returned by mach_thread_self.
a value of int

macroTHREAD_INSPECT_PORT

#define THREAD_INSPECT_PORT 2
The inspect port for thread.

macroTHREAD_READ_PORT

#define THREAD_READ_PORT 3
The read port for thread.

macroTHREAD_MAX_SPECIAL_PORT

#define THREAD_MAX_SPECIAL_PORT THREAD_READ_PORT

macrothread_get_kernel_port

#define thread_get_kernel_port(thread, port) (thread_get_special_port((thread), THREAD_KERNEL_PORT, (port)))
GNU Mach reference · 7.1.7 Thread Special Ports · © FSF, GFDL
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.

macrothread_set_kernel_port

#define thread_set_kernel_port(thread, port) (thread_set_special_port((thread), THREAD_KERNEL_PORT, (port)))
GNU Mach reference · 7.1.7 Thread Special Ports · © FSF, GFDL
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.