Function - Modify the specified port right's count of user references.
kern_return_t mach_port_mod_refs (ipc_space_t task, mach_port_name_t name, mach_port_right_t right, mach_port_delta_t delta);
The mach_port_mod_refs function requests that the number of user references a task has for a right be changed. This results in the right being destroyed, if the number of user references is changed to zero.
The name parameter should denote the specified right. The number of user references for the right is changed by the amount delta, subject to the following restrictions: port sets, receive rights, and send-once rights may only have one user reference. The resulting number of user references can't be negative. If the resulting number of user references is zero, the effect is to de-allocate the right. For dead names and send rights, there is an implementation-defined maximum number of user references.
If the call destroys the right, then the effect is as described for mach_port_destroy, with the exception that mach_port_destroy simultaneously destroys all the rights denoted by a name, while mach_port_mod_refs can only destroy one right. The name will be available for reuse if it only denoted the one right.
This interface is machine word length specific because of the port name parameter.
Functions: mach_port_destroy, mach_port_get_refs.