summaryrefslogtreecommitdiff
path: root/src/dbus-unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus-unit.c')
-rw-r--r--src/dbus-unit.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/dbus-unit.c b/src/dbus-unit.c
index 45eba8ab55..47aa8d338c 100644
--- a/src/dbus-unit.c
+++ b/src/dbus-unit.c
@@ -367,6 +367,34 @@ static DBusHandlerResult bus_unit_message_dispatch(Unit *u, DBusConnection *conn
} else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Unit", "ReloadOrTryRestart")) {
reload_if_possible = true;
job_type = JOB_TRY_RESTART;
+ } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Unit", "Kill")) {
+ const char *swho, *smode;
+ int32_t signo;
+ KillMode mode;
+ KillWho who;
+ int r;
+
+ if (!dbus_message_get_args(
+ message,
+ &error,
+ DBUS_TYPE_STRING, &swho,
+ DBUS_TYPE_STRING, &smode,
+ DBUS_TYPE_INT32, &signo,
+ DBUS_TYPE_INVALID))
+ return bus_send_error_reply(m, connection, message, &error, -EINVAL);
+
+ if ((mode = kill_mode_from_string(smode)) < 0 ||
+ (who = kill_who_from_string(swho)) < 0 ||
+ signo <= 0 ||
+ signo >= _NSIG)
+ return bus_send_error_reply(m, connection, message, &error, -EINVAL);
+
+ if ((r = unit_kill(u, who, mode, signo, &error)) < 0)
+ return bus_send_error_reply(m, connection, message, &error, r);
+
+ if (!(reply = dbus_message_new_method_return(message)))
+ goto oom;
+
} else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Unit", "ResetFailed")) {
unit_reset_failed(u);