POSIX message queue changes from 20020301?
Jay Monkman
jtm at smoothsmoothie.com
Thu Dec 5 23:14:26 UTC 2002
I'm trying to update my application from the 20020301 snapshot to the
latest one, and some code that uses POSIX message queues now fails.
I create and open a message queue for read/write. Then I open it again
(as in another thread) write-only. When I write to the second instance of
it, I get an error - "Bad file number".
Here's a test case the causes the problem:
void qtest(void)
{
struct mq_attr attr;
mqd_t mqfd_rw;
mqd_t mqfd_wo;
int errno;
char buf[] = "this is a test buffer";
attr.mq_msgsize = 400;
attr.mq_maxmsg = 50;
mqfd_rw = mq_open("msgq", (O_CREAT|O_RDWR), (S_IRUSR|S_IWUSR), &attr);
mqfd_wo = mq_open("msgq", O_WRONLY);
if (mq_send(mqfd_wo, buf, strlen(buf), 10) == -1) {
printf("mq_send returned an error: %d (%s)\n", errno, strerror(errno));
sleep(15);
rtemsReboot();
}
}
Am I doing something I'm not supposed to be doing? Thanks for any help.
--
Jay Monkman The truth knocks on the door and you say "Go away, I'm
looking for the truth," and so it goes away. Puzzling.
- from _Zen_and_the_Art_of_Motorcycle_Maintenance_
More information about the users
mailing list