Back to Darwin Xnu

Mach Subsystem Create

osfmk/man/mach_subsystem_create.html

latest2.5 KB
Original Source

mach_subsystem_create


Function - Register information about an RPC subsystem.

SYNOPSIS

**kern\_return\_t mach\_subsystem\_create**** (task\_t **target\_task,** user\_subsystem\_t **user\_subsys,** mach\_msg\_type\_number\_t **user\_subsysCnt,** subsystem\_t **subsystem\_t** );**

PARAMETERS

target_taskThe task for which the subsystem is registered; normally the calling task, but not necessarily.

user_subsysThe MIG-generated data structure describing the exported routines and their input/output characteristics (e.g. arguments and return values).

user_subsysCntThe size of the user_subsys data structure argument, in bytes.

subsysThe port returned that names the registered subsystem.

DESCRIPTION

The mach_subsystem_create function is used by a server to register information about an RPC subsystem with the kernel. MIG automatically generates, in the server source file, a user_subsystem_t data structure that is appropriate for registering the subsystem. This data structure includes a per-routine array that specifies:

  • The address of the server function that performs the work.
  • The address of the MIG-generated server-side marshalling stub, to be used with mach_msg.
  • The argument signature (i.e. NDR-style argument format) of the routine.

Upon successful completion, mach_subsystem_create returns, via the subsys parameter, a port naming the registered subsystem.

Each port on which the server is to receive short-circuited RPC's (or a mach_rpc call) must be associated with a registered subsystem, by calling mach_port_allocate_subsystem.

RETURN VALUES

KERN_INVALD_ADDRESS One or more of the addresses in the range specified by the subsystem address and size are not valid addresses in the caller, or some of the internal pointers in the subsystem do not point to places within the address range (all of the data of the subsystem is required to be contiguous, even the parts that are pointed to by other parts).

KERN_INVALID_ARGUMENT The port name specified by target_task is not a send right naming a task, or the subsystem size is too small to be valid.

KERN_INVALID_TASK The target task is dead.

KERN_RESOURCE_SHORTAGE The kernel cannot allocate the subsystem due to insufficient available memory.

Functions: mach_port_allocate_subsystem, thread_activation_create.