ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
ecbff1
From ab0cdf76c184cbe7f8376e0a2c8d7a60d10ca9b3 Mon Sep 17 00:00:00 2001
ecbff1
From: Werner Fink <werner@suse.de>
ecbff1
Date: Wed, 10 Jun 2015 14:36:50 +0200
ecbff1
Subject: [PATCH] core: Let two more booleans survive a daemon-reload
ecbff1
ecbff1
Without the boolean bus_name_good services as well as cgroup_realized
ecbff1
for units a unit of Type=dbus and ExecReload sending SIGHUP to $MAINPID
ecbff1
will be terminated if systemd will be daemon reloaded.
ecbff1
ecbff1
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=746151
ecbff1
https://bugs.freedesktop.org/show_bug.cgi?id=78311
ecbff1
https://bugzilla.opensuse.org/show_bug.cgi?id=934077
ecbff1
ecbff1
Cherry-picked from: de1d4f9b5c6345f63edd46f643485eca909995bf
ecbff1
Resolves: #1542391
ecbff1
---
ecbff1
 src/core/service.c |  9 +++++++++
ecbff1
 src/core/unit.c    | 11 +++++++++++
ecbff1
 2 files changed, 20 insertions(+)
ecbff1
ecbff1
diff --git a/src/core/service.c b/src/core/service.c
ecbff1
index ceed1cc2e..71ec5e37c 100644
ecbff1
--- a/src/core/service.c
ecbff1
+++ b/src/core/service.c
ecbff1
@@ -2044,6 +2044,7 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
ecbff1
                 unit_serialize_item_format(u, f, "main-pid", PID_FMT, s->main_pid);
ecbff1
 
ecbff1
         unit_serialize_item(u, f, "main-pid-known", yes_no(s->main_pid_known));
ecbff1
+        unit_serialize_item(u, f, "bus-name-good", yes_no(s->bus_name_good));
ecbff1
 
ecbff1
         if (s->status_text)
ecbff1
                 unit_serialize_item(u, f, "status-text", s->status_text);
ecbff1
@@ -2264,6 +2265,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
ecbff1
                         log_unit_debug(u->id, "Failed to parse main-pid-known value %s", value);
ecbff1
                 else
ecbff1
                         s->main_pid_known = b;
ecbff1
+        } else if (streq(key, "bus-name-good")) {
ecbff1
+                int b;
ecbff1
+
ecbff1
+                b = parse_boolean(value);
ecbff1
+                if (b < 0)
ecbff1
+                        log_unit_debug(u->id, "Failed to parse bus-name-good value: %s", value);
ecbff1
+                else
ecbff1
+                        s->bus_name_good = b;
ecbff1
         } else if (streq(key, "status-text")) {
ecbff1
                 char *t;
ecbff1
 
ecbff1
diff --git a/src/core/unit.c b/src/core/unit.c
ecbff1
index 8c0fde878..41d7b63d7 100644
ecbff1
--- a/src/core/unit.c
ecbff1
+++ b/src/core/unit.c
ecbff1
@@ -2619,6 +2619,7 @@ int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) {
ecbff1
 
ecbff1
         if (u->cgroup_path)
ecbff1
                 unit_serialize_item(u, f, "cgroup", u->cgroup_path);
ecbff1
+        unit_serialize_item(u, f, "cgroup-realized", yes_no(u->cgroup_realized));
ecbff1
 
ecbff1
         if (serialize_jobs) {
ecbff1
                 if (u->job) {
ecbff1
@@ -2809,6 +2810,16 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
ecbff1
                         u->cgroup_path = s;
ecbff1
                         assert(hashmap_put(u->manager->cgroup_unit, s, u) == 1);
ecbff1
 
ecbff1
+                        continue;
ecbff1
+                } else if (streq(l, "cgroup-realized")) {
ecbff1
+                        int b;
ecbff1
+
ecbff1
+                        b = parse_boolean(v);
ecbff1
+                        if (b < 0)
ecbff1
+                                log_unit_debug(u->id, "Failed to parse cgroup-realized bool %s, ignoring.", v);
ecbff1
+                        else
ecbff1
+                                u->cgroup_realized = b;
ecbff1
+
ecbff1
                         continue;
ecbff1
                 }
ecbff1