thread_get_special_port


Function - Return a send right to the caller-specified special port.

SYNOPSIS

kern_return_t   thread_get_special_port
                (thread_act_t                            thread,
                 int                                 which_port,
                 thread                            special_port);

Macro form:

kern_return_t   thread_get_kernel_port
                (thread_act_t                            thread,
                 thread                            special_port);

PARAMETERS

thread
[in thread send right] The thread 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:

THREAD_KERNEL_PORT
[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.

special_port
[out thread-special send right] The returned value for the port.

DESCRIPTION

The thread_get_special_port function returns a send right for a special port belonging to thread.

The thread kernel port is a port for which the kernel holds the receive right. The kernel uses this port to identify the thread.

If one thread has a send right for the kernel port of another thread, it can use the port to perform kernel operations for the other thread. Send rights for a kernel port normally are held only by the thread to which the port belongs, or by the task that contains the thread. Using the mach_msg function, however, any thread can pass a send right for its kernel port to another thread.

RETURN VALUES

Only generic errors apply.

RELATED INFORMATION

Functions: mach_thread_self, task_get_special_port, task_set_special_port, thread_create, thread_set_special_port.