## mach_port_deallocate

Function - Decrement the target port right's user reference count.

### SYNOPSIS

    kern_return_t   mach_port_deallocate
                    (ipc_space_t                               task,
                     mach_port_name_t                          name);

### PARAMETERS

task
  [in task send right] The task holding the right.

name
  [in scalar] The task's name for the right.

### DESCRIPTION

The mach_port_deallocate function releases a user reference for a right. It is an alternate form of mach_port_mod_refs that allows a task to release a user reference for a send or send-once right without failing if the port has died and the right is now actually a dead name.

If name denotes a dead name, send right, or send-once right, then the right loses one user reference. If it only had one user reference, then the right is destroyed. If name does not denote an element in the port name space, the function returns success.

### NOTES

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

### RETURN VALUES

KERN_INVALID_RIGHT
  The name parameter denoted an invalid right.

### RELATED INFORMATION

Functions: mach_port_allocate, mach_port_allocate_name, mach_port_mod_refs.