chiark / gitweb /
swap: add only swaps listed in /etc/fstab automatically to swap.target, others should...
[elogind.git] / src / manager.c
index f2ec2b72ada50e6608b84f25419bd46c90e58211..ae2960236ec4dac7c54f097830668987d24d0332 100644 (file)
@@ -216,7 +216,7 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
         m->audit_fd = -1;
 #endif
 
-        m->signal_watch.fd = m->mount_watch.fd = m->udev_watch.fd = m->epoll_fd = m->dev_autofs_fd = -1;
+        m->signal_watch.fd = m->mount_watch.fd = m->udev_watch.fd = m->epoll_fd = m->dev_autofs_fd = m->swap_watch.fd = -1;
         m->current_job_id = 1; /* start as id #1, so that we can leave #0 around as "null-like" value */
 
         if (!(m->environment = strv_copy(environ)))
@@ -1413,7 +1413,7 @@ static int transaction_add_job_and_dependencies(
         if (type != JOB_STOP && unit->meta.load_state == UNIT_ERROR) {
                 dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
                                "Unit %s failed to load: %s. "
-                               "You might find more information in the system logs.",
+                               "See system logs and 'systemctl status' for details.",
                                unit->meta.id,
                                strerror(-unit->meta.load_error));
                 return -EINVAL;
@@ -2171,6 +2171,11 @@ static int process_event(Manager *m, struct epoll_event *ev) {
                 mount_fd_event(m, ev->events);
                 break;
 
+        case WATCH_SWAP:
+                /* Some swap table change, intended for the swap subsystem */
+                swap_fd_event(m, ev->events);
+                break;
+
         case WATCH_UDEV:
                 /* Some notification from udev, intended for the device subsystem */
                 device_fd_event(m, ev->events);
@@ -2485,10 +2490,17 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds) {
         assert(f);
         assert(fds);
 
-        fprintf(f, "startup-timestamp=%llu %llu\n\n",
+        fprintf(f, "startup-timestamp=%llu %llu\n",
                 (unsigned long long) m->startup_timestamp.realtime,
                 (unsigned long long) m->startup_timestamp.monotonic);
 
+        if (dual_timestamp_is_set(&m->finish_timestamp))
+                fprintf(f, "finish-timestamp=%llu %llu\n",
+                        (unsigned long long) m->finish_timestamp.realtime,
+                        (unsigned long long) m->finish_timestamp.monotonic);
+
+        fputc('\n', f);
+
         HASHMAP_FOREACH_KEY(u, t, m->units, i) {
                 if (u->meta.id != t)
                         continue;
@@ -2547,6 +2559,15 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
                                 m->startup_timestamp.realtime = a;
                                 m->startup_timestamp.monotonic = b;
                         }
+                } else if (startswith(l, "finish-timestamp=")) {
+                        unsigned long long a, b;
+
+                        if (sscanf(l+17, "%lli %llu", &a, &b) != 2)
+                                log_debug("Failed to parse finish timestamp value %s", l+17);
+                        else {
+                                m->finish_timestamp.realtime = a;
+                                m->finish_timestamp.monotonic = b;
+                        }
                 } else
                         log_debug("Unknown serialization item '%s'", l);
         }