X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Funit.c;h=d2f60801a9a2a1ad8c5916216c0a143fdc20e03e;hb=b9ba604e8720c30deb7095b049b577eec1cbb74a;hp=ab6eb20227c1c9c1b2177228646ad422826d30a8;hpb=9fc507041eb524799a0410839e961ec188a78491;p=elogind.git diff --git a/src/unit.c b/src/unit.c index ab6eb2022..d2f60801a 100644 --- a/src/unit.c +++ b/src/unit.c @@ -2252,6 +2252,22 @@ bool unit_name_is_valid(const char *n, bool template_ok) { return unit_name_is_valid_no_type(n, template_ok); } +int unit_kill(Unit *u, KillWho w, KillMode m, int signo, DBusError *error) { + assert(u); + assert(w >= 0 && w < _KILL_WHO_MAX); + assert(m >= 0 && m < _KILL_MODE_MAX); + assert(signo > 0); + assert(signo < _NSIG); + + if (m == KILL_NONE) + return 0; + + if (!UNIT_VTABLE(u)->kill) + return -ENOTSUP; + + return UNIT_VTABLE(u)->kill(u, w, m, signo, error); +} + static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = { [UNIT_STUB] = "stub", [UNIT_LOADED] = "loaded", @@ -2292,12 +2308,3 @@ static const char* const unit_dependency_table[_UNIT_DEPENDENCY_MAX] = { }; DEFINE_STRING_TABLE_LOOKUP(unit_dependency, UnitDependency); - -static const char* const kill_mode_table[_KILL_MODE_MAX] = { - [KILL_CONTROL_GROUP] = "control-group", - [KILL_PROCESS_GROUP] = "process-group", - [KILL_PROCESS] = "process", - [KILL_NONE] = "none" -}; - -DEFINE_STRING_TABLE_LOOKUP(kill_mode, KillMode);