Next: , Previous: Receive Rights, Up: Port Manipulation Interface


4.3.7 Port Sets

— Function: kern_return_t mach_port_get_set_status (ipc_space_t task, mach_port_t name, mach_port_array_t *members, mach_msg_type_number_t *count)

The function mach_port_get_set_status returns the members of a port set. members is an array that is automatically allocated when the reply message is received. The user should vm_deallocate it when the data is no longer needed.

The function returns KERN_SUCCESS if the call succeeded, KERN_INVALID_TASK if task was invalid, KERN_INVALID_NAME if name did not denote a right, KERN_INVALID_RIGHT if name denoted a right, but not a receive right and KERN_RESOURCE_SHORTAGE if the kernel ran out of memory.

The mach_port_get_set_status call is actually an RPC to task, normally a send right for a task port, but potentially any send right. In addition to the normal diagnostic return codes from the call's server (normally the kernel), the call may return mach_msg return codes.

— Function: kern_return_t mach_port_move_member (ipc_space_t task, mach_port_t member, mach_port_t after)

The function mach_port_move_member moves the receive right member into the port set after. If the receive right is already a member of another port set, it is removed from that set first (the whole operation is atomic). If the port set is MACH_PORT_NULL, then the receive right is not put into a port set, but removed from its current port set.

The function returns KERN_SUCCESS if the call succeeded, KERN_INVALID_TASK if task was invalid, KERN_INVALID_NAME if member or after did not denote a right, KERN_INVALID_RIGHT if member denoted a right, but not a receive right or after denoted a right, but not a port set, and KERN_NOT_IN_SET if after was MACH_PORT_NULL, but member wasn't currently in a port set.

The mach_port_move_member call is actually an RPC to task, normally a send right for a task port, but potentially any send right. In addition to the normal diagnostic return codes from the call's server (normally the kernel), the call may return mach_msg return codes.