diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-05-29 16:26:24 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-06-06 10:55:45 +0200 |
commit | a5cc7e5ac109eab0ded6d8ed265bd7944fc8aa10 (patch) | |
tree | 34f5835ffb3a79dd657d94fe434ca08ff7afd2b3 | |
parent | 4f811d27d6d9324e65ce628fa20ac1761ef98de0 (diff) | |
download | systemd-a5cc7e5ac109eab0ded6d8ed265bd7944fc8aa10.tar.gz |
core: schedule time and timezone change events a bit before .timer elapsation events
We really should make sure that .timer units are dispatched while taking
the newest time/timezone data into account.
-rw-r--r-- | src/core/manager.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index d2f628d2bb..7fc31ce569 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -369,6 +369,11 @@ static int manager_setup_time_change(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to create time change event source: %m"); + /* Schedule this slightly earlier than the .timer event sources */ + r = sd_event_source_set_priority(m->time_change_event_source, SD_EVENT_PRIORITY_NORMAL-1); + if (r < 0) + return log_error_errno(r, "Failed to set priority of time change event sources: %m"); + (void) sd_event_source_set_description(m->time_change_event_source, "manager-time-change"); log_debug("Set up TFD_TIMER_CANCEL_ON_SET timerfd."); @@ -401,7 +406,7 @@ static int manager_read_timezone_stat(Manager *m) { } static int manager_setup_timezone_change(Manager *m) { - sd_event_source *new_event = NULL; + _cleanup_(sd_event_source_unrefp) sd_event_source *new_event = NULL; int r; assert(m); @@ -429,8 +434,13 @@ static int manager_setup_timezone_change(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to create timezone change event source: %m"); + /* Schedule this slightly earlier than the .timer event sources */ + r = sd_event_source_set_priority(new_event, SD_EVENT_PRIORITY_NORMAL-1); + if (r < 0) + return log_error_errno(r, "Failed to set priority of timezone change event sources: %m"); + sd_event_source_unref(m->timezone_change_event_source); - m->timezone_change_event_source = new_event; + m->timezone_change_event_source = TAKE_PTR(new_event); return 0; } |