xref: /xnu-10002.61.3/osfmk/man/mach_subsystem_create.html (revision 0f4c859e951fba394238ab619495c4e1d54d0f34)
1*0f4c859eSApple OSS Distributions<h2>mach_subsystem_create</h2>
2*0f4c859eSApple OSS Distributions<hr>
3*0f4c859eSApple OSS Distributions<p>
4*0f4c859eSApple OSS Distributions<strong>Function</strong> - Register information about an RPC subsystem.
5*0f4c859eSApple OSS Distributions<h3>SYNOPSIS</h3>
6*0f4c859eSApple OSS Distributions<pre>
7*0f4c859eSApple OSS Distributions<strong>kern_return_t   mach_subsystem_create</strong>
8*0f4c859eSApple OSS Distributions                <strong>(task_t</strong>                             <var>target_task</var>,
9*0f4c859eSApple OSS Distributions                 <strong>user_subsystem_t</strong>                   <var>user_subsys</var>,
10*0f4c859eSApple OSS Distributions                 <strong>mach_msg_type_number_t</strong>          <var>user_subsysCnt</var>,
11*0f4c859eSApple OSS Distributions                 <strong>subsystem_t</strong>                        <var>subsystem_t</var><strong>);</strong>
12*0f4c859eSApple OSS Distributions</pre>
13*0f4c859eSApple OSS Distributions<h3>PARAMETERS</h3>
14*0f4c859eSApple OSS Distributions<dl>
15*0f4c859eSApple OSS Distributions<p>
16*0f4c859eSApple OSS Distributions<dt> <var>target_task</var>
17*0f4c859eSApple OSS Distributions<dd>
18*0f4c859eSApple OSS DistributionsThe task for which the subsystem is registered; normally the calling
19*0f4c859eSApple OSS Distributionstask, but not necessarily.
20*0f4c859eSApple OSS Distributions<p>
21*0f4c859eSApple OSS Distributions<dt> <var>user_subsys</var>
22*0f4c859eSApple OSS Distributions<dd>
23*0f4c859eSApple OSS DistributionsThe MIG-generated data structure describing the exported routines and
24*0f4c859eSApple OSS Distributionstheir input/output characteristics (e.g. arguments and return values).
25*0f4c859eSApple OSS Distributions<p>
26*0f4c859eSApple OSS Distributions<dt> <var>user_subsysCnt</var>
27*0f4c859eSApple OSS Distributions<dd>
28*0f4c859eSApple OSS DistributionsThe size of the user_subsys data structure argument, in bytes.
29*0f4c859eSApple OSS Distributions<p>
30*0f4c859eSApple OSS Distributions<dt> <var>subsys</var>
31*0f4c859eSApple OSS Distributions<dd>
32*0f4c859eSApple OSS DistributionsThe port returned that names the registered subsystem.
33*0f4c859eSApple OSS Distributions</dl>
34*0f4c859eSApple OSS Distributions<h3>DESCRIPTION</h3>
35*0f4c859eSApple OSS Distributions<p>
36*0f4c859eSApple OSS DistributionsThe <strong>mach_subsystem_create</strong> function is used by a server to register
37*0f4c859eSApple OSS Distributionsinformation about an RPC subsystem with the kernel.
38*0f4c859eSApple OSS DistributionsMIG automatically generates, in the server source file, a
39*0f4c859eSApple OSS Distributions<strong>user_subsystem_t</strong> data structure that is appropriate for registering
40*0f4c859eSApple OSS Distributionsthe subsystem. This data structure includes a per-routine array that
41*0f4c859eSApple OSS Distributionsspecifies:
42*0f4c859eSApple OSS Distributions<ul>
43*0f4c859eSApple OSS Distributions<li>
44*0f4c859eSApple OSS DistributionsThe address of the server function that performs the work.
45*0f4c859eSApple OSS Distributions<li>
46*0f4c859eSApple OSS DistributionsThe address of the MIG-generated server-side marshalling stub, to be
47*0f4c859eSApple OSS Distributionsused with <strong>mach_msg</strong>.
48*0f4c859eSApple OSS Distributions<li>
49*0f4c859eSApple OSS DistributionsThe argument signature (i.e. NDR-style argument format) of the
50*0f4c859eSApple OSS Distributionsroutine.
51*0f4c859eSApple OSS Distributions</ul>
52*0f4c859eSApple OSS Distributions<p>
53*0f4c859eSApple OSS DistributionsUpon successful completion, <strong>mach_subsystem_create</strong> returns,
54*0f4c859eSApple OSS Distributionsvia the <var>subsys</var> parameter, a port naming the registered subsystem.
55*0f4c859eSApple OSS Distributions<p>
56*0f4c859eSApple OSS DistributionsEach port on which the server is to receive short-circuited RPC's (or
57*0f4c859eSApple OSS Distributionsa <strong>mach_rpc</strong> call) must be associated with a registered subsystem, by
58*0f4c859eSApple OSS Distributionscalling <strong>mach_port_allocate_subsystem</strong>.
59*0f4c859eSApple OSS Distributions<h3>RETURN VALUES</h3>
60*0f4c859eSApple OSS Distributions<dl>
61*0f4c859eSApple OSS Distributions<p>
62*0f4c859eSApple OSS Distributions<dt> <strong>KERN_INVALD_ADDRESS</strong>
63*0f4c859eSApple OSS Distributions<dd>
64*0f4c859eSApple OSS DistributionsOne or more of the addresses in the range specified by the subsystem
65*0f4c859eSApple OSS Distributionsaddress and size are not valid addresses in the caller, or some of the
66*0f4c859eSApple OSS Distributionsinternal pointers in the subsystem do not point to places within the
67*0f4c859eSApple OSS Distributionsaddress range (all of the data of the subsystem is required to be
68*0f4c859eSApple OSS Distributionscontiguous, even the parts that are pointed to by other parts).
69*0f4c859eSApple OSS Distributions<p>
70*0f4c859eSApple OSS Distributions<dt> <strong>KERN_INVALID_ARGUMENT</strong>
71*0f4c859eSApple OSS Distributions<dd>
72*0f4c859eSApple OSS DistributionsThe port name specified by <var>target_task</var> is not a send right naming a task,
73*0f4c859eSApple OSS Distributionsor the subsystem size is too small to be valid.
74*0f4c859eSApple OSS Distributions<p>
75*0f4c859eSApple OSS Distributions<dt> <strong>KERN_INVALID_TASK</strong>
76*0f4c859eSApple OSS Distributions<dd>
77*0f4c859eSApple OSS DistributionsThe target task is dead.
78*0f4c859eSApple OSS Distributions<p>
79*0f4c859eSApple OSS Distributions<dt> <strong>KERN_RESOURCE_SHORTAGE</strong>
80*0f4c859eSApple OSS Distributions<dd>
81*0f4c859eSApple OSS DistributionsThe kernel cannot allocate the subsystem due to insufficient available
82*0f4c859eSApple OSS Distributionsmemory.
83*0f4c859eSApple OSS Distributions</dl>
84*0f4c859eSApple OSS Distributions<h3>RELATED INFORMATION</h3>
85*0f4c859eSApple OSS Distributions<p>
86*0f4c859eSApple OSS DistributionsFunctions:
87*0f4c859eSApple OSS Distributions<a href="MP_allocate_subsystem.html"><strong>mach_port_allocate_subsystem</strong></a>,
88*0f4c859eSApple OSS Distributions<a href="thread_activation_create.html"><strong>thread_activation_create</strong></a>.
89