exit-status.c revision d7832d2c6e0ef5f2839a2296c1cc2fc85c7d9632
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering This file is part of systemd.
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering Copyright 2010 Lennart Poettering
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering systemd is free software; you can redistribute it and/or modify it
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering under the terms of the GNU General Public License as published by
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering the Free Software Foundation; either version 2 of the License, or
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering (at your option) any later version.
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering systemd is distributed in the hope that it will be useful, but
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering General Public License for more details.
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering You should have received a copy of the GNU General Public License
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poetteringconst char* exit_status_to_string(ExitStatus status, ExitStatusLevel level) {
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering /* We cast to int here, so that -Wenum doesn't complain that
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering * EXIT_SUCCESS/EXIT_FAILURE aren't in the enum */
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering switch ((int) status) {
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "SUCCESS";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "FAILURE";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering if (level == EXIT_STATUS_SYSTEMD || level == EXIT_STATUS_LSB) {
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering switch ((int) status) {
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "CHDIR";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "NICE";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "EXEC";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "MEMORY";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "LIMITS";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "OOM_ADJUST";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "SIGNAL_MASK";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "STDIN";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "STDOUT";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "CHROOT";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "IOPRIO";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "TIMERSLACK";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "SECUREBITS";
0e2656744f6d2e2cf65788a497f266d469865e30Lennart Poettering return "SETSCHEDULER";
0e2656744f6d2e2cf65788a497f266d469865e30Lennart Poettering return "CPUAFFINITY";
0e2656744f6d2e2cf65788a497f266d469865e30Lennart Poettering return "GROUP";
0e2656744f6d2e2cf65788a497f266d469865e30Lennart Poettering return "USER";
0e2656744f6d2e2cf65788a497f266d469865e30Lennart Poettering return "CAPABILITIES";
0e2656744f6d2e2cf65788a497f266d469865e30Lennart Poettering return "CGROUP";
0e2656744f6d2e2cf65788a497f266d469865e30Lennart Poettering return "SETSID";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "CONFIRM";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "STDERR";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "TCPWRAP";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "NETWORK";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "NAMESPACE";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering switch ((int) status) {
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "INVALIDARGUMENT";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "NOTIMPLEMENTED";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "NOPERMISSION";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "NOTINSSTALLED";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "NOTCONFIGURED";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering return "NOTRUNNING";
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poetteringbool is_clean_exit(int code, int status) {
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering /* If a daemon does not implement handlers for some of the
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poettering * signals that's not considered an unclean shutdown */
f757855e81fc0bc116de372220096e532afb5cb8Lennart Poetteringbool is_clean_exit_lsb(int code, int status) {