문제

Possible Duplicate:
process re-parenting: controlling who is the new parent

I'm writing a small tool to help me launch my helper tools (because AuthorizationExecuteWithPrivilages is horrifying to use) but when I do fork()/execve() in my NSTask-like wrapper class, it forks as a child process of the helper tool. How would I get it to fork as a child process of the originating parent (the parent of the small tool launching my helper tools)? I've tried setpgid(0, parent_pid); after the fork but it doesn't work.

올바른 솔루션이 없습니다

다른 팁

A child process will always have a new pid. However, you can do the exec in the parent process and thus keep the pid. This works only once tho. :-)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top