Operating System - HP-UX
1753894 Members
7221 Online
108809 Solutions
New Discussion юеВ

create message queue on HP with mq_open

 
AUBERT
Occasional Contributor

create message queue on HP with mq_open

Hello,
I want to create message queue by using mq_open with this parameters:
mq_open(p,O_CREAT|O_WRONLY|O_EXCL|0_NONBLOC,0600,&queue_attr)
with p char [][]
and the function returns the value 2.
can you help me ?
Thanks.
3 REPLIES 3
Bruno Ganino
Honored Contributor

Re: create message queue on HP with mq_open

I don't sure, but try write
mq_open(p,O_CREAT|O_WRONLY|O_EXCL|O_NONBLOCK,0600,&queue_attr)

(your 0_NONBLOC is incorrect, right O_NONBLOCK).

Bruno

Torino (Turin) +2H
AUBERT
Occasional Contributor

Re: create message queue on HP with mq_open

Thank for your answer.
when I wrote this message I made an error , in fact in my code I have O_NONBLOCK.
Sorry.
Mike Stroyan
Honored Contributor

Re: create message queue on HP with mq_open

If the function actually returns a value of 2, then it succeeded and 2 is the message queue descriptor.
If the function returns -1 and sets errno to 2, then that is ENOENT. That shouldn't happen with the O_CREAT flag. I would suspect that the O_CREAT flag was not seen. Perhaps you are compiling with 64-bit pointers and did not #include so the first parameter was passed as a 32-bit int.