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