mq_open error


 
Thread Tools Search this Thread
Top Forums Programming mq_open error
# 1  
Old 10-08-2007
mq_open error

Hi,

Am creating a msgqueue using mq_open
</code>
main()
{
struct mq_attr attr; /* message queue attributes structure */
memset(&_attr,0,sizeof(struct mq_attr));
attr.mq_maxmsg= 10;
attr.mq_msgsize= 20;

msg.flag = HS_FWK_MSGQ_FLAGS;
mq_open("/h_qname",O_CREAT|O_RDWR|O_EXCL|O_NONBLOCK, 00666,&attr);

then sending message using
mq_send(....)
}


Again opening the message queue using the name to receive the message...but mq_open fails here...
main()
{
struct mq_attr attr; /* message queue attributes structure */
memset(&_attr,0,sizeof(struct mq_attr));
attr.mq_maxmsg= 10;
attr.mq_msgsize= 20;

msg.flag = HS_FWK_MSGQ_FLAGS;
mq_open("h_qname",O_CREAT|O_RDONLY, 00666,&attr);

}
<code>


I tried with O_RDWR flag too... but thatz also failing... i couldn't find out where exactly am going wrong... could somebody help me on this.

Thanks.
# 2  
Old 10-08-2007
What error are you getting? Did you try to capture that using errno/perror?
# 3  
Old 10-11-2007
Hi,

Thanks...

The problem is solved
i have put "/" before the message queue name even while reading from the queue.. and the oflag as O_RDONLY for reading...
now its working fine...

mq_open("/h_queue",O_RDONLY,......)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Rpcinfo: can't contact portmapper: RPC: Authentication error; why = Failed (unspecified error)

I have two servers with a fresh install of Solaris 11, and having problems when doing rpcinfo between them. There is no firewall involved, so everything should theoretically be getting through. Does anyone have any ideas? I did a lot of Google searches, and haven't found a working solution yet. ... (2 Replies)
Discussion started by: christr
2 Replies

2. Programming

POSIX message queue mq_open directory

hello, I try to test the POSIX mq_open function on book unp like below: #include "unpipc.h" # include <mqueue.h> int main(int argc, char **argv) { int c, flags; mqd_t mqd; flags = O_RDWR | O_CREAT; while ((c = getopt(argc, argv, "e")) != -1) { ... (3 Replies)
Discussion started by: anpufeng
3 Replies

3. UNIX for Dummies Questions & Answers

> 5 ")syntax error: operand expected (error token is " error

im kinda new to shell scripting so i need some help i try to run this script and get the error code > 5 ")syntax error: operand expected (error token is " the code for the script is #!/bin/sh # # script to see if the given value is correct # # Define errors ER_AF=86 # Var is... (4 Replies)
Discussion started by: metal005
4 Replies

4. Programming

creating a message queue using mq_open

Hi all, First of all thanks in advance for reading my post and for your heart for helping me. I am trying to create a message queue using mq_open(name,oflags,mode_t,attr) method. But that function call is returning with an error code EFAULT. By googling it I found that it happens when there is... (10 Replies)
Discussion started by: parusasi
10 Replies

5. AIX

nim mksysb error :/usr/bin/savevg[33]: 1016,07: syntax error

-------------------------------------------------------------------------------- Hello, help me please. I am trying to create a mksysb bakup using nim. I am geting this error, how to correct it ? : Command : failed stdout: yes stderr: no... (9 Replies)
Discussion started by: astjen
9 Replies

6. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

7. UNIX for Advanced & Expert Users

mq_open too many files

On True64 UNIX, in a process, how many message queues can be open and how to increase it if the value has been out of the system limits. In our program, we want to create 1000 message queues,the mq_open returns the error message "too many open files".thanks (3 Replies)
Discussion started by: Frank2004
3 Replies

8. UNIX for Dummies Questions & Answers

Error: Internal system error: Unable to initialize standard output file

Hey guys, need some help. Running AIX Version 5.2 and one of our cron jobs is writing errors to a log file. Any ideas on the following error message. Error: Internal system error: Unable to initialize standard output file I'm guessing more info might be needed, so let me know. Thanks (2 Replies)
Discussion started by: firkus
2 Replies

9. HP-UX

error mq_open message queue

Hello, J work on a HP. I want to create message queue by using mq_open with this parameters: mq_open(p,O_CREAT|O_WRONLY|O_EXCL|0_NONBLOCK,0600,&queue_attr) with p char and the function returns the value -1 and errno equal 2. can you help me ? Thank. (3 Replies)
Discussion started by: AUBERT
3 Replies

10. Programming

mq_open Hanging

One of my program which uses posix message queues was hanging in mq_open() system call, and after some time, it threw an error "Interrupted system call". I couldnt even unlink that message queue using mq_unlink(), as I have to use mq_open() prior to mq_unlink(). I use SunOS 5.7 Generic_106541-22... (0 Replies)
Discussion started by: Deepa
0 Replies
Login or Register to Ask a Question