ryantimwilson / rpms / systemd

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