X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Fjournal%2Fjournald-server.c;h=0d8e3618ee77742937fc7b8c376cc9035b67ab5b;hb=39cf0351c529584aa8f270e3b418d7ab9461b622;hp=9efa65a29427d88882b567411edda70218431e50;hpb=165bda37badafcb5923dff2c7b028cb82c91dd69;p=thirdparty%2Fsystemd.git diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 9efa65a2942..0d8e3618ee7 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1633,23 +1633,24 @@ static int server_parse_config_file(Server *s) { /* If we are running in namespace mode, load the namespace specific configuration file, and nothing else */ namespaced = strjoina(PKGSYSCONFDIR "/journald@", s->namespace, ".conf"); - r = config_parse( - NULL, - namespaced, NULL, - "Journal\0", - config_item_perf_lookup, journald_gperf_lookup, - CONFIG_PARSE_WARN, s); + r = config_parse(NULL, + namespaced, NULL, + "Journal\0", + config_item_perf_lookup, journald_gperf_lookup, + CONFIG_PARSE_WARN, s, + NULL); if (r < 0) return r; return 0; } - return config_parse_many_nulstr(PKGSYSCONFDIR "/journald.conf", - CONF_PATHS_NULSTR("systemd/journald.conf.d"), - "Journal\0", - config_item_perf_lookup, journald_gperf_lookup, - CONFIG_PARSE_WARN, s); + return config_parse_many_nulstr( + PKGSYSCONFDIR "/journald.conf", + CONF_PATHS_NULSTR("systemd/journald.conf.d"), + "Journal\0", + config_item_perf_lookup, journald_gperf_lookup, + CONFIG_PARSE_WARN, s, NULL); } static int server_dispatch_sync(sd_event_source *es, usec_t t, void *userdata) { @@ -1676,27 +1677,20 @@ int server_schedule_sync(Server *s, int priority) { return 0; if (s->sync_interval_usec > 0) { - usec_t when; - - r = sd_event_now(s->event, CLOCK_MONOTONIC, &when); - if (r < 0) - return r; - - when += s->sync_interval_usec; if (!s->sync_event_source) { - r = sd_event_add_time( + r = sd_event_add_time_relative( s->event, &s->sync_event_source, CLOCK_MONOTONIC, - when, 0, + s->sync_interval_usec, 0, server_dispatch_sync, s); if (r < 0) return r; r = sd_event_source_set_priority(s->sync_event_source, SD_EVENT_PRIORITY_IMPORTANT); } else { - r = sd_event_source_set_time(s->sync_event_source, when); + r = sd_event_source_set_time_relative(s->sync_event_source, s->sync_interval_usec); if (r < 0) return r; @@ -1887,7 +1881,7 @@ static int server_connect_notify(Server *s) { if (sd_watchdog_enabled(false, &s->watchdog_usec) > 0) { s->send_watchdog = true; - r = sd_event_add_time(s->event, &s->watchdog_event_source, CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + s->watchdog_usec/2, s->watchdog_usec/4, dispatch_watchdog, s); + r = sd_event_add_time_relative(s->event, &s->watchdog_event_source, CLOCK_MONOTONIC, s->watchdog_usec/2, s->watchdog_usec/4, dispatch_watchdog, s); if (r < 0) return log_error_errno(r, "Failed to add watchdog time event: %m"); } @@ -2115,7 +2109,6 @@ static int server_idle_handler(sd_event_source *source, uint64_t usec, void *use int server_start_or_stop_idle_timer(Server *s) { _cleanup_(sd_event_source_unrefp) sd_event_source *source = NULL; - usec_t when; int r; assert(s); @@ -2128,11 +2121,7 @@ int server_start_or_stop_idle_timer(Server *s) { if (s->idle_event_source) return 1; - r = sd_event_now(s->event, CLOCK_MONOTONIC, &when); - if (r < 0) - return log_error_errno(r, "Failed to determine current time: %m"); - - r = sd_event_add_time(s->event, &source, CLOCK_MONOTONIC, usec_add(when, IDLE_TIMEOUT_USEC), 0, server_idle_handler, s); + r = sd_event_add_time_relative(s->event, &source, CLOCK_MONOTONIC, IDLE_TIMEOUT_USEC, 0, server_idle_handler, s); if (r < 0) return log_error_errno(r, "Failed to allocate idle timer: %m"); @@ -2147,7 +2136,6 @@ int server_start_or_stop_idle_timer(Server *s) { } int server_refresh_idle_timer(Server *s) { - usec_t when; int r; assert(s); @@ -2155,11 +2143,7 @@ int server_refresh_idle_timer(Server *s) { if (!s->idle_event_source) return 0; - r = sd_event_now(s->event, CLOCK_MONOTONIC, &when); - if (r < 0) - return log_error_errno(r, "Failed to determine current time: %m"); - - r = sd_event_source_set_time(s->idle_event_source, usec_add(when, IDLE_TIMEOUT_USEC)); + r = sd_event_source_set_time_relative(s->idle_event_source, IDLE_TIMEOUT_USEC); if (r < 0) return log_error_errno(r, "Failed to refresh idle timer: %m");