1 /* SPDX-License-Identifier: LGPL-2.1+ */
10 /* This defines pretty names for the LSB 'start' verb exit codes. Note that they shouldn't be confused with the LSB
11 * 'status' verb exit codes which are defined very differently. For details see:
13 * https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
17 /* EXIT_SUCCESS defined by libc */
18 /* EXIT_FAILURE defined by libc */
19 EXIT_INVALIDARGUMENT
= 2,
20 EXIT_NOTIMPLEMENTED
= 3,
21 EXIT_NOPERMISSION
= 4,
22 EXIT_NOTINSTALLED
= 5,
23 EXIT_NOTCONFIGURED
= 6,
26 /* BSD's sysexits.h defines a couple EX_xyz exit codes in the range 64 … 78 */
28 /* The LSB suggests that error codes >= 200 are "reserved". We use them here under the assumption that they
29 * hence are unused by init scripts. */
40 EXIT_CHROOT
, /* 210 */
50 EXIT_SETSID
, /* 220 */
53 _EXIT_RESERVED
, /* used to be tcpwrap, don't reuse! */
57 EXIT_NO_NEW_PRIVILEGES
,
60 EXIT_PERSONALITY
, /* 230 */
61 EXIT_APPARMOR_PROFILE
,
62 EXIT_ADDRESS_FAMILIES
,
63 EXIT_RUNTIME_DIRECTORY
,
64 _EXIT_RESERVED2
, /* used to be used by kdbus, don't reuse */
66 EXIT_SMACK_PROCESS_LABEL
,
70 EXIT_LOGS_DIRECTORY
, /* 240 */
71 EXIT_CONFIGURATION_DIRECTORY
,
73 EXIT_EXCEPTION
= 255, /* Whenever we want to propagate an abnormal/signal exit, in line with bash */
76 typedef enum ExitStatusLevel
{
77 EXIT_STATUS_MINIMAL
, /* only cover libc EXIT_STATUS/EXIT_FAILURE */
78 EXIT_STATUS_SYSTEMD
, /* cover libc and systemd's own exit codes */
79 EXIT_STATUS_LSB
, /* cover libc, systemd's own and LSB exit codes */
80 EXIT_STATUS_FULL
, /* cover libc, systemd's own, LSB and BSD (EX_xyz) exit codes */
83 typedef struct ExitStatusSet
{
88 const char* exit_status_to_string(int status
, ExitStatusLevel level
) _const_
;
90 typedef enum ExitClean
{
95 bool is_clean_exit(int code
, int status
, ExitClean clean
, ExitStatusSet
*success_status
);
97 void exit_status_set_free(ExitStatusSet
*x
);
98 bool exit_status_set_is_empty(ExitStatusSet
*x
);
99 bool exit_status_set_test(ExitStatusSet
*x
, int code
, int status
);