POSIX message queue changes from 20020301?

Jay Monkman jtm at smoothsmoothie.com
Fri Dec 6 20:12:33 UTC 2002


Jay Monkman wrote:
> 
> 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".

I've looked at this some more, and I think I know what's going on, but
I'm not sure.

When mq_open() is called the first time for a queue and O_CREAR is set,
it creates the queue, and eventually calls _Objects_Open(). On
subsequent calls to mq_open() for the same queue, _Objects_Open() is
never called. When I later call mq_send on the 2nd queue descriptor,
it can't find a reference to the object since _Objects_Open() was
never called. 

I'm guessing that _Objects_Open() should be called for the 2nd descriptor.

Is that right? 

-- 
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