If you spawn() a process on another node, as Chris point out, your root
is still “/net/fox”. So anything involve pathname, will be goes back to
netmgr_*() make a connection to “/dev/netmgr”, which, in the spawned
case, it actually connect to “/net/fox/dev/netmgr”. That’s why you got the
ConnectAttach() on the other hand, don’t involve a pathname, so …
If you want the process running on remote “as you started it on remote
You should do a chroot("/net/bobcat"); before spawn().
John Nagle <email@example.com> wrote in message
But the node number for ConnectAttach has to be the
real remote node number. That is, if node “fox” spawns
a process on node “bobcat”, and the process on “bobcat”
wants to talk to a channel opened by the process on “fox”,
it has to do a ConnectAttach specifying the node descriptor
of “fox”, not “bobcat”. ConnectAttach needs a valid
nd/pid/chid triplet. You can’t use a node descriptor of 0
to refer to another node. So a “rooted” node descriptor
is useless for ConnectAttach.
Even worse, if I actually do
on “bobcat”, I get 0 returned. That’s just wrong.
How do I get real node descriptors and numbers in
a spawned process? “chroot” only works if you’re
“root”, and I’m trying hard to avoid running
programs as root.
John Nagle wrote:
OK. I accept that “rooted on” and “running on” can be
It would be appreciated if this were to be
documented in the QNX help files.
Chris McKillop wrote:
John Nagle <> firstname.lastname@example.org> > wrote:
Now this is wierd.
I have a program on node “fox” that spawns another program on node
“bobcat”. This works, and the program really launches on “bobcat”;
I can see it in “ps” on “bobcat”.
In that program, I call
char mynodename; int cnt =
which should return “bobcat”. But, in fact, it returns
“fox” (or “fox.overbot.org”, actually), even though the program
is running on “bobcat”.
What’s going on here? Does the node ID inherit across spawn?
That’s not right.
Yes it is - since your process is still rooted at the node you spawned
from. So if you try to access /tmp it will be /tmp on fox. If you
to be rooted on the other node just chroot() before you start the