Res Mgr receives wrong OCB upon close()


i have problem with my Resource Manager. I extends the OCB just as described in “Extending Data Control Structures” of QNX 6.3.2 docs.

But the problem occurs that if my application spawn a child process, and the child process executes close(), somehow the Resource Manager receives the OCB from the parent process !?

The child process is spawned as follows:

  struct inheritance   inherit;
  char *argv[] = {CHILD_PROC_PATH, NULL};
  inherit.pgroup = SPAWN_NEWPGROUP;

  /* spawn child process */
  pid = spawnp(CHILD_PROC_PATH, 0, NULL, &inherit, argv, NULL);

Have i done something wrong?

Thanks for any answer.


I’m not exactly sure what you are asking.

Is your problem/question:

  1. The fact that the Resource Manager received an OCB from the parent when you expected it to come from the child?
  2. The fact the child can close the parents connection to the Resource Manager?

Looking at spawnp the answer would seem to lie in arguments 2 & 3. Your call to spawnp says the child process should inherit all open file descriptors from the parent which means the child inherits the parents connection to the Resource Manager.

If you don’t want that behaviour you have 2 options:

  1. Open the connection to the Resource Manager in the parent after spawning the child process.
  2. Fill out arguments 2 & 3 to specify exactly what file descriptors the child should inherit (you can probably just set arg 2 to 1 and fill in stdout if the child doen’t need the parents file descriptors).


Halo Tim,

thanks for the answer.

My problem is as you mentioned in 1) that the child process closes the connection to Resource Manager as parrent process instead as the child process itself. I tried your solution and the first solution works.

Thanks once again.