osfmk/man/mach_port_extract_right.html
Function - Remove the specified right from the target task and return it to the caller.
**kern\_return\_t mach\_port\_extract\_right**** (ipc\_space\_t **task,** mach\_port\_name\_t **name,** mach\_msg\_type\_name\_t **desired\_type,** mach\_port\_poly\_t **\*right,** mach\_msg\_type\_name\_ **\*acquired\_type** );**
task[in task send right] The task holding the port right.
name[in scalar] The task's name for the port right.
desired_type[in scalar] IPC type, specifying how the right should be extracted.
right[out random right] The extracted right.
acquired_type[out scalar] The type of the extracted right.
The mach_port_extract_right function extracts a port right from the target task and returns it to the caller as if the task sent the right voluntarily, using desired_type as the disposition for the right. See mach_msg.
The returned value of acquired_type will be MACH_MSG_TYPE_PORT_SEND if a send right is extracted, MACH_MSG_TYPE_PORT_RECEIVE if a receive right is extracted, and MACH_MSG_TYPE_PORT_SEND_ONCE if a send-once right is extracted.
This interface is machine word length specific because of the port name parameter.
KERN_INVALID_NAME name did not denote a right.
KERN_INVALID_RIGHT name denoted an invalid right.
Functions: mach_port_insert_right, mach_msg.