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 an invalid memory address reference and in another forum it is said that it is because of "internal virtual memory error". Can anybody please help me to get out of this error. Any efforts will be very much appreciated. I am really stuck with that..
Once again thanking you all and waiting for a reply,
regards,
paru.
hi Smith,
Thanks for your time.
I checked in the man page. In my man page also EFAULT is not listed. I am not understanding then why it is returning such an error code. Please do help me to clear it out. Thanks again.
Hi Smith,
I am calling the method like this. mq_attr is null and thread name is also valid.
mq_open( "/iothreadNewTest", oflags,(S_IRUSR | S_IWUSR),NULL)
Is there any other reasons why it is coming?
Thanks,
Paru
According to my documentation of mq_open (from the man page), the flags are O_RDONLY, O_WRONLY, and
O_RDWR, but you are using S_IRUSR | S_IWUSR. S_IRUSR | S_IWUSR does not have the same value as
O_RDWR on my linux system, so I'm guessing that's your problem. Try changing your flags to O_RDWR.
sorry for not being specific. Since that message queue was not created , i tried O_CREAT first. But then also i got the same error. Then as an experimental thing, i tried with each of these.
Can you run your program with strace to see what system calls are being executed and with what parameters? (assuming strace is available on your platform)