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