core: followups for the recent subgroup killing commits
This is a follow-up for0f23564ad4and6b02854f50, as suggested here: https://github.com/systemd/systemd/pull/37855#pullrequestreview-2997596953
This commit is contained in:
committed by
Yu Watanabe
parent
dee77ac201
commit
03b4a607f6
@@ -826,14 +826,14 @@ static int method_start_unit_replace(sd_bus_message *message, void *userdata, sd
|
||||
}
|
||||
|
||||
static int method_kill_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* We don't bother with GENERIC_UNIT_LOAD nor GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't
|
||||
* matter whether a unit is loaded for killing any processes possibly in the unit's cgroup. */
|
||||
/* We don't bother with GENERIC_UNIT_LOAD or GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't
|
||||
* matter whether a unit is loaded for killing any processes in the unit's cgroup. */
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_kill, 0);
|
||||
}
|
||||
|
||||
static int method_kill_unit_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* We don't bother with GENERIC_UNIT_LOAD nor GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't
|
||||
* matter whether a unit is loaded for killing any processes possibly in the unit's cgroup. */
|
||||
/* We don't bother with GENERIC_UNIT_LOAD or GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't
|
||||
* matter whether a unit is loaded for killing any processes in the unit's cgroup. */
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_kill_subgroup, 0);
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -4065,10 +4065,12 @@ int unit_kill(
|
||||
|
||||
if (subgroup) {
|
||||
if (!IN_SET(whom, KILL_CGROUP, KILL_CGROUP_FAIL))
|
||||
return sd_bus_error_set(ret_error, SD_BUS_ERROR_NOT_SUPPORTED, "Killing by subgroup is only supported for 'cgroup' or 'cgroup-kill' modes.");
|
||||
return sd_bus_error_set(ret_error, SD_BUS_ERROR_NOT_SUPPORTED,
|
||||
"Killing by subgroup is only supported for 'cgroup' or 'cgroup-kill' modes.");
|
||||
|
||||
if (!unit_cgroup_delegate(u))
|
||||
return sd_bus_error_set(ret_error, SD_BUS_ERROR_NOT_SUPPORTED, "Killing by subgroup is only available for units with control group delegation enabled.");
|
||||
return sd_bus_error_set(ret_error, SD_BUS_ERROR_NOT_SUPPORTED,
|
||||
"Killing by subgroup is only available for units with control group delegation enabled.");
|
||||
}
|
||||
|
||||
main_pid = unit_main_pid(u);
|
||||
|
||||
@@ -260,7 +260,7 @@ static int systemctl_help(void) {
|
||||
" --kill-whom=WHOM Whom to send signal to\n"
|
||||
" --kill-value=INT Signal value to enqueue\n"
|
||||
" --kill-subgroup=PATH\n"
|
||||
" Send signal to sub-control-group only\n"
|
||||
" Send signal to sub-control group only\n"
|
||||
" --what=RESOURCES Which types of resources to remove\n"
|
||||
" --now Start or stop unit after enabling or disabling it\n"
|
||||
" --dry-run Only print what would be done\n"
|
||||
|
||||
Reference in New Issue
Block a user