1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 10:51:20 +03:00

exit-status: introduce EXIT_EXCEPTION mapping to 255

This commit is contained in:
Lennart Poettering 2018-11-20 16:55:51 +01:00
parent 7fa0269bca
commit 3584d3ca4f
2 changed files with 9 additions and 3 deletions

View File

@ -19,9 +19,10 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) {
* 79199 (Currently unmapped)
* 200241 systemd's private error codes (might be extended to 254 in future development)
* 242254 (Currently unmapped, but see above)
* 255 (We should probably stay away from that one, it's frequently used by applications to indicate an
* exit reason that cannot really be expressed in a single exit status value such as a propagated
* signal or such)
*
* 255 EXIT_EXCEPTION (We use this to propagate exit-by-signal events. It's frequently used by others apps (like bash)
* to indicate exit reason that cannot really be expressed in a single exit status value such as a propagated
* signal or such, and we follow that logic here.)
*/
switch (status) { /* We always cover the ISO C ones */
@ -155,6 +156,9 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) {
case EXIT_CONFIGURATION_DIRECTORY:
return "CONFIGURATION_DIRECTORY";
case EXIT_EXCEPTION:
return "EXCEPTION";
}
}

View File

@ -69,6 +69,8 @@ enum {
EXIT_CACHE_DIRECTORY,
EXIT_LOGS_DIRECTORY, /* 240 */
EXIT_CONFIGURATION_DIRECTORY,
EXIT_EXCEPTION = 255, /* Whenever we want to propagate an abnormal/signal exit, in line with bash */
};
typedef enum ExitStatusLevel {