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