mq_close Subroutine

Purpose

Closes a message queue.

Library

Standard C Library (libc.a)

Syntax

#include <mqueue.h>

int mq_close (mqdes)
mqd_t mqdes;

Description

The mq_close subroutine removes the association between the message queue descriptor, mqdes, and its message queue. The results of using this message queue descriptor after successful return from the mq_close subroutine, and until the return of this message queue descriptor from a subsequent mq_open call, are undefined.

If the process has successfully attached a notification request to the message queue through the mqdes parameter, this attachment is removed, and the message queue is available for another process to attach for notification.

Parameters

Item Description
mqdes Specifies the message queue descriptor.

Return Values

Upon successful completion, the mq_close subroutine returns a zero. Otherwise, the subroutine returns a -1 and sets errno to indicate the error.

Error Codes

The mq_close subroutine fails if:
Item Description
EBADF The mqdes parameter is not a valid message queue descriptor.
ENOMEM Insufficient memory for the required operation.
ENOTSUP This function is not supported with processes that have been checkpoint-restart'ed.