Question

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.

No correct solution

OTHER TIPS

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. :-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top