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