exit-status.h revision b6e2f3293d0f9a821819d96038eec2a19062151f
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#pragma once
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/***
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2010 Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering***/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#include <stdbool.h>
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#include "set.h"
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringtypedef enum ExitStatus {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* EXIT_SUCCESS defined by libc */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* EXIT_FAILURE defined by libc */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_INVALIDARGUMENT = 2,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_NOTIMPLEMENTED = 3,
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering EXIT_NOPERMISSION = 4,
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering EXIT_NOTINSTALLED = 5,
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering EXIT_NOTCONFIGURED = 6,
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering EXIT_NOTRUNNING = 7,
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* The LSB suggests that error codes >= 200 are "reserved". We
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * use them here under the assumption that they hence are
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * unused by init scripts.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering *
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_CHDIR = 200,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_NICE,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_FDS,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_EXEC,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_MEMORY,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_LIMITS,
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering EXIT_OOM_ADJUST,
0dd25fb9f005d8ab7ac4bc10a609d00569f8c56aLennart Poettering EXIT_SIGNAL_MASK,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_STDIN,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_STDOUT,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_CHROOT, /* 210 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_IOPRIO,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_TIMERSLACK,
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering EXIT_SECUREBITS,
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering EXIT_SETSCHEDULER,
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering EXIT_CPUAFFINITY,
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering EXIT_GROUP,
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering EXIT_USER,
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering EXIT_CAPABILITIES,
aea2429d6ec32261dbf6b9caa125fcc6ea9ea76aLennart Poettering EXIT_CGROUP,
aea2429d6ec32261dbf6b9caa125fcc6ea9ea76aLennart Poettering EXIT_SETSID, /* 220 */
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering EXIT_CONFIRM,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_STDERR,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_TCPWRAP,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_PAM,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_NETWORK,
0dd25fb9f005d8ab7ac4bc10a609d00569f8c56aLennart Poettering EXIT_NAMESPACE,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_NO_NEW_PRIVILEGES,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_SECCOMP,
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering EXIT_SELINUX_CONTEXT
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering} ExitStatus;
ad867662936a4c7ab2c7116d804c272338801231Lennart Poettering
51323288fc628a5cac50914df915545d685b793eLennart Poetteringtypedef enum ExitStatusLevel {
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering EXIT_STATUS_MINIMAL,
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering EXIT_STATUS_SYSTEMD,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering EXIT_STATUS_LSB,
2c27fbca2d88214bd305272308a370a962818f1eLennart Poettering EXIT_STATUS_FULL = EXIT_STATUS_LSB
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering} ExitStatusLevel;
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poetteringtypedef struct ExitStatusSet {
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering Set *code;
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering Set *signal;
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering} ExitStatusSet;
dc4d47e2c79aafa3ef646e32ff3422c4ce935c1bLennart Poettering
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poetteringconst char* exit_status_to_string(ExitStatus status, ExitStatusLevel level) _const_;
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poettering
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poetteringbool is_clean_exit(int code, int status, ExitStatusSet *success_status);
bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status);
/* Manager status */
typedef enum ShowStatus {
_SHOW_STATUS_UNSET = -2,
SHOW_STATUS_AUTO = -1,
SHOW_STATUS_NO = 0,
SHOW_STATUS_YES = 1,
SHOW_STATUS_TEMPORARY = 2,
} ShowStatus;
int parse_show_status(const char *v, ShowStatus *ret);