pacemaker
2.0.1-9e909a5bdd
Scalable High-Availability cluster resource manager
include
crm
common
results.h
Go to the documentation of this file.
1
/*
2
* Copyright 2012-2018 Andrew Beekhof <andrew@beekhof.net>
3
*
4
* This source code is licensed under the GNU Lesser General Public License
5
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
6
*/
7
#ifndef CRM_RESULTS__H
8
# define CRM_RESULTS__H
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
13
20
# define CRM_ASSERT(expr) do { \
21
if(__unlikely((expr) == FALSE)) { \
22
crm_abort(__FILE__, __FUNCTION__, __LINE__, #expr, TRUE, FALSE); \
23
abort();
/* Redundant but it makes static analyzers happy */
\
24
} \
25
} while(0)
26
27
/*
28
* Function return codes
29
*
30
* For system error codes, see:
31
* - /usr/include/asm-generic/errno.h
32
* - /usr/include/asm-generic/errno-base.h
33
*/
34
35
# define pcmk_ok 0
36
# define PCMK_ERROR_OFFSET 190
/* Replacements on non-linux systems, see include/portability.h */
37
# define PCMK_CUSTOM_OFFSET 200
/* Purely custom codes */
38
# define pcmk_err_generic 201
39
# define pcmk_err_no_quorum 202
40
# define pcmk_err_schema_validation 203
41
# define pcmk_err_transform_failed 204
42
# define pcmk_err_old_data 205
43
# define pcmk_err_diff_failed 206
44
# define pcmk_err_diff_resync 207
45
# define pcmk_err_cib_modified 208
46
# define pcmk_err_cib_backup 209
47
# define pcmk_err_cib_save 210
48
# define pcmk_err_schema_unchanged 211
49
# define pcmk_err_cib_corrupt 212
50
# define pcmk_err_multiple 213
51
# define pcmk_err_node_unknown 214
52
# define pcmk_err_already 215
53
54
/*
55
* Exit status codes
56
*
57
* We want well-specified (i.e. OS-invariant) exit status codes for our daemons
58
* and applications so they can be relied on by callers. (Function return codes
59
* and errno's do not make good exit statuses.)
60
*
61
* The only hard rule is that exit statuses must be between 0 and 255; all else
62
* is convention. Universally, 0 is success, and 1 is generic error (excluding
63
* OSes we don't support -- for example, OpenVMS considers 1 success!).
64
*
65
* For init scripts, the LSB gives meaning to 0-7, and sets aside 150-199 for
66
* application use. OCF adds 8-9 and 189-199.
67
*
68
* sysexits.h was an attempt to give additional meanings, but never really
69
* caught on. It uses 0 and 64-78.
70
*
71
* Bash reserves 2 ("incorrect builtin usage") and 126-255 (126 is "command
72
* found but not executable", 127 is "command not found", 128 + n is
73
* "interrupted by signal n").
74
*
75
* tldp.org recommends 64-113 for application use.
76
*
77
* We try to overlap with the above conventions when practical.
78
*/
79
typedef
enum
crm_exit_e
{
80
// Common convention
81
CRM_EX_OK
= 0,
82
CRM_EX_ERROR
= 1,
83
84
// LSB + OCF
85
CRM_EX_INVALID_PARAM
= 2,
86
CRM_EX_UNIMPLEMENT_FEATURE
= 3,
87
CRM_EX_INSUFFICIENT_PRIV
= 4,
88
CRM_EX_NOT_INSTALLED
= 5,
89
CRM_EX_NOT_CONFIGURED
= 6,
90
CRM_EX_NOT_RUNNING
= 7,
91
92
// sysexits.h
93
CRM_EX_USAGE
= 64,
// command line usage error
94
CRM_EX_DATAERR
= 65,
// user-supplied data incorrect
95
CRM_EX_NOINPUT
= 66,
// input file not available
96
CRM_EX_NOUSER
= 67,
// user does not exist
97
CRM_EX_NOHOST
= 68,
// host unknown
98
CRM_EX_UNAVAILABLE
= 69,
// needed service unavailable
99
CRM_EX_SOFTWARE
= 70,
// internal software bug
100
CRM_EX_OSERR
= 71,
// external (OS/environmental) problem
101
CRM_EX_OSFILE
= 72,
// system file not usable
102
CRM_EX_CANTCREAT
= 73,
// file couldn't be created
103
CRM_EX_IOERR
= 74,
// file I/O error
104
CRM_EX_TEMPFAIL
= 75,
// try again
105
CRM_EX_PROTOCOL
= 76,
// protocol violated
106
CRM_EX_NOPERM
= 77,
// non-file permission issue
107
CRM_EX_CONFIG
= 78,
// misconfiguration
108
109
// Custom
110
CRM_EX_FATAL
= 100,
// do not respawn
111
CRM_EX_PANIC
= 101,
// panic the local host
112
CRM_EX_DISCONNECT
= 102,
// lost connection to something
113
CRM_EX_OLD
= 103,
// update older than existing config
114
CRM_EX_DIGEST
= 104,
// digest comparison failed
115
CRM_EX_NOSUCH
= 105,
// requested item does not exist
116
CRM_EX_QUORUM
= 106,
// local partition does not have quorum
117
CRM_EX_UNSAFE
= 107,
// requires --force or new conditions
118
CRM_EX_EXISTS
= 108,
// requested item already exists
119
CRM_EX_MULTIPLE
= 109,
// requested item has multiple matches
120
121
// Other
122
CRM_EX_TIMEOUT
= 124,
// convention from timeout(1)
123
CRM_EX_MAX
= 255,
// ensure crm_exit_t can hold this
124
}
crm_exit_t
;
125
126
const
char
*
pcmk_strerror
(
int
rc);
127
const
char
*
pcmk_errorname
(
int
rc);
128
const
char
*
bz2_strerror
(
int
rc);
129
crm_exit_t
crm_errno2exit
(
int
rc);
130
const
char
*
crm_exit_name
(
crm_exit_t
exit_code);
131
const
char
*
crm_exit_str
(
crm_exit_t
exit_code);
132
crm_exit_t
crm_exit
(
crm_exit_t
rc);
133
134
#ifdef __cplusplus
135
}
136
#endif
137
138
#endif
CRM_EX_TEMPFAIL
Definition:
results.h:104
CRM_EX_OK
Definition:
results.h:81
CRM_EX_CONFIG
Definition:
results.h:107
CRM_EX_INSUFFICIENT_PRIV
Definition:
results.h:87
CRM_EX_ERROR
Definition:
results.h:82
CRM_EX_UNIMPLEMENT_FEATURE
Definition:
results.h:86
crm_exit_name
const char * crm_exit_name(crm_exit_t exit_code)
Definition:
results.c:252
CRM_EX_UNAVAILABLE
Definition:
results.h:98
pcmk_strerror
const char * pcmk_strerror(int rc)
Definition:
results.c:184
crm_exit_t
enum crm_exit_e crm_exit_t
CRM_EX_EXISTS
Definition:
results.h:118
CRM_EX_OSERR
Definition:
results.h:100
CRM_EX_NOINPUT
Definition:
results.h:95
CRM_EX_UNSAFE
Definition:
results.h:117
CRM_EX_NOHOST
Definition:
results.h:97
CRM_EX_PANIC
Definition:
results.h:111
crm_exit_str
const char * crm_exit_str(crm_exit_t exit_code)
Definition:
results.c:295
CRM_EX_NOPERM
Definition:
results.h:106
CRM_EX_DIGEST
Definition:
results.h:114
CRM_EX_SOFTWARE
Definition:
results.h:99
CRM_EX_PROTOCOL
Definition:
results.h:105
CRM_EX_IOERR
Definition:
results.h:103
CRM_EX_NOT_INSTALLED
Definition:
results.h:88
CRM_EX_TIMEOUT
Definition:
results.h:122
CRM_EX_MAX
Definition:
results.h:123
crm_exit
crm_exit_t crm_exit(crm_exit_t rc)
Definition:
results.c:458
CRM_EX_NOUSER
Definition:
results.h:96
CRM_EX_MULTIPLE
Definition:
results.h:119
CRM_EX_INVALID_PARAM
Definition:
results.h:85
CRM_EX_CANTCREAT
Definition:
results.h:102
CRM_EX_NOT_CONFIGURED
Definition:
results.h:89
CRM_EX_OSFILE
Definition:
results.h:101
CRM_EX_NOT_RUNNING
Definition:
results.h:90
CRM_EX_DATAERR
Definition:
results.h:94
CRM_EX_OLD
Definition:
results.h:113
pcmk_errorname
const char * pcmk_errorname(int rc)
Definition:
results.c:24
crm_exit_e
crm_exit_e
Definition:
results.h:79
crm_errno2exit
crm_exit_t crm_errno2exit(int rc)
Map an errno to a similar exit status.
Definition:
results.c:348
CRM_EX_QUORUM
Definition:
results.h:116
CRM_EX_NOSUCH
Definition:
results.h:115
CRM_EX_USAGE
Definition:
results.h:93
bz2_strerror
const char * bz2_strerror(int rc)
Definition:
results.c:425
CRM_EX_DISCONNECT
Definition:
results.h:112
CRM_EX_FATAL
Definition:
results.h:110
Generated on Mon Feb 10 2020 07:15:04 for pacemaker by
1.8.16