chiark / gitweb /
relicense to LGPLv2.1 (with exceptions)
[elogind.git] / src / shared / exit-status.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #ifndef fooexitstatushfoo
4 #define fooexitstatushfoo
5
6 /***
7   This file is part of systemd.
8
9   Copyright 2010 Lennart Poettering
10
11   systemd is free software; you can redistribute it and/or modify it
12   under the terms of the GNU Lesser General Public License as published by
13   the Free Software Foundation; either version 2.1 of the License, or
14   (at your option) any later version.
15
16   systemd is distributed in the hope that it will be useful, but
17   WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19   Lesser General Public License for more details.
20
21   You should have received a copy of the GNU Lesser General Public License
22   along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 ***/
24
25 #include <stdbool.h>
26
27 typedef enum ExitStatus {
28         /* EXIT_SUCCESS defined by libc */
29         /* EXIT_FAILURE defined by libc */
30         EXIT_INVALIDARGUMENT = 2,
31         EXIT_NOTIMPLEMENTED = 3,
32         EXIT_NOPERMISSION = 4,
33         EXIT_NOTINSTALLED = 5,
34         EXIT_NOTCONFIGURED = 6,
35         EXIT_NOTRUNNING = 7,
36
37         /* The LSB suggests that error codes >= 200 are "reserved". We
38          * use them here under the assumption that they hence are
39          * unused by init scripts.
40          *
41          * http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */
42
43         EXIT_CHDIR = 200,
44         EXIT_NICE,
45         EXIT_FDS,
46         EXIT_EXEC,
47         EXIT_MEMORY,
48         EXIT_LIMITS,
49         EXIT_OOM_ADJUST,
50         EXIT_SIGNAL_MASK,
51         EXIT_STDIN,
52         EXIT_STDOUT,
53         EXIT_CHROOT,   /* 210 */
54         EXIT_IOPRIO,
55         EXIT_TIMERSLACK,
56         EXIT_SECUREBITS,
57         EXIT_SETSCHEDULER,
58         EXIT_CPUAFFINITY,
59         EXIT_GROUP,
60         EXIT_USER,
61         EXIT_CAPABILITIES,
62         EXIT_CGROUP,
63         EXIT_SETSID,   /* 220 */
64         EXIT_CONFIRM,
65         EXIT_STDERR,
66         EXIT_TCPWRAP,
67         EXIT_PAM,
68         EXIT_NETWORK,
69         EXIT_NAMESPACE
70
71 } ExitStatus;
72
73 typedef enum ExitStatusLevel {
74         EXIT_STATUS_MINIMAL,
75         EXIT_STATUS_SYSTEMD,
76         EXIT_STATUS_LSB,
77         EXIT_STATUS_FULL = EXIT_STATUS_LSB
78 } ExitStatusLevel;
79
80 const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level);
81
82 bool is_clean_exit(int code, int status);
83 bool is_clean_exit_lsb(int code, int status);
84
85 #endif