]> git.ipfire.org Git - thirdparty/systemd.git/commit
exit-status: list BSD exit codes too
authorLennart Poettering <lennart@poettering.net>
Mon, 23 Apr 2018 17:26:25 +0000 (19:26 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 27 Apr 2018 15:32:01 +0000 (17:32 +0200)
commit0a233ba1795fc526e8b604da9893ee3e3a6702c3
tree62e5f14b9ecfe50fb83dad0961a0a45ab6212110
parent3e0bff7d0b812357c43aa831c57a34f00cdf2f31
exit-status: list BSD exit codes too

Let's optionally translate BSD exit codes to error strings too.

My first approach on adding this was to turn ExitStatusLevel into a
bitmask rather than a linear level, with one bit for the various feature
bits. However, the exit code ranges are generally not defined
independently from each other, i.e. our own ones are defined with the
LSB ones in mind, and most sets are defined with the ISO C ones.

Hence, instead I changed the existing hierarchy of MINIMAL, SYSTEMD, LSB
with an alias of FULL == LSB, only slightly by seperating FULL and LSB
into two separate levels, so that there's now:

1. MINIMAL (only EXIT_SUCCESS/EXIT_FAILURE)
2. SYSTEMD (incorporating our own exit codes)
3. LSB (like SYSTEMD but adding in LSB service exit codes)
4. FULL (like FULL but adding BSD exit codes)

Note that across the codebase only FULL, SYSTEMD, and MINIMAL are used,
depending on context, how much we know about the process and whether we
are logging for debugging purposes or not. This means the LSB level
wouldn't really have to be separate, but it appeared careless to me to
fold it into FULL along with the BSD exit codes.

Note that this commit doesn't change much for regular codepaths: the
FULL exit status level is only used during debug logging, as a helper to
the user reading the debug logs.
src/basic/exit-status.c
src/basic/exit-status.h