<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[23525] trunk/launchd/src</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/launchd/changeset/23525">23525</a></dd>
<dt>Author</dt> <dd>zarzycki@apple.com</dd>
<dt>Date</dt> <dd>2008-02-26 13:39:33 -0800 (Tue, 26 Feb 2008)</dd>
</dl>
<h3>Log Message</h3>
<pre><rdar://problem/5741980> 10A14 vs. 10A12: 3-4 sec boot time regression (launchd)</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunklaunchdsrclaunchctlc">trunk/launchd/src/launchctl.c</a></li>
<li><a href="#trunklaunchdsrclaunchd_core_logicc">trunk/launchd/src/launchd_core_logic.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunklaunchdsrclaunchctlc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchctl.c (23524 => 23525)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -152,6 +152,7 @@
</span><span class="cx"> static void read_launchd_conf(void);
</span><span class="cx"> static bool job_disabled_logic(launch_data_t obj);
</span><span class="cx"> static void fix_bogus_file_metadata(void);
</span><ins>+static void do_file_init(void) __attribute__((constructor));
</ins><span class="cx">
</span><span class="cx"> typedef enum {
</span><span class="cx">         BOOTCACHE_START = 1,
</span><span class="lines">@@ -220,6 +221,7 @@
</span><span class="cx"> static bool istty;
</span><span class="cx"> static bool verbose;
</span><span class="cx"> static bool is_managed;
</span><ins>+static bool do_apple_internal_magic;
</ins><span class="cx">
</span><span class="cx"> int
</span><span class="cx"> main(int argc, char *const argv[])
</span><span class="lines">@@ -1481,7 +1483,6 @@
</span><span class="cx">
</span><span class="cx">         assumes(load_and_unload_cmd(4, load_launchd_items) == 0);
</span><span class="cx">
</span><del>-#ifdef __ppc__
</del><span class="cx">         /*
</span><span class="cx">          * 5066316
</span><span class="cx">          *
</span><span class="lines">@@ -1524,9 +1525,10 @@
</span><span class="cx">          * fine. Remember: IPC is the preferred way to serialize operations.
</span><span class="cx">          *
</span><span class="cx">          */
</span><del>-        mach_timespec_t w = { 5, 0 };
-        IOKitWaitQuiet(kIOMasterPortDefault, &w);
-#endif
</del><ins>+        if (!do_apple_internal_magic) {
+                mach_timespec_t w = { 5, 0 };
+                IOKitWaitQuiet(kIOMasterPortDefault, &w);
+        }
</ins><span class="cx">
</span><span class="cx">         do_BootCache_magic(BOOTCACHE_TAG);
</span><span class="cx">
</span><span class="lines">@@ -3182,3 +3184,13 @@
</span><span class="cx">                 assumes(reboot(RB_AUTOBOOT) != -1);
</span><span class="cx">         }
</span><span class="cx"> }
</span><ins>+
+void
+do_file_init(void)
+{
+        struct stat sb;
+
+        if (stat("/AppleInternal", &sb) == 0) {
+                do_apple_internal_magic = true;
+        }
+}
</ins></span></pre></div>
<a id="trunklaunchdsrclaunchd_core_logicc"></a>
<div class="modfile"><h4>Modified: trunk/launchd/src/launchd_core_logic.c (23524 => 23525)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -4028,22 +4028,17 @@
</span><span class="cx">         struct machservice *ms;
</span><span class="cx">         struct stat sb;
</span><span class="cx">         bool good_exit = (WIFEXITED(j->last_exit_status) && WEXITSTATUS(j->last_exit_status) == 0);
</span><ins>+        bool is_not_kextd = (do_apple_internal_logging || (strcmp(j->label, "com.apple.kextd") != 0));
</ins><span class="cx">
</span><del>-#ifdef __ppc__
</del><span class="cx">         /*
</span><span class="cx">          * 5066316
</span><span class="cx">          *
</span><span class="cx">          * We definitely need to revisit this after Leopard ships. Please see
</span><span class="cx">          * launchctl.c for the other half of this hack.
</span><span class="cx">          */
</span><del>-        if (unlikely(j->mgr->global_on_demand_cnt > 0 && strcmp(j->label, "com.apple.kextd") != 0)) {
</del><ins>+        if (unlikely(j->mgr->global_on_demand_cnt > 0 && is_not_kextd)) {
</ins><span class="cx">                 return false;
</span><span class="cx">         }
</span><del>-#else
-        if (unlikely(j->mgr->global_on_demand_cnt > 0)) {
-                return false;
-        }
-#endif
</del><span class="cx">
</span><span class="cx">         if (j->start_pending) {
</span><span class="cx">                 job_log(j, LOG_DEBUG, "KeepAlive check: Pent-up non-IPC launch criteria.");
</span></span></pre>
</div>
</div>
</body>
</html>