Sending a message to yourself.

Hello all,

I have a resource manager that accepts POSIX write() msgs. When I get some data from this message I would like the resource manager to reply to the original sender and then process the data that was received.

This is the ideal situation… and the way that it worked when I sent the data via a custom message, however I’m converting the resource manager over to using write(). I’m guessing that I am unable to MsgReply directly from my io_write() function… however if it is possible could someone tell me how!!?

To get around this I am attempting to have the io_write function open up the resource manager and send a simple custom message indicating that data is available at which point the thread processing that message would process the data, and it would allow io_write to return/Reply however the resmgr library does it.

This however doesn’t work. Open() returns with errno == 2 “No such file or directory” (i’ve already made sure that I’m attempting to open the proper file)

So really I have 2 questions… is there a way that I can reply directly from my io_write function (most ideal situation)

or barring that is there some way that I can send a message from within my resource manager to myself?

I do a way around all of this if neither of these will work, but I’d rather not use my last approach (not explained here).

Thanks,

Josh

  1. I don’t know why you think you can’t MsgReply in the io_write() function. Where else would you do it?

  2. I believe your errno=2 is part of a feature of QNX 6. Let’s say you wanted to put some processing in front of some resource, for example a file: /myfile. Your resource manager registers /myfile, so that such opens come to you. But now your resource manager wants to open that file, so how can it? Well the open ignores your registration and you get to open the original /myfile. In your case, there is no such file so errno=2.

Maschoen… Thanks for the info in the second bullet. As far as the first topic, I guess for better or worse I made an assumption that the return value of the io_write function would be interpreted by the resmgr library at which point the library would send a MsgReply().

Thinking about this stuff I went back to the nto_prog.pdf document an on page 150 of the pdf there is a section entitled “Performing the reply in the server” which is exactly what I want to do. And to keep the resmgr library from doing a reply for me I just return _RESMGR_NOREPLY

Hopefully this is useful for someone else.

Thanks

Yep, that’s right, but having a write() return something other than what is defined by Posix, is not a good idea IMHO.

What was wrong with the original method of using MsgSend()?

Rennie

Maybe he just want to reply at a later time. no the the io_write callback itself?