6 Oct
2009
6 Oct
'09
8:26 p.m.
TN2083 explains that launchd kills child processes when the parent exits, and suggests using setsid() as a workaround when a child needs to stay alive. I'm in that situation, (see http://lists.macosforge.org/pipermail/launchd-dev/2009-September/000664.html for details, I want to change the StartInterval of my job and use a helper tool to un/reload myself from launchd), but I can't get my helper tool into a state where it's not killed. Calling setsid() from either the daemon (before launching the helper) or from the helper tool itself returns -1 and it's killed off by launchd as soon as the job is unloaded. What's the right way to use setsid() (or another approach) here?