spawning a process over qnet

I am trying to spawn a process on an embedded computer from another computer over a qnet network. Once the embedded process is spawned, I want to be able to do in and out calls (on the embedded computer hardware).

I have tried using a system ( on …) call to start the embedded process, but when the embedded process does a “name_attach”, it creates a new “computer_name” under the /net directory. The new name has a “.” in front of it, and is invisible to all other computers on the network (so my name_open call won’t work).

I have tried spawning with the spawnl as well. This does allow the two computers to connect to each other but I think that my IO calls are being directed to the host PC rather than the embedded computer.

Re-reading what I just wrote… seems confusing. If anyone can make sense of what I wrote and help me out, please do.

You want to use the spawn() function alone, with the inheritance structure setup to spawn to a remote node. Check the docs on spawn().

I can’t seem to get the spawn function to work either. I have the same problem of the “/net/.computer-name” which is only visible from that computer. Let me try to give a detailed summary of my problem.

I have two computers compeng20, and compeng27.

First the contents of the /net directories on each computer:

ls /net (on compeng20)
compeng20 compeng27

ls /net (on compeng27)
compeng20 compeng27

so qnet is running.

Then I try to spwan a process from compeng20 on compeng27

#define SPAWN_STRING “/net/compeng27/home/r07l/robot”
char *arg_list[] = {SPAWN_STRING,NULL};

struct inheritance inherit;
inherit.flags = SPAWN_SETND;
nd = netmgr_strtond(“compeng27”,NULL);
inherit.nd = nd;

this starts the remote process fine, then I try to attach to the process for communication.


where my_name_open is a function given in the qnx 4 to qnx 6 migration guide.

I use this my_name_open in a loop to try to connect several times before quitting. Eventually the program ends because it can’t connect. The “robot” program continues running on compeng27. When I do an ls on both computers /net directory again.

ls /net (on compeng20)
compeng20 compeng27

ls /net (on compeng27)
compeng20 compeng27 .compeng20

note the .compeng20, it is this computer name in which the /dev/name/global/“name” is registered. The .compeng20 computer however is not visible anywhere exceot compeng27.

Any ideas?

  1. try use “on -f compeng27 /net/compeng27/home/r07l/robot” , see if it works probably.
  2. if use spawn(), do a ‘chroot("/net/compeng27")’ first.
  3. what is ROBOT_ATTACH_POINT looks like? Make sure it does not start with “/”.

still no luck.

I tried using the system ( “on -f …”) before. It gave me the same problems as spawn is now.
I also tried the chroot() thing, didn’t help.

The process will start fine, I just can’t connect to the attach point (which does not start with a /).

If I start the processes separately, they run fine, everything works. The act of spawning seems to be the cause of the problem. If anyone else has any ideas, I could sure use 'em.


Maybe I can help You a liitle bit. We had the same problem and we were working a lot with it. The method described by QNX master worked but there was a problem. After chroot("/net/blablabla"); and then calling spawn i cant return to the previous point. I tried another chroot command after first two commands, but without success. So i decided to make chroot in the another process, this new one. And suprisingly chroot(".") has helped. In this combinatiotion You dont have to call chroot in the parent process. But there is another problem with qnet. This method doesn’t start after rebooting both computers. You have to reboot computers, then unpluged ethernet cable!!! and then call spawn. The answer hosy is down or so is ok. Then plug ethernet cable and call spawn again. Form this meoment it should work. The method i described iseems to be strange, but it works (unfortunatly with problems) and i dont’t know any better. If anybody do, please help me for example how to restart qnet, without unplugging ethernet cable.


I used the same method for some time :smiley:, and I had the same problems.