mq_open returns "Function not implemented"

Hi,

I have the following problem:

When I want to open a Message Queue via mq_open,
I receive an ERROR with

ENOSYS:
The mq_open() function isn’t implemented for the filesystem specified
in name.

I’m using QNX Neutrino 6.3 as OS as platform, and compile with
QNX Momentics 2.2.0.

Has anyone an idea why I’m receiving this error?

Thanx!!

Here the code:
/*
|| Program to test mq_open(3).
|| mq_open [-p ] [-b ] [-m ]
[-c] [-x]
|| -p access mode to use when creating, default
0600
|| -b maximum message size to set, default
MQ_DEF_MSGSIZE
|| -m maximum messages on the queue, default
MQ_DEF_MAXMSG
|| -f flags to use with mq_open, including:
|| c use O_CREAT
|| x use O_EXCL
|| the pathname of the queue, required
|| Numeric arguments can be given in any form supported by
strtoul(3).
/
#include <mqueue.h> /
message queue stuff /
#define MQ_DEF_MSGSIZE 1024
#define MQ_DEF_MAXMSG 16
#include <unistd.h> /
for getopt() /
#include <errno.h> /
errno and perror */ls

#include <fcntl.h> /* O_flags */
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv)
{
int perms = 0600; /
permissions /
int oflags = O_RDWR; /
flags: O_CREAT + O_EXCL /
int rd=0, wr=0; /
-r and -w options /
mqd_t mqd; /
returned msg queue descriptor */
int c;
char path; / ->first non-option argument /
struct mq_attr buf; /
buffer for stat info /
buf.mq_msgsize = MQ_DEF_MSGSIZE;
buf.mq_maxmsg = MQ_DEF_MAXMSG;
while ( -1 != (c = getopt(argc,argv,“p:b:m:cx”)) )
{
switch (c)
{
case ‘p’: /
permissions /
perms = (int) strtoul(optarg, NULL, 0);
break;
case ‘b’: /
message size /
buf.mq_msgsize = (int) strtoul(optarg, NULL, 0);
break;
case ‘m’: /
max messages /
buf.mq_maxmsg = (int) strtoul(optarg, NULL, 0);
break;
case ‘c’: /
use O_CREAT /
oflags |= O_CREAT;
break;
case ‘x’: /
use O_EXCL /
oflags |= O_EXCL;
break;
default: /
unknown or missing argument /
return -1;
} /
switch /
} /
while /
if (optind < argc)
path = argv[optind]; /
first non-option argument */
else
{ printf(“Queue pathname required\n”); return -1; }
mqd = mq_open(path,oflags,perms,&buf);
if (-1 != mqd)
{
if ( ! mq_getattr(mqd,&buf) )
{
printf(“flags: 0x%x maxmsg: %d msgsize: %d curmsgs:
%d\n”,
buf.mq_flags, buf.mq_maxmsg, buf.mq_msgsize,
buf.mq_curmsgs);
}
else
perror(“mq_getattr()”);
}
else
perror(“mq_open()”);
}

MOSTMAN wrote:

When I want to open a Message Queue via mq_open,
I receive an ERROR with
ENOSYS:

Is the mqueue server running? Try “pidin -Pmqueue”;
if not then start it with “/sbin/mqueue &” …

Hi!

The problem was mqueue was stopped after 5 minutes. So I restarted it
and now it works,
thanx, Mostman