osfmk/man/mach_port_get_refs.html
Function - Return the current count of user references on the target port right.
**kern\_return\_t mach\_port\_get\_refs**** (ipc\_space\_t **task,** mach\_port\_name\_t **name,** mach\_port\_right\_t **right,** mach\_port\_urefs\_t **\*refs** );**
task[in task send right] The task holding the right.
name[in scalar] The task's name for the right.
right[in scalar] The type of right/entity being examined:
MACH_PORT_RIGHT_SEND
MACH_PORT_RIGHT_RECEIVE
MACH_PORT_RIGHT_SEND_ONCE
MACH_PORT_RIGHT_PORT_SET
MACH_PORT_RIGHT_DEAD_NAME
refs[out scalar] Number of user references.
The mach_port_get_refs function returns the number of user references a task has for a right.
If name denotes a right, but not the type of right specified, then zero is returned. Otherwise a positive number of user references is returned. Note a name may simultaneously denote send and receive rights. The number of references for send-once rights is always one.
This interface is machine word length specific because of the port name parameter.
KERN_INVALID_NAME name did not denote a right.
Functions: mach_port_mod_refs.