summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/manager.c4
-rw-r--r--src/service.c51
-rw-r--r--src/unit.c8
-rw-r--r--src/util.c3
-rw-r--r--src/util.h2
5 files changed, 16 insertions, 52 deletions
diff --git a/src/manager.c b/src/manager.c
index 14f18eb921..b6a1da7fa4 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2545,9 +2545,9 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
break;
if (startswith(l, "startup-timestamp="))
- dual_timestamp_deserialize(f, l+18, &m->startup_timestamp);
+ dual_timestamp_deserialize(l+18, &m->startup_timestamp);
else if (startswith(l, "finish-timestamp="))
- dual_timestamp_deserialize(f, l+17, &m->finish_timestamp);
+ dual_timestamp_deserialize(l+17, &m->finish_timestamp);
else
log_debug("Unknown serialization item '%s'", l);
}
diff --git a/src/service.c b/src/service.c
index 5cf78966a1..49bdae7258 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2299,21 +2299,10 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
if (s->main_exec_status.pid > 0) {
unit_serialize_item_format(u, f, "main-exec-status-pid", "%lu", (unsigned long) s->main_exec_status.pid);
+ dual_timestamp_serialize(f, "main-exec-status-start", &s->main_exec_status.start_timestamp);
+ dual_timestamp_serialize(f, "main-exec-status-exit", &s->main_exec_status.exit_timestamp);
- if (s->main_exec_status.start_timestamp.realtime > 0) {
- unit_serialize_item_format(u, f, "main-exec-status-start-realtime",
- "%llu", (unsigned long long) s->main_exec_status.start_timestamp.realtime);
-
- unit_serialize_item_format(u, f, "main-exec-status-start-monotonic",
- "%llu", (unsigned long long) s->main_exec_status.start_timestamp.monotonic);
- }
-
- if (s->main_exec_status.exit_timestamp.realtime > 0) {
- unit_serialize_item_format(u, f, "main-exec-status-exit-realtime",
- "%llu", (unsigned long long) s->main_exec_status.exit_timestamp.realtime);
- unit_serialize_item_format(u, f, "main-exec-status-exit-monotonic",
- "%llu", (unsigned long long) s->main_exec_status.exit_timestamp.monotonic);
-
+ if (dual_timestamp_is_set(&s->main_exec_status.exit_timestamp)) {
unit_serialize_item_format(u, f, "main-exec-status-code", "%i", s->main_exec_status.code);
unit_serialize_item_format(u, f, "main-exec-status-status", "%i", s->main_exec_status.status);
}
@@ -2414,35 +2403,11 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
log_debug("Failed to parse main-exec-status-status value %s", value);
else
s->main_exec_status.status = i;
- } else if (streq(key, "main-exec-status-start-realtime")) {
- uint64_t k;
-
- if (safe_atou64(value, &k) < 0)
- log_debug("Failed to parse main-exec-status-start-realtime value %s", value);
- else
- s->main_exec_status.start_timestamp.realtime = (usec_t) k;
- } else if (streq(key, "main-exec-status-start-monotonic")) {
- uint64_t k;
-
- if (safe_atou64(value, &k) < 0)
- log_debug("Failed to parse main-exec-status-start-monotonic value %s", value);
- else
- s->main_exec_status.start_timestamp.monotonic = (usec_t) k;
- } else if (streq(key, "main-exec-status-exit-realtime")) {
- uint64_t k;
-
- if (safe_atou64(value, &k) < 0)
- log_debug("Failed to parse main-exec-status-exit-realtime value %s", value);
- else
- s->main_exec_status.exit_timestamp.realtime = (usec_t) k;
- } else if (streq(key, "main-exec-status-exit-monotonic")) {
- uint64_t k;
-
- if (safe_atou64(value, &k) < 0)
- log_debug("Failed to parse main-exec-status-exit-monotonic value %s", value);
- else
- s->main_exec_status.exit_timestamp.monotonic = (usec_t) k;
- } else
+ } else if (streq(key, "main-exec-status-start"))
+ dual_timestamp_deserialize(value, &s->main_exec_status.start_timestamp);
+ else if (streq(key, "main-exec-status-exit"))
+ dual_timestamp_deserialize(value, &s->main_exec_status.exit_timestamp);
+ else
log_debug("Unknown serialization key '%s'", key);
return 0;
diff --git a/src/unit.c b/src/unit.c
index fd9bdae1ad..1775c1daf2 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -2088,16 +2088,16 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
continue;
} else if (streq(l, "inactive-exit-timestamp")) {
- dual_timestamp_deserialize(f, v, &u->meta.inactive_exit_timestamp);
+ dual_timestamp_deserialize(v, &u->meta.inactive_exit_timestamp);
continue;
} else if (streq(l, "active-enter-timestamp")) {
- dual_timestamp_deserialize(f, v, &u->meta.active_enter_timestamp);
+ dual_timestamp_deserialize(v, &u->meta.active_enter_timestamp);
continue;
} else if (streq(l, "active-exit-timestamp")) {
- dual_timestamp_deserialize(f, v, &u->meta.active_exit_timestamp);
+ dual_timestamp_deserialize(v, &u->meta.active_exit_timestamp);
continue;
} else if (streq(l, "inactive-enter-timestamp")) {
- dual_timestamp_deserialize(f, v, &u->meta.inactive_enter_timestamp);
+ dual_timestamp_deserialize(v, &u->meta.inactive_enter_timestamp);
continue;
}
diff --git a/src/util.c b/src/util.c
index 9a82c71dcb..fecdee12e2 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3552,10 +3552,9 @@ void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t) {
(unsigned long long) t->monotonic);
}
-void dual_timestamp_deserialize(FILE *f, const char *value, dual_timestamp *t) {
+void dual_timestamp_deserialize(const char *value, dual_timestamp *t) {
unsigned long long a, b;
- assert(f);
assert(value);
assert(t);
diff --git a/src/util.h b/src/util.h
index 3256fbaafc..b469009bf7 100644
--- a/src/util.h
+++ b/src/util.h
@@ -368,7 +368,7 @@ DIR *xopendirat(int dirfd, const char *name);
int ask_password_tty(const char *message, usec_t until, const char *flag_file, char **_passphrase);
void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t);
-void dual_timestamp_deserialize(FILE *f, const char *line, dual_timestamp *t);
+void dual_timestamp_deserialize(const char *value, dual_timestamp *t);
#define NULSTR_FOREACH(i, l) \
for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)