Revision
22925
Author
zarzycki@apple.com
Date
2006-10-27 10:52:50 -0700 (Fri, 27 Oct 2006)

Log Message

Since Mach service lookups are O(n) right now, let's keep the popular (MRU) services at the head of the list.

Modified Paths

Diff

Modified: trunk/launchd/src/launchd_core_logic.c (22924 => 22925)


--- 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;
 			}
 		}