osfmk/man/MP_allocate_subsystem.html
Function - Create a port right associated with the caller-specified subsystem.
**kern\_return\_t mach\_port\_allocate\_subsystem**** (ipc\_space\_t **task,** subsystem\_t **subsys,** mach\_port\_name\_t **mach\_port\_name\_t** );**
task[in task send right] The task acquiring the port right.
subsys[in scalar] The port right naming the subsystem the newly created port is to be associated with.
name[out scalar] The task's name for the port right. This can be any name that wasn't in use.
The mach_port_allocate_subsystem function creates a new right and associates it with the specifed subsystem (specified via the subsys parameter) previously registered via a call to the mach_subsystem_create interface. The new right's name is returned in the name parameter. The association of this port with the subsystem is immutable for the life of the port.
Any RPC targeted at the new port will cause the kernel glue-code to locate the server function address and argument signature in the associated subsystem.
This interface is machine word length specific because of the port name parameter.
KERN_SUCCESS The right is allocated.
KERN_INVALID_TASK The space is null.
KERN_INVALID_TASK The space is dead.
KERN_RESOURCE_SHORTAGE Couldn't allocate memory.
KERN_NO_SPACE No room in space for another right.
Functions: mach_subsystem_create, thread_activation_create.