chiark / gitweb /
MurmurHash3: actually inline functions
[elogind.git] / src / shared / exit-status.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
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
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
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
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <stdbool.h>
25 #include "set.h"
26 typedef enum ExitStatus {
27         /* EXIT_SUCCESS defined by libc */
28         /* EXIT_FAILURE defined by libc */
29         EXIT_INVALIDARGUMENT = 2,
30         EXIT_NOTIMPLEMENTED = 3,
31         EXIT_NOPERMISSION = 4,
32         EXIT_NOTINSTALLED = 5,
33         EXIT_NOTCONFIGURED = 6,
34         EXIT_NOTRUNNING = 7,
35
36         /* The LSB suggests that error codes >= 200 are "reserved". We
37          * use them here under the assumption that they hence are
38          * unused by init scripts.
39          *
40          * http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */
41
42         EXIT_CHDIR = 200,
43         EXIT_NICE,
44         EXIT_FDS,
45         EXIT_EXEC,
46         EXIT_MEMORY,
47         EXIT_LIMITS,
48         EXIT_OOM_ADJUST,
49         EXIT_SIGNAL_MASK,
50         EXIT_STDIN,
51         EXIT_STDOUT,
52         EXIT_CHROOT,   /* 210 */
53         EXIT_IOPRIO,
54         EXIT_TIMERSLACK,
55         EXIT_SECUREBITS,
56         EXIT_SETSCHEDULER,
57         EXIT_CPUAFFINITY,
58         EXIT_GROUP,
59         EXIT_USER,
60         EXIT_CAPABILITIES,
61         EXIT_CGROUP,
62         EXIT_SETSID,   /* 220 */
63         EXIT_CONFIRM,
64         EXIT_STDERR,
65         EXIT_TCPWRAP,
66         EXIT_PAM,
67         EXIT_NETWORK,
68         EXIT_NAMESPACE,
69         EXIT_NO_NEW_PRIVILEGES,
70         EXIT_SECCOMP
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 typedef struct ExitStatusSet {
81         Set *code;
82         Set *signal;
83 } ExitStatusSet;
84
85 const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level);
86
87 bool is_clean_exit(int code, int status, ExitStatusSet *success_status);
88 bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status);