process re-parenting: controlling who is the new parent

跟風遠走 提交于 2019-11-27 15:12:50

Orphaned children are always adopted by init. There is no Unix way of changing the parent to some non-init process.


As of Linux 3.4 this is no longer strictly true. There's still no portable Unix way of doing this but as Andy Lutomirski points out Linux 3.4 adds PR_SET_CHILD_SUBREAPER for prctl.

In effect, a subreaper fulfills the role of init(1) for its descendant processes.

On Linux, you can use PR_SET_CHILD_SUBREAPER to indicate that your orphaned descendants should be re-parented to you instead of to init.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!