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