analyze: rename "exit-codes" to "exit-status"

waitid(2) and the libc function signature calls this "exit status", and
uses "exit code" for something different. Let's stick to the same
nomenclature hence.
This commit is contained in:
Lennart Poettering 2019-07-29 19:18:56 +02:00
parent 563067ad26
commit 5238d9a83a
3 changed files with 28 additions and 28 deletions

6
NEWS
View File

@ -106,9 +106,9 @@ CHANGES WITH 243 in spe:
unambiguously distinguished. unambiguously distinguished.
* SuccessExitStatus=, RestartPreventExitStatus=, and * SuccessExitStatus=, RestartPreventExitStatus=, and
RestartForceExitStatus= now accept exit code names (e.g. "DATAERR" is RestartForceExitStatus= now accept exit status names (e.g. "DATAERR"
equivalent to "65"). systemd-analyze learnt a new 'exit-codes' verb is equivalent to "65"). systemd-analyze learnt a new 'exit-status'
to display those exit code name mappings. verb to display those exit status name mappings.
* /usr/sbin/halt.local is no longer supported. Implementation in * /usr/sbin/halt.local is no longer supported. Implementation in
distributions was inconsistent and it seems this functionality was distributions was inconsistent and it seems this functionality was

View File

@ -86,8 +86,8 @@
<cmdsynopsis> <cmdsynopsis>
<command>systemd-analyze</command> <command>systemd-analyze</command>
<arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt" rep="repeat">OPTIONS</arg>
<arg choice="plain">exit-codes</arg> <arg choice="plain">exit-status</arg>
<arg choice="opt" rep="repeat"><replaceable>CODE</replaceable></arg> <arg choice="opt" rep="repeat"><replaceable>STATUS</replaceable></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
<command>systemd-analyze</command> <command>systemd-analyze</command>
@ -372,25 +372,25 @@ $ eog targets.svg</programlisting>
</refsect2> </refsect2>
<refsect2> <refsect2>
<title><command>systemd-analyze exit-codes <optional><replaceable>CODE</replaceable>...</optional></command></title> <title><command>systemd-analyze exit-status <optional><replaceable>STATUS</replaceable>...</optional></command></title>
<para>This command prints a list of exit codes along with their "class", i.e. the source of the <para>This command prints a list of exit statuses along with their "class", i.e. the source of the
definition (one of <literal>glibc</literal>, <literal>systemd</literal>, <literal>LSB</literal>, or definition (one of <literal>glibc</literal>, <literal>systemd</literal>, <literal>LSB</literal>, or
<literal>BSD</literal>), see the Process Exit Codes section in <literal>BSD</literal>), see the Process Exit Codes section in
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
If no additional arguments are specified, all known codes are are shown. Otherwise, only the If no additional arguments are specified, all known statuses are are shown. Otherwise, only the
definitions for the specified codes are shown.</para> definitions for the specified codes are shown.</para>
<example> <example>
<title><command>Show some example exit code names</command></title> <title><command>Show some example exit status names</command></title>
<programlisting>$ systemd-analyze exit-codes 0 1 {63..65} <programlisting>$ systemd-analyze exit-status 0 1 {63..65}
NAME CODE CLASS NAME STATUS CLASS
SUCCESS 0 glibc SUCCESS 0 glibc
FAILURE 1 glibc FAILURE 1 glibc
- 63 - - 63 -
USAGE 64 BSD USAGE 64 BSD
DATAERR 65 BSD DATAERR 65 BSD
</programlisting> </programlisting>
</example> </example>
</refsect2> </refsect2>

View File

@ -1638,11 +1638,11 @@ static void dump_syscall_filter(const SyscallFilterSet *set) {
printf(" %s%s%s\n", syscall[0] == '@' ? ansi_underline() : "", syscall, ansi_normal()); printf(" %s%s%s\n", syscall[0] == '@' ? ansi_underline() : "", syscall, ansi_normal());
} }
static int dump_exit_codes(int argc, char *argv[], void *userdata) { static int dump_exit_status(int argc, char *argv[], void *userdata) {
_cleanup_(table_unrefp) Table *table = NULL; _cleanup_(table_unrefp) Table *table = NULL;
int r; int r;
table = table_new("name", "code", "class"); table = table_new("name", "status", "class");
if (!table) if (!table)
return log_oom(); return log_oom();
@ -1660,17 +1660,17 @@ static int dump_exit_codes(int argc, char *argv[], void *userdata) {
} }
else else
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
int code; int status;
code = exit_status_from_string(argv[i]); status = exit_status_from_string(argv[i]);
if (code < 0) if (status < 0)
return log_error_errno(r, "Invalid exit code \"%s\": %m", argv[i]); return log_error_errno(r, "Invalid exit status \"%s\": %m", argv[i]);
assert(code >= 0 && (size_t) code < ELEMENTSOF(exit_status_mappings)); assert(status >= 0 && (size_t) status < ELEMENTSOF(exit_status_mappings));
r = table_add_many(table, r = table_add_many(table,
TABLE_STRING, exit_status_mappings[code].name ?: "-", TABLE_STRING, exit_status_mappings[status].name ?: "-",
TABLE_INT, code, TABLE_INT, status,
TABLE_STRING, exit_status_class(code) ?: "-"); TABLE_STRING, exit_status_class(status) ?: "-");
if (r < 0) if (r < 0)
return r; return r;
} }
@ -2213,7 +2213,7 @@ static int help(int argc, char *argv[], void *userdata) {
" dump Output state serialization of service manager\n" " dump Output state serialization of service manager\n"
" cat-config Show configuration file and drop-ins\n" " cat-config Show configuration file and drop-ins\n"
" unit-paths List load directories for units\n" " unit-paths List load directories for units\n"
" exit-codes List exit code definitions\n" " exit-status List exit status definitions\n"
" syscall-filter [NAME...] Print list of syscalls in seccomp filter\n" " syscall-filter [NAME...] Print list of syscalls in seccomp filter\n"
" condition CONDITION... Evaluate conditions and asserts\n" " condition CONDITION... Evaluate conditions and asserts\n"
" verify FILE... Check unit files for correctness\n" " verify FILE... Check unit files for correctness\n"
@ -2418,7 +2418,7 @@ static int run(int argc, char *argv[]) {
{ "dump", VERB_ANY, 1, 0, dump }, { "dump", VERB_ANY, 1, 0, dump },
{ "cat-config", 2, VERB_ANY, 0, cat_config }, { "cat-config", 2, VERB_ANY, 0, cat_config },
{ "unit-paths", 1, 1, 0, dump_unit_paths }, { "unit-paths", 1, 1, 0, dump_unit_paths },
{ "exit-codes", VERB_ANY, VERB_ANY, 0, dump_exit_codes }, { "exit-status", VERB_ANY, VERB_ANY, 0, dump_exit_status },
{ "syscall-filter", VERB_ANY, VERB_ANY, 0, dump_syscall_filters }, { "syscall-filter", VERB_ANY, VERB_ANY, 0, dump_syscall_filters },
{ "condition", 2, VERB_ANY, 0, do_condition }, { "condition", 2, VERB_ANY, 0, do_condition },
{ "verify", 2, VERB_ANY, 0, do_verify }, { "verify", 2, VERB_ANY, 0, do_verify },