No Unix, that I know, would allow you to do this.
If a process forks of a child process, it becomes the parent-process
of this new process. If this parent terminates, before the child
the child is "adopted by" the init process (pid==1).
So either the original parent-process (or init/pid==1) will have the
ability to call wait()/waitpid() to examine the child-processes exitcode.
(And init will only be able to do this, if the original parent
You can however check, if a certain process exists (kill() with signo==0).
But the only thing you'll know from this is "a process with a certain pid
or "a process with this pid doesn't exist" ... not more than this.
Regards ... Rainer
You can if you use the de* interface (ptrace or procfs) though thisQuote:> Can I wait for the child process from other process and get the status
> in SUN, AIX and HP?
> > Can I wait for the child process from other process and get the
> > in SUN, AIX and HP?
> You can if you use the de* interface (ptrace or procfs) though this
> comes will all sorts of baggage. You don't want to do this unless you
> have to.
You'll probably want to implement this using process groups. Have all ofQuote:> Im trying to implement the recovery routine, if the parent dies, I want
> start up another process and will able to wait for all the children from
> dead parent, is it possible? and How? TIA.
There is plenty of documentation on process groups in most unix programming
books, if you need more help with this, let me know.
If I want to make a UNIX child process wait until its parent exits
before the child
process proceeds with what it needs to do, is there any other way than
condition variables in shared memory which is the general way of
unrelated processes? By other way I mean something similar to the
API but applies in the reverse direction? After all, this case qualifies
to synchronize two related processes.
Thanks in advance for any information!