<term><option>-s</option></term>
<term><option>--signal=</option></term>
- <listitem><para>When used with <command>kill-session</command>
- or <command>kill-user</command>, choose which signal to send
- to selected processes. Must be one of the well known signal
- specifiers, such as <constant>SIGTERM</constant>,
- <constant>SIGINT</constant> or <constant>SIGSTOP</constant>.
- If omitted, defaults to
- <constant>SIGTERM</constant>.</para></listitem>
+ <listitem><para>When used with <command>kill-session</command> or <command>kill-user</command>,
+ choose which signal to send to selected processes. Must be one of the well known signal specifiers,
+ such as <constant>SIGTERM</constant>, <constant>SIGINT</constant> or <constant>SIGSTOP</constant>.
+ If omitted, defaults to <constant>SIGTERM</constant>.</para>
+
+ <para>The special value <literal>help</literal> will list the known values and the program will exit
+ immediately, and the special value <literal>list</literal> will list known values along with the
+ numerical signal numbers and the program will exit immediately.</para></listitem>
</varlistentry>
<varlistentry>
<option>SIGTERM</option>.</para>
<para>The special value <literal>help</literal> will list the known values and the program will exit
- immediately.</para>
+ immediately, and the special value <literal>list</literal> will list known values along with the
+ numerical signal numbers and the program will exit immediately.</para>
</listitem>
</varlistentry>
</variablelist>
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "format-table.h"
#include "parse-argument.h"
#include "signal-util.h"
+#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"
return 0;
}
+ if (streq(s, "list")) {
+ _cleanup_(table_unrefp) Table *table = NULL;
+
+ table = table_new("signal", "name");
+ if (!table)
+ return log_oom();
+
+ for (int i = 1; i < _NSIG; i++) {
+ r = table_add_many(
+ table,
+ TABLE_INT, i,
+ TABLE_SIGNAL, i);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
+
+ r = table_print(table, NULL);
+ if (r < 0)
+ return table_log_print_error(r);
+
+ return 0;
+ }
+
r = signal_from_string(s);
if (r < 0)
return log_error_errno(r, "Failed to parse signal string \"%s\".", s);