chiark / gitweb /
config_parse_set_status: put signals in the correct set
[elogind.git] / src / core / dbus-kill.c
index 42488b1f54e97fbe85ec413908b2c5c9a4b00f06..fb29e147cbd0910b2f817b1528b5b3a833bd9305 100644 (file)
@@ -19,7 +19,6 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "bus-util.h"
 #include "kill.h"
 #include "dbus-kill.h"
 #include "bus-util.h"
@@ -28,10 +27,10 @@ static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_kill_mode, kill_mode, KillMode)
 
 const sd_bus_vtable bus_kill_vtable[] = {
         SD_BUS_VTABLE_START(0),
-        SD_BUS_PROPERTY("KillMode", "s", property_get_kill_mode, offsetof(KillContext, kill_mode), 0),
-        SD_BUS_PROPERTY("KillSignal", "i", bus_property_get_int, offsetof(KillContext, kill_signal), 0),
-        SD_BUS_PROPERTY("SendSIGKILL", "b", bus_property_get_bool, offsetof(KillContext, send_sigkill), 0),
-        SD_BUS_PROPERTY("SendSIGHUP", "b", bus_property_get_bool,  offsetof(KillContext, send_sighup), 0),
+        SD_BUS_PROPERTY("KillMode", "s", property_get_kill_mode, offsetof(KillContext, kill_mode), SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("KillSignal", "i", bus_property_get_int, offsetof(KillContext, kill_signal), SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("SendSIGKILL", "b", bus_property_get_bool, offsetof(KillContext, send_sigkill), SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("SendSIGHUP", "b", bus_property_get_bool,  offsetof(KillContext, send_sighup), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_VTABLE_END
 };
 
@@ -70,6 +69,24 @@ int bus_kill_context_set_transient_property(
 
                 return 1;
 
+        } else if (streq(name, "KillSignal")) {
+                int sig;
+
+                r = sd_bus_message_read(message, "i", &sig);
+                if (r < 0)
+                        return r;
+
+                if (sig <= 0 || sig >= _NSIG)
+                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Signal %i out of range", sig);
+
+                if (mode != UNIT_CHECK) {
+                        c->kill_signal = sig;
+
+                        unit_write_drop_in_private_format(u, mode, name, "KillSignal=%s\n", signal_to_string(sig));
+                }
+
+                return 1;
+
         } else if (streq(name, "SendSIGHUP")) {
                 int b;