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