[23223] trunk/launchd/src/launchd_core_logic.c
Revision: 23223 http://trac.macosforge.org/projects/launchd/changeset/23223 Author: zarzycki@apple.com Date: 2007-04-17 08:46:10 -0700 (Tue, 17 Apr 2007) Log Message: ----------- <rdar://problem/5138272> tag BootCache twice Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2007-04-16 22:33:31 UTC (rev 23222) +++ trunk/launchd/src/launchd_core_logic.c 2007-04-17 15:46:10 UTC (rev 23223) @@ -403,6 +403,7 @@ static char **mach_cmd2argv(const char *string); static size_t our_strhash(const char *s) __attribute__((pure)); static mach_port_t the_exception_server; +static bool did_first_per_user_launchd_BootCache_hack; jobmgr_t root_jobmgr; @@ -2180,6 +2181,10 @@ total_children++; LIST_INSERT_HEAD(&j->mgr->active_jobs[ACTIVE_JOB_HASH(c)], j, pid_hash_sle); + if (j->per_user && !did_first_per_user_launchd_BootCache_hack) { + did_first_per_user_launchd_BootCache_hack = true; + } + if (!j->legacy_mach_job) { job_assumes(j, runtime_close(oepair[1]) != -1); } @@ -2209,6 +2214,23 @@ } } +static void +do_first_per_user_launchd_hack(void) +{ + char *bcct_tool[] = { "/usr/sbin/BootCacheControl", "tag", NULL }; + int dummystatus; + pid_t bcp; + + if (launchd_assumes((bcp = vfork()) != -1)) { + if (bcp == 0) { + execve(bcct_tool[0], bcct_tool, environ); + _exit(EXIT_FAILURE); + } else { + launchd_assumes(waitpid(bcp, &dummystatus, 0) != -1); + } + } +} + void job_start_child(job_t j) { @@ -2222,6 +2244,10 @@ size_t binpref_out_cnt = 0; int i; + if (j->per_user && !did_first_per_user_launchd_BootCache_hack) { + do_first_per_user_launchd_hack(); + } + job_assumes(j, posix_spawnattr_init(&spattr) == 0); job_setup_attributes(j);
participants (1)
-
source_changes@macosforge.org