How do I get the pid of the process that triggered a proxy?

Can someone tell me how to get the pid of the process that triggered a
proxy? I am trying to implement a special version of _select_receive()
as referenced in the documentation for the select() function and that’s
the one thing I can’t figure out (so far, at least). Am I missing
something simple?

Thank You,

Mark Faust

You can’t get the pid of the process that triggered the proxy… the docs
are a test to see if you are really reading them :wink:

_select_receive(pid_t pidin)
{
pid_t pid;
while (1) {
pid = Receive(0, buffer, len)
if ((pid == pidin) || (pid == -1))
return pid;

// … handle your stuff here

}

// keep compiler happy
return(0);
}

The -1 is optional but for handling things like signals (broken pipes,
torn down connections) it is a must.

Jay

Mark Faust wrote in message <3A7DCFE6.F6637F9C@sri.com>…

Can someone tell me how to get the pid of the process that triggered a
proxy? I am trying to implement a special version of _select_receive()
as referenced in the documentation for the select() function and that’s
the one thing I can’t figure out (so far, at least). Am I missing
something simple?

Thank You,

Mark Faust

Ahh, good. Thanks.

Mark

Jay Hogg wrote:

You can’t get the pid of the process that triggered the proxy… the docs
are a test to see if you are really reading them > :wink:

_select_receive(pid_t pidin)
{
pid_t pid;
while (1) {
pid = Receive(0, buffer, len)

The problem is that the pid of a proxy is different from the proxy
of the sendig process.

You have to use qnx_psinfo() to get more infos about the type of the
received pid … check out the proc structure and the father, son,
brother components.

Armin


if ((pid == pidin) || (pid == -1))
return pid;

// … handle your stuff here

}

// keep compiler happy
return(0);
}

The -1 is optional but for handling things like signals (broken pipes,
torn down connections) it is a must.

Jay

Mark Faust wrote in message <> 3A7DCFE6.F6637F9C@sri.com> >…
Can someone tell me how to get the pid of the process that triggered a
proxy? I am trying to implement a special version of _select_receive()
as referenced in the documentation for the select() function and that’s
the one thing I can’t figure out (so far, at least). Am I missing
something simple?

Thank You,

Mark Faust

Armin,
You are correct on the qnx_psinfo() to get the parent of the proxy but
for _select_receive() the documentation is actually wrong… what is
supposed to be returned is the proxy or -1 if an error occurred.

The actual function under the covers is:
pid_t _select_receive(pid_t pid)
{ return Receive(pid, NULL, 0));

Jay

Armin Steinhoff wrote in message <3A7EA3B5.61DA5330@web_.de>…

Jay Hogg wrote:

You can’t get the pid of the process that triggered the proxy… the docs
are a test to see if you are really reading them > :wink:

_select_receive(pid_t pidin)
{
pid_t pid;
while (1) {
pid = Receive(0, buffer, len)

The problem is that the pid of a proxy is different from the proxy
of the sendig process.

You have to use qnx_psinfo() to get more infos about the type of the
received pid … check out the proc structure and the father, son,
brother components.

Armin


if ((pid == pidin) || (pid == -1))
return pid;

// … handle your stuff here

}

// keep compiler happy
return(0);
}

The -1 is optional but for handling things like signals (broken pipes,
torn down connections) it is a must.

Jay

Mark Faust wrote in message <> 3A7DCFE6.F6637F9C@sri.com> >…
Can someone tell me how to get the pid of the process that triggered a
proxy? I am trying to implement a special version of _select_receive()
as referenced in the documentation for the select() function and that’s
the one thing I can’t figure out (so far, at least). Am I missing
something simple?

Thank You,

Mark Faust

Jay Hogg <Jay.Hogg@t-netix.com> wrote:

Armin,
You are correct on the qnx_psinfo() to get the parent of the proxy…

Note that the parent of the proxy isn’t neccessarily the process that
triggered the proxy – in many cases it will not be.

-David

QNX Training Services
dagibbs@qnx.com