sysvinit/startpar-bootchart.diff

32 lines
885 B
Diff

--- startpar.c 2009-03-25 16:52:25.357391610 +0100
+++ startpar.c 2009-03-25 21:22:50.145032810 +0100
@@ -368,6 +368,7 @@
if (!strcmp(arg, "start"))
{
int s, t, len;
+ pid_t child;
struct sockaddr_un remote;
char str[100];
@@ -397,6 +398,20 @@
kill(parent, SIGUSR2);
}
close(s);
+ /*
+ * if we use preload, we fork again to make bootcharts easier to read.
+ * The reason is that the name of the init script will otherwise be used
+ * when in reality the above code waited for preload. If we fork away
+ * before the exec, the waiting code will be folded into startpar
+ */
+ child = fork();
+ if (child) {
+ int status;
+ int ret = waitpid(child, &status, 0);
+ if (ret == -1)
+ perror("waitpid");
+ exit(WEXITSTATUS(status));
+ }
}
}