chiark / gitweb /
main: redirection to telinit is unnecessary if sysv compat is disabled
[elogind.git] / src / main.c
index b181447ca33b61a537e2ea4a3b9b938fe1625538..f8682d2456b9cb894f4e028a68b7174022ebeee8 100644 (file)
@@ -1013,12 +1013,15 @@ static void test_cgroups(void) {
 int main(int argc, char *argv[]) {
         Manager *m = NULL;
         int r, retval = EXIT_FAILURE;
+        usec_t before_startup, after_startup;
+        char timespan[FORMAT_TIMESPAN_MAX];
         FDSet *fds = NULL;
         bool reexecute = false;
         const char *shutdown_verb = NULL;
         dual_timestamp initrd_timestamp = { 0ULL, 0ULL };
         char systemd[] = "systemd";
 
+#ifdef HAVE_SYSV_COMPAT
         if (getpid() != 1 && strstr(program_invocation_short_name, "init")) {
                 /* This is compatibility support for SysV, where
                  * calling init as a user is identical to telinit. */
@@ -1028,6 +1031,7 @@ int main(int argc, char *argv[]) {
                 log_error("Failed to exec " SYSTEMCTL_BINARY_PATH ": %m");
                 return 1;
         }
+#endif
 
         /* If we get started via the /sbin/init symlink then we are
            called 'init'. After a subsequent reexecution we are then
@@ -1227,6 +1231,8 @@ int main(int argc, char *argv[]) {
         if (arg_default_controllers)
                 manager_set_default_controllers(m, arg_default_controllers);
 
+        before_startup = now(CLOCK_MONOTONIC);
+
         if ((r = manager_startup(m, serialization, fds)) < 0)
                 log_error("Failed to fully start up daemon: %s", strerror(-r));
 
@@ -1294,6 +1300,10 @@ int main(int argc, char *argv[]) {
                 }
         }
 
+        after_startup = now(CLOCK_MONOTONIC);
+        log_debug("Loaded units and determined initial transaction in %s.",
+                  format_timespan(timespan, sizeof(timespan), after_startup - before_startup));
+
         for (;;) {
                 if ((r = manager_loop(m)) < 0) {
                         log_error("Failed to run mainloop: %s", strerror(-r));