Revision: 23029 http://trac.macosforge.org/projects/launchd/changeset/23029 Author: zarzycki@apple.com Date: 2007-02-05 14:11:16 -0800 (Mon, 05 Feb 2007) Log Message: ----------- <rdar://problem/4976905> turn SystemStarter into a launchd job Modified Paths: -------------- trunk/launchd/src/Makefile.am trunk/launchd/src/Makefile.in trunk/launchd/src/SystemStarter.c trunk/launchd/src/launchctl.c Modified: trunk/launchd/src/Makefile.am =================================================================== --- trunk/launchd/src/Makefile.am 2007-02-05 21:35:42 UTC (rev 23028) +++ trunk/launchd/src/Makefile.am 2007-02-05 22:11:16 UTC (rev 23029) @@ -93,7 +93,8 @@ mkdir -p $(DESTDIR)/$(sysconfdir)/mach_init_per_user.d mkdir -p $(DESTDIR)/Library/LaunchDaemons mkdir -p $(DESTDIR)/Library/LaunchAgents + mkdir -p $(DESTDIR)/System/Library/LaunchAgents mkdir -p $(DESTDIR)/System/Library/LaunchDaemons - mkdir -p $(DESTDIR)/System/Library/LaunchAgents + cp $(srcdir)/com.apple.SystemStarter.plist $(DESTDIR)/System/Library/LaunchDaemons endif Modified: trunk/launchd/src/Makefile.in =================================================================== --- trunk/launchd/src/Makefile.in 2007-02-05 21:35:42 UTC (rev 23028) +++ trunk/launchd/src/Makefile.in 2007-02-05 22:11:16 UTC (rev 23029) @@ -1107,8 +1107,9 @@ @LIBS_ONLY_FALSE@ mkdir -p $(DESTDIR)/$(sysconfdir)/mach_init_per_user.d @LIBS_ONLY_FALSE@ mkdir -p $(DESTDIR)/Library/LaunchDaemons @LIBS_ONLY_FALSE@ mkdir -p $(DESTDIR)/Library/LaunchAgents +@LIBS_ONLY_FALSE@ mkdir -p $(DESTDIR)/System/Library/LaunchAgents @LIBS_ONLY_FALSE@ mkdir -p $(DESTDIR)/System/Library/LaunchDaemons -@LIBS_ONLY_FALSE@ mkdir -p $(DESTDIR)/System/Library/LaunchAgents +@LIBS_ONLY_FALSE@ cp $(srcdir)/com.apple.SystemStarter.plist $(DESTDIR)/System/Library/LaunchDaemons # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Modified: trunk/launchd/src/SystemStarter.c =================================================================== --- trunk/launchd/src/SystemStarter.c 2007-02-05 21:35:42 UTC (rev 23028) +++ trunk/launchd/src/SystemStarter.c 2007-02-05 22:11:16 UTC (rev 23029) @@ -22,6 +22,9 @@ * @APPLE_APACHE_LICENSE_HEADER_END@ **/ +#include <sys/types.h> +#include <sys/stat.h> +#include <paths.h> #include <unistd.h> #include <crt_externs.h> #include <fcntl.h> @@ -147,7 +150,27 @@ } } - exit(system_starter(anAction, aService)); + int ssec = system_starter(anAction, aService); + struct stat sb; + + if (anAction == kActionStart && stat("/etc/rc.local", &sb) != -1) { + int wstatus; + pid_t rclp; + + switch ((rclp = fork())) { + case -1: + break; + case 0: + execlp(_PATH_BSHELL, _PATH_BSHELL, "/etc/rc.local", NULL); + _exit(EXIT_FAILURE); + break; + default: + waitpid(rclp, &wstatus, 0); + break; + } + } + + exit(ssec); } Modified: trunk/launchd/src/launchctl.c =================================================================== --- trunk/launchd/src/launchctl.c 2007-02-05 21:35:42 UTC (rev 23028) +++ trunk/launchd/src/launchctl.c 2007-02-05 22:11:16 UTC (rev 23029) @@ -1274,14 +1274,6 @@ _vproc_set_global_on_demand(false); - const char *SystemStarter_tool[] = { "SystemStarter", NULL }; - assumes(fwexec(SystemStarter_tool, false) != -1); - - if (path_check("/etc/rc.local")) { - const char *rc_local_tool[] = { _PATH_BSHELL, "/etc/rc.local", NULL }; - assumes(fwexec(rc_local_tool, true) != -1); - } - return 0; }
participants (1)
-
source_changes@macosforge.org