How to get the PID?

I’m still pretty new to QNX6 and, as part of my familiarization
process, I have been trying to write a little do-nothing server and a
little do-nothing client to talk to it via QNX message passing. I’ve
been reading through the document “Writing a Resource Manager” and
I’ve decided this is much too complex for my initial go. Don’t get me
wrong, I really like what resource managers appear to offer and I like
library support QNX seems to have for them. Eventually, I expect we
will write resource managers most of the time. However, for this
first little project I just wanted to use MsgSend(), MsgReceive(),
MsgReply() and so on. I worked with QNX4 for several years so these
are more or less familiar to me and they offer a certain amount of
nostalgia value :slight_smile:

In just a very few lines of code, I’ve managed to put together a
little test server and client. They don’t do anything interesting at
all. Basically the client sends a number to the server, the server
prints it out and sends a different number back to the client.
Everything worked great! My only problem was trying to get the
server’s pid, etc. necessary for the client to make a successful
ConnectAttach() call. All I do now is start the server, use ‘pidin’
to get the necessary numbers, and then pass them to the client on the
command line. Works great for a little test but not really something
I’d care to do in general. In QNX4 there was a way for a server to
register a name and then clients could look up that name to get the
server’s pid. Is there a similar mechanism in QNX6? I understand with
a resource manager the open() takes care of this problem for you.
What do you do if you don’t want to write your server as a resource
manager? I’d hoped the ‘See also’ section for one of the message
passing functions (ChannelCreate(), ConnectAttach(), MsgSend(), etc.)
might point me in the right direction but I didn’t find anything.


Charlie Hubbard
charlieh@innovsys.com

Charlie Hubbard wrote:

Is there a similar mechanism in QNX6? I understand with

Yes, see name_open() in the on-line docs (even includes your do-nothing
client for you which you can cut and paste - the do-nothing server is
supposed to be there also I suspect, but it looks like it is missing).

On Tue, 05 Mar 2002 15:35:47 -0800, Rennie Allen <rallen@csical.com>
wrote:

Charlie Hubbard wrote:

Is there a similar mechanism in QNX6? I understand with


Yes, see name_open() in the on-line docs (even includes your do-nothing
client for you which you can cut and paste - the do-nothing server is
supposed to be there also I suspect, but it looks like it is missing).

Thanks, Rennie, that works great! That’s exactly what I needed.


Charlie Hubbard
charlieh@innovsys.com