Since Mach service lookups are O(n) right now, let's keep the popular (MRU) services at the head of the list.
--- trunk/launchd/src/launchd_core_logic.c 2006-10-26 21:50:06 UTC (rev 22924)
+++ trunk/launchd/src/launchd_core_logic.c 2006-10-27 17:52:50 UTC (rev 22925)
@@ -3040,6 +3040,10 @@
SLIST_FOREACH(ms, &ji->machservices, sle) {
if (strcmp(name, ms->name) == 0) {
+ if (ji->parent) {
+ SLIST_REMOVE(&ji->parent->jobs, ji, job_s, sle);
+ SLIST_INSERT_HEAD(&ji->parent->jobs, ji, sle);
+ }
return ms;
}
}