[launchd-changes] [23039] trunk/launchd/src/launchd.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 7 13:07:49 PST 2007
Revision: 23039
http://trac.macosforge.org/projects/launchd/changeset/23039
Author: zarzycki at apple.com
Date: 2007-02-07 13:07:49 -0800 (Wed, 07 Feb 2007)
Log Message:
-----------
Clean up. Now if we can properly make our reflector threads go away, we should be able to go to single user mode again. :-)
Modified Paths:
--------------
trunk/launchd/src/launchd.c
Modified: trunk/launchd/src/launchd.c
===================================================================
--- trunk/launchd/src/launchd.c 2007-02-07 20:19:36 UTC (rev 23038)
+++ trunk/launchd/src/launchd.c 2007-02-07 21:07:49 UTC (rev 23039)
@@ -300,11 +300,11 @@
* to skip it.
*/
if (!h && stat(ldconf, &sb) == 0) {
- job_dispatch(rlcj, true);
+ rlcj = job_dispatch(rlcj, true);
}
if (fbj) {
- job_dispatch(fbj, true);
+ fbj = job_dispatch(fbj, true);
}
char *doom_why = "at instruction";
@@ -474,24 +474,15 @@
void
launchd_single_user(void)
{
- int tries;
+ syslog(LOG_NOTICE, "Going to single-user mode");
+ re_exec_in_single_user_mode = true;
+
launchd_shutdown();
- kill(-1, SIGTERM);
+ sleep(3);
- for (tries = 0; tries < 10; tries++) {
- sleep(1);
- if (kill(-1, 0) == -1 && errno == ESRCH) {
- goto out;
- }
- }
-
- syslog(LOG_WARNING, "Gave up waiting for processes to exit while going to single user mode, sending SIGKILL");
kill(-1, SIGKILL);
-
-out:
- re_exec_in_single_user_mode = true;
}
static void signal_callback(void *obj __attribute__((unused)), struct kevent *kev)
@@ -501,7 +492,7 @@
switch (kev->ident) {
case SIGHUP:
if (rlcj) {
- job_dispatch(rlcj, true);
+ rlcj = job_dispatch(rlcj, true);
}
break;
case SIGTERM:
@@ -691,6 +682,7 @@
exit(EXIT_SUCCESS);
} else if (re_exec_in_single_user_mode) {
re_exec_in_single_user_mode = false;
+ kill(-1, SIGKILL); /* One last time, just to clear the room */
launchd_assumes(execl("/sbin/launchd", "/sbin/launchd", "-s", NULL) != -1);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070207/7917bf4a/attachment.html
More information about the launchd-changes
mailing list