]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
exit-status: introduce EXIT_EXCEPTION mapping to 255
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Nov 2018 15:55:51 +0000 (16:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Nov 2018 16:04:07 +0000 (17:04 +0100)
src/shared/exit-status.c
src/shared/exit-status.h

index 21af8c4c7194ec5881f5e71f5995b0369c366fc9..26b3060d9b939198a3240954ca7af1ae7a6b5df2 100644 (file)
@@ -19,9 +19,10 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) {
          *  79…199 │ (Currently unmapped)
          * 200…241 │ systemd's private error codes (might be extended to 254 in future development)
          * 242…254 │ (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";
                 }
         }
 
index c41e8b82c33aa4292bf29e36a303337669da742f..510eb319cf6b2c06ce93d5074e724a5f82624e0f 100644 (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 {