1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 This file is part of systemd.
5 Copyright 2012 Lennart Poettering
10 #include "dbus-util.h"
12 #include "signal-util.h"
14 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_kill_mode
, kill_mode
, KillMode
);
16 const sd_bus_vtable bus_kill_vtable
[] = {
17 SD_BUS_VTABLE_START(0),
18 SD_BUS_PROPERTY("KillMode", "s", property_get_kill_mode
, offsetof(KillContext
, kill_mode
), SD_BUS_VTABLE_PROPERTY_CONST
),
19 SD_BUS_PROPERTY("KillSignal", "i", bus_property_get_int
, offsetof(KillContext
, kill_signal
), SD_BUS_VTABLE_PROPERTY_CONST
),
20 SD_BUS_PROPERTY("SendSIGKILL", "b", bus_property_get_bool
, offsetof(KillContext
, send_sigkill
), SD_BUS_VTABLE_PROPERTY_CONST
),
21 SD_BUS_PROPERTY("SendSIGHUP", "b", bus_property_get_bool
, offsetof(KillContext
, send_sighup
), SD_BUS_VTABLE_PROPERTY_CONST
),
25 static BUS_DEFINE_SET_TRANSIENT_PARSE(kill_mode
, KillMode
, kill_mode_from_string
);
26 static BUS_DEFINE_SET_TRANSIENT_TO_STRING(kill_signal
, "i", int32_t, int, "%" PRIi32
, signal_to_string_with_check
);
28 int bus_kill_context_set_transient_property(
32 sd_bus_message
*message
,
34 sd_bus_error
*error
) {
41 flags
|= UNIT_PRIVATE
;
43 if (streq(name
, "KillMode"))
44 return bus_set_transient_kill_mode(u
, name
, &c
->kill_mode
, message
, flags
, error
);
46 if (streq(name
, "SendSIGHUP"))
47 return bus_set_transient_bool(u
, name
, &c
->send_sighup
, message
, flags
, error
);
49 if (streq(name
, "SendSIGKILL"))
50 return bus_set_transient_bool(u
, name
, &c
->send_sigkill
, message
, flags
, error
);
52 if (streq(name
, "KillSignal"))
53 return bus_set_transient_kill_signal(u
, name
, &c
->kill_signal
, message
, flags
, error
);