The attached patch implements the PR_DETACH prctl command. It detaches the entire process group from its parent, allowing the parent to still read the detach code with normal wait(). If the process then exits, the notification of the new parent is delayed till the old parent does either wait() to read the detach code, or exits.