Can I disown a child?

Doug Gwyn gwyn at smoke.brl.mil
Wed Apr 3 10:29:52 AEST 1991


In article <1991Apr1.190700.2833 at ultra.com> shj at ultra.com (Steve Jay) writes:
>I want to fork a process & not have to worry about reaping it.  How
>can I prevent the child from becoming a zombie when it quits?

The classical solution is to fork twice, with the intermediate parent
immediately terminating, so that the "grandchild" has no parent and
the "grandparent" continues about its business.  When an orphaned
child terminates, it is assigned PID #1 as its surrogate parent.
PID #1 is the "init" process that always exists and fairly soon will
wait() for a child, thus finally laying the deceased orphan to rest.

>I don't normally read this newsgroup, so please email responses directly
>to me.

Too bad, if you ask it here you should look here for the answer.



More information about the Comp.unix.questions mailing list