chiark / gitweb /
bus: process AddMatch/RemoveMatch driver call in proxy
[elogind.git] / src / core / service.c
index 78a2e06fff4b1cc80ec2580bfd75ebaf1aaa47af..ae3695aff2dfd3e0c9c0c3e69caad28f671ec1bd 100644 (file)
@@ -257,7 +257,12 @@ static void service_start_watchdog(Service *s) {
 
                 r = sd_event_source_set_enabled(s->watchdog_event_source, SD_EVENT_ONESHOT);
         } else {
-                r = sd_event_add_monotonic(UNIT(s)->manager->event, &s->watchdog_event_source, s->watchdog_timestamp.monotonic + s->watchdog_usec, 0, service_dispatch_watchdog, s);
+                r = sd_event_add_time(
+                                UNIT(s)->manager->event,
+                                &s->watchdog_event_source,
+                                CLOCK_MONOTONIC,
+                                s->watchdog_timestamp.monotonic + s->watchdog_usec, 0,
+                                service_dispatch_watchdog, s);
                 if (r < 0) {
                         log_warning_unit(UNIT(s)->id, "%s failed to add watchdog timer: %s", UNIT(s)->id, strerror(-r));
                         return;
@@ -345,7 +350,12 @@ static int service_arm_timer(Service *s, usec_t usec) {
                 return sd_event_source_set_enabled(s->timer_event_source, SD_EVENT_ONESHOT);
         }
 
-        return sd_event_add_monotonic(UNIT(s)->manager->event, &s->timer_event_source, now(CLOCK_MONOTONIC) + usec, 0, service_dispatch_timer, s);
+        return sd_event_add_time(
+                        UNIT(s)->manager->event,
+                        &s->timer_event_source,
+                        CLOCK_MONOTONIC,
+                        now(CLOCK_MONOTONIC) + usec, 0,
+                        service_dispatch_timer, s);
 }
 
 #ifdef HAVE_SYSV_COMPAT
@@ -654,13 +664,8 @@ static int service_load_sysv_path(Service *s, const char *path) {
 
                                 state = NORMAL;
 
-                                if (sscanf(t+10, "%15s %i %*i",
-                                           runlevels,
-                                           &start_priority) != 2) {
-
-                                        log_warning_unit(u->id,
-                                                         "[%s:%u] Failed to parse chkconfig line. Ignoring.",
-                                                         path, line);
+                                if (sscanf(t+10, "%15s %i %*i", runlevels, &start_priority) != 2) {
+                                        log_warning_unit(u->id, "[%s:%u] Failed to parse chkconfig line. Ignoring.", path, line);
                                         continue;
                                 }
 
@@ -668,19 +673,17 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                  * symlink farms is preferred over the
                                  * data from the LSB header. */
                                 if (start_priority < 0 || start_priority > 99)
-                                        log_warning_unit(u->id,
-                                                         "[%s:%u] Start priority out of range. Ignoring.",
-                                                         path, line);
+                                        log_warning_unit(u->id, "[%s:%u] Start priority out of range. Ignoring.", path, line);
                                 else
-                                        s->sysv_start_priority = start_priority;
+                                        log_debug_unit(u->id, "[%s:%u] Ignoring start priority set in the chkconfig file.", path, line);
 
                                 char_array_0(runlevels);
                                 k = delete_chars(runlevels, WHITESPACE "-");
-
                                 if (k[0]) {
                                         char *d;
 
-                                        if (!(d = strdup(k))) {
+                                        d = strdup(k);
+                                        if (!d) {
                                                 r = -ENOMEM;
                                                 goto finish;
                                         }
@@ -982,9 +985,9 @@ static int service_load_sysv_path(Service *s, const char *path) {
                 u->description = d;
         }
 
-        /* The priority that has been set in /etc/rcN.d/ hierarchies
-         * takes precedence over what is stored as default in the LSB
-         * header */
+        /* Initialize the start priority from what has been set in the
+         * /etc/rcN.d/ hierarchies if we load the unit file as SysV
+         * init script. */
         if (s->sysv_start_priority_from_rcnd >= 0)
                 s->sysv_start_priority = s->sysv_start_priority_from_rcnd;