[launchd-dev] Preventing killing of child processes?

Sidney San Martín s at sidneysm.com
Tue Oct 6 13:26:26 PDT 2009


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?


More information about the launchd-dev mailing list