diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-06-27 02:17:39 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-06-26 20:17:39 -0400 |
commit | 3285baa85781a906883d991fefc5ec977c6100c4 (patch) | |
tree | b753abe3fabf098eaad51e8756c90bfe7e2c8a94 /src/udev/udevd.c | |
parent | 3e875a71e848b46d019cbda718fb9115583963c2 (diff) | |
download | systemd-3285baa85781a906883d991fefc5ec977c6100c4.tar.gz |
udev: fix some incorrect usages of CLOCK_BOOTTIME (#6198)
CLOCK_BOOTTIME should only be used if we actually want the clock to
count on while we are suspended, and it is hence not useful for normal
code execution time limits, fix that.
Moreover, a couple of uses were even more broken, as
clock_bottime_or_monotonic() was called where actually
now(clock_boottime_or_monotic()) was supposed to be called. Ouch!
Fixes: #5903
Diffstat (limited to 'src/udev/udevd.c')
-rw-r--r-- | src/udev/udevd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 3af06c68b2..acbddd4180 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -284,12 +284,12 @@ static void worker_attach_event(struct worker *worker, struct event *event) { e = worker->manager->event; - assert_se(sd_event_now(e, clock_boottime_or_monotonic(), &usec) >= 0); + assert_se(sd_event_now(e, CLOCK_MONOTONIC, &usec) >= 0); - (void) sd_event_add_time(e, &event->timeout_warning, clock_boottime_or_monotonic(), + (void) sd_event_add_time(e, &event->timeout_warning, CLOCK_MONOTONIC, usec + arg_event_timeout_warn_usec, USEC_PER_SEC, on_event_timeout_warning, event); - (void) sd_event_add_time(e, &event->timeout, clock_boottime_or_monotonic(), + (void) sd_event_add_time(e, &event->timeout, CLOCK_MONOTONIC, usec + arg_event_timeout_usec, USEC_PER_SEC, on_event_timeout, event); } @@ -755,9 +755,9 @@ static void manager_exit(Manager *manager) { event_queue_cleanup(manager, EVENT_QUEUED); manager_kill_workers(manager); - assert_se(sd_event_now(manager->event, clock_boottime_or_monotonic(), &usec) >= 0); + assert_se(sd_event_now(manager->event, CLOCK_MONOTONIC, &usec) >= 0); - r = sd_event_add_time(manager->event, NULL, clock_boottime_or_monotonic(), + r = sd_event_add_time(manager->event, NULL, CLOCK_MONOTONIC, usec + 30 * USEC_PER_SEC, USEC_PER_SEC, on_exit_timeout, manager); if (r < 0) return; @@ -791,7 +791,7 @@ static void event_queue_start(Manager *manager) { manager->exit || manager->stop_exec_queue) return; - assert_se(sd_event_now(manager->event, clock_boottime_or_monotonic(), &usec) >= 0); + assert_se(sd_event_now(manager->event, CLOCK_MONOTONIC, &usec) >= 0); /* check for changed config, every 3 seconds at most */ if (manager->last_usec == 0 || (usec - manager->last_usec) > 3 * USEC_PER_SEC) { |