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