[launchd-changes] [23525] trunk/launchd/src

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 26 13:39:34 PST 2008


Revision: 23525
          http://trac.macosforge.org/projects/launchd/changeset/23525
Author:   zarzycki at apple.com
Date:     2008-02-26 13:39:33 -0800 (Tue, 26 Feb 2008)

Log Message:
-----------
<rdar://problem/5741980> 10A14 vs. 10A12: 3-4 sec boot time regression (launchd)

Modified Paths:
--------------
    trunk/launchd/src/launchctl.c
    trunk/launchd/src/launchd_core_logic.c

Modified: trunk/launchd/src/launchctl.c
===================================================================
--- trunk/launchd/src/launchctl.c	2008-02-26 21:19:49 UTC (rev 23524)
+++ trunk/launchd/src/launchctl.c	2008-02-26 21:39:33 UTC (rev 23525)
@@ -152,6 +152,7 @@
 static void read_launchd_conf(void);
 static bool job_disabled_logic(launch_data_t obj);
 static void fix_bogus_file_metadata(void);
+static void do_file_init(void) __attribute__((constructor));
 
 typedef enum {
 	BOOTCACHE_START = 1,
@@ -220,6 +221,7 @@
 static bool istty;
 static bool verbose;
 static bool is_managed;
+static bool do_apple_internal_magic;
 
 int
 main(int argc, char *const argv[])
@@ -1481,7 +1483,6 @@
 
 	assumes(load_and_unload_cmd(4, load_launchd_items) == 0);
 
-#ifdef __ppc__
 	/*
 	 * 5066316
 	 *
@@ -1524,9 +1525,10 @@
 	 * fine. Remember: IPC is the preferred way to serialize operations.
 	 *
 	 */
-	mach_timespec_t w = { 5, 0 };
-	IOKitWaitQuiet(kIOMasterPortDefault, &w);
-#endif
+	if (!do_apple_internal_magic) {
+		mach_timespec_t w = { 5, 0 };
+		IOKitWaitQuiet(kIOMasterPortDefault, &w);
+	}
 
 	do_BootCache_magic(BOOTCACHE_TAG);
 
@@ -3182,3 +3184,13 @@
 		assumes(reboot(RB_AUTOBOOT) != -1);
 	}
 }
+
+void
+do_file_init(void)
+{
+	struct stat sb;
+
+	if (stat("/AppleInternal", &sb) == 0) {
+		do_apple_internal_magic = true;
+	}
+}

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2008-02-26 21:19:49 UTC (rev 23524)
+++ trunk/launchd/src/launchd_core_logic.c	2008-02-26 21:39:33 UTC (rev 23525)
@@ -4028,22 +4028,17 @@
 	struct machservice *ms;
 	struct stat sb;
 	bool good_exit = (WIFEXITED(j->last_exit_status) && WEXITSTATUS(j->last_exit_status) == 0);
+	bool is_not_kextd = (do_apple_internal_logging || (strcmp(j->label, "com.apple.kextd") != 0));
 
-#ifdef __ppc__
 	/*
 	 * 5066316
 	 *
 	 * We definitely need to revisit this after Leopard ships. Please see
 	 * launchctl.c for the other half of this hack.
 	 */
-	if (unlikely(j->mgr->global_on_demand_cnt > 0 && strcmp(j->label, "com.apple.kextd") != 0)) {
+	if (unlikely(j->mgr->global_on_demand_cnt > 0 && is_not_kextd)) {
 		return false;
 	}
-#else
-	if (unlikely(j->mgr->global_on_demand_cnt > 0)) {
-		return false;
-	}
-#endif
 
 	if (j->start_pending) {
 		job_log(j, LOG_DEBUG, "KeepAlive check: Pent-up non-IPC launch criteria.");

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


More information about the launchd-changes mailing list