ryantimwilson / rpms / systemd

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