osfmk/man/mach_port_deallocate.html
Function - Decrement the target port right's user reference count.
**kern\_return\_t mach\_port\_deallocate**** (ipc\_space\_t **task,** mach\_port\_name\_t **name** );**
task[in task send right] The task holding the right.
name[in scalar] The task's name for the right.
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.
This interface is machine word length specific because of the port name parameter.
KERN_INVALID_RIGHT The name parameter denoted an invalid right.
Functions: mach_port_allocate, mach_port_allocate_name, mach_port_mod_refs.