Removes a message queue.
Standard C Library (libc.a)
#include <mqueue.h>
int mq_unlink (name)
const char *name;
The mq_unlink subroutine removes the message queue named by the pathname name. After a successful call to the mq_unlink subroutine with the name parameter, a call to the mq_open subroutine with the name parameter and the O_CREAT flag will create a new message queue. If one or more processes have the message queue open when the mq_unlink subroutine is called, destruction of the message queue is postponed until all references to the message queue have been closed.
After a successful completion of the mq_unlink subroutine, calls to the mq_open subroutine to recreate a message queue with the same name will succeed. The mq_unlink subroutine never blocks even if all references to the message queue have not been closed.
Item | Description |
---|---|
name | Specifies the message queue to be removed. |
Upon successful completion, the mq_unlink subroutine returns a zero. Otherwise, the named message queue is unchanged, and the mq_unlink subroutine returns a -1 and sets errno to indicate the error.
Item | Description |
---|---|
EACCES | Permission is denied to unlink the named message queue. |
EFAULT | Invalid used address. |
EINVAL | The name parameter value is not valid |
ENAMETOOLONG | The length of the name parameter exceeds PATH_MAX or a pathname component is longer than NAME_MAX. |
ENOENT | The named message queue does not exist. |
ENOTSUP | This function is not supported with processes that have been checkpoint-restart'ed. |