diff --git a/NEWS b/NEWS
index e4a1556d86..f10380113c 100644
--- a/NEWS
+++ b/NEWS
@@ -106,9 +106,9 @@ CHANGES WITH 243 in spe:
unambiguously distinguished.
* SuccessExitStatus=, RestartPreventExitStatus=, and
- RestartForceExitStatus= now accept exit code names (e.g. "DATAERR" is
- equivalent to "65"). systemd-analyze learnt a new 'exit-codes' verb
- to display those exit code name mappings.
+ RestartForceExitStatus= now accept exit status names (e.g. "DATAERR"
+ is equivalent to "65"). systemd-analyze learnt a new 'exit-status'
+ verb to display those exit status name mappings.
* /usr/sbin/halt.local is no longer supported. Implementation in
distributions was inconsistent and it seems this functionality was
diff --git a/man/systemd-analyze.xml b/man/systemd-analyze.xml
index 8e9f24caac..7e842ac201 100644
--- a/man/systemd-analyze.xml
+++ b/man/systemd-analyze.xml
@@ -86,8 +86,8 @@
systemd-analyze
OPTIONS
- exit-codes
- CODE
+ exit-status
+ STATUS
systemd-analyze
@@ -372,25 +372,25 @@ $ eog targets.svg
- systemd-analyze exit-codes CODE...
+ systemd-analyze exit-status STATUS...
- This command prints a list of exit codes along with their "class", i.e. the source of the
+ This command prints a list of exit statuses along with their "class", i.e. the source of the
definition (one of glibc, systemd, LSB, or
BSD), see the Process Exit Codes section in
systemd.exec5.
- 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.
- Show some example exit code names
+ Show some example exit status names
- $ systemd-analyze exit-codes 0 1 {63..65}
-NAME CODE CLASS
-SUCCESS 0 glibc
-FAILURE 1 glibc
-- 63 -
-USAGE 64 BSD
-DATAERR 65 BSD
+ $ systemd-analyze exit-status 0 1 {63..65}
+NAME STATUS CLASS
+SUCCESS 0 glibc
+FAILURE 1 glibc
+- 63 -
+USAGE 64 BSD
+DATAERR 65 BSD
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index f9c3f41890..fbbfd4f514 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -2718,8 +2718,7 @@ StandardInputData=SWNrIHNpdHplIGRhIHVuJyBlc3NlIEtsb3BzLAp1ZmYgZWVtYWwga2xvcHAncy
The following service exit codes are defined by the LSB specification
- .
+ url="https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB specification.
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 45e41fedee..e5c0cc853d 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1638,14 +1638,18 @@ static void dump_syscall_filter(const SyscallFilterSet *set) {
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;
int r;
- table = table_new("name", "code", "class");
+ table = table_new("name", "status", "class");
if (!table)
return log_oom();
+ r = table_set_align_percent(table, table_get_cell(table, 0, 1), 100);
+ if (r < 0)
+ return log_error_errno(r, "Failed to right-align status: %m");
+
if (strv_isempty(strv_skip(argv, 1)))
for (size_t i = 0; i < ELEMENTSOF(exit_status_mappings); i++) {
if (!exit_status_mappings[i].name)
@@ -1653,24 +1657,24 @@ static int dump_exit_codes(int argc, char *argv[], void *userdata) {
r = table_add_many(table,
TABLE_STRING, exit_status_mappings[i].name,
- TABLE_UINT, i,
+ TABLE_INT, (int) i,
TABLE_STRING, exit_status_class(i));
if (r < 0)
return r;
}
else
for (int i = 1; i < argc; i++) {
- int code;
+ int status;
- code = exit_status_from_string(argv[i]);
- if (code < 0)
- return log_error_errno(r, "Invalid exit code \"%s\": %m", argv[i]);
+ status = exit_status_from_string(argv[i]);
+ if (status < 0)
+ 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,
- TABLE_STRING, exit_status_mappings[code].name ?: "-",
- TABLE_UINT, code,
- TABLE_STRING, exit_status_class(code) ?: "-");
+ TABLE_STRING, exit_status_mappings[status].name ?: "-",
+ TABLE_INT, status,
+ TABLE_STRING, exit_status_class(status) ?: "-");
if (r < 0)
return r;
}
@@ -2213,7 +2217,7 @@ static int help(int argc, char *argv[], void *userdata) {
" dump Output state serialization of service manager\n"
" cat-config Show configuration file and drop-ins\n"
" unit-paths List load directories for units\n"
- " exit-codes List exit code definitions\n"
+ " exit-status [STATUS...] List exit status definitions\n"
" syscall-filter [NAME...] Print list of syscalls in seccomp filter\n"
" condition CONDITION... Evaluate conditions and asserts\n"
" verify FILE... Check unit files for correctness\n"
@@ -2418,7 +2422,7 @@ static int run(int argc, char *argv[]) {
{ "dump", VERB_ANY, 1, 0, dump },
{ "cat-config", 2, VERB_ANY, 0, cat_config },
{ "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 },
{ "condition", 2, VERB_ANY, 0, do_condition },
{ "verify", 2, VERB_ANY, 0, do_verify },
diff --git a/src/core/execute.c b/src/core/execute.c
index 5b55557f4e..21127d4f70 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -3881,7 +3881,7 @@ int exec_spawn(Unit *unit,
if (r < 0) {
const char *status =
exit_status_to_string(exit_status,
- EXIT_STATUS_GLIBC | EXIT_STATUS_SYSTEMD);
+ EXIT_STATUS_LIBC | EXIT_STATUS_SYSTEMD);
log_struct_errno(LOG_ERR, r,
"MESSAGE_ID=" SD_MESSAGE_SPAWN_FAILED_STR,
diff --git a/src/core/main.c b/src/core/main.c
index 0698f893fd..bcce7178a8 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -223,7 +223,7 @@ _noreturn_ static void crash(int sig) {
log_emergency_errno(r, "Caught <%s>, waitpid() failed: %m", signal_to_string(sig));
else if (status.si_code != CLD_DUMPED) {
const char *s = status.si_code == CLD_EXITED
- ? exit_status_to_string(status.si_status, EXIT_STATUS_GLIBC)
+ ? exit_status_to_string(status.si_status, EXIT_STATUS_LIBC)
: signal_to_string(status.si_status);
log_emergency("Caught <%s>, core dump failed (child "PID_FMT", code=%s, status=%i/%s).",
diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c
index 80ac4868cb..44b1c9b749 100644
--- a/src/shared/exit-status.c
+++ b/src/shared/exit-status.c
@@ -26,8 +26,8 @@ const ExitStatusMapping exit_status_mappings[256] = {
* │ signal or such, and we follow that logic here.)
*/
- [EXIT_SUCCESS] = { "SUCCESS", EXIT_STATUS_GLIBC },
- [EXIT_FAILURE] = { "FAILURE", EXIT_STATUS_GLIBC },
+ [EXIT_SUCCESS] = { "SUCCESS", EXIT_STATUS_LIBC },
+ [EXIT_FAILURE] = { "FAILURE", EXIT_STATUS_LIBC },
[EXIT_CHDIR] = { "CHDIR", EXIT_STATUS_SYSTEMD },
[EXIT_NICE] = { "NICE", EXIT_STATUS_SYSTEMD },
@@ -107,8 +107,8 @@ const char* exit_status_class(int code) {
return NULL;
switch (exit_status_mappings[code].class) {
- case EXIT_STATUS_GLIBC:
- return "glibc";
+ case EXIT_STATUS_LIBC:
+ return "libc";
case EXIT_STATUS_SYSTEMD:
return "systemd";
case EXIT_STATUS_LSB:
diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h
index d6da8c19b9..9ea147c842 100644
--- a/src/shared/exit-status.h
+++ b/src/shared/exit-status.h
@@ -75,11 +75,11 @@ enum {
};
typedef enum ExitStatusClass {
- EXIT_STATUS_GLIBC = 1 << 0, /* libc EXIT_STATUS/EXIT_FAILURE */
+ EXIT_STATUS_LIBC = 1 << 0, /* libc EXIT_STATUS/EXIT_FAILURE */
EXIT_STATUS_SYSTEMD = 1 << 1, /* systemd's own exit codes */
EXIT_STATUS_LSB = 1 << 2, /* LSB exit codes */
EXIT_STATUS_BSD = 1 << 3, /* BSD (EX_xyz) exit codes */
- EXIT_STATUS_FULL = EXIT_STATUS_GLIBC | EXIT_STATUS_SYSTEMD | EXIT_STATUS_LSB | EXIT_STATUS_BSD,
+ EXIT_STATUS_FULL = EXIT_STATUS_LIBC | EXIT_STATUS_SYSTEMD | EXIT_STATUS_LSB | EXIT_STATUS_BSD,
} ExitStatusClass;
typedef struct ExitStatusSet {
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 880a04411c..82babaa691 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4380,7 +4380,7 @@ static void print_status_info(
printf("status=%i", p->status);
- c = exit_status_to_string(p->status, EXIT_STATUS_GLIBC | EXIT_STATUS_SYSTEMD);
+ c = exit_status_to_string(p->status, EXIT_STATUS_LIBC | EXIT_STATUS_SYSTEMD);
if (c)
printf("/%s", c);
@@ -4422,7 +4422,7 @@ static void print_status_info(
printf("status=%i", i->exit_status);
c = exit_status_to_string(i->exit_status,
- EXIT_STATUS_GLIBC | EXIT_STATUS_SYSTEMD);
+ EXIT_STATUS_LIBC | EXIT_STATUS_SYSTEMD);
if (c)
printf("/%s", c);