exit-status.h revision d7832d2c6e0ef5f2839a2296c1cc2fc85c7d9632
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering#ifndef fooexitstatushfoo
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering#define fooexitstatushfoo
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering/***
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering This file is part of systemd.
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering Copyright 2010 Lennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering systemd is free software; you can redistribute it and/or modify it
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering under the terms of the GNU General Public License as published by
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering the Free Software Foundation; either version 2 of the License, or
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering (at your option) any later version.
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering systemd is distributed in the hope that it will be useful, but
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering General Public License for more details.
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering You should have received a copy of the GNU General Public License
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
4ad7f2761da661853dcc29d542efb4727abb1101Nick Owens***/
0f7091e624fdba6c0bf281f2a9a23cd3e9ca93fbLennart Poettering
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart Poettering#include <stdbool.h>
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poetteringtypedef enum ExitStatus {
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering /* EXIT_SUCCESS defined by libc */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering /* EXIT_FAILURE defined by libc */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_INVALIDARGUMENT = 2,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_NOTIMPLEMENTED = 3,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_NOPERMISSION = 4,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_NOTINSTALLED = 5,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_NOTCONFIGURED = 6,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_NOTRUNNING = 7,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering /* The LSB suggests that error codes >= 200 are "reserved". We
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering * use them here under the assumption that they hence are
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering * unused by init scripts.
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering *
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering * http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_CHDIR = 200,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_NICE,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_FDS,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_EXEC,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_MEMORY,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_LIMITS,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_OOM_ADJUST,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_SIGNAL_MASK,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_STDIN,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_STDOUT,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_CHROOT, /* 210 */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_IOPRIO,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_TIMERSLACK,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_SECUREBITS,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_SETSCHEDULER,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_CPUAFFINITY,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_GROUP,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_USER,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_CAPABILITIES,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_CGROUP,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_SETSID, /* 220 */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_CONFIRM,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_STDERR,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_TCPWRAP,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_PAM,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_NETWORK,
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_NAMESPACE
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering} ExitStatus;
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poetteringtypedef enum ExitStatusLevel {
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering EXIT_STATUS_MINIMAL,
8013e860b6344cb109e68208a3a91b0fc3cb9ed1Lennart Poettering EXIT_STATUS_SYSTEMD,
8013e860b6344cb109e68208a3a91b0fc3cb9ed1Lennart Poettering EXIT_STATUS_LSB,
8013e860b6344cb109e68208a3a91b0fc3cb9ed1Lennart Poettering EXIT_STATUS_FULL = EXIT_STATUS_LSB
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering} ExitStatusLevel;
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poetteringconst char* exit_status_to_string(ExitStatus status, ExitStatusLevel level);
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poetteringbool is_clean_exit(int code, int status);
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poetteringbool is_clean_exit_lsb(int code, int status);
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering#endif
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering