Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > M


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


mq_close — close a message queue descriptor


#include <sys/mqueue.h>

int mq_close(mqd_t mqdes);


The mq_close() system call removes the association between the message queue descriptor, mqdes, and a message queue. Use of this message queue descriptor by the process, after a successful return from this mq_close(), and until this descriptor is returned by a subsequent mq_open(), will result in the failure of message queue system calls, with errno set to EBADF.

If the process has a registered notification request with the message queue associated with this mqdes, the registration is canceled and the queue becomes available for another process to register a notification request.

If the message queue has been unlinked and mqdes is the only existing open descriptor for the queue, the queue is destroyed.

To use this function, link in the realtime library by specifying -lrt on the compiler or linker command line.


mq_close() returns the following values:


Successful completion.


Failure. errno is set to indicate the error.


If mq_close() fails, errno is set to one of the following values:


mqdes is not a valid message queue descriptor.


mq_close() is not supported by the implementation.


mq_close(): POSIX 1003.1b

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.