20 #include <qb/qbdefs.h>
25 G_DEFINE_QUARK(pcmk-
rc-error-quark, pcmk__rc_error)
26 G_DEFINE_QUARK(pcmk-exitc-error-quark, pcmk__exitc_error)
73 return "Generic Pacemaker error";
75 return "Operation requires quorum";
77 return "Update does not conform to the configured schema";
79 return "Schema transform failed";
81 return "Update was older than existing configuration";
83 return "Application of an update diff failed";
85 return "Application of an update diff failed, requesting a full refresh";
87 return "The on-disk configuration was manually modified";
89 return "Could not archive the previous configuration";
91 return "Could not save the new configuration to disk";
93 return "Could not parse on-disk configuration";
95 return "Resource active on multiple nodes";
97 return "Node not found";
99 return "Situation already as requested";
101 return "Bad name/value pair given";
103 return "Schema is already the latest available";
105 return "Unknown output format";
110 return "Name not unique on network";
113 return "Communication error on send";
116 return "Can not access a needed shared library";
119 return "Remote I/O error";
122 return "Protocol driver not attached";
125 return "Required key not available";
127 crm_err(
"Unknown error code: %d", rc);
128 return "Unknown error";
137 static struct pcmk__rc_info {
146 {
"pcmk_rc_unknown_format",
147 "Unknown output format",
150 {
"pcmk_rc_bad_nvpair",
151 "Bad name/value pair given",
155 "Already in requested state",
158 {
"pcmk_rc_node_unknown",
162 {
"pcmk_rc_multiple",
163 "Resource active on multiple nodes",
166 {
"pcmk_rc_cib_corrupt",
167 "Could not parse on-disk configuration",
170 {
"pcmk_rc_cib_save",
171 "Could not save new configuration to disk",
174 {
"pcmk_rc_cib_backup",
175 "Could not archive previous configuration",
178 {
"pcmk_rc_cib_modified",
179 "On-disk configuration was manually modified",
182 {
"pcmk_rc_diff_resync",
183 "Application of update diff failed, requesting full refresh",
186 {
"pcmk_rc_diff_failed",
187 "Application of update diff failed",
190 {
"pcmk_rc_old_data",
191 "Update was older than existing configuration",
194 {
"pcmk_rc_transform_failed",
195 "Schema transform failed",
198 {
"pcmk_rc_schema_unchanged",
199 "Schema is already the latest available",
202 {
"pcmk_rc_schema_validation",
203 "Update does not conform to the configured schema",
206 {
"pcmk_rc_no_quorum",
207 "Operation requires quorum",
210 {
"pcmk_rc_ipc_pid_only",
211 "IPC server process is active but not accepting connections",
214 {
"pcmk_rc_ipc_unresponsive",
215 "IPC server is unresponsive",
218 {
"pcmk_rc_ipc_unauthorized",
219 "IPC server is blocked by unauthorized process",
222 {
"pcmk_rc_op_unsatisifed",
223 "Not applicable under current conditions",
226 {
"pcmk_rc_undetermined",
227 "Result undetermined",
230 {
"pcmk_rc_before_range",
231 "Result occurs before given range",
234 {
"pcmk_rc_within_range",
235 "Result occurs within given range",
238 {
"pcmk_rc_after_range",
239 "Result occurs after given range",
242 {
"pcmk_rc_no_output",
243 "Output message produced no output",
246 {
"pcmk_rc_no_input",
247 "Input file not available",
250 {
"pcmk_rc_underflow",
251 "Value too small to be stored in data type",
256 #define PCMK__N_RC (sizeof(pcmk__rcs) / sizeof(struct pcmk__rc_info))
273 case E2BIG:
return "E2BIG";
274 case EACCES:
return "EACCES";
275 case EADDRINUSE:
return "EADDRINUSE";
276 case EADDRNOTAVAIL:
return "EADDRNOTAVAIL";
277 case EAFNOSUPPORT:
return "EAFNOSUPPORT";
278 case EAGAIN:
return "EAGAIN";
279 case EALREADY:
return "EALREADY";
280 case EBADF:
return "EBADF";
281 case EBADMSG:
return "EBADMSG";
282 case EBUSY:
return "EBUSY";
283 case ECANCELED:
return "ECANCELED";
284 case ECHILD:
return "ECHILD";
285 case ECOMM:
return "ECOMM";
286 case ECONNABORTED:
return "ECONNABORTED";
287 case ECONNREFUSED:
return "ECONNREFUSED";
288 case ECONNRESET:
return "ECONNRESET";
290 case EDESTADDRREQ:
return "EDESTADDRREQ";
291 case EDOM:
return "EDOM";
292 case EDQUOT:
return "EDQUOT";
293 case EEXIST:
return "EEXIST";
294 case EFAULT:
return "EFAULT";
295 case EFBIG:
return "EFBIG";
296 case EHOSTDOWN:
return "EHOSTDOWN";
297 case EHOSTUNREACH:
return "EHOSTUNREACH";
298 case EIDRM:
return "EIDRM";
299 case EILSEQ:
return "EILSEQ";
300 case EINPROGRESS:
return "EINPROGRESS";
301 case EINTR:
return "EINTR";
302 case EINVAL:
return "EINVAL";
303 case EIO:
return "EIO";
304 case EISCONN:
return "EISCONN";
305 case EISDIR:
return "EISDIR";
306 case ELIBACC:
return "ELIBACC";
307 case ELOOP:
return "ELOOP";
308 case EMFILE:
return "EMFILE";
309 case EMLINK:
return "EMLINK";
310 case EMSGSIZE:
return "EMSGSIZE";
311 #ifdef EMULTIHOP // Not available on OpenBSD
312 case EMULTIHOP:
return "EMULTIHOP";
314 case ENAMETOOLONG:
return "ENAMETOOLONG";
315 case ENETDOWN:
return "ENETDOWN";
316 case ENETRESET:
return "ENETRESET";
317 case ENETUNREACH:
return "ENETUNREACH";
318 case ENFILE:
return "ENFILE";
319 case ENOBUFS:
return "ENOBUFS";
320 case ENODATA:
return "ENODATA";
321 case ENODEV:
return "ENODEV";
322 case ENOENT:
return "ENOENT";
323 case ENOEXEC:
return "ENOEXEC";
324 case ENOKEY:
return "ENOKEY";
325 case ENOLCK:
return "ENOLCK";
326 #ifdef ENOLINK // Not available on OpenBSD
327 case ENOLINK:
return "ENOLINK";
329 case ENOMEM:
return "ENOMEM";
330 case ENOMSG:
return "ENOMSG";
331 case ENOPROTOOPT:
return "ENOPROTOOPT";
332 case ENOSPC:
return "ENOSPC";
333 case ENOSR:
return "ENOSR";
334 case ENOSTR:
return "ENOSTR";
335 case ENOSYS:
return "ENOSYS";
336 case ENOTBLK:
return "ENOTBLK";
337 case ENOTCONN:
return "ENOTCONN";
338 case ENOTDIR:
return "ENOTDIR";
339 case ENOTEMPTY:
return "ENOTEMPTY";
340 case ENOTSOCK:
return "ENOTSOCK";
341 #if ENOTSUP != EOPNOTSUPP
342 case ENOTSUP:
return "ENOTSUP";
344 case ENOTTY:
return "ENOTTY";
346 case ENXIO:
return "ENXIO";
347 case EOPNOTSUPP:
return "EOPNOTSUPP";
348 case EOVERFLOW:
return "EOVERFLOW";
349 case EPERM:
return "EPERM";
350 case EPFNOSUPPORT:
return "EPFNOSUPPORT";
351 case EPIPE:
return "EPIPE";
352 case EPROTO:
return "EPROTO";
353 case EPROTONOSUPPORT:
return "EPROTONOSUPPORT";
354 case EPROTOTYPE:
return "EPROTOTYPE";
355 case ERANGE:
return "ERANGE";
356 case EREMOTE:
return "EREMOTE";
358 case EROFS:
return "EROFS";
359 case ESHUTDOWN:
return "ESHUTDOWN";
360 case ESPIPE:
return "ESPIPE";
361 case ESOCKTNOSUPPORT:
return "ESOCKTNOSUPPORT";
362 case ESRCH:
return "ESRCH";
363 case ESTALE:
return "ESTALE";
364 case ETIME:
return "ETIME";
365 case ETIMEDOUT:
return "ETIMEDOUT";
366 case ETXTBSY:
return "ETXTBSY";
367 case EUNATCH:
return "EUNATCH";
368 case EUSERS:
return "EUSERS";
370 case EXDEV:
return "EXDEV";
372 #ifdef EBADE // Not available on OS X
373 case EBADE:
return "EBADE";
374 case EBADFD:
return "EBADFD";
375 case EBADSLT:
return "EBADSLT";
376 case EDEADLOCK:
return "EDEADLOCK";
377 case EBADR:
return "EBADR";
378 case EBADRQC:
return "EBADRQC";
379 case ECHRNG:
return "ECHRNG";
380 #ifdef EISNAM // Not available on OS X, Illumos, Solaris
381 case EISNAM:
return "EISNAM";
382 case EKEYEXPIRED:
return "EKEYEXPIRED";
384 case EKEYREVOKED:
return "EKEYREVOKED";
386 case EL2HLT:
return "EL2HLT";
387 case EL2NSYNC:
return "EL2NSYNC";
388 case EL3HLT:
return "EL3HLT";
389 case EL3RST:
return "EL3RST";
390 case ELIBBAD:
return "ELIBBAD";
391 case ELIBMAX:
return "ELIBMAX";
392 case ELIBSCN:
return "ELIBSCN";
393 case ELIBEXEC:
return "ELIBEXEC";
394 #ifdef ENOMEDIUM // Not available on OS X, Illumos, Solaris
395 case ENOMEDIUM:
return "ENOMEDIUM";
396 case EMEDIUMTYPE:
return "EMEDIUMTYPE";
398 case ENONET:
return "ENONET";
399 case ENOPKG:
return "ENOPKG";
400 case EREMCHG:
return "EREMCHG";
401 case ERESTART:
return "ERESTART";
402 case ESTRPIPE:
return "ESTRPIPE";
403 #ifdef EUCLEAN // Not available on OS X, Illumos, Solaris
404 case EUCLEAN:
return "EUCLEAN";
406 case EXFULL:
return "EXFULL";
408 default:
return "Unknown";
429 return "Unknown error";
452 legacy_rc = abs(legacy_rc);
472 default:
return legacy_rc;
522 return "CRM_EX_UNKNOWN";
544 case CRM_EX_OSERR:
return "Operating system error occurred";
552 case CRM_EX_FATAL:
return "Fatal error occurred, will not respawn";
565 case CRM_EX_OLD:
return "Update was older than existing configuration";
569 if ((exit_code > 128) && (exit_code <
CRM_EX_MAX)) {
570 return "Interrupted by signal";
572 return "Unknown exit status";
655 case EPROTONOSUPPORT:
678 #if EOPNOTSUPP != ENOTSUP
736 case BZ_CONFIG_ERROR:
737 return "libbz2 has been improperly compiled on your platform";
738 case BZ_SEQUENCE_ERROR:
739 return "library functions called in the wrong order";
741 return "parameter is out of range or otherwise incorrect";
743 return "memory allocation failed";
745 return "data integrity error is detected during decompression";
746 case BZ_DATA_ERROR_MAGIC:
747 return "the compressed stream does not start with the correct magic bytes";
749 return "error reading or writing in the compressed file";
750 case BZ_UNEXPECTED_EOF:
751 return "compressed file finishes before the logical end of stream is detected";
752 case BZ_OUTBUFF_FULL:
753 return "output data will not fit into the buffer provided";
755 return "Unknown error";
764 if ((((
int) rc) < 0) || (((
int) rc) >
CRM_EX_MAX)) {
#define pcmk_err_old_data
#define pcmk_err_schema_validation
const char * pcmk_errorname(int rc)
crm_exit_t crm_errno2exit(int rc)
const char * pcmk_strerror(int rc)
const char * bz2_strerror(int rc)
#define pcmk_err_no_quorum
#define pcmk_err_schema_unchanged
int pcmk_rc2legacy(int rc)
_Noreturn crm_exit_t crm_exit(crm_exit_t rc)
void crm_xml_cleanup(void)
#define pcmk_err_transform_failed
crm_exit_t pcmk_rc2exitc(int rc)
Map a function return code to the most similar exit code.
#define pcmk_err_node_unknown
void mainloop_cleanup(void)
enum crm_exit_e crm_exit_t
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
char * strerror(int errnum)
#define pcmk_err_cib_backup
Wrappers for and extensions to glib mainloop.
#define pcmk_err_cib_save
#define pcmk_err_diff_failed
const char * crm_exit_str(crm_exit_t exit_code)
#define PCMK_ERROR_OFFSET
#define pcmk_err_multiple
#define crm_trace(fmt, args...)
Wrappers for and extensions to libxml2.
int pcmk_legacy2rc(int legacy_rc)
#define pcmk_err_cib_modified
#define pcmk_err_diff_resync
void pcmk__cli_option_cleanup(void)
const char * pcmk_rc_name(int rc)
Get a return code constant name as a string.
#define crm_err(fmt, args...)
#define pcmk_err_unknown_format
#define pcmk_err_bad_nvpair
#define pcmk_err_cib_corrupt
#define crm_info(fmt, args...)
const char * crm_exit_name(crm_exit_t exit_code)