Вопрос

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