From 6398320759ce4ed84922bb28f715d3c6c66166c4 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 1 Jul 2010 00:26:44 +0200 Subject: [PATCH] core: rename struct timestamp to dual_timestamp to avoid name clash with IP system headers --- src/dbus-unit.h | 8 ++++---- src/execute.c | 12 ++++++------ src/execute.h | 4 ++-- src/initctl.c | 2 +- src/manager.c | 2 +- src/manager.h | 2 +- src/unit.c | 4 ++-- src/unit.h | 8 ++++---- src/util.c | 2 +- src/util.h | 6 +++--- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/dbus-unit.h b/src/dbus-unit.h index 07641ee9..5662d305 100644 --- a/src/dbus-unit.h +++ b/src/dbus-unit.h @@ -95,10 +95,10 @@ { "org.freedesktop.systemd1.Unit", "ActiveState", bus_unit_append_active_state, "s", u }, \ { "org.freedesktop.systemd1.Unit", "SubState", bus_unit_append_sub_state, "s", u }, \ { "org.freedesktop.systemd1.Unit", "FragmentPath", bus_property_append_string, "s", u->meta.fragment_path }, \ - { "org.freedesktop.systemd1.Unit", "InactiveExitTimestamp",bus_property_append_uint64, "t", &u->meta.inactive_exit_timestamp }, \ - { "org.freedesktop.systemd1.Unit", "ActiveEnterTimestamp", bus_property_append_uint64, "t", &u->meta.active_enter_timestamp }, \ - { "org.freedesktop.systemd1.Unit", "ActiveExitTimestamp", bus_property_append_uint64, "t", &u->meta.active_exit_timestamp }, \ - { "org.freedesktop.systemd1.Unit", "InactiveEnterTimestamp",bus_property_append_uint64, "t", &u->meta.inactive_enter_timestamp }, \ + { "org.freedesktop.systemd1.Unit", "InactiveExitTimestamp",bus_property_append_uint64, "t", &u->meta.inactive_exit_timestamp.realtime }, \ + { "org.freedesktop.systemd1.Unit", "ActiveEnterTimestamp", bus_property_append_uint64, "t", &u->meta.active_enter_timestamp.realtime }, \ + { "org.freedesktop.systemd1.Unit", "ActiveExitTimestamp", bus_property_append_uint64, "t", &u->meta.active_exit_timestamp.realtime }, \ + { "org.freedesktop.systemd1.Unit", "InactiveEnterTimestamp",bus_property_append_uint64, "t", &u->meta.inactive_enter_timestamp.realtime }, \ { "org.freedesktop.systemd1.Unit", "CanStart", bus_unit_append_can_start, "b", u }, \ { "org.freedesktop.systemd1.Unit", "CanReload", bus_unit_append_can_reload, "b", u }, \ { "org.freedesktop.systemd1.Unit", "Job", bus_unit_append_job, "(uo)", u }, \ diff --git a/src/execute.c b/src/execute.c index d5bb8d36..cf71f232 100644 --- a/src/execute.c +++ b/src/execute.c @@ -1273,7 +1273,7 @@ int exec_spawn(ExecCommand *command, log_debug("Forked %s as %lu", command->path, (unsigned long) pid); command->exec_status.pid = pid; - command->exec_status.start_timestamp = now(CLOCK_REALTIME); + dual_timestamp_get(&command->exec_status.start_timestamp); *ret = pid; return 0; @@ -1553,7 +1553,7 @@ void exec_status_fill(ExecStatus *s, pid_t pid, int code, int status) { assert(s); s->pid = pid; - s->exit_timestamp = now(CLOCK_REALTIME); + dual_timestamp_get(&s->exit_timestamp); s->code = code; s->status = status; @@ -1575,17 +1575,17 @@ void exec_status_dump(ExecStatus *s, FILE *f, const char *prefix) { "%sPID: %lu\n", prefix, (unsigned long) s->pid); - if (s->start_timestamp > 0) + if (s->start_timestamp.realtime > 0) fprintf(f, "%sStart Timestamp: %s\n", - prefix, format_timestamp(buf, sizeof(buf), s->start_timestamp)); + prefix, format_timestamp(buf, sizeof(buf), s->start_timestamp.realtime)); - if (s->exit_timestamp > 0) + if (s->exit_timestamp.realtime > 0) fprintf(f, "%sExit Timestamp: %s\n" "%sExit Code: %s\n" "%sExit Status: %i\n", - prefix, format_timestamp(buf, sizeof(buf), s->exit_timestamp), + prefix, format_timestamp(buf, sizeof(buf), s->exit_timestamp.realtime), prefix, sigchld_code_to_string(s->code), prefix, s->status); } diff --git a/src/execute.h b/src/execute.h index e6180494..841670aa 100644 --- a/src/execute.h +++ b/src/execute.h @@ -67,8 +67,8 @@ typedef enum ExecOutput { } ExecOutput; struct ExecStatus { - usec_t start_timestamp; - usec_t exit_timestamp; + dual_timestamp start_timestamp; + dual_timestamp exit_timestamp; pid_t pid; int code; /* as in siginfo_t::si_code */ int status; /* as in sigingo_t::si_status */ diff --git a/src/initctl.c b/src/initctl.c index 3de7fcd4..a18cf384 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -290,7 +290,7 @@ static int server_init(Server *s, unsigned n_sockets) { goto fail; } - f->fd = SD_LISTEN_FDS_START+i; + f->fd = fd; LIST_PREPEND(Fifo, fifo, s->fifos, f); f->server = s; s->n_fifos ++; diff --git a/src/manager.c b/src/manager.c index f9763c83..b8daffd6 100644 --- a/src/manager.c +++ b/src/manager.c @@ -194,7 +194,7 @@ int manager_new(ManagerRunningAs running_as, bool confirm_spawn, Manager **_m) { if (!(m = new0(Manager, 1))) return -ENOMEM; - timestamp_get(&m->startup_timestamp); + dual_timestamp_get(&m->startup_timestamp); m->running_as = running_as; m->confirm_spawn = confirm_spawn; diff --git a/src/manager.h b/src/manager.h index 6e74773f..eed137b1 100644 --- a/src/manager.h +++ b/src/manager.h @@ -137,7 +137,7 @@ struct Manager { char **environment; - timestamp startup_timestamp; + dual_timestamp startup_timestamp; /* Data specific to the device subsystem */ struct udev* udev; diff --git a/src/unit.c b/src/unit.c index c546035c..76e8cd74 100644 --- a/src/unit.c +++ b/src/unit.c @@ -926,7 +926,7 @@ static void retroactively_stop_dependencies(Unit *u) { void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { bool unexpected = false; - timestamp ts; + dual_timestamp ts; assert(u); assert(os < _UNIT_ACTIVE_STATE_MAX); @@ -939,7 +939,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { * this function will be called too and the utmp code below * relies on that! */ - timestamp_get(&ts); + dual_timestamp_get(&ts); if (os == UNIT_INACTIVE && ns != UNIT_INACTIVE) u->meta.inactive_exit_timestamp = ts; diff --git a/src/unit.h b/src/unit.h index fb158d51..70b3c9a4 100644 --- a/src/unit.h +++ b/src/unit.h @@ -153,10 +153,10 @@ struct Meta { * the job for it */ Job *job; - timestamp inactive_exit_timestamp; - timestamp active_enter_timestamp; - timestamp active_exit_timestamp; - timestamp inactive_enter_timestamp; + dual_timestamp inactive_exit_timestamp; + dual_timestamp active_enter_timestamp; + dual_timestamp active_exit_timestamp; + dual_timestamp inactive_enter_timestamp; /* Counterparts in the cgroup filesystem */ CGroupBonding *cgroup_bondings; diff --git a/src/util.c b/src/util.c index 11ab0745..41d8e7f9 100644 --- a/src/util.c +++ b/src/util.c @@ -75,7 +75,7 @@ usec_t now(clockid_t clock_id) { return timespec_load(&ts); } -timestamp* timestamp_get(timestamp *ts) { +dual_timestamp* dual_timestamp_get(dual_timestamp *ts) { assert(ts); ts->realtime = now(CLOCK_REALTIME); diff --git a/src/util.h b/src/util.h index 24103124..91e0359e 100644 --- a/src/util.h +++ b/src/util.h @@ -34,10 +34,10 @@ typedef uint64_t usec_t; -typedef struct timestamp { +typedef struct dual_timestamp { usec_t realtime; usec_t monotonic; -} timestamp; +} dual_timestamp; #define MSEC_PER_SEC 1000ULL #define USEC_PER_SEC 1000000ULL @@ -60,7 +60,7 @@ typedef struct timestamp { usec_t now(clockid_t clock); -timestamp* timestamp_get(timestamp *ts); +dual_timestamp* dual_timestamp_get(dual_timestamp *ts); usec_t timespec_load(const struct timespec *ts); struct timespec *timespec_store(struct timespec *ts, usec_t u); -- 2.39.5