LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-26-2005, 10:59 AM   #16
jfitzger68
LQ Newbie
 
Registered: Jul 2005
Location: San Rafael, CA, USA
Distribution: Cygwin, FedoraCore 4
Posts: 18

Rep: Reputation: 0

Okay, here it is. These are the declarations:

typedef struct {
long type;
cmd_types command;
state_types state;
char description[80];
} SmartHubMessage_T;

#define PROJECTOR_INBOX_SIZE 16
#define PROJECTOR_INBOX_FLAGS 0
const char PROJECTOR_INBOX_NAME[] = "/home/josh/hack/projQ";
struct mq_attr projInboxAttr;
mqd_t projectorInboxId;

And here's the code:

projInboxAttr.mq_maxmsg = PROJECTOR_INBOX_SIZE;
projInboxAttr.mq_msgsize = sizeof(SmartHubMessage_T);
projInboxAttr.mq_flags = PROJECTOR_INBOX_FLAGS;
projectorInboxId = mq_open(PROJECTOR_INBOX_NAME, O_CREAT|O_RDWR|O_EXCL, S_IRWXU, &projInboxAttr);
if (projectorInboxId == (mqd_t)-1) {
perror("\nSmartHub");
exit(-1);
}

Thanks!
 
Old 07-26-2005, 12:09 PM   #17
rstewart
Member
 
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Rep: Reputation: 38
Well, I've done some testing using my FC3 based system and I have to tell you - I am still not impressed with POSIX message queues...

After looking at the behavior of a test program based upon your code snippets, along with the man pages, I think that when the man pages claim "implementation-defined" they mean "bug". What I eventually got to work was to use a message queue name of "/msgQ" (without any other path information). Also, I had to run the executable test program as root, running as a lowly user just error-ed out even if I granted all read/write/search permissions to the root "/" directory.

I hope that this helps you, it may not be the best solution but it looks like it should work for you as a workaround unless some other brave and knowing person can offer more insights.
 
Old 07-26-2005, 12:26 PM   #18
jfitzger68
LQ Newbie
 
Registered: Jul 2005
Location: San Rafael, CA, USA
Distribution: Cygwin, FedoraCore 4
Posts: 18

Rep: Reputation: 0
Thanks so much for looking at this.

In the end this application will run under the eCos Real-Time OS, and I can only hope that the implementation there will be more straightforward. I had hoped to develop the app under Linux to control for the complexities of the OS and focus more on the base application logic, bus alas it seems this is not to be.

Anyhow, I'll try your solution. Thanks so much once again.
 
Old 07-26-2005, 12:38 PM   #19
jfitzger68
LQ Newbie
 
Registered: Jul 2005
Location: San Rafael, CA, USA
Distribution: Cygwin, FedoraCore 4
Posts: 18

Rep: Reputation: 0
Your solution worked! UNIX is a strange world sometimes.
 
Old 07-26-2005, 12:46 PM   #20
rstewart
Member
 
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Rep: Reputation: 38
Congratulations!

Good luck on the RTOS implementation. IMHO real-time embedded work is much more fun than "conventional" programming. Real-time; nice compact ,tight, and efficient organized chaos.
 
Old 07-26-2005, 04:59 PM   #21
jfitzger68
LQ Newbie
 
Registered: Jul 2005
Location: San Rafael, CA, USA
Distribution: Cygwin, FedoraCore 4
Posts: 18

Rep: Reputation: 0
I agree. I am a huge fan of efficient, compact chaos.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
POSIX message queues(Solaris) to SYS V message queues(Linux) devershetty Programming 1 01-22-2007 10:15 AM
message queues - please some checkup from the pros kirmet Programming 4 09-20-2005 08:40 AM
Message Queues rag_mg Programming 1 05-08-2005 08:00 AM
POSIX message queues... infamous41md Programming 6 05-25-2004 02:53 PM
Message Queues BoldKiller Programming 1 05-28-2003 05:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration