chdir() returns -1, ESRCH on remote node.

Hello all. This is an (indirect) continuation of a problem I was having
many months ago and posted about several times. I got pulled off the
project before I could resolve anything, but am now back on it (shifting
corporate priorities and all, of course).

We have two nodes running evaluation copies of 6.2.1, named dev-1 and dev-2.
They are visible to one another over the network; /net/ on both machines
shows dev-1 and dev-2, and both hard drives are browsable via /net/. The
command ‘on -f dev-x date’ works from both machines. In other words, all
indications are that QNX networking is fully functional between the two
nodes.

The problem arises when I try to run the app we’re porting from QNX 4. A
process called exec runs on dev-1 and spawns another process (call it coll
for short) on dev-2. The spawn itself succeeds and, at least momentarily,
coll seems to be happily running on dev-2. But, shortly after starting,
coll attempts to open exec’s ‘file’ (exec is a resource manager and
presents a file interface). This open() fails.

So I starting trying to trace the problem back. I got as far as putting in
chdir() calls with various directories. Keeping in mind that coll is
running on dev-2, here’s what I saw:

chdir("/net/") => works
chdir("/net/dev-2/") => works
chdir("/net/dev-2/home/") => works
chdir("/net/dev-1/") => returns -1, errno is set to 3 (ESRCH)

So what is this trying to tell me? I’m at a loss as to what I may be doing
wrong within the code to cause this. Does anyone have any ideas as to what
an ESRCH from chdir() means? Thanks.

Josh Hamacher
FAAC Incorporated

I think chdir("/net/myself/") failed is a bug that fixed later.

As your problem of spawn() cross network, you actually need to
chroot("/net/dev-2") before you sapwn() the “coll” process.
chroot or not, is the difference between “on -n” and “on -f”.

-xtang

Josh Hamacher <jh@faac.com> wrote in message
news:bnma1p$j2k$1@inn.qnx.com

Hello all. This is an (indirect) continuation of a problem I was having
many months ago and posted about several times. I got pulled off the
project before I could resolve anything, but am now back on it (shifting
corporate priorities and all, of course).

We have two nodes running evaluation copies of 6.2.1, named dev-1 and
dev-2.
They are visible to one another over the network; /net/ on both machines
shows dev-1 and dev-2, and both hard drives are browsable via /net/. The
command ‘on -f dev-x date’ works from both machines. In other words, all
indications are that QNX networking is fully functional between the two
nodes.

The problem arises when I try to run the app we’re porting from QNX 4. A
process called exec runs on dev-1 and spawns another process (call it coll
for short) on dev-2. The spawn itself succeeds and, at least momentarily,
coll seems to be happily running on dev-2. But, shortly after starting,
coll attempts to open exec’s ‘file’ (exec is a resource manager and
presents a file interface). This open() fails.

So I starting trying to trace the problem back. I got as far as putting
in
chdir() calls with various directories. Keeping in mind that coll is
running on dev-2, here’s what I saw:

chdir("/net/") => works
chdir("/net/dev-2/") => works
chdir("/net/dev-2/home/") => works
chdir("/net/dev-1/") => returns -1, errno is set to 3 (ESRCH)

So what is this trying to tell me? I’m at a loss as to what I may be
doing
wrong within the code to cause this. Does anyone have any ideas as to
what
an ESRCH from chdir() means? Thanks.

Josh Hamacher
FAAC Incorporated

Thanks, the chroot() seems to have done it. I need to adjust a lot of paths
after that, but I think everything will be accessible as long as I go
through /net/…/.

Josh Hamacher
FAAC Incorporated