xref: /xnu-11417.121.6/osfmk/man/thread_activation_create.html (revision a1e26a70f38d1d7daa7b49b258e2f8538ad81650)
1*a1e26a70SApple OSS Distributions<h2>thread_activation_create</h2>
2*a1e26a70SApple OSS Distributions<hr>
3*a1e26a70SApple OSS Distributions<p>
4*a1e26a70SApple OSS Distributions<strong>Function</strong> - Create a thread activation.
5*a1e26a70SApple OSS Distributions<h3>SYNOPSIS</h3>
6*a1e26a70SApple OSS Distributions<pre>
7*a1e26a70SApple OSS Distributions<strong>kern_return_t   thread_activation_create</strong>
8*a1e26a70SApple OSS Distributions                <strong>(task_t</strong>                                    <var>task</var>,
9*a1e26a70SApple OSS Distributions                 <strong>mach_port_name_t</strong>                      <var>RPC_port</var>,
10*a1e26a70SApple OSS Distributions                 <strong>vm_offset_t</strong>                         <var>user_stack</var>,
11*a1e26a70SApple OSS Distributions                 <strong>vm_size_t</strong>                           <var>stack_size</var>,
12*a1e26a70SApple OSS Distributions                 <strong>thread_act_t</strong>                      <var>thread_act_t</var><strong>);</strong>
13*a1e26a70SApple OSS Distributions</pre>
14*a1e26a70SApple OSS Distributions<h3>PARAMETERS</h3>
15*a1e26a70SApple OSS Distributions<dl>
16*a1e26a70SApple OSS Distributions<p>
17*a1e26a70SApple OSS Distributions<dt> <var>task</var>
18*a1e26a70SApple OSS Distributions<dd>
19*a1e26a70SApple OSS Distributions[in task send right] The port for the task that is to contain the new
20*a1e26a70SApple OSS Distributionsthread activation.
21*a1e26a70SApple OSS Distributions<p>
22*a1e26a70SApple OSS Distributions<dt> <var>RPC_port</var>
23*a1e26a70SApple OSS Distributions<dd>
24*a1e26a70SApple OSS Distributions[in receive right] A receive right held by the task, or a port set in the
25*a1e26a70SApple OSS Distributionstask.
26*a1e26a70SApple OSS Distributions<p>
27*a1e26a70SApple OSS Distributions<dt> <var>user_stack</var>
28*a1e26a70SApple OSS Distributions<dd>
29*a1e26a70SApple OSS Distributions[in scalar] The virtual address in the task to be used as the starting ad-
30*a1e26a70SApple OSS Distributionsdress of the user-level stack.
31*a1e26a70SApple OSS Distributions<p>
32*a1e26a70SApple OSS Distributions<dt> <var>new_act</var>
33*a1e26a70SApple OSS Distributions<dd>
34*a1e26a70SApple OSS Distributions[out thread send right] The kernel-assigned name for the new thread ac-
35*a1e26a70SApple OSS Distributionstivation.
36*a1e26a70SApple OSS Distributions</dl>
37*a1e26a70SApple OSS Distributions<h3>DESCRIPTION</h3>
38*a1e26a70SApple OSS Distributions<p>
39*a1e26a70SApple OSS DistributionsThe thread_activation_create function creates a thread activation, or
40*a1e26a70SApple OSS Distributions"empty thread", into which a client thread shuttle can migrate during
41*a1e26a70SApple OSS DistributionsRPC.  The RPC_port must name ei- ther a receive right held by the
42*a1e26a70SApple OSS Distributionstask, or a port set in the task.  The new thread activation will be
43*a1e26a70SApple OSS Distributionsadded to a pool of activations attached to this port (or port set).
44*a1e26a70SApple OSS DistributionsIncoming RPC's targeted at the port (or one of the ports in the set)
45*a1e26a70SApple OSS Distributionscan use any of the activations in the pool.  That is, the client
46*a1e26a70SApple OSS Distributionsthread shuttle will migrate into the specified server task, take one
47*a1e26a70SApple OSS Distributionsof the thread activations out of the pool, and join up with it for the
48*a1e26a70SApple OSS Distributionsduration of the RPC.  The shuttle will migrate back to the original
49*a1e26a70SApple OSS Distributionsclient activation at the end of the RPC.  If no thread activations are
50*a1e26a70SApple OSS Distributionsin the pool, RPC will be blocked until one is created in the pool, or
51*a1e26a70SApple OSS Distributionsan existing one finishes its RPC and returns to the pool.
52*a1e26a70SApple OSS DistributionsThe new thread activation will begin each RPC using the stack pointer
53*a1e26a70SApple OSS Distributionsspecified by user_stack.  The kernel neither knows nor cares how big
54*a1e26a70SApple OSS Distributionsthe specified stack is.
55*a1e26a70SApple OSS DistributionsWhen a short-circuited RPC (or mach_rpc) is invoked on a port created
56*a1e26a70SApple OSS Distributionswith mach_port_allocate_subsystem, the RPC will begin execution in the
57*a1e26a70SApple OSS Distributionssubsystem server at the work function address specified by the port
58*a1e26a70SApple OSS Distributionsand routine number and looked up in the associated subsystem data.
59*a1e26a70SApple OSS Distributions<h3>NOTES</h3>
60*a1e26a70SApple OSS Distributions<p>
61*a1e26a70SApple OSS DistributionsThe following calls targeted at a thread_act port may _not_ be called
62*a1e26a70SApple OSS Distributionson an empty thread_act (and will return KERN_INVALID_ARGUMENT if
63*a1e26a70SApple OSS Distributionsthey are called with one):
64*a1e26a70SApple OSS Distributionsthread_abort
65*a1e26a70SApple OSS Distributionsthread_abort_safely
66*a1e26a70SApple OSS Distributionsthread_depress_abort
67*a1e26a70SApple OSS Distributionsthread_info
68*a1e26a70SApple OSS Distributionsthread_wire
69*a1e26a70SApple OSS DistributionsIn addition, if thread_switch is called with an empty thread_act as
70*a1e26a70SApple OSS Distributionsits first argument, the argument will be ignored (i.e., the function
71*a1e26a70SApple OSS Distributionswill behave as if a zero-valued argument had been given).
72*a1e26a70SApple OSS Distributions<h3>RETURN VALUES</h3>
73*a1e26a70SApple OSS Distributions<p>
74*a1e26a70SApple OSS DistributionsOnly generic errors apply.
75*a1e26a70SApple OSS Distributions<h3>RELATED INFORMATION</h3>
76*a1e26a70SApple OSS Distributions<p>
77*a1e26a70SApple OSS DistributionsFunctions:
78*a1e26a70SApple OSS Distributions<a href="task_create.html"><strong>task_create</strong></a>,
79*a1e26a70SApple OSS Distributions<a href="MP_allocate_subsystem.html"><strong>mach_port_allocate_subsystem</strong></a>,
80