thread_get_special_port.html   [plain text]


<h2>thread_get_special_port</h2>
<hr>
<p>
<strong>Function</strong> - Return a send right to the caller-specified special port.
<h3>SYNOPSIS</h3>
<pre>
<strong>kern_return_t   thread_get_special_port</strong>
                <strong>(thread_act_t</strong>                            <var>thread</var>,
                 <strong>int</strong>                                 <var>which_port</var>,
                 <strong>thread</strong>                            <var>special_port</var><strong>);</strong>
</pre>

<h4>Macro form:</h4>

<pre>
<strong>kern_return_t   thread_get_kernel_port</strong>
                <strong>(thread_act_t</strong>                            <var>thread</var>,
                 <strong>thread</strong>                            <var>special_port</var><strong>);</strong>
</pre>
<h3>PARAMETERS</h3>
<dl>
<p>
<dt> <var>thread</var> 
<dd>
[in thread send right]
The thread for which to return the port's send 
right.
<p>
<dt> <var>which_port</var> 
<dd>
[in scalar]
The special port for which the send right is requested.  Valid 
values are:
<dl>
<p>
<dt> <strong>THREAD_KERNEL_PORT</strong>
<dd>
[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 <strong>mach_thread_self</strong>.
</dl>
<p>
<dt> <var>special_port</var> 
<dd>
[out thread-special send right]
The returned value for the port.
</dl>
<h3>DESCRIPTION</h3>
<p>
The <strong>thread_get_special_port</strong> function returns a send
right for a special port
belonging to <var>thread</var>.
<p>
The thread kernel port is a port for which the kernel holds the
receive right.  The 
kernel uses this port to identify the thread.
<p>
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 <strong>mach_msg</strong>
function, however, any 
thread can pass a send right for its kernel port to another thread.
<h3>RETURN VALUES</h3>
<p>
Only generic errors apply.
<h3>RELATED INFORMATION</h3>
<p>
Functions:
<a href="mach_thread_self.html"><strong>mach_thread_self</strong></a>,
<a href="task_get_special_port.html"><strong>task_get_special_port</strong></a>,
<a href="task_set_special_port.html"><strong>task_set_special_port</strong></a>,
<a href="thread_create.html"><strong>thread_create</strong></a>,
<a href="thread_set_special_port.html"><strong>thread_set_special_port</strong></a>.