]>
Commit | Line | Data |
---|---|---|
1afbdcb0 LP |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
c2f1db8f | 3 | #pragma once |
1afbdcb0 LP |
4 | |
5 | /*** | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2010 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
11 | under the terms of the GNU Lesser General Public License as published by |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
1afbdcb0 LP |
13 | (at your option) any later version. |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 18 | Lesser General Public License for more details. |
1afbdcb0 | 19 | |
5430f7f2 | 20 | You should have received a copy of the GNU Lesser General Public License |
1afbdcb0 LP |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
22 | ***/ | |
23 | ||
9a57c629 | 24 | #include <stdbool.h> |
4d7213b2 | 25 | |
96342de6 | 26 | #include "set.h" |
4d7213b2 | 27 | |
1afbdcb0 LP |
28 | typedef enum ExitStatus { |
29 | /* EXIT_SUCCESS defined by libc */ | |
30 | /* EXIT_FAILURE defined by libc */ | |
31 | EXIT_INVALIDARGUMENT = 2, | |
32 | EXIT_NOTIMPLEMENTED = 3, | |
33 | EXIT_NOPERMISSION = 4, | |
34 | EXIT_NOTINSTALLED = 5, | |
35 | EXIT_NOTCONFIGURED = 6, | |
36 | EXIT_NOTRUNNING = 7, | |
37 | ||
38 | /* The LSB suggests that error codes >= 200 are "reserved". We | |
39 | * use them here under the assumption that they hence are | |
40 | * unused by init scripts. | |
41 | * | |
5b89f67f | 42 | * http://refspecs.linuxfoundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */ |
1afbdcb0 LP |
43 | |
44 | EXIT_CHDIR = 200, | |
45 | EXIT_NICE, | |
46 | EXIT_FDS, | |
47 | EXIT_EXEC, | |
48 | EXIT_MEMORY, | |
49 | EXIT_LIMITS, | |
50 | EXIT_OOM_ADJUST, | |
51 | EXIT_SIGNAL_MASK, | |
52 | EXIT_STDIN, | |
53 | EXIT_STDOUT, | |
54 | EXIT_CHROOT, /* 210 */ | |
55 | EXIT_IOPRIO, | |
56 | EXIT_TIMERSLACK, | |
57 | EXIT_SECUREBITS, | |
58 | EXIT_SETSCHEDULER, | |
59 | EXIT_CPUAFFINITY, | |
60 | EXIT_GROUP, | |
61 | EXIT_USER, | |
62 | EXIT_CAPABILITIES, | |
63 | EXIT_CGROUP, | |
64 | EXIT_SETSID, /* 220 */ | |
65 | EXIT_CONFIRM, | |
66 | EXIT_STDERR, | |
7f8aa671 | 67 | _EXIT_RESERVED, /* used to be tcpwrap, don't reuse! */ |
ff01d048 | 68 | EXIT_PAM, |
4c2630eb | 69 | EXIT_NETWORK, |
8351ceae LP |
70 | EXIT_NAMESPACE, |
71 | EXIT_NO_NEW_PRIVILEGES, | |
7b52a628 | 72 | EXIT_SECCOMP, |
ac45f971 | 73 | EXIT_SELINUX_CONTEXT, |
eef65bf3 | 74 | EXIT_PERSONALITY, /* 230 */ |
4298d0b5 LP |
75 | EXIT_APPARMOR_PROFILE, |
76 | EXIT_ADDRESS_FAMILIES, | |
3900e5fd | 77 | EXIT_RUNTIME_DIRECTORY, |
a4152e3f | 78 | EXIT_MAKE_STARTER, |
3900e5fd | 79 | EXIT_CHOWN, |
060e088e | 80 | EXIT_BUS_ENDPOINT, |
2ca620c4 | 81 | EXIT_SMACK_PROCESS_LABEL, |
1afbdcb0 LP |
82 | } ExitStatus; |
83 | ||
84 | typedef enum ExitStatusLevel { | |
85 | EXIT_STATUS_MINIMAL, | |
86 | EXIT_STATUS_SYSTEMD, | |
87 | EXIT_STATUS_LSB, | |
88 | EXIT_STATUS_FULL = EXIT_STATUS_LSB | |
89 | } ExitStatusLevel; | |
90 | ||
96342de6 | 91 | typedef struct ExitStatusSet { |
3e2d435b | 92 | Set *status; |
96342de6 LN |
93 | Set *signal; |
94 | } ExitStatusSet; | |
95 | ||
44a6b1b6 | 96 | const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level) _const_; |
1afbdcb0 | 97 | |
96342de6 LN |
98 | bool is_clean_exit(int code, int status, ExitStatusSet *success_status); |
99 | bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status); | |
37520c1b LP |
100 | |
101 | void exit_status_set_free(ExitStatusSet *x); | |
55ebf98c | 102 | bool exit_status_set_is_empty(ExitStatusSet *x); |
597466f4 | 103 | bool exit_status_set_test(ExitStatusSet *x, int code, int status); |