pacemaker
2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
|
Function and executable result codes. More...
Go to the source code of this file.
Macros | |
#define | _Noreturn |
#define | CRM_ASSERT(expr) |
#define | pcmk_ok 0 |
#define | PCMK_ERROR_OFFSET 190 /* Replacements on non-linux systems, see include/portability.h */ |
#define | PCMK_CUSTOM_OFFSET 200 /* Purely custom codes */ |
#define | pcmk_err_generic 201 |
#define | pcmk_err_no_quorum 202 |
#define | pcmk_err_schema_validation 203 |
#define | pcmk_err_transform_failed 204 |
#define | pcmk_err_old_data 205 |
#define | pcmk_err_diff_failed 206 |
#define | pcmk_err_diff_resync 207 |
#define | pcmk_err_cib_modified 208 |
#define | pcmk_err_cib_backup 209 |
#define | pcmk_err_cib_save 210 |
#define | pcmk_err_schema_unchanged 211 |
#define | pcmk_err_cib_corrupt 212 |
#define | pcmk_err_multiple 213 |
#define | pcmk_err_node_unknown 214 |
#define | pcmk_err_already 215 |
#define | pcmk_err_bad_nvpair 216 |
#define | pcmk_err_unknown_format 217 |
Typedefs | |
typedef enum crm_exit_e | crm_exit_t |
Functions | |
int | pcmk_result_get_strings (int code, enum pcmk_result_type type, const char **name, const char **desc) |
Get the name and description of a given result code. More... | |
const char * | pcmk_rc_name (int rc) |
Get a return code constant name as a string. More... | |
const char * | pcmk_rc_str (int rc) |
Get a user-friendly description of a return code. More... | |
crm_exit_t | pcmk_rc2exitc (int rc) |
Map a function return code to the most similar exit code. More... | |
enum ocf_exitcode | pcmk_rc2ocf (int rc) |
Map a function return code to the most similar OCF exit code. More... | |
int | pcmk_rc2legacy (int rc) |
int | pcmk_legacy2rc (int legacy_rc) |
const char * | pcmk_strerror (int rc) |
const char * | pcmk_errorname (int rc) |
const char * | crm_exit_name (crm_exit_t exit_code) |
const char * | crm_exit_str (crm_exit_t exit_code) |
_Noreturn crm_exit_t | crm_exit (crm_exit_t rc) |
Function and executable result codes.
Definition in file results.h.
#define CRM_ASSERT | ( | expr | ) |
#define PCMK_ERROR_OFFSET 190 /* Replacements on non-linux systems, see include/portability.h */ |
typedef enum crm_exit_e crm_exit_t |
enum crm_exit_e |
Exit status codes for tools and daemons.
We want well-specified (i.e. OS-invariant) exit status codes for our daemons and applications so they can be relied on by callers. (Function return codes and errno's do not make good exit statuses.)
The only hard rule is that exit statuses must be between 0 and 255; all else is convention. Universally, 0 is success, and 1 is generic error (excluding OSes we don't support – for example, OpenVMS considers 1 success!).
For init scripts, the LSB gives meaning to 0-7, and sets aside 150-199 for application use. OCF adds 8-9 and 190-191.
sysexits.h was an attempt to give additional meanings, but never really caught on. It uses 0 and 64-78.
Bash reserves 2 ("incorrect builtin usage") and 126-255 (126 is "command found but not executable", 127 is "command not found", 128 + n is "interrupted by signal n").
tldp.org recommends 64-113 for application use.
We try to overlap with the above conventions when practical.
enum ocf_exitcode |
Exit status codes for resource agents.
The OCF Resource Agent API standard enumerates the possible exit status codes that agents should return. Besides being used with OCF agents, these values are also used by the executor as a universal status for all agent standards; actual results are mapped to these before returning them to clients.
Enumerator | |
---|---|
PCMK_OCF_OK | Success. |
PCMK_OCF_UNKNOWN_ERROR | Unspecified error. |
PCMK_OCF_INVALID_PARAM | Parameter invalid (in local context) |
PCMK_OCF_UNIMPLEMENT_FEATURE | Requested action not implemented. |
PCMK_OCF_INSUFFICIENT_PRIV | Insufficient privileges. |
PCMK_OCF_NOT_INSTALLED | Dependencies not available locally. |
PCMK_OCF_NOT_CONFIGURED | Parameter invalid (inherently) |
PCMK_OCF_NOT_RUNNING | Service safely stopped. |
PCMK_OCF_RUNNING_PROMOTED | Service active and promoted. |
PCMK_OCF_FAILED_PROMOTED | Service failed and possibly in promoted role. |
PCMK_OCF_DEGRADED | Service active but more likely to fail soon. |
PCMK_OCF_DEGRADED_PROMOTED | Service promoted but more likely to fail soon. |
PCMK_OCF_CONNECTION_DIED |
|
PCMK_OCF_UNKNOWN | Action is pending. |
PCMK_OCF_EXEC_ERROR |
|
PCMK_OCF_SIGNAL |
|
PCMK_OCF_NOT_SUPPORTED |
|
PCMK_OCF_PENDING |
|
PCMK_OCF_CANCELLED |
|
PCMK_OCF_TIMEOUT |
|
PCMK_OCF_OTHER_ERROR |
|
PCMK_OCF_RUNNING_MASTER |
|
PCMK_OCF_FAILED_MASTER |
|
PCMK_OCF_DEGRADED_MASTER |
|
enum pcmk_exec_status |
Execution status.
These codes are used to specify the result of the attempt to execute an agent, rather than the agent's result itself.
enum pcmk_rc_e |
Return codes for Pacemaker API functions.
Any Pacemaker API function documented as returning a "standard Pacemaker return code" will return pcmk_rc_ok (0) on success, and one of this enumeration's other (negative) values or a (positive) system error number otherwise. The custom codes are at -1001 and lower, so that the caller may use -1 through -1000 for their own custom values if desired. While generally referred to as "errors", nonzero values simply indicate a result, which might or might not be an error depending on the calling context.
enum pcmk_result_type |
Types of Pacemaker result codes.
A particular integer can have different meanings within different Pacemaker result code families. It may be interpretable within zero, one, or multiple families.
These values are useful for specifying how an integer result code should be interpreted in situations involving a generic integer value. For example, a function that can process multiple types of result codes might accept an arbitrary integer argument along with a pcmk_result_type
argument that specifies how to interpret the integer.
Enumerator | |
---|---|
pcmk_result_legacy | Legacy API function return code. |
pcmk_result_rc | Standard Pacemaker return code. |
pcmk_result_exitcode | Exit status code. |
pcmk_result_exec_status | Execution status. |
_Noreturn crm_exit_t crm_exit | ( | crm_exit_t | rc | ) |
const char* crm_exit_name | ( | crm_exit_t | exit_code | ) |
const char* crm_exit_str | ( | crm_exit_t | exit_code | ) |
const char* pcmk_errorname | ( | int | rc | ) |
int pcmk_legacy2rc | ( | int | legacy_rc | ) |
crm_exit_t pcmk_rc2exitc | ( | int | rc | ) |
int pcmk_rc2legacy | ( | int | rc | ) |
enum ocf_exitcode pcmk_rc2ocf | ( | int | rc | ) |
const char* pcmk_rc_name | ( | int | rc | ) |
const char* pcmk_rc_str | ( | int | rc | ) |
int pcmk_result_get_strings | ( | int | code, |
enum pcmk_result_type | type, | ||
const char ** | name, | ||
const char ** | desc | ||
) |
Get the name and description of a given result code.
A result code can be interpreted as a member of any one of several families.
[in] | code | The result code to look up |
[in] | type | How code should be interpreted |
[out] | name | Where to store the result code's name |
[out] | desc | Where to store the result code's description |
const char* pcmk_strerror | ( | int | rc | ) |