MsgQueueOpen()

QNX SDP8.0C Library ReferenceAPIDeveloper

Associate a client with a kernel message queue

Synopsis:

#include <sys/neutrino.h>

int MsgQueueOpen( rcvid_t rcvid,
                  int queueid,
                  uint32_t msgsize,
                  uint32_t maxmsg,
                  unsigned oflag );

Arguments:

rcvid
The receive ID associated with an open request that a message queue manager has received.
queueid
The identifier of the message queue. Specify a non-negative integer to open an existing queue or -1 to create a new queue.
msgsize
The maximum size of messages that can be sent or received on the message queue.
maxmsg
The maximum number of messages that the message queue can hold.
oflag
Flags specifying the behavior of the open operation:
  • _IO_FLAG_RD—open the connection for reading.
  • _IO_FLAG_WR—open the connection for writing.
  • O_NONBLOCK —specify non-blocking queue access.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The MsgQueueOpen() function is used by message queue managers to connect a client to a message queue in response to an mq_open() call. It performs the necessary steps for locating the queue (and creates it if necessary), creates a new connection between the client (identified by rcvid) of the caller and the queue object, and stores the relevant flags for subsequent operations.

To create a new queue (i.e., queueid is -1), a process must have the msg_queue ability. For more information, go to Abilities Reference in the QNX OS System Security Guide.

Returns:

≥0
If the queueid argument was -1, the ID of the newly created message queue. Otherwise, 0 to indicate that the queue specified by queueid was successfully opened.
-1
An error occurred (errno is set).

Errors:

EBUSY
The client connection identified by rcvid is already associated with a queue.
EINVAL
An argument was invalid.
ENOSPC
There's insufficient memory for a new queue.
EPERM
The process tried to create a new queue without having the required permission; go to go to Abilities Reference in the QNX OS System Security Guide.
ESRCH
One of the following is true:
  • The queue specified by queueid doesn't exist.
  • The rcvid value does not identify an existing client for the message queue.

Classification:

QNX OS

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: