]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
manager: tell correctly if the manager is booting
authorMichal Schmidt <mschmidt@redhat.com>
Thu, 2 Feb 2012 11:39:33 +0000 (12:39 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Thu, 2 Feb 2012 12:39:15 +0000 (13:39 +0100)
The assumption that the initial job is the job with id==1 is incorrect.
Some jobs may be enqueued before the job that starts the default unit as
in this example:

 -.mount changed dead -> mounted
 Trying to enqueue job quotacheck.service/start/fail
 Installed new job quotacheck.service/start as 1
 Installed new job systemd-stdout-syslog-bridge.socket/start as 2
 Enqueued job quotacheck.service/start as 1
 Trying to enqueue job quotaon.service/start/fail
 Installed new job quotaon.service/start as 5
 Enqueued job quotaon.service/start as 5
 Activating default unit: default.target
 Trying to enqueue job graphical.target/start/replace

This fixes a bug where displaying of boot status messages was turned off
too early.

src/main.c
src/manager.c
src/manager.h

index 738db6c264e94abd5e3e772e8c682163a33d62b7..18cc74a2eaff10c721d7b0642fc61ca555369752 100644 (file)
@@ -1404,6 +1404,7 @@ int main(int argc, char *argv[]) {
         } else {
                 DBusError error;
                 Unit *target = NULL;
+                Job *default_unit_job;
 
                 dbus_error_init(&error);
 
@@ -1440,11 +1441,13 @@ int main(int argc, char *argv[]) {
                         manager_dump_units(m, stdout, "\t");
                 }
 
-                if ((r = manager_add_job(m, JOB_START, target, JOB_REPLACE, false, &error, NULL)) < 0) {
+                r = manager_add_job(m, JOB_START, target, JOB_REPLACE, false, &error, &default_unit_job);
+                if (r < 0) {
                         log_error("Failed to start default target: %s", bus_error(&error, r));
                         dbus_error_free(&error);
                         goto finish;
                 }
+                m->default_unit_job_id = default_unit_job->id;
 
                 after_startup = now(CLOCK_MONOTONIC);
                 log_full(arg_action == ACTION_TEST ? LOG_INFO : LOG_DEBUG,
index 19e54417221fdfeb969b5703af979fb9e5cf0cd2..74bd740747800217ec2911d6be0c8e903753514b 100644 (file)
@@ -2943,7 +2943,7 @@ bool manager_is_booting_or_shutting_down(Manager *m) {
         assert(m);
 
         /* Is the initial job still around? */
-        if (manager_get_job(m, 1))
+        if (manager_get_job(m, m->default_unit_job_id))
                 return true;
 
         /* Is there a job for the shutdown target? */
index 5e65fdb8fc25ea4a82ebc34ce7b8e21e40a14c4a..a9d08f0a25d0ebe9fc904190cd6a3f5ce91a8b04 100644 (file)
@@ -183,6 +183,7 @@ struct Manager {
         int32_t subscribed_data_slot;
 
         uint32_t current_job_id;
+        uint32_t default_unit_job_id;
 
         /* Data specific to the Automount subsystem */
         int dev_autofs_fd;