1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2010 Lennart Poettering
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
29 /* This defines pretty names for the LSB 'start' verb exit codes. Note that they shouldn't be confused with the LSB
30 * 'status' verb exit codes which are defined very differently. For details see:
32 * https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
36 /* EXIT_SUCCESS defined by libc */
37 /* EXIT_FAILURE defined by libc */
38 EXIT_INVALIDARGUMENT
= 2,
39 EXIT_NOTIMPLEMENTED
= 3,
40 EXIT_NOPERMISSION
= 4,
41 EXIT_NOTINSTALLED
= 5,
42 EXIT_NOTCONFIGURED
= 6,
45 /* The LSB suggests that error codes >= 200 are "reserved". We
46 * use them here under the assumption that they hence are
47 * unused by init scripts. */
59 EXIT_CHROOT
, /* 210 */
69 EXIT_SETSID
, /* 220 */
72 _EXIT_RESERVED
, /* used to be tcpwrap, don't reuse! */
76 EXIT_NO_NEW_PRIVILEGES
,
79 EXIT_PERSONALITY
, /* 230 */
80 EXIT_APPARMOR_PROFILE
,
81 EXIT_ADDRESS_FAMILIES
,
82 EXIT_RUNTIME_DIRECTORY
,
83 _EXIT_RESERVED2
, /* used to be used by kdbus, don't reuse */
85 EXIT_SMACK_PROCESS_LABEL
,
89 EXIT_LOGS_DIRECTORY
, /* 240 */
90 EXIT_CONFIGURATION_DIRECTORY
,
93 typedef enum ExitStatusLevel
{
94 EXIT_STATUS_MINIMAL
, /* only cover libc EXIT_STATUS/EXIT_FAILURE */
95 EXIT_STATUS_SYSTEMD
, /* cover libc and systemd's own exit codes */
96 EXIT_STATUS_LSB
, /* cover libc, systemd's own and LSB exit codes */
97 EXIT_STATUS_FULL
= EXIT_STATUS_LSB
100 typedef struct ExitStatusSet
{
105 const char* exit_status_to_string(int status
, ExitStatusLevel level
) _const_
;
107 typedef enum ExitClean
{
112 bool is_clean_exit(int code
, int status
, ExitClean clean
, ExitStatusSet
*success_status
);
114 void exit_status_set_free(ExitStatusSet
*x
);
115 bool exit_status_set_is_empty(ExitStatusSet
*x
);
116 bool exit_status_set_test(ExitStatusSet
*x
, int code
, int status
);