## mach_port_get_refs

Function - Return the current count of user references on the target port right.

### SYNOPSIS

    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);

### PARAMETERS

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.

### DESCRIPTION

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.

### NOTES

This interface is machine word length specific because of the port name parameter.

### RETURN VALUES

KERN_INVALID_NAME
  name did not denote a right.

### RELATED INFORMATION

Functions: mach_port_mod_refs.