Revision: 23425 http://trac.macosforge.org/projects/launchd/changeset/23425 Author: zarzycki@apple.com Date: 2007-09-21 16:25:52 -0700 (Fri, 21 Sep 2007) Log Message: ----------- <rdar://problem/5487724> Leopard: M67 Hang on the way to power-off Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2007-09-21 20:36:08 UTC (rev 23424) +++ trunk/launchd/src/launchd_core_logic.c 2007-09-21 23:25:52 UTC (rev 23425) @@ -4122,6 +4122,19 @@ jobmgr_log(jm, LOG_DEBUG, "Garbage collecting."); + /* + * Normally, we wait for all resources of a job (Unix PIDs/FDs and Mach ports) + * to reset before we conider the job truly dead and ready to be spawned again. + * + * In order to work around 5487724 and 3456090, we're going to call reboot() + * when the last PID dies and not wait for the associated resources to reset. + */ + if (getpid() == 1 && jm->parentmgr == NULL && total_children == 0) { + jobmgr_log(jm, LOG_DEBUG, "About to force a call to: reboot(%s)", reboot_flags_to_C_names(jm->reboot_flags)); + runtime_closelog(); + jobmgr_assumes(jm, reboot(jm->reboot_flags) != -1); + } + if (jm->hopefully_first_cnt) { return jm; }