getopt allows non-ambiguous abbreviations, so backwards-compat is maintained, and
people can use --kill-who (or even shorter abbreviations). English is flexible,
so in common speach people would use both forms, even if "whom" is technically
more correct. The advantage of using the longer form in the code is that we
effectively allow both forms, so we stop punishing people who DTGCT¹, but still
allow people to use the spoken form if they prefer.
1. Do the gramatically correct thing
<term><command>kill-session</command> <replaceable>ID</replaceable>…</term>
<listitem><para>Send a signal to one or more processes of the session. Use
- <option>--kill-who=</option> to select which process to kill. Use <option>--signal=</option> to
+ <option>--kill-whom=</option> to select which process to kill. Use <option>--signal=</option> to
select the signal to send. If the argument is specified as empty string the signal is sent to the
session invoking the command.</para></listitem>
</varlistentry>
</varlistentry>
<varlistentry>
- <term><option>--kill-who=</option></term>
+ <term><option>--kill-whom=</option></term>
<listitem><para>When used with
<command>kill-session</command>, choose which processes to
<listitem><para>Send a signal to one or more processes of the
virtual machine or container. This means processes as seen by
the host, not the processes inside the virtual machine or
- container. Use <option>--kill-who=</option> to select which
+ container. Use <option>--kill-whom=</option> to select which
process to kill. Use <option>--signal=</option> to select the
signal to send.</para></listitem>
</varlistentry>
</varlistentry>
<varlistentry>
- <term><option>--kill-who=</option></term>
+ <term><option>--kill-whom=</option></term>
<listitem><para>When used with <command>kill</command>, choose
which processes to kill. Must be one of
<listitem>
<para>Send a signal to one or more processes of the
- unit. Use <option>--kill-who=</option> to select which
+ unit. Use <option>--kill-whom=</option> to select which
process to kill. Use <option>--signal=</option> to select
the signal to send.</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><option>--kill-who=</option></term>
+ <term><option>--kill-whom=</option></term>
<listitem>
<para>When used with <command>kill</command>, choose which
local -A OPTS=(
[STANDALONE]='--all -a --help -h --no-pager --version
--no-legend --no-ask-password -l --full --value'
- [ARG]='--host -H --kill-who --property -p --signal -s -M --machine
+ [ARG]='--host -H --kill-whom --property -p --signal -s -M --machine
-n --lines -o --output -P'
)
_signals
return
;;
- --kill-who)
+ --kill-whom|--kill-who)
comps='all leader'
;;
--host|-H)
local -A OPTS=(
[STANDALONE]='--all -a -l --full --help -h --no-ask-password --no-legend --no-pager --version --value
--mkdir --read-only --force -q --quiet'
- [ARG]='--host -H --kill-who -M --machine --property -p --signal -s --uid -E --setenv -n --lines
+ [ARG]='--host -H --kill-whom -M --machine --property -p --signal -s --uid -E --setenv -n --lines
-o --output --verify --format --max-addresses'
)
_signals
return
;;
- --kill-who)
+ --kill-whom|--kill-who)
comps='all leader'
;;
--host|-H)
--help -h --no-ask-password --no-block --legend=no --no-pager --no-reload --no-wall --now
--quiet -q --system --user --version --runtime --recursive -r --firmware-setup
--show-types --plain --failed --value --fail --dry-run --wait'
- [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root
+ [ARG]='--host -H --kill-whom --property -p --signal -s --type -t --state --job-mode --root
--preset-mode -n --lines -o --output -M --machine --message --timestamp --check-inhibitors'
)
comps='fail replace replace-irreversibly isolate
ignore-dependencies ignore-requirements flush'
;;
- --kill-who)
+ --kill-whom|--kill-who)
comps='all control main'
;;
--root)
'--version[Show package version]' \
\*{-p+,--property=}'[Show only properties by this name]:unit property' \
{-a,--all}'[Show all properties, including empty ones]' \
- '--kill-who=[Who to send signal to]:killwho:(main control all)' \
+ '--kill-whom=[Whom to send signal to]:killwhom:(main control all)' \
{-s+,--signal=}'[Which signal to send]:signal:_signals' \
{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
{-M+,--machine=}'[Operate on local container]:machine:_sd_machines' \
{-a,--all}'[Show all properties.]' \
{-q,--quiet}'[Suppress output.]' \
{-l,--full}'[Do not ellipsize cgroup members.]' \
- '--kill-who=[Who to send signal to.]:killwho:(leader all)' \
+ '--kill-whom=[Whom to send signal to.]:killwhom:(leader all)' \
{-s+,--signal=}'[Which signal to send.]:signal:_signals' \
'--read-only[Create read-only bind mount.]' \
'--mkdir[Create directory before bind mounting, if missing.]' \
'--global[Enable/disable/mask default user unit files globally]' \
"--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
'--no-ask-password[Do not ask for system passwords]' \
- '--kill-who=[Who to send signal to]:killwho:(main control all)' \
+ '--kill-whom=[Whom to send signal to]:killwhom:(main control all)' \
{-s+,--signal=}'[Which signal to send]:signal:_signals' \
{-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \
'--root=[Enable/disable/mask unit files in the specified root directory]:directory:_directories' \
static bool arg_full = false;
static PagerFlags arg_pager_flags = 0;
static bool arg_legend = true;
-static const char *arg_kill_who = NULL;
+static const char *arg_kill_whom = NULL;
static int arg_signal = SIGTERM;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
static char *arg_host = NULL;
polkit_agent_open_if_enabled(arg_transport, arg_ask_password);
- if (!arg_kill_who)
- arg_kill_who = "all";
+ if (!arg_kill_whom)
+ arg_kill_whom = "all";
for (int i = 1; i < argc; i++) {
bus_login_mgr,
"KillSession",
&error, NULL,
- "ssi", argv[i], arg_kill_who, arg_signal);
+ "ssi", argv[i], arg_kill_whom, arg_signal);
if (r < 0)
return log_error_errno(r, "Could not kill session: %s", bus_error_message(&error, r));
}
polkit_agent_open_if_enabled(arg_transport, arg_ask_password);
- if (!arg_kill_who)
- arg_kill_who = "all";
+ if (!arg_kill_whom)
+ arg_kill_whom = "all";
for (int i = 1; i < argc; i++) {
uid_t uid;
" -a --all Show all properties, including empty ones\n"
" --value When showing properties, only print the value\n"
" -l --full Do not ellipsize output\n"
- " --kill-who=WHO Who to send signal to\n"
+ " --kill-whom=WHOM Whom to send signal to\n"
" -s --signal=SIGNAL Which signal to send\n"
" -n --lines=INTEGER Number of journal entries to show\n"
" -o --output=STRING Change journal output mode (short, short-precise,\n"
ARG_VALUE,
ARG_NO_PAGER,
ARG_NO_LEGEND,
- ARG_KILL_WHO,
+ ARG_KILL_WHOM,
ARG_NO_ASK_PASSWORD,
};
{ "full", no_argument, NULL, 'l' },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
{ "no-legend", no_argument, NULL, ARG_NO_LEGEND },
- { "kill-who", required_argument, NULL, ARG_KILL_WHO },
+ { "kill-whom", required_argument, NULL, ARG_KILL_WHOM },
{ "signal", required_argument, NULL, 's' },
{ "host", required_argument, NULL, 'H' },
{ "machine", required_argument, NULL, 'M' },
arg_ask_password = false;
break;
- case ARG_KILL_WHO:
- arg_kill_who = optarg;
+ case ARG_KILL_WHOM:
+ arg_kill_whom = optarg;
break;
case 's':
static bool arg_full = false;
static PagerFlags arg_pager_flags = 0;
static bool arg_legend = true;
-static const char *arg_kill_who = NULL;
+static const char *arg_kill_whom = NULL;
static int arg_signal = SIGTERM;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
static const char *arg_host = NULL;
polkit_agent_open_if_enabled(arg_transport, arg_ask_password);
- if (!arg_kill_who)
- arg_kill_who = "all";
+ if (!arg_kill_whom)
+ arg_kill_whom = "all";
for (int i = 1; i < argc; i++) {
r = bus_call_method(
"KillMachine",
&error,
NULL,
- "ssi", argv[i], arg_kill_who, arg_signal);
+ "ssi", argv[i], arg_kill_whom, arg_signal);
if (r < 0)
return log_error_errno(r, "Could not kill machine: %s", bus_error_message(&error, r));
}
}
static int reboot_machine(int argc, char *argv[], void *userdata) {
- arg_kill_who = "leader";
+ arg_kill_whom = "leader";
arg_signal = SIGINT; /* sysvinit + systemd */
return kill_machine(argc, argv, userdata);
}
static int poweroff_machine(int argc, char *argv[], void *userdata) {
- arg_kill_who = "leader";
+ arg_kill_whom = "leader";
arg_signal = SIGRTMIN+4; /* only systemd */
return kill_machine(argc, argv, userdata);
" -a --all Show all properties, including empty ones\n"
" --value When showing properties, only print the value\n"
" -l --full Do not ellipsize output\n"
- " --kill-who=WHO Who to send signal to\n"
+ " --kill-whom=WHOM Whom to send signal to\n"
" -s --signal=SIGNAL Which signal to send\n"
" --uid=USER Specify user ID to invoke shell as\n"
" -E --setenv=VAR[=VALUE] Add an environment variable for shell\n"
ARG_NO_PAGER,
ARG_NO_LEGEND,
ARG_VALUE,
- ARG_KILL_WHO,
+ ARG_KILL_WHOM,
ARG_READ_ONLY,
ARG_MKDIR,
ARG_NO_ASK_PASSWORD,
{ "full", no_argument, NULL, 'l' },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
{ "no-legend", no_argument, NULL, ARG_NO_LEGEND },
- { "kill-who", required_argument, NULL, ARG_KILL_WHO },
+ { "kill-whom", required_argument, NULL, ARG_KILL_WHOM },
{ "signal", required_argument, NULL, 's' },
{ "host", required_argument, NULL, 'H' },
{ "machine", required_argument, NULL, 'M' },
arg_legend = false;
break;
- case ARG_KILL_WHO:
- arg_kill_who = optarg;
+ case ARG_KILL_WHOM:
+ arg_kill_whom = optarg;
break;
case 's':
int verb_kill(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **names = NULL;
- char *kill_who = NULL;
+ char *kill_whom = NULL;
sd_bus *bus;
int r, q;
polkit_agent_open_maybe();
- if (!arg_kill_who)
- arg_kill_who = "all";
+ if (!arg_kill_whom)
+ arg_kill_whom = "all";
/* --fail was specified */
if (streq(arg_job_mode(), "fail"))
- kill_who = strjoina(arg_kill_who, "-fail");
+ kill_whom = strjoina(arg_kill_whom, "-fail");
r = expand_unit_names(bus, strv_skip(argv, 1), NULL, &names, NULL);
if (r < 0)
"KillUnit",
&error,
NULL,
- "ssi", *name, kill_who ? kill_who : arg_kill_who, arg_signal);
+ "ssi", *name, kill_whom ?: arg_kill_whom, arg_signal);
if (q < 0) {
log_error_errno(q, "Failed to kill unit %s: %s", *name, bus_error_message(&error, q));
if (r == 0)
bool arg_runtime = false;
UnitFilePresetMode arg_preset_mode = UNIT_FILE_PRESET_FULL;
char **arg_wall = NULL;
-const char *arg_kill_who = NULL;
+const char *arg_kill_whom = NULL;
int arg_signal = SIGTERM;
char *arg_root = NULL;
usec_t arg_when = 0;
STATIC_DESTRUCTOR_REGISTER(arg_properties, strv_freep);
STATIC_DESTRUCTOR_REGISTER(_arg_job_mode, unsetp);
STATIC_DESTRUCTOR_REGISTER(arg_wall, strv_freep);
-STATIC_DESTRUCTOR_REGISTER(arg_kill_who, unsetp);
+STATIC_DESTRUCTOR_REGISTER(arg_kill_whom, unsetp);
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
STATIC_DESTRUCTOR_REGISTER(arg_reboot_argument, unsetp);
STATIC_DESTRUCTOR_REGISTER(arg_host, unsetp);
" Whether to check inhibitors before shutting down,\n"
" sleeping, or hibernating\n"
" -i Shortcut for --check-inhibitors=no\n"
- " --kill-who=WHO Whom to send signal to\n"
+ " --kill-whom=WHOM Whom to send signal to\n"
" -s --signal=SIGNAL Which signal to send\n"
" --what=RESOURCES Which types of resources to remove\n"
" --now Start or stop unit after enabling or disabling it\n"
ARG_NO_WALL,
ARG_ROOT,
ARG_NO_RELOAD,
- ARG_KILL_WHO,
+ ARG_KILL_WHOM,
ARG_NO_ASK_PASSWORD,
ARG_FAILED,
ARG_RUNTIME,
{ "root", required_argument, NULL, ARG_ROOT },
{ "force", no_argument, NULL, 'f' },
{ "no-reload", no_argument, NULL, ARG_NO_RELOAD },
- { "kill-who", required_argument, NULL, ARG_KILL_WHO },
+ { "kill-whom", required_argument, NULL, ARG_KILL_WHOM },
{ "signal", required_argument, NULL, 's' },
{ "no-ask-password", no_argument, NULL, ARG_NO_ASK_PASSWORD },
{ "host", required_argument, NULL, 'H' },
arg_no_reload = true;
break;
- case ARG_KILL_WHO:
- arg_kill_who = optarg;
+ case ARG_KILL_WHOM:
+ arg_kill_whom = optarg;
break;
case 's':
extern bool arg_runtime;
extern UnitFilePresetMode arg_preset_mode;
extern char **arg_wall;
-extern const char *arg_kill_who;
+extern const char *arg_kill_whom;
extern int arg_signal;
extern char *arg_root;
extern usec_t arg_when;
[Service]
ExecStart=/bin/sleep infinity
+# --kill-who= (no 'm') to check that the short form is accepted
ExecStopPost=systemctl kill --kill-who=main -sRTMIN+1 testsuite-57.service
[Service]
ExecStart=/bin/sleep infinity
-ExecStopPost=systemctl kill --kill-who=main -sUSR2 testsuite-57.service
+ExecStopPost=systemctl kill --kill-whom=main -sUSR2 testsuite-57.service
echo "$counter" > /tmp/testsuite-57.counter
if [ "$counter" -eq 5 ] ; then
- systemctl kill --kill-who=main -sUSR1 testsuite-57.service
+ systemctl kill --kill-whom=main -sUSR1 testsuite-57.service
fi
exec sleep 1.5