26 #include <sys/types.h> 
   29 #include <sys/utsname.h> 
   41 #include <qb/qbdefs.h> 
   52 #include <libxml2/libxml/relaxng.h> 
   63 #  define PW_BUFFER_LEN     500 
   77 static struct crm_option *crm_long_options = NULL;
 
   78 static const char *crm_app_description = NULL;
 
   79 static char *crm_short_options = NULL;
 
   80 static const char *crm_app_usage = NULL;
 
   95     free(crm_short_options);
 
  196     if(stat(value, &st) != 0) {
 
  197         crm_err(
"Script %s does not exist", value);
 
  201     if(S_ISREG(st.st_mode) == 0) {
 
  202         crm_err(
"Script %s is not a regular file", value);
 
  206     if( (st.st_mode & (S_IXUSR | S_IXGRP )) == 0) {
 
  207         crm_err(
"Script %s is not executable", value);
 
  218     long number = strtol(value, &end, 10);
 
  220     if(end && end[0] != 
'%') {
 
  222     } 
else if(number < 0) {
 
  295                const char *name, 
const char *old_name, 
const char *def_value)
 
  297     const char *value = NULL;
 
  298     char *new_value = NULL;
 
  303         value = g_hash_table_lookup(options, name);
 
  305         if ((value == NULL) && old_name) {
 
  306             value = g_hash_table_lookup(options, old_name);
 
  309                                 " is deprecated and will be removed in a future release",
 
  313                 new_value = strdup(value);
 
  314                 g_hash_table_insert(options, strdup(name), new_value);
 
  319         if (value && validate && (validate(value) == FALSE)) {
 
  320             crm_config_err(
"Resetting cluster option '%s' to default: value '%s' is invalid",
 
  334         crm_trace(
"No value or default provided for cluster option '%s'",
 
  341                   crm_err(
"Bug: default value for cluster option '%s' is invalid", name);
 
  345     crm_trace(
"Using default value '%s' for cluster option '%s'",
 
  348         new_value = strdup(value);
 
  349         g_hash_table_insert(options, strdup(name), new_value);
 
  358     const char *value = NULL;
 
  360     for (
int lpc = 0; lpc < len; lpc++) {
 
  363                                    option_list[lpc].is_valid,
 
  364                                    option_list[lpc].name,
 
  365                                    option_list[lpc].alt_name,
 
  366                                    option_list[lpc].default_value);
 
  380     fprintf(stdout, 
"<?xml version=\"1.0\"?>" 
  381             "<!DOCTYPE resource-agent SYSTEM \"ra-api-1.dtd\">\n" 
  382             "<resource-agent name=\"%s\">\n" 
  383             "  <version>%s</version>\n" 
  384             "  <longdesc lang=\"en\">%s</longdesc>\n" 
  385             "  <shortdesc lang=\"en\">%s</shortdesc>\n" 
  386             "  <parameters>\n", name, version, desc_long, desc_short);
 
  388     for (lpc = 0; lpc < len; lpc++) {
 
  389         if (option_list[lpc].description_long == NULL && option_list[lpc].description_short == NULL) {
 
  392         fprintf(stdout, 
"    <parameter name=\"%s\" unique=\"0\">\n" 
  393                 "      <shortdesc lang=\"en\">%s</shortdesc>\n" 
  394                 "      <content type=\"%s\" default=\"%s\"/>\n" 
  395                 "      <longdesc lang=\"en\">%s%s%s</longdesc>\n" 
  397                 option_list[lpc].name,
 
  398                 option_list[lpc].description_short,
 
  399                 option_list[lpc].
type,
 
  400                 option_list[lpc].default_value,
 
  401                 option_list[lpc].description_long ? option_list[lpc].
 
  402                 description_long : option_list[lpc].description_short,
 
  403                 option_list[lpc].values ? 
"  Allowed values: " : 
"",
 
  404                 option_list[lpc].values ? option_list[lpc].values : 
"");
 
  406     fprintf(stdout, 
"  </parameters>\n</resource-agent>\n");
 
  414     for (lpc = 0; lpc < len; lpc++) {
 
  416                        option_list[lpc].is_valid,
 
  417                        option_list[lpc].name,
 
  418                        option_list[lpc].alt_name, option_list[lpc].default_value);
 
  425     char *hash_key = 
crm_concat(sys ? sys : 
"none", crm_msg_reference, 
'_');
 
  427     crm_trace(
"created hash key: (%s)", hash_key);
 
  438     struct passwd *pwentry = NULL;
 
  441     rc = getpwnam_r(name, &pwd, buffer, 
PW_BUFFER_LEN, &pwentry);
 
  444             *uid = pwentry->pw_uid;
 
  447             *gid = pwentry->pw_gid;
 
  449         crm_trace(
"User %s has uid=%d gid=%d", name, pwentry->pw_uid, pwentry->pw_gid);
 
  452         rc = rc? -rc : -EINVAL;
 
  461 crm_version_helper(
const char *text, 
char **end_text)
 
  463     int atoi_result = -1;
 
  469     if (text != NULL && text[0] != 0) {
 
  470         atoi_result = (int)strtol(text, end_text, 10);
 
  472         if (errno == EINVAL) {
 
  473             crm_err(
"Conversion of '%s' %c failed", text, text[0]);
 
  490     char *ver1_copy = NULL, *ver2_copy = NULL;
 
  491     char *rest1 = NULL, *rest2 = NULL;
 
  493     if (version1 == NULL && version2 == NULL) {
 
  495     } 
else if (version1 == NULL) {
 
  497     } 
else if (version2 == NULL) {
 
  501     ver1_copy = strdup(version1);
 
  502     ver2_copy = strdup(version2);
 
  512         if (rest1 == rest2) {
 
  517             digit1 = crm_version_helper(rest1, &rest1);
 
  521             digit2 = crm_version_helper(rest2, &rest2);
 
  524         if (digit1 < digit2) {
 
  528         } 
else if (digit1 > digit2) {
 
  533         if (rest1 != NULL && rest1[0] == 
'.') {
 
  536         if (rest1 != NULL && rest1[0] == 0) {
 
  540         if (rest2 != NULL && rest2[0] == 
'.') {
 
  543         if (rest2 != NULL && rest2[0] == 0) {
 
  552         crm_trace(
"%s == %s (%d)", version1, version2, lpc);
 
  554         crm_trace(
"%s < %s (%d)", version1, version2, lpc);
 
  556         crm_trace(
"%s > %s (%d)", version1, version2, lpc);
 
  565 #  define   NUMCHARS    "0123456789." 
  569 #  define   WHITESPACE  " \t\n\r\f" 
  575     unsigned long long msec = 0;
 
  580     } 
else if (input[0] != 
'P') {
 
  600     const char *cp = input;
 
  602     long long multiplier = 1000;
 
  603     long long divisor = 1;
 
  605     char *end_text = NULL;
 
  617     if (strchr(
NUMCHARS, *cp) == NULL) {
 
  621     if (strncasecmp(units, 
"ms", 2) == 0 || strncasecmp(units, 
"msec", 4) == 0) {
 
  624     } 
else if (strncasecmp(units, 
"us", 2) == 0 || strncasecmp(units, 
"usec", 4) == 0) {
 
  627     } 
else if (strncasecmp(units, 
"s", 1) == 0 || strncasecmp(units, 
"sec", 3) == 0) {
 
  630     } 
else if (strncasecmp(units, 
"m", 1) == 0 || strncasecmp(units, 
"min", 3) == 0) {
 
  631         multiplier = 60 * 1000;
 
  633     } 
else if (strncasecmp(units, 
"h", 1) == 0 || strncasecmp(units, 
"hr", 2) == 0) {
 
  634         multiplier = 60 * 60 * 1000;
 
  636     } 
else if (*units != 
EOS && *units != 
'\n' && *units != 
'\r') {
 
  641     if (msec > LLONG_MAX/multiplier) {
 
  656 crm_abort(
const char *file, 
const char *
function, 
int line,
 
  657           const char *assert_condition, gboolean do_core, gboolean do_fork)
 
  666     if(crm_is_daemon == FALSE) {
 
  674     if (do_core == FALSE) {
 
  675         crm_err(
"%s: Triggered assert at %s:%d : %s", 
function, file, line, assert_condition);
 
  678     } 
else if (do_fork) {
 
  682         crm_err(
"%s: Triggered fatal assert at %s:%d : %s", 
function, file, line, assert_condition);
 
  686         crm_crit(
"%s: Cannot create core for non-fatal assert at %s:%d : %s",
 
  687                  function, file, line, assert_condition);
 
  690     } 
else if(pid == 0) {
 
  697     crm_err(
"%s: Forked child %d to record non-fatal assert at %s:%d : %s",
 
  698             function, pid, file, line, assert_condition);
 
  702         rc = waitpid(pid, &status, 0);
 
  707     } 
while(errno == EINTR);
 
  709     if (errno == ECHILD) {
 
  711         crm_trace(
"Cannot wait on forked child %d - SIGCHLD is probably set to SIG_IGN", pid);
 
  714     crm_perror(LOG_ERR, 
"Cannot wait on forked child %d", pid);
 
  720     static int have_proc_pid = 0;
 
  722     if(have_proc_pid == 0) {
 
  723         char proc_path[PATH_MAX], exe_path[PATH_MAX];
 
  726         snprintf(proc_path, 
sizeof(proc_path), 
"/proc/%lu/exe", (
long unsigned int)getpid());
 
  729         if(readlink(proc_path, exe_path, PATH_MAX - 1) < 0) {
 
  737     } 
else if (kill(pid, 0) < 0 && errno == ESRCH) {
 
  740     } 
else if(daemon == NULL || have_proc_pid == -1) {
 
  745         char proc_path[PATH_MAX], exe_path[PATH_MAX], myexe_path[PATH_MAX];
 
  748         snprintf(proc_path, 
sizeof(proc_path), 
"/proc/%lu/exe", pid);
 
  750         rc = readlink(proc_path, exe_path, PATH_MAX - 1);
 
  751         if (rc < 0 && errno == EACCES) {
 
  752             crm_perror(LOG_INFO, 
"Could not read from %s", proc_path);
 
  755             crm_perror(LOG_ERR, 
"Could not read from %s", proc_path);
 
  762         if(daemon[0] != 
'/') {
 
  763             rc = snprintf(myexe_path, 
sizeof(proc_path), 
CRM_DAEMON_DIR"/%s", daemon);
 
  766             rc = snprintf(myexe_path, 
sizeof(proc_path), 
"%s", daemon);
 
  770         if (strcmp(exe_path, myexe_path) == 0) {
 
  778 #define LOCKSTRLEN  11 
  788     if ((fd = open(filename, O_RDONLY)) < 0) {
 
  792     if (fstat(fd, &sbuf) >= 0 && sbuf.st_size < 
LOCKSTRLEN) {
 
  798     if (read(fd, buf, 
sizeof(buf)) < 1) {
 
  802     if (sscanf(buf, 
"%lu", &pid) > 0) {
 
  806             crm_trace(
"Got pid %lu from %s\n", pid, filename);
 
  827     } 
else if (mypid && pid == mypid) {
 
  836     } 
else if (mypid && pid != mypid) {
 
  845 crm_lock_pidfile(
const char *filename, 
const char *name)
 
  851     mypid = (
unsigned long)getpid();
 
  862     if ((fd = open(filename, O_CREAT | O_WRONLY | O_EXCL, 0644)) < 0) {
 
  867     snprintf(buf, 
sizeof(buf), 
"%*lu\n", 
LOCKSTRLEN - 1, mypid);
 
  872         crm_perror(LOG_ERR, 
"Incomplete write to %s", filename);
 
  884     const char *devnull = 
"/dev/null";
 
  886     if (daemonize == FALSE) {
 
  892     if(rc < 
pcmk_ok && rc != -ENOENT) {
 
  894         crm_err(
"%s: already running [pid %ld in %s]", name, pid, pidfile);
 
  895         printf(
"%s: already running [pid %ld in %s]\n", name, pid, pidfile);
 
  901         fprintf(stderr, 
"%s: could not start daemon\n", name);
 
  905     } 
else if (pid > 0) {
 
  909     rc = crm_lock_pidfile(pidfile, name);
 
  912         printf(
"Could not lock '%s' for %s: %s (%d)\n", pidfile, name, 
pcmk_strerror(rc), rc);
 
  916     umask(S_IWGRP | S_IWOTH | S_IROTH);
 
  919     (void)open(devnull, O_RDONLY);      
 
  920     close(STDOUT_FILENO);
 
  921     (void)open(devnull, O_WRONLY);      
 
  922     close(STDERR_FILENO);
 
  923     (void)open(devnull, O_WRONLY);      
 
  931     char *crm_name = NULL;
 
  937     max = strlen(crm_name);
 
  938     for (; lpc < max; lpc++) {
 
  939         switch (crm_name[lpc]) {
 
  952     const char *value = NULL;
 
  956         value = g_hash_table_lookup(hash, key);
 
  963 static struct option *
 
  964 crm_create_long_opts(
struct crm_option *long_options)
 
  966     struct option *long_opts = NULL;
 
  969     int index = 0, lpc = 0;
 
  978     long_opts = realloc_safe(long_opts, (index + 1) * 
sizeof(
struct option));
 
  979     long_opts[index].name = 
"__dummmy__";
 
  980     long_opts[index].has_arg = 0;
 
  981     long_opts[index].flag = 0;
 
  982     long_opts[index].val = 
'_';
 
  985     for (lpc = 0; long_options[lpc].
name != NULL; lpc++) {
 
  986         if (long_options[lpc].name[0] == 
'-') {
 
  990         long_opts = realloc_safe(long_opts, (index + 1) * 
sizeof(
struct option));
 
  993         long_opts[index].name = long_options[lpc].
name;
 
  994         long_opts[index].has_arg = long_options[lpc].
has_arg;
 
  995         long_opts[index].flag = long_options[lpc].
flag;
 
  996         long_opts[index].val = long_options[lpc].
val;
 
 1001     long_opts = realloc_safe(long_opts, (index + 1) * 
sizeof(
struct option));
 
 1002     long_opts[index].name = NULL;
 
 1003     long_opts[index].has_arg = 0;
 
 1004     long_opts[index].flag = 0;
 
 1005     long_opts[index].val = 0;
 
 1013                 const char *app_desc)
 
 1015     if (short_options) {
 
 1016         crm_short_options = strdup(short_options);
 
 1018     } 
else if (long_options) {
 
 1020         int opt_string_len = 0;
 
 1021         char *local_short_options = NULL;
 
 1023         for (lpc = 0; long_options[lpc].
name != NULL; lpc++) {
 
 1024             if (long_options[lpc].val && long_options[lpc].val != 
'-' && long_options[lpc].val < UCHAR_MAX) {
 
 1025                 local_short_options = realloc_safe(local_short_options, opt_string_len + 4);
 
 1026                 local_short_options[opt_string_len++] = long_options[lpc].
val;
 
 1028                 if (long_options[lpc].has_arg == optional_argument) {
 
 1029                     local_short_options[opt_string_len++] = 
':';
 
 1031                 if (long_options[lpc].has_arg >= required_argument) {
 
 1032                     local_short_options[opt_string_len++] = 
':';
 
 1034                 local_short_options[opt_string_len] = 0;
 
 1037         crm_short_options = local_short_options;
 
 1038         crm_trace(
"Generated short option string: '%s'", local_short_options);
 
 1042         crm_long_options = long_options;
 
 1045         crm_app_description = app_desc;
 
 1048         crm_app_usage = app_usage;
 
 1061 #ifdef HAVE_GETOPT_H 
 1062     static struct option *long_opts = NULL;
 
 1064     if (long_opts == NULL && crm_long_options) {
 
 1065         long_opts = crm_create_long_opts(crm_long_options);
 
 1070         int flag = getopt_long(argc, argv, crm_short_options, long_opts, index);
 
 1074                 if (long_opts[*index].val) {
 
 1075                     return long_opts[*index].val;
 
 1076                 } 
else if (longname) {
 
 1077                     *longname = long_opts[*index].name;
 
 1079                     crm_notice(
"Unhandled option --%s", long_opts[*index].name);
 
 1096     if (crm_short_options) {
 
 1097         return getopt(argc, argv, crm_short_options);
 
 1107     FILE *stream = (exit_code ? stderr : stdout);
 
 1109     if (cmd == 
'v' || cmd == 
'$') {
 
 1111         fprintf(stream, 
"Written by Andrew Beekhof\n");
 
 1122     if (crm_app_usage) {
 
 1126     if (crm_long_options) {
 
 1127         fprintf(stream, 
"Options:\n");
 
 1128         for (i = 0; crm_long_options[i].
name != NULL; i++) {
 
 1132                 fprintf(stream, 
"%s\n\n", crm_long_options[i].desc);
 
 1135                 fprintf(stream, 
"\t#%s\n\n", crm_long_options[i].desc);
 
 1137             } 
else if (crm_long_options[i].val == 
'-' && crm_long_options[i].desc) {
 
 1138                 fprintf(stream, 
"%s\n", crm_long_options[i].desc);
 
 1142                 if (crm_long_options[i].val && crm_long_options[i].val <= UCHAR_MAX) {
 
 1143                     fprintf(stream, 
" -%c,", crm_long_options[i].val);
 
 1147                 fprintf(stream, 
" --%s%s\t%s\n", crm_long_options[i].name,
 
 1148                         crm_long_options[i].has_arg == optional_argument ? 
"[=value]" :
 
 1149                         crm_long_options[i].has_arg == required_argument ? 
"=value" : 
"",
 
 1150                         crm_long_options[i].desc ? crm_long_options[i].desc : 
"");
 
 1154     } 
else if (crm_short_options) {
 
 1155         fprintf(stream, 
"Usage: %s - %s\n", 
crm_system_name, crm_app_description);
 
 1156         for (i = 0; crm_short_options[i] != 0; i++) {
 
 1157             int has_arg = no_argument ;
 
 1159             if (crm_short_options[i + 1] == 
':') {
 
 1160                 if (crm_short_options[i + 2] == 
':')
 
 1161                     has_arg = optional_argument ;
 
 1163                     has_arg = required_argument ;
 
 1166             fprintf(stream, 
" -%c %s\n", crm_short_options[i],
 
 1167                     has_arg == optional_argument ? 
"[value]" :
 
 1168                     has_arg == required_argument ? 
"{value}" : 
"");
 
 1180         qb_ipcs_service_t **ipcs_rw,
 
 1181         qb_ipcs_service_t **ipcs_shm,
 
 1182         struct qb_ipcs_service_handlers *ro_cb,
 
 1183         struct qb_ipcs_service_handlers *rw_cb)
 
 1189     if (*ipcs_ro == NULL || *ipcs_rw == NULL || *ipcs_shm == NULL) {
 
 1190         crm_err(
"Failed to create cib servers: exiting and inhibiting respawn.");
 
 1191         crm_warn(
"Verify pacemaker and pacemaker_remote are not both enabled.");
 
 1197         qb_ipcs_service_t *ipcs_rw,
 
 1198         qb_ipcs_service_t *ipcs_shm)
 
 1200     qb_ipcs_destroy(ipcs_ro);
 
 1201     qb_ipcs_destroy(ipcs_rw);
 
 1202     qb_ipcs_destroy(ipcs_shm);
 
 1216     if (*ipcs == NULL) {
 
 1217         crm_err(
"Failed to create attrd servers: exiting and inhibiting respawn.");
 
 1218         crm_warn(
"Verify pacemaker and pacemaker_remote are not both enabled.");
 
 1228     if (*ipcs == NULL) {
 
 1229         crm_err(
"Failed to create stonith-ng servers: exiting and inhibiting respawn.");
 
 1230         crm_warn(
"Verify pacemaker and pacemaker_remote are not both enabled.");
 
 1239     if(user == NULL || strlen(user) == 0) {
 
 1246     } 
else if (strcmp(user, 
"root") == 0) {
 
 1249     crm_trace(
"acls required for %s", user);
 
 1261     struct passwd *pwent = getpwuid(uid);
 
 1263     if (pwent == NULL) {
 
 1264         crm_perror(LOG_ERR, 
"Cannot get password entry of uid: %d", uid);
 
 1268         return strdup(pwent->pw_name);
 
 1276     static const char *effective_user = NULL;
 
 1277     const char *requested_user = NULL;
 
 1278     const char *user = NULL;
 
 1280     if(effective_user == NULL) {
 
 1285     if(requested_user == NULL) {
 
 1289     if (is_privileged(effective_user) == FALSE) {
 
 1291         user = effective_user;
 
 1293     } 
else if(peer_user == NULL && requested_user == NULL) {
 
 1295         user = effective_user;
 
 1297     } 
else if(peer_user == NULL) {
 
 1299         user = requested_user;
 
 1301     } 
else if (is_privileged(peer_user) == FALSE) {
 
 1305     } 
else if (requested_user == NULL) {
 
 1311         user = requested_user;
 
 1323     return requested_user;
 
 1330     CRM_CHECK(user != NULL && request != NULL && field != NULL, 
return);
 
 1333     if (is_privileged(user) == FALSE) {
 
 1354     if (*handle == NULL) {
 
 1355         *handle = dlopen(lib, RTLD_LAZY);
 
 1359         crm_err(
"%sCould not open %s: %s", fatal ? 
"Fatal: " : 
"", lib, dlerror());
 
 1366     a_function = dlsym(*handle, fn);
 
 1367     if (a_function == NULL) {
 
 1369         crm_err(
"%sCould not find %s in %s: %s", fatal ? 
"Fatal: " : 
"", fn, lib, error);
 
 1385 #ifdef HAVE_UUID_UUID_H 
 1386 #  include <uuid/uuid.h> 
 1392     unsigned char uuid[16];
 
 1393     char *buffer = malloc(37);  
 
 1395     uuid_generate(uuid);
 
 1396     uuid_unparse(uuid, buffer);
 
 1426     int lpc = 0, len = 0;
 
 1427     char *digest = NULL;
 
 1430     if (buffer == NULL) {
 
 1433     len = strlen(buffer);
 
 1435     crm_trace(
"Beginning digest of %d bytes", len);
 
 1440             sprintf(digest + (2 * lpc), 
"%02x", raw_digest[lpc]);
 
 1446         crm_err(
"Could not create digest");
 
 1451 #ifdef HAVE_GNUTLS_GNUTLS_H 
 1453 crm_gnutls_global_init(
void)
 
 1455     signal(SIGPIPE, SIG_IGN);
 
 1456     gnutls_global_init();
 
 1463     if (!
class && !provider && !type) {
 
 1468                              (
class? 
class : 
""),
 
 1469                              (provider? 
":" : 
""), (provider? provider : 
""),
 
 1483     CRM_CHECK(standard != NULL, 
return FALSE);
 
 1517     CRM_CHECK(spec && standard && provider && type, 
return -EINVAL);
 
 1522     colon = strchr(spec, 
':');
 
 1523     if ((colon == NULL) || (colon == spec)) {
 
 1527     *standard = calloc(colon - spec + 1, 
sizeof(
char));
 
 1528     strncpy(*standard, spec, colon - spec);
 
 1532         colon = strchr(spec, 
':');
 
 1533         if ((colon == NULL) || (colon == spec)) {
 
 1537         *provider = calloc(colon - spec + 1, 
sizeof(
char));
 
 1538         strncpy(*provider, spec, colon - spec);
 
 1542     if (*spec == 
'\0') {
 
 1548     *type = strdup(spec);
 
#define CRM_CHECK(expr, failure_action)
 
void crm_write_blackbox(int nsig, struct qb_log_callsite *callsite)
 
void * find_library_function(void **handle, const char *lib, const char *fn, int fatal)
 
#define crm_notice(fmt, args...)
 
int crm_pid_active(long pid, const char *daemon)
 
void crm_enable_stderr(int enable)
 
bool crm_is_daemon_name(const char *name)
Check whether a string represents a cluster daemon name. 
 
#define crm_crit(fmt, args...)
 
char * crm_generate_uuid(void)
 
long crm_pidfile_inuse(const char *filename, long mypid, const char *daemon)
 
struct crm_time_s crm_time_t
 
const char * pcmk_strerror(int rc)
 
#define crm_config_err(fmt...)
 
void crm_xml_cleanup(void)
 
long long crm_int_helper(const char *text, char **end_text)
 
int char2score(const char *score)
 
long long crm_get_msec(const char *input)
 
void crm_make_daemon(const char *name, gboolean daemonize, const char *pidfile)
 
char * score2char_stack(int score, char *buf, size_t len)
 
const char * crm_meta_value(GHashTable *hash, const char *field)
 
int crm_help(char cmd, int exit_code)
 
void stonith_ipc_server_init(qb_ipcs_service_t **ipcs, struct qb_ipcs_service_handlers *cb)
 
void mainloop_cleanup(void)
 
int crm_parse_int(const char *text, const char *default_text)
 
crm_time_t * crm_time_parse_duration(const char *duration_str)
 
int crm_user_lookup(const char *name, uid_t *uid, gid_t *gid)
 
void crm_set_options(const char *short_options, const char *usage, struct crm_option *long_options, const char *app_desc)
 
gboolean check_number(const char *value)
 
#define PACEMAKER_VERSION
 
Wrappers for and extensions to glib mainloop. 
 
void * convert_const_pointer(const void *ptr)
 
char * crm_meta_name(const char *field)
 
int crm_parse_agent_spec(const char *spec, char **standard, char **provider, char **type)
Parse a "standard[:provider]:type" agent specification. 
 
const char * crm_xml_replace(xmlNode *node, const char *name, const char *value)
 
void cib_ipc_servers_init(qb_ipcs_service_t **ipcs_ro, qb_ipcs_service_t **ipcs_rw, qb_ipcs_service_t **ipcs_shm, struct qb_ipcs_service_handlers *ro_cb, struct qb_ipcs_service_handlers *rw_cb)
 
#define CRM_TRACE_INIT_DATA(name)
 
gboolean crm_config_error
 
void config_metadata(const char *name, const char *version, const char *desc_short, const char *desc_long, pe_cluster_option *option_list, int len)
 
#define crm_warn(fmt, args...)
 
int daemon(int nochdir, int noclose)
 
#define PCMK_RESOURCE_CLASS_OCF
 
bool pcmk_acl_required(const char *user)
 
void determine_request_user(const char *user, xmlNode *request, const char *field)
 
unsigned long long crm_get_interval(const char *input)
 
#define pcmk_option_example
 
gboolean check_quorum(const char *value)
 
#define crm_trace(fmt, args...)
 
#define pcmk_option_paragraph
 
Wrappers for and extensions to libxml2. 
 
const char * crm_element_value(xmlNode *data, const char *name)
 
void cib_ipc_servers_destroy(qb_ipcs_service_t *ipcs_ro, qb_ipcs_service_t *ipcs_rw, qb_ipcs_service_t *ipcs_shm)
 
gboolean check_positive_number(const char *value)
 
gboolean check_time(const char *value)
 
gboolean check_boolean(const char *value)
 
char * crm_itoa_stack(int an_int, char *buf, size_t len)
 
int crm_get_option_long(int argc, char **argv, int *index, const char **longname)
 
long long int crm_time_get_seconds(crm_time_t *dt)
 
#define DAEMON_RESPAWN_STOP
 
#define crm_config_warn(fmt...)
 
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
 
void attrd_ipc_server_init(qb_ipcs_service_t **ipcs, struct qb_ipcs_service_handlers *cb)
 
#define CRM_SYSTEM_STONITHD
 
int crm_str_to_boolean(const char *s, int *ret)
 
qb_ipcs_service_t * crmd_ipc_server_init(struct qb_ipcs_service_handlers *cb)
 
#define CRM_SYSTEM_TENGINE
 
const char * cluster_option(GHashTable *options, gboolean(*validate)(const char *), const char *name, const char *old_name, const char *def_value)
 
#define crm_perror(level, fmt, args...)
Log a system error message. 
 
gboolean check_script(const char *value)
 
#define crm_err(fmt, args...)
 
gboolean check_utilization(const char *value)
 
gboolean crm_config_warning
 
int compare_version(const char *version1, const char *version2)
 
void verify_all_options(GHashTable *options, pe_cluster_option *option_list, int len)
 
#define pcmk_option_hidden
 
long crm_read_pidfile(const char *filename)
 
void * md5_buffer(const char *buffer, size_t len, void *resblock)
 
Wrappers for and extensions to libqb IPC. 
 
char * generate_hash_key(const char *crm_msg_reference, const char *sys)
 
#define PACKAGE_BUGREPORT
 
const char * crm_acl_get_set_user(xmlNode *request, const char *field, const char *peer_user)
 
char * crm_generate_ra_key(const char *class, const char *provider, const char *type)
 
char * crm_md5sum(const char *buffer)
 
bool crm_provider_required(const char *standard)
Check whether a resource standard requires a provider to be specified. 
 
gboolean check_timer(const char *value)
 
int crm_get_option(int argc, char **argv, int *index)
 
char * crm_concat(const char *prefix, const char *suffix, char join)
 
char * crm_itoa(int an_int)
 
#define safe_str_eq(a, b)
 
qb_ipcs_service_t * mainloop_add_ipc_server(const char *name, enum qb_ipc_type type, struct qb_ipcs_service_handlers *callbacks)
 
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
 
void crm_abort(const char *file, const char *function, int line, const char *condition, gboolean do_core, gboolean do_fork)
 
const char * get_cluster_pref(GHashTable *options, pe_cluster_option *option_list, int len, const char *name)
 
#define crm_info(fmt, args...)
 
char * uid2username(uid_t uid)
 
enum crm_ais_msg_types type
 
char * score2char(int score)
 
void crm_time_free(crm_time_t *dt)