struct inheritance

hi:

i want to use the Posix-compliant variant “spawn()” and set the ‘mode’
to P_NOWAIT. however the inheritance struct does not have any means of
setting the mode (as does spawnl()). the qnx documentation is a little
fuzzy about ‘struct inheritance’.

what is the mapping of spwanl( mode = P_NOWAIT) to spawn() ?

help would be greatly appreciated…

-Rommel

Rommel Dongre <rdongre@pillardata.com> wrote:

hi:

i want to use the Posix-compliant variant “spawn()” and set the ‘mode’
to P_NOWAIT. however the inheritance struct does not have any means of
setting the mode (as does spawnl()). the qnx documentation is a little
fuzzy about ‘struct inheritance’.

what is the mapping of spwanl( mode = P_NOWAIT) to spawn() ?

I’m pretty sure the lower-level spawn() is automatically P_NOWAIT,
and that setting P_WAIT to the higher-level spawn*() functions actually
causes them to call spawn() then to a waitpid() on the child’s pid.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

David Gibbs wrote:

Rommel Dongre <> rdongre@pillardata.com> > wrote:

hi:


i want to use the Posix-compliant variant “spawn()” and set the ‘mode’
to P_NOWAIT. however the inheritance struct does not have any means of
setting the mode (as does spawnl()). the qnx documentation is a little
fuzzy about ‘struct inheritance’.


what is the mapping of spwanl( mode = P_NOWAIT) to spawn() ?


I’m pretty sure the lower-level spawn() is automatically P_NOWAIT,
and that setting P_WAIT to the higher-level spawn*() functions actually
causes them to call spawn() then to a waitpid() on the child’s pid.

-David
Well, the lower-level spawn() does result in it’s chil processes

becoming zombies, so I think it’s a case of P_WAIT.

I used a SPAWN_NOZOMBIE flag in the ‘struct inheritance’ and am not
seeing zombies, but then wait() fails (correctly, i would think).

i just want to know if SPAWN_NOZOMBIE and P_NOWAIT are equivalent?

Rommel Dongre <rdongre@pillardata.com> wrote:

i just want to know if SPAWN_NOZOMBIE and P_NOWAIT are equivalent?

No, it is equivalent to P_NOWAITO. In other words, P_WAIT clears
SPAWN_NOZOMBIE because it needs to be able to wait for the exit,
P_NOWAITO sets SPAWN_NOZOMBIE because you can’t wait for the status,
and with P_NOWAIT you are expected to waitpid() yourself at a later
point and so SPAWN_NOZOMBIE is also cleared (this is all assuming
you are coming through the spawnv[p]e() interface - refer to the
diagram in the online docs for spawn()).

But this seems to be diverging from your original question …

i want to use the Posix-compliant variant “spawn()” and set the
‘mode’ to P_NOWAIT.

The POSIX-compliant functions (ie spawnp) do not have a ‘mode’.

what is the mapping of spwanl( mode = P_NOWAIT) to spawn() ?

This is the default operation for spawn(), i.e to not wait; any other
libc variant that does offer a P_WAIT mode is explicitly doing a
waitpid() for you. I assume that you want to spawn without waiting
and without having to reap the child at a future point but using spawn()
directly - set SPAWN_NOZOMBIE in inherit.flags.

Rommel Dongre <rdongre@pillardata.com> wrote:

David Gibbs wrote:
Rommel Dongre <> rdongre@pillardata.com> > wrote:

Well, the lower-level spawn() does result in it’s chil processes
becoming zombies, so I think it’s a case of P_WAIT.

No – that isn’t P_WAIT related, that’s the NOZOMBIE flag.

I used a SPAWN_NOZOMBIE flag in the ‘struct inheritance’ and am not
seeing zombies, but then wait() fails (correctly, i would think).

Correctly.

i just want to know if SPAWN_NOZOMBIE and P_NOWAIT are equivalent?

No, they are not.

SPAWN_NOZOMBIE is the equivalent of P_NOWAITO.

P_NOWAIT is the equivalent of spawn().

P_WAIT is the equivalent of waitpid( spawn() );

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.