21 #include <sys/param.h>
22 #include <sys/types.h>
25 #include <sys/utsname.h>
40 #include <qb/qbdefs.h>
47 static gboolean crm_tracing_enabled(
void);
51 #ifdef HAVE_G_LOG_SET_DEFAULT_HANDLER
52 GLogFunc glib_log_default;
55 crm_glib_handler(
const gchar * log_domain, GLogLevelFlags
flags,
const gchar * message,
58 int log_level = LOG_WARNING;
59 GLogLevelFlags msg_level = (flags & G_LOG_LEVEL_MASK);
60 static struct qb_log_callsite *glib_cs = NULL;
62 if (glib_cs == NULL) {
63 glib_cs = qb_log_callsite_get(__FUNCTION__, __FILE__,
"glib-handler", LOG_DEBUG, __LINE__,
crm_trace_nonlog);
68 case G_LOG_LEVEL_CRITICAL:
73 crm_abort(__FILE__, __FUNCTION__, __LINE__, message, TRUE, TRUE);
77 case G_LOG_LEVEL_ERROR:
80 case G_LOG_LEVEL_MESSAGE:
81 log_level = LOG_NOTICE;
83 case G_LOG_LEVEL_INFO:
86 case G_LOG_LEVEL_DEBUG:
87 log_level = LOG_DEBUG;
90 case G_LOG_LEVEL_WARNING:
91 case G_LOG_FLAG_RECURSION:
92 case G_LOG_FLAG_FATAL:
93 case G_LOG_LEVEL_MASK:
94 log_level = LOG_WARNING;
98 do_crm_log(log_level,
"%s: %s", log_domain, message);
103 # define NAME_MAX 256
107 crm_trigger_blackbox(
int nsig)
109 if(nsig == SIGTRAP) {
120 const char *value = NULL;
122 snprintf(env_name,
NAME_MAX,
"PCMK_%s", option);
123 value = getenv(env_name);
125 crm_trace(
"Found %s = %s", env_name, value);
129 snprintf(env_name,
NAME_MAX,
"HA_%s", option);
130 value = getenv(env_name);
132 crm_trace(
"Found %s = %s", env_name, value);
136 crm_trace(
"Nothing found for %s", option);
145 snprintf(env_name,
NAME_MAX,
"PCMK_%s", option);
147 crm_trace(
"Setting %s to %s", env_name, value);
148 setenv(env_name, value, 1);
154 snprintf(env_name,
NAME_MAX,
"HA_%s", option);
156 crm_trace(
"Setting %s to %s", env_name, value);
157 setenv(env_name, value, 1);
172 }
else if (value != NULL && strstr(value, daemon)) {
182 #ifdef HAVE_G_LOG_SET_DEFAULT_HANDLER
183 g_log_set_default_handler(glib_log_default, NULL);
189 set_format_string(
int method,
const char *
daemon)
194 if (method > QB_LOG_STDERR) {
198 if (
uname(&res) == 0) {
200 snprintf(fmt + offset,
FMT_MAX - offset,
"%%t [%lu] %s %10s: ",
201 (
unsigned long) getpid(), res.nodename, daemon);
203 offset += snprintf(fmt + offset,
FMT_MAX - offset,
"%%t [%lu] %10s: ",
204 (
unsigned long) getpid(), daemon);
208 if (method == QB_LOG_SYSLOG) {
209 offset += snprintf(fmt + offset,
FMT_MAX - offset,
"%%g %%-7p: %%b");
210 crm_extended_logging(method, QB_FALSE);
211 }
else if (crm_tracing_enabled()) {
212 offset += snprintf(fmt + offset,
FMT_MAX - offset,
"(%%-12f:%%5l %%g) %%-7p: %%n:\t%%b");
214 offset += snprintf(fmt + offset,
FMT_MAX - offset,
"%%g %%-7p: %%n:\t%%b");
218 qb_log_format_set(method, fmt);
224 bool is_default =
false;
225 static int default_fd = -1;
226 static gboolean have_logfile = FALSE;
231 const char *default_logfile =
"/var/log/pacemaker.log";
235 FILE *logfile = NULL;
236 char *parent_dir = NULL;
239 if (filename == NULL && have_logfile == FALSE) {
240 filename = default_logfile;
243 if (filename == NULL) {
249 }
else if(
safe_str_eq(filename, default_logfile)) {
253 if(is_default && default_fd >= 0) {
258 filename_cp = strdup(filename);
259 parent_dir = dirname(filename_cp);
260 rc = stat(parent_dir, &parent);
263 crm_err(
"Directory '%s' does not exist: logging to '%s' is disabled", parent_dir, filename);
270 logfile = fopen(filename,
"a");
271 if(logfile == NULL) {
272 crm_err(
"%s (%d): Logging to '%s' as uid=%u, gid=%u is disabled",
273 pcmk_strerror(errno), errno, filename, geteuid(), getegid());
278 if (geteuid() == 0) {
282 gboolean fix = FALSE;
283 int logfd = fileno(logfile);
285 rc = fstat(logfd, &st);
287 crm_perror(LOG_WARNING,
"Cannot stat %s", filename);
293 if (st.st_gid != pcmk_gid) {
296 }
else if ((st.st_mode & S_IRWXG) != (S_IRGRP | S_IWGRP)) {
303 rc = fchown(logfd, pcmk_uid, pcmk_gid);
305 crm_warn(
"Cannot change the ownership of %s to user %s and gid %d",
309 rc = fchmod(logfd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
311 crm_warn(
"Cannot change the mode of %s to rw-rw----", filename);
314 fprintf(logfile,
"Set r/w permissions for uid=%d, gid=%d on %s\n",
315 pcmk_uid, pcmk_gid, filename);
316 if (fflush(logfile) < 0 || fsync(logfd) < 0) {
317 crm_err(
"Couldn't write out logfile: %s", filename);
324 fd = qb_log_file_open(filename);
327 crm_perror(LOG_WARNING,
"Couldn't send additional logging to %s", filename);
334 }
else if(default_fd >= 0) {
336 qb_log_ctl(default_fd, QB_LOG_CONF_ENABLED, QB_FALSE);
339 crm_notice(
"Additional logging available in %s", filename);
340 qb_log_ctl(fd, QB_LOG_CONF_ENABLED, QB_TRUE);
350 static int blackbox_trigger = 0;
351 static char *blackbox_file_prefix = NULL;
354 blackbox_logger(
int32_t t,
struct qb_log_callsite *cs, time_t timestamp,
const char *msg)
356 if(cs && cs->priority < LOG_ERR) {
364 crm_control_blackbox(
int nsig,
bool enable)
368 if (blackbox_file_prefix == NULL) {
369 pid_t
pid = getpid();
371 blackbox_file_prefix = malloc(
NAME_MAX);
372 snprintf(blackbox_file_prefix,
NAME_MAX,
"%s/%s-%lu",
376 if (enable && qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_STATE_GET, 0) != QB_LOG_STATE_ENABLED) {
377 qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_SIZE, 5 * 1024 * 1024);
378 qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_TRUE);
381 for (lpc = QB_LOG_BLACKBOX; lpc < QB_LOG_TARGET_MAX; lpc++) {
382 qb_log_ctl(lpc, QB_LOG_CONF_FILE_SYNC, QB_TRUE);
385 crm_notice(
"Initiated blackbox recorder: %s", blackbox_file_prefix);
396 blackbox_trigger = qb_log_custom_open(blackbox_logger, NULL, NULL, NULL);
397 qb_log_ctl(blackbox_trigger, QB_LOG_CONF_ENABLED, QB_TRUE);
398 crm_trace(
"Trigger: %d is %d %d", blackbox_trigger,
399 qb_log_ctl(blackbox_trigger, QB_LOG_CONF_STATE_GET, 0), QB_LOG_STATE_ENABLED);
403 }
else if (!enable && qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_STATE_GET, 0) == QB_LOG_STATE_ENABLED) {
404 qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_FALSE);
407 for (lpc = QB_LOG_BLACKBOX; lpc < QB_LOG_TARGET_MAX; lpc++) {
408 qb_log_ctl(lpc, QB_LOG_CONF_FILE_SYNC, QB_FALSE);
416 crm_control_blackbox(nsig, TRUE);
422 crm_control_blackbox(nsig, FALSE);
429 static time_t last = 0;
432 time_t now = time(NULL);
434 if (blackbox_file_prefix == NULL) {
443 if (nsig == 0 && now == last) {
448 snprintf(buffer,
NAME_MAX,
"%s.%d", blackbox_file_prefix, counter++);
449 if (nsig == SIGTRAP) {
450 crm_notice(
"Blackbox dump requested, please see %s for contents", buffer);
454 "Problem detected at %s:%d (%s), please see %s for additional details",
455 cs->function, cs->lineno, cs->filename, buffer);
457 crm_notice(
"Problem detected, please see %s for additional details", buffer);
461 qb_log_blackbox_write_to_file(buffer);
466 qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_FALSE);
467 qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_TRUE);
475 qb_log_blackbox_write_to_file(blackbox_file_prefix);
476 qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_FALSE);
485 return crm_log_init(entity, LOG_ERR, FALSE, FALSE, 0, NULL, TRUE);
491 const char *text = g_quark_to_string(tag);
500 crm_log_filter_source(
int source,
const char *trace_files,
const char *trace_fns,
501 const char *trace_fmts,
const char *trace_tags,
const char *trace_blackbox,
502 struct qb_log_callsite *cs)
504 if (qb_log_ctl(source, QB_LOG_CONF_STATE_GET, 0) != QB_LOG_STATE_ENABLED) {
508 qb_bit_set(cs->targets, source);
510 }
else if (source == blackbox_trigger && blackbox_trigger > 0) {
512 if (cs->priority <= LOG_ERR) {
513 qb_bit_set(cs->targets, source);
515 }
else if (trace_blackbox) {
518 if (strstr(trace_blackbox, key) != NULL) {
519 qb_bit_set(cs->targets, source);
524 }
else if (source == QB_LOG_SYSLOG) {
526 qb_bit_set(cs->targets, source);
530 qb_bit_set(cs->targets, source);
531 }
else if (trace_files && strstr(trace_files, cs->filename) != NULL) {
532 qb_bit_set(cs->targets, source);
533 }
else if (trace_fns && strstr(trace_fns, cs->function) != NULL) {
534 qb_bit_set(cs->targets, source);
535 }
else if (trace_fmts && strstr(trace_fmts, cs->format) != NULL) {
536 qb_bit_set(cs->targets, source);
537 }
else if (trace_tags
540 qb_bit_set(cs->targets, source);
545 crm_log_filter(
struct qb_log_callsite *cs)
548 static int need_init = 1;
549 static const char *trace_fns = NULL;
550 static const char *trace_tags = NULL;
551 static const char *trace_fmts = NULL;
552 static const char *trace_files = NULL;
553 static const char *trace_blackbox = NULL;
557 trace_fns = getenv(
"PCMK_trace_functions");
558 trace_fmts = getenv(
"PCMK_trace_formats");
559 trace_tags = getenv(
"PCMK_trace_tags");
560 trace_files = getenv(
"PCMK_trace_files");
561 trace_blackbox = getenv(
"PCMK_trace_blackbox");
563 if (trace_tags != NULL) {
566 const char *offset = NULL;
567 const char *next = trace_tags;
572 snprintf(token,
sizeof(token),
"%.*s", (
int)(next - offset), offset);
574 tag = g_quark_from_string(token);
575 crm_info(
"Created GQuark %u from token '%s' in '%s'", tag, token, trace_tags);
581 }
while (next != NULL && next[0] != 0);
586 for (lpc = QB_LOG_SYSLOG; lpc < QB_LOG_TARGET_MAX; lpc++) {
587 crm_log_filter_source(lpc, trace_files, trace_fns, trace_fmts, trace_tags, trace_blackbox,
595 gboolean refilter = FALSE;
601 if (cs->priority != level) {
602 cs->priority = level;
606 if (cs->tags != tags) {
615 if (cs->targets == 0) {
624 static gboolean log = TRUE;
629 (
"Enabling callsites based on priority=%d, files=%s, functions=%s, formats=%s, tags=%s",
630 crm_log_level, getenv(
"PCMK_trace_files"), getenv(
"PCMK_trace_functions"),
631 getenv(
"PCMK_trace_formats"), getenv(
"PCMK_trace_tags"));
633 qb_log_filter_fn_set(crm_log_filter);
637 crm_tracing_enabled(
void)
641 }
else if (getenv(
"PCMK_trace_files") || getenv(
"PCMK_trace_functions")
642 || getenv(
"PCMK_trace_formats") || getenv(
"PCMK_trace_tags")) {
649 crm_priority2int(
const char *name)
651 struct syslog_names {
655 static struct syslog_names p_names[] = {
656 {
"emerg", LOG_EMERG},
657 {
"alert", LOG_ALERT},
660 {
"warning", LOG_WARNING},
661 {
"notice", LOG_NOTICE},
663 {
"debug", LOG_DEBUG},
668 for (lpc = 0; name != NULL && p_names[lpc].name != NULL; lpc++) {
669 if (
crm_str_eq(p_names[lpc].name, name, TRUE)) {
670 return p_names[lpc].priority;
678 crm_identity(
const char *entity,
int argc,
char **argv)
687 }
else if (argc > 0 && argv != NULL) {
688 char *
mutable = strdup(argv[0]);
689 char *modified = basename(
mutable);
691 if (strstr(modified,
"lt-") == modified) {
715 static bool have_logging = FALSE;
717 if(have_logging == FALSE) {
723 crm_trace_nonlog = g_quark_from_static_string(
"Pacemaker non-logging tracepoint");
726 umask(S_IWGRP | S_IWOTH | S_IROTH);
729 #ifdef HAVE_G_LOG_SET_DEFAULT_HANDLER
730 glib_log_default = g_log_set_default_handler(crm_glib_handler, NULL);
734 g_log_set_always_fatal((GLogLevelFlags) 0);
737 crm_identity(entity, argc, argv);
739 qb_facility = qb_log_facility2int(
"local0");
744 qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE);
749 qb_log_tags_stringify_fn_set(crm_quark_to_string);
750 for (lpc = QB_LOG_SYSLOG; lpc < QB_LOG_TARGET_MAX; lpc++) {
751 qb_log_ctl(lpc, QB_LOG_CONF_THREADED, QB_FALSE);
759 int argc,
char **argv, gboolean quiet)
761 const char *syslog_priority = NULL;
764 const char *f_copy = facility;
774 if (facility == NULL) {
788 qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_FACILITY, qb_log_facility2int(facility));
798 if(syslog_priority) {
799 int priority = crm_priority2int(syslog_priority);
801 qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE,
"*", priority);
803 qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE,
"*", LOG_NOTICE);
808 qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_TRUE);
833 crm_trace(
"Quiet: %d, facility %s", quiet, f_copy);
845 const char *user = getenv(
"USER");
848 crm_trace(
"Not switching to corefile directory for %s", user);
856 struct passwd *pwent = getpwuid(user);
859 crm_perror(LOG_ERR,
"Cannot get name for uid: %d", user);
863 crm_trace(
"Don't change active directory for regular user: %s", pwent->pw_name);
865 }
else if (chdir(base) < 0) {
866 crm_perror(LOG_INFO,
"Cannot change active directory to %s", base);
869 crm_info(
"Changed active directory to %s", base);
874 snprintf(path, 512,
"%s-%lu",
crm_system_name, (
unsigned long) getpid());
877 crm_info(
"Changed active directory to %s/%s/%s", base, pwent->pw_name, path);
914 if (enable && qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_STATE_GET, 0) != QB_LOG_STATE_ENABLED) {
915 qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE);
918 }
else if (enable == FALSE) {
919 qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_FALSE);
926 static int args = TRUE;
929 if (args && argc > 1) {
933 if (qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_STATE_GET, 0) == QB_LOG_STATE_ENABLED) {
947 #define ARGS_FMT "Invoked: %s"
953 int existing_len = 0;
955 static int logged = 0;
957 char *arg_string = NULL;
959 if (argc == 0 || argv == NULL || logged) {
965 for (; lpc < argc; lpc++) {
966 if (argv[lpc] == NULL) {
970 len = 2 + strlen(argv[lpc]);
971 arg_string = realloc_safe(arg_string, len + existing_len);
972 existing_len += sprintf(arg_string + existing_len,
"%s ", argv[lpc]);
975 qb_log_from_external_source(__func__, __FILE__,
ARGS_FMT, LOG_NOTICE, line, 0, arg_string);
986 case E2BIG:
return "E2BIG";
987 case EACCES:
return "EACCES";
988 case EADDRINUSE:
return "EADDRINUSE";
989 case EADDRNOTAVAIL:
return "EADDRNOTAVAIL";
990 case EAFNOSUPPORT:
return "EAFNOSUPPORT";
991 case EAGAIN:
return "EAGAIN";
992 case EALREADY:
return "EALREADY";
993 case EBADF:
return "EBADF";
994 case EBADMSG:
return "EBADMSG";
995 case EBUSY:
return "EBUSY";
996 case ECANCELED:
return "ECANCELED";
997 case ECHILD:
return "ECHILD";
998 case ECOMM:
return "ECOMM";
999 case ECONNABORTED:
return "ECONNABORTED";
1000 case ECONNREFUSED:
return "ECONNREFUSED";
1001 case ECONNRESET:
return "ECONNRESET";
1003 case EDESTADDRREQ:
return "EDESTADDRREQ";
1004 case EDOM:
return "EDOM";
1005 case EDQUOT:
return "EDQUOT";
1006 case EEXIST:
return "EEXIST";
1007 case EFAULT:
return "EFAULT";
1008 case EFBIG:
return "EFBIG";
1009 case EHOSTDOWN:
return "EHOSTDOWN";
1010 case EHOSTUNREACH:
return "EHOSTUNREACH";
1011 case EIDRM:
return "EIDRM";
1012 case EILSEQ:
return "EILSEQ";
1013 case EINPROGRESS:
return "EINPROGRESS";
1014 case EINTR:
return "EINTR";
1015 case EINVAL:
return "EINVAL";
1016 case EIO:
return "EIO";
1017 case EISCONN:
return "EISCONN";
1018 case EISDIR:
return "EISDIR";
1019 case ELIBACC:
return "ELIBACC";
1020 case ELOOP:
return "ELOOP";
1021 case EMFILE:
return "EMFILE";
1022 case EMLINK:
return "EMLINK";
1023 case EMSGSIZE:
return "EMSGSIZE";
1024 case EMULTIHOP:
return "EMULTIHOP";
1025 case ENAMETOOLONG:
return "ENAMETOOLONG";
1026 case ENETDOWN:
return "ENETDOWN";
1027 case ENETRESET:
return "ENETRESET";
1028 case ENETUNREACH:
return "ENETUNREACH";
1029 case ENFILE:
return "ENFILE";
1030 case ENOBUFS:
return "ENOBUFS";
1031 case ENODATA:
return "ENODATA";
1032 case ENODEV:
return "ENODEV";
1033 case ENOENT:
return "ENOENT";
1034 case ENOEXEC:
return "ENOEXEC";
1035 case ENOKEY:
return "ENOKEY";
1036 case ENOLCK:
return "ENOLCK";
1037 case ENOLINK:
return "ENOLINK";
1038 case ENOMEM:
return "ENOMEM";
1039 case ENOMSG:
return "ENOMSG";
1040 case ENOPROTOOPT:
return "ENOPROTOOPT";
1041 case ENOSPC:
return "ENOSPC";
1042 case ENOSR:
return "ENOSR";
1043 case ENOSTR:
return "ENOSTR";
1044 case ENOSYS:
return "ENOSYS";
1045 case ENOTBLK:
return "ENOTBLK";
1046 case ENOTCONN:
return "ENOTCONN";
1047 case ENOTDIR:
return "ENOTDIR";
1048 case ENOTEMPTY:
return "ENOTEMPTY";
1049 case ENOTSOCK:
return "ENOTSOCK";
1051 case ENOTTY:
return "ENOTTY";
1053 case ENXIO:
return "ENXIO";
1054 case EOPNOTSUPP:
return "EOPNOTSUPP";
1055 case EOVERFLOW:
return "EOVERFLOW";
1056 case EPERM:
return "EPERM";
1057 case EPFNOSUPPORT:
return "EPFNOSUPPORT";
1058 case EPIPE:
return "EPIPE";
1059 case EPROTO:
return "EPROTO";
1060 case EPROTONOSUPPORT:
return "EPROTONOSUPPORT";
1061 case EPROTOTYPE:
return "EPROTOTYPE";
1062 case ERANGE:
return "ERANGE";
1063 case EREMOTE:
return "EREMOTE";
1066 case EROFS:
return "EROFS";
1067 case ESHUTDOWN:
return "ESHUTDOWN";
1068 case ESPIPE:
return "ESPIPE";
1069 case ESOCKTNOSUPPORT:
return "ESOCKTNOSUPPORT";
1070 case ESRCH:
return "ESRCH";
1071 case ESTALE:
return "ESTALE";
1072 case ETIME:
return "ETIME";
1073 case ETIMEDOUT:
return "ETIMEDOUT";
1074 case ETXTBSY:
return "ETXTBSY";
1075 case EUNATCH:
return "EUNATCH";
1076 case EUSERS:
return "EUSERS";
1078 case EXDEV:
return "EXDEV";
1082 case EBADE:
return "EBADE";
1083 case EBADFD:
return "EBADFD";
1084 case EBADSLT:
return "EBADSLT";
1085 case EDEADLOCK:
return "EDEADLOCK";
1086 case EBADR:
return "EBADR";
1087 case EBADRQC:
return "EBADRQC";
1088 case ECHRNG:
return "ECHRNG";
1090 case EISNAM:
return "EISNAM";
1091 case EKEYEXPIRED:
return "EKEYEXPIRED";
1093 case EKEYREVOKED:
return "EKEYREVOKED";
1095 case EL2HLT:
return "EL2HLT";
1096 case EL2NSYNC:
return "EL2NSYNC";
1097 case EL3HLT:
return "EL3HLT";
1098 case EL3RST:
return "EL3RST";
1099 case ELIBBAD:
return "ELIBBAD";
1100 case ELIBMAX:
return "ELIBMAX";
1101 case ELIBSCN:
return "ELIBSCN";
1102 case ELIBEXEC:
return "ELIBEXEC";
1104 case ENOMEDIUM:
return "ENOMEDIUM";
1105 case EMEDIUMTYPE:
return "EMEDIUMTYPE";
1107 case ENONET:
return "ENONET";
1108 case ENOPKG:
return "ENOPKG";
1109 case EREMCHG:
return "EREMCHG";
1110 case ERESTART:
return "ERESTART";
1111 case ESTRPIPE:
return "ESTRPIPE";
1113 case EUCLEAN:
return "EUCLEAN";
1115 case EXFULL:
return "EXFULL";
1137 int error = abs(rc);
1147 return "Generic Pacemaker error";
1149 return "Operation requires quorum";
1151 return "Update does not conform to the configured schema";
1153 return "Schema transform failed";
1155 return "Update was older than existing configuration";
1157 return "Application of an update diff failed";
1159 return "Application of an update diff failed, requesting a full refresh";
1161 return "The on-disk configuration was manually modified";
1163 return "Could not archive the previous configuration";
1165 return "Could not save the new configuration to disk";
1167 return "Could not parse on-disk configuration";
1170 return "Schema is already the latest available";
1175 return "Name not unique on network";
1178 return "Communication error on send";
1181 return "Can not access a needed shared library";
1184 return "Remote I/O error";
1187 return "Protocol driver not attached";
1190 return "Required key not available";
1193 crm_err(
"Unknown error code: %d", rc);
1194 return "Unknown error";
1208 case BZ_CONFIG_ERROR:
1209 return "libbz2 has been improperly compiled on your platform";
1210 case BZ_SEQUENCE_ERROR:
1211 return "library functions called in the wrong order";
1212 case BZ_PARAM_ERROR:
1213 return "parameter is out of range or otherwise incorrect";
1215 return "memory allocation failed";
1217 return "data integrity error is detected during decompression";
1218 case BZ_DATA_ERROR_MAGIC:
1219 return "the compressed stream does not start with the correct magic bytes";
1221 return "error reading or writing in the compressed file";
1222 case BZ_UNEXPECTED_EOF:
1223 return "compressed file finishes before the logical end of stream is detected";
1224 case BZ_OUTBUFF_FULL:
1225 return "output data will not fit into the buffer provided";
1227 return "Unknown error";
1234 const char *next = NULL;
1235 const char *offset = NULL;
1237 if (output == NULL) {
1239 output =
"-- empty --";
1247 (
int)(next - offset), offset);
1252 }
while (next != NULL && next[0] != 0);
1260 char *
string = NULL;
1262 va_start(ap, format);
1264 len = vasprintf (&
string, format, ap);
gboolean daemon_option_enabled(const char *daemon, const char *option)
void crm_write_blackbox(int nsig, struct qb_log_callsite *callsite)
#define crm_notice(fmt, args...)
void crm_enable_stderr(int enable)
gboolean safe_str_neq(const char *a, const char *b)
gboolean mainloop_add_signal(int sig, void(*dispatch)(int sig))
const char * pcmk_strerror(int rc)
char unsigned int set_crm_log_level(unsigned int level)
gboolean crm_log_init(const char *entity, uint8_t level, gboolean daemon, gboolean to_stderr, int argc, char **argv, gboolean quiet)
#define pcmk_err_old_data
#define pcmk_err_schema_unchanged
int crm_user_lookup(const char *name, uid_t *uid, gid_t *gid)
#define CRM_LOG_ASSERT(expr)
#define do_crm_log_alias(level, file, function, line, fmt, args...)
Log a message as if it came from a different code location.
unsigned int crm_trace_nonlog
char * strerror(int errnum)
Wrappers for and extensions to glib mainloop.
gboolean crm_log_cli_init(const char *entity)
void crm_bump_log_level(int argc, char **argv)
#define pcmk_err_diff_failed
void crm_log_deinit(void)
#define pcmk_err_diff_resync
#define crm_warn(fmt, args...)
int daemon(int nochdir, int noclose)
#define crm_debug(fmt, args...)
void crm_log_output_fn(const char *file, const char *function, int line, int level, const char *prefix, const char *output)
gboolean crm_signal(int sig, void(*dispatch)(int sig))
#define pcmk_err_no_quorum
#define pcmk_err_schema_validation
#define crm_trace(fmt, args...)
#define do_crm_log(level, fmt, args...)
Log a message.
int setenv(const char *name, const char *value, int why)
void crm_enable_blackbox(int nsig)
#define pcmk_err_cib_save
const char * pcmk_errorname(int rc)
#define pcmk_err_cib_backup
#define PCMK_ERROR_OFFSET
void crm_log_args(int argc, char **argv)
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
#define pcmk_err_transform_failed
void crm_log_preinit(const char *entity, int argc, char **argv)
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
const char * daemon_option(const char *option)
unsigned int get_crm_log_level(void)
unsigned int crm_log_level
void crm_disable_blackbox(int nsig)
#define crm_perror(level, fmt, args...)
Log a system error message.
#define crm_err(fmt, args...)
const char * bz2_strerror(int rc)
void set_daemon_option(const char *option, const char *value)
#define pcmk_err_cib_modified
char * strchrnul(const char *s, int c_in)
gboolean crm_is_true(const char *s)
unsigned int crm_log_priority
#define safe_str_eq(a, b)
gboolean crm_add_logfile(const char *filename)
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)
#define pcmk_err_cib_corrupt
void crm_update_callsites(void)
#define crm_info(fmt, args...)