1
2
3
4
5
6
7
8
9 #ifndef CRM_RESULTS__H
10 # define CRM_RESULTS__H
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16
17
18
19
20
21
22
23
24 #ifndef _Noreturn
25 # if (defined __cplusplus \
26 && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
27 || (defined _MSC_VER && 1900 <= _MSC_VER)))
28 # define _Noreturn [[noreturn]]
29 # elif ((!defined __cplusplus || defined __clang__) \
30 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
31 || 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
32
33 # elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
34 # define _Noreturn __attribute__ ((__noreturn__))
35 # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
36 # define _Noreturn __declspec (noreturn)
37 # else
38 # define _Noreturn
39 # endif
40 #endif
41
42 # define CRM_ASSERT(expr) do { \
43 if(__unlikely((expr) == FALSE)) { \
44 crm_abort(__FILE__, __func__, __LINE__, #expr, TRUE, FALSE); \
45 abort(); \
46 } \
47 } while(0)
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 # define pcmk_ok 0
68 # define PCMK_ERROR_OFFSET 190
69 # define PCMK_CUSTOM_OFFSET 200
70 # define pcmk_err_generic 201
71 # define pcmk_err_no_quorum 202
72 # define pcmk_err_schema_validation 203
73 # define pcmk_err_transform_failed 204
74 # define pcmk_err_old_data 205
75 # define pcmk_err_diff_failed 206
76 # define pcmk_err_diff_resync 207
77 # define pcmk_err_cib_modified 208
78 # define pcmk_err_cib_backup 209
79 # define pcmk_err_cib_save 210
80 # define pcmk_err_schema_unchanged 211
81 # define pcmk_err_cib_corrupt 212
82 # define pcmk_err_multiple 213
83 # define pcmk_err_node_unknown 214
84 # define pcmk_err_already 215
85
86 #ifdef __hppa__
87 # define pcmk_err_bad_nvpair 250
88 # define pcmk_err_unknown_format 252
89 #else
90 # define pcmk_err_bad_nvpair 216
91 # define pcmk_err_unknown_format 217
92 #endif
93
94
95
96
97
98
99
100
101
102
103
104
105
106 enum pcmk_rc_e {
107
108
109
110 pcmk_rc_underflow = -1028,
111 pcmk_rc_no_input = -1027,
112 pcmk_rc_no_output = -1026,
113 pcmk_rc_after_range = -1025,
114 pcmk_rc_within_range = -1024,
115 pcmk_rc_before_range = -1023,
116 pcmk_rc_undetermined = -1022,
117 pcmk_rc_op_unsatisfied = -1021,
118 pcmk_rc_ipc_pid_only = -1020,
119 pcmk_rc_ipc_unresponsive = -1019,
120 pcmk_rc_ipc_unauthorized = -1018,
121 pcmk_rc_no_quorum = -1017,
122 pcmk_rc_schema_validation = -1016,
123 pcmk_rc_schema_unchanged = -1015,
124 pcmk_rc_transform_failed = -1014,
125 pcmk_rc_old_data = -1013,
126 pcmk_rc_diff_failed = -1012,
127 pcmk_rc_diff_resync = -1011,
128 pcmk_rc_cib_modified = -1010,
129 pcmk_rc_cib_backup = -1009,
130 pcmk_rc_cib_save = -1008,
131 pcmk_rc_cib_corrupt = -1007,
132 pcmk_rc_multiple = -1006,
133 pcmk_rc_node_unknown = -1005,
134 pcmk_rc_already = -1004,
135 pcmk_rc_bad_nvpair = -1003,
136 pcmk_rc_unknown_format = -1002,
137
138 pcmk_rc_error = -1001,
139
140
141
142 pcmk_rc_ok = 0
143
144
145 };
146
147
148
149
150 enum ocf_exitcode {
151 PCMK_OCF_OK = 0,
152 PCMK_OCF_UNKNOWN_ERROR = 1,
153 PCMK_OCF_INVALID_PARAM = 2,
154 PCMK_OCF_UNIMPLEMENT_FEATURE = 3,
155 PCMK_OCF_INSUFFICIENT_PRIV = 4,
156 PCMK_OCF_NOT_INSTALLED = 5,
157 PCMK_OCF_NOT_CONFIGURED = 6,
158 PCMK_OCF_NOT_RUNNING = 7,
159 PCMK_OCF_RUNNING_MASTER = 8,
160 PCMK_OCF_FAILED_MASTER = 9,
161
162
163
164 PCMK_OCF_CONNECTION_DIED = 189,
165
166 PCMK_OCF_DEGRADED = 190,
167 PCMK_OCF_DEGRADED_MASTER = 191,
168
169 PCMK_OCF_EXEC_ERROR = 192,
170 PCMK_OCF_UNKNOWN = 193,
171 PCMK_OCF_SIGNAL = 194,
172 PCMK_OCF_NOT_SUPPORTED = 195,
173 PCMK_OCF_PENDING = 196,
174 PCMK_OCF_CANCELLED = 197,
175 PCMK_OCF_TIMEOUT = 198,
176 PCMK_OCF_OTHER_ERROR = 199,
177 };
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204 typedef enum crm_exit_e {
205
206 CRM_EX_OK = 0,
207 CRM_EX_ERROR = 1,
208
209
210 CRM_EX_INVALID_PARAM = 2,
211 CRM_EX_UNIMPLEMENT_FEATURE = 3,
212 CRM_EX_INSUFFICIENT_PRIV = 4,
213 CRM_EX_NOT_INSTALLED = 5,
214 CRM_EX_NOT_CONFIGURED = 6,
215 CRM_EX_NOT_RUNNING = 7,
216
217
218 CRM_EX_USAGE = 64,
219 CRM_EX_DATAERR = 65,
220 CRM_EX_NOINPUT = 66,
221 CRM_EX_NOUSER = 67,
222 CRM_EX_NOHOST = 68,
223 CRM_EX_UNAVAILABLE = 69,
224 CRM_EX_SOFTWARE = 70,
225 CRM_EX_OSERR = 71,
226 CRM_EX_OSFILE = 72,
227 CRM_EX_CANTCREAT = 73,
228 CRM_EX_IOERR = 74,
229 CRM_EX_TEMPFAIL = 75,
230 CRM_EX_PROTOCOL = 76,
231 CRM_EX_NOPERM = 77,
232 CRM_EX_CONFIG = 78,
233
234
235 CRM_EX_FATAL = 100,
236 CRM_EX_PANIC = 101,
237 CRM_EX_DISCONNECT = 102,
238 CRM_EX_OLD = 103,
239 CRM_EX_DIGEST = 104,
240 CRM_EX_NOSUCH = 105,
241 CRM_EX_QUORUM = 106,
242 CRM_EX_UNSAFE = 107,
243 CRM_EX_EXISTS = 108,
244 CRM_EX_MULTIPLE = 109,
245 CRM_EX_EXPIRED = 110,
246 CRM_EX_NOT_YET_IN_EFFECT = 111,
247 CRM_EX_INDETERMINATE = 112,
248 CRM_EX_UNSATISFIED = 113,
249
250
251 CRM_EX_TIMEOUT = 124,
252 CRM_EX_MAX = 255,
253 } crm_exit_t;
254
255 const char *pcmk_rc_name(int rc);
256 const char *pcmk_rc_str(int rc);
257 crm_exit_t pcmk_rc2exitc(int rc);
258 int pcmk_rc2legacy(int rc);
259 int pcmk_legacy2rc(int legacy_rc);
260 const char *pcmk_strerror(int rc);
261 const char *pcmk_errorname(int rc);
262 const char *bz2_strerror(int rc);
263 crm_exit_t crm_errno2exit(int rc);
264 const char *crm_exit_name(crm_exit_t exit_code);
265 const char *crm_exit_str(crm_exit_t exit_code);
266 _Noreturn crm_exit_t crm_exit(crm_exit_t rc);
267
268 #ifdef __cplusplus
269 }
270 #endif
271
272 #endif