[launchd-changes] [23346] trunk/launchd/src/launchd_core_logic.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 24 14:31:25 PDT 2007


Revision: 23346
          http://trac.macosforge.org/projects/launchd/changeset/23346
Author:   zarzycki at apple.com
Date:     2007-08-24 14:31:24 -0700 (Fri, 24 Aug 2007)

Log Message:
-----------
<rdar://problem/5330262> Cancelled FUS restart kills pre-login launchd agent

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-08-17 20:48:49 UTC (rev 23345)
+++ trunk/launchd/src/launchd_core_logic.c	2007-08-24 21:31:24 UTC (rev 23346)
@@ -5614,7 +5614,9 @@
 	}
 
 	SLIST_FOREACH(jmi, &root_jobmgr->submgrs, sle) {
-		if (strcasecmp(jmi->name, where) == 0) {
+		if (jmi->shutting_down) {
+			continue;
+		} else if (strcasecmp(jmi->name, where) == 0) {
 			goto jm_found;
 		} else if (strcasecmp(jmi->name, VPROCMGR_SESSION_BACKGROUND) == 0 && getpid() == 1) {
 			SLIST_FOREACH(jmi2, &jmi->submgrs, sle) {
@@ -5709,6 +5711,31 @@
 			SLIST_REMOVE(&j->mgr->parentmgr->submgrs, j->mgr, jobmgr_s, sle);
 			j->mgr->parentmgr = background_jobmgr;
 			SLIST_INSERT_HEAD(&j->mgr->parentmgr->submgrs, j->mgr, sle);
+		} else if (strcmp(session_type, VPROCMGR_SESSION_LOGINWINDOW) == 0) {
+			jobmgr_t jmi;
+
+			/*
+			 * 5330262
+			 *
+			 * We're working around LoginWindow and the WindowServer.
+			 *
+			 * In practice, there is only one LoginWindow session.  * Unfortunately, for certain
+			 * scenarios, the WindowServer spawns loginwindow, and in those cases, it frequently
+			 * spawns a replacement loginwindow session before cleaning up the previous one.
+			 *
+			 * We're going to use the creation of a new LoginWindow context as a clue that the
+			 * previous LoginWindow context is on the way out and therefore we should just
+			 * kick-start the shutdown of it.
+			 */
+
+			SLIST_FOREACH(jmi, &root_jobmgr->submgrs, sle) {
+				if (jmi->shutting_down) {
+					continue;
+				} else if (strcasecmp(jmi->name, session_type) == 0) {
+					jobmgr_shutdown(jmi);
+					break;
+				}
+			}
 		}
 
 		jobmgr_log(j->mgr, LOG_DEBUG, "Renaming to: %s", session_type);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070824/ceb51e87/attachment.html


More information about the launchd-changes mailing list