Revision: 22926 http://trac.macosforge.org/projects/launchd/changeset/22926 Author: zarzycki@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); +}
participants (1)
-
source_changes@macosforge.org