PDA

View Full Version : Reattach a process to a deferent parent in C



SIGTERMer
May 5th, 2010, 07:19 AM
hi. Can anyone tell me how to attach a forked process to init so that the forked process doesn't get killed when the parent dies?

MadCow108
May 5th, 2010, 08:13 AM
setsid() should be what your looking for

juzzlin
May 5th, 2010, 08:17 AM
If you have only one child process, then one simple trick is to treat the parent as the child and the child as the parent :) So just swap the roles.

SIGTERMer
May 5th, 2010, 08:44 AM
madcow: Thank you. exactly what I needed :)

juzzlin: that's another way to skin a poor cat. thanks for bringing that up.