[launchd-changes] [22926] trunk/launchd/src/launchctl.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Oct 30 08:16:10 PST 2006


Revision: 22926
          http://trac.macosforge.org/projects/launchd/changeset/22926
Author:   zarzycki at apple.com
Date:     2006-10-30 08:16:10 -0800 (Mon, 30 Oct 2006)

Log Message:
-----------
Just an experiment. The code is disabled for now...

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

Modified: trunk/launchd/src/launchctl.c
===================================================================
--- trunk/launchd/src/launchctl.c	2006-10-27 17:52:50 UTC (rev 22925)
+++ trunk/launchd/src/launchctl.c	2006-10-30 16:16:10 UTC (rev 22926)
@@ -132,6 +132,7 @@
 static void do_sysversion_sysctl(void);
 static void workaround4465949(void);
 static void do_application_firewall_magic(int sfd, launch_data_t thejob);
+static void preheat_page_cache_hack(void);
 
 static int bootstrap_cmd(int argc, char *const argv[]);
 static int load_and_unload_cmd(int argc, char *const argv[]);
@@ -1240,6 +1241,8 @@
 	const char *bcc_tool[] = { "BootCacheControl", "start", NULL };
 	assumes(fwexec(bcc_tool, true) != -1);
 
+	preheat_page_cache_hack();
+
 	char *load_launchd_items[] = { "load", "-D", "all", "/etc/mach_init.d", NULL };
 	if (is_safeboot())
 		load_launchd_items[2] = "system";
@@ -2724,3 +2727,43 @@
 		assumes(setsockopt(sfd, SOL_SOCKET, SO_EXECPATH, prog, strlen(prog) + 1) != -1);
 	}
 }
+
+
+void
+preheat_page_cache_hack(void)
+{
+	struct dirent *de;
+	DIR *thedir;
+
+	/* Disable this hack for now */
+	return;
+
+	if ((thedir = opendir("/etc/preheat_at_boot")) == NULL) {
+		return;
+	}
+
+	while ((de = readdir(thedir))) {
+		struct stat sb;
+		void *junkbuf;
+		int fd;
+
+		if (de->d_name[0] == '.') {
+			continue;
+		}
+
+		if ((fd = open(de->d_name, O_RDONLY)) == -1) {
+			continue;
+		}
+
+		if (fstat(fd, &sb) != -1) { 
+			if ((junkbuf = malloc(sb.st_size)) != NULL) {
+				assumes(read(fd, junkbuf, sb.st_size) == sb.st_size);
+				free(junkbuf);
+			}
+		}
+
+		close(fd);
+	}
+
+	closedir(thedir);
+}

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


More information about the launchd-changes mailing list