delete a message queue
#include <mqueue.h>
int mq_unlink( const char *name );
This call removes the queue name:
- If some process has the queue open when the call to
mq_unlink() is made, then the actual deletion
of the queue is postponed until it has been closed.
- If a queue exists in the netherworld between unlinking and the actual
removal of the queue, then all calls to open it fail, even if
O_CREAT is present in oflag.
- Once the queue is deleted, all elements currently on it are freed. Due
to the lazy deletion of queues, it is impossible for any process to be
blocked on the message queue when it is deleted.
Calling unlink() with a name that resolves to the message queue
server's namespace (for example, /dev/mqueue/my_queue) is
analogous to calling mq_unlink() with name set to the
last element of the pathname (for example, my_queue).
- 0
- Success
- -1
- An error occurred. errno is set to indicate the error.
- EACCES
- You don't have permission to unlink the specified queue.
- EINVAL
- The name parameter is NULL.
- ENAMETOOLONG
- The length of name exceeds PATH_MAX.
- ENOENT
- The queue name doesn't exist.
POSIX 1003.4
Safety: | |
Interrupt handler |
No |
Signal handler |
Yes, but modifies errno |
Thread |
No |
In order to use the mq_... functions, you must:
- Link your application with the mqueue library
(specify -lmqueue in your cc command).
- Start the message queue server, Mqueue.
For more information, see the QNX Utilities Reference.
errno,
mq_close(),
mq_getattr(),
mq_notify(),
mq_open(),
mq_receive(),
mq_send(),
mq_setattr()
chapter on POSIX.4 message queues