1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright 2010 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 #include "exit-status.h"
26 const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level) {
28 /* We cast to int here, so that -Wenum doesn't complain that
29 * EXIT_SUCCESS/EXIT_FAILURE aren't in the enum */
31 switch ((int) status) {
41 if (level == EXIT_STATUS_SYSTEMD || level == EXIT_STATUS_LSB) {
42 switch ((int) status) {
65 case EXIT_SIGNAL_MASK:
86 case EXIT_SETSCHEDULER:
87 return "SETSCHEDULER";
89 case EXIT_CPUAFFINITY:
98 case EXIT_CAPABILITIES:
99 return "CAPABILITIES";
121 if (level == EXIT_STATUS_LSB) {
122 switch ((int) status) {
124 case EXIT_INVALIDARGUMENT:
125 return "INVALIDARGUMENT";
127 case EXIT_NOTIMPLEMENTED:
128 return "NOTIMPLEMENTED";
130 case EXIT_NOPERMISSION:
131 return "NOPERMISSION";
133 case EXIT_NOTINSTALLED:
134 return "NOTINSSTALLED";
136 case EXIT_NOTCONFIGURED:
137 return "NOTCONFIGURED";
139 case EXIT_NOTRUNNING: