char logfile[PATH_MAX]; /* mcelog logfile */
pthread_t tid; /* poll thread id */
llist_t *dimms_list; /* DIMMs list */
char logfile[PATH_MAX]; /* mcelog logfile */
pthread_t tid; /* poll thread id */
llist_t *dimms_list; /* DIMMs list */
- if (dimm_le == NULL) {
- mcelog_memory_rec_t *dimm_mr = calloc(1, sizeof(*dimm_mr));
- if (dimm_mr == NULL) {
- ERROR(MCELOG_PLUGIN ": Error allocating dimm memory item");
- return NULL;
- }
- char *p_name = strdup(dimm_name);
- if (p_name == NULL) {
- ERROR(MCELOG_PLUGIN ": strdup: error");
- free(dimm_mr);
- return NULL;
- }
+ if (dimm_le != NULL)
+ return dimm_le;
- /* add new dimm */
- dimm_le = llentry_create(p_name, dimm_mr);
- if (dimm_le == NULL) {
- ERROR(MCELOG_PLUGIN ": llentry_create(): error");
- free(dimm_mr);
- free(p_name);
- return NULL;
- }
- pthread_mutex_lock(&g_mcelog_config.dimms_lock);
- llist_append(g_mcelog_config.dimms_list, dimm_le);
- pthread_mutex_unlock(&g_mcelog_config.dimms_lock);
+ /* allocate new linked list entry */
+ mcelog_memory_rec_t *dimm_mr = calloc(1, sizeof(*dimm_mr));
+ if (dimm_mr == NULL) {
+ ERROR(MCELOG_PLUGIN ": Error allocating dimm memory item");
+ return NULL;
+ }
+ char *p_name = strdup(dimm_name);
+ if (p_name == NULL) {
+ ERROR(MCELOG_PLUGIN ": strdup: error");
+ free(dimm_mr);
+ return NULL;
+ /* add new dimm */
+ dimm_le = llentry_create(p_name, dimm_mr);
+ if (dimm_le == NULL) {
+ ERROR(MCELOG_PLUGIN ": llentry_create(): error");
+ free(dimm_mr);
+ free(p_name);
+ return NULL;
+ }
+ pthread_mutex_lock(&g_mcelog_config.dimms_lock);
+ llist_append(g_mcelog_config.dimms_list, dimm_le);
+ pthread_mutex_unlock(&g_mcelog_config.dimms_lock);
+
ERROR(MCELOG_PLUGIN ": Invalid configuration option: \"%s\", Logfile "
"option is already configured.",
child->key);
ERROR(MCELOG_PLUGIN ": Invalid configuration option: \"%s\", Logfile "
"option is already configured.",
child->key);
if (strcasecmp("McelogClientSocket", mem_child->key) == 0) {
if (cf_util_get_string_buffer(
mem_child, socket_adapter.unix_sock.sun_path,
sizeof(socket_adapter.unix_sock.sun_path)) < 0) {
ERROR(MCELOG_PLUGIN ": Invalid configuration option: \"%s\".",
mem_child->key);
if (strcasecmp("McelogClientSocket", mem_child->key) == 0) {
if (cf_util_get_string_buffer(
mem_child, socket_adapter.unix_sock.sun_path,
sizeof(socket_adapter.unix_sock.sun_path)) < 0) {
ERROR(MCELOG_PLUGIN ": Invalid configuration option: \"%s\".",
mem_child->key);
}
} else if (strcasecmp("PersistentNotification", mem_child->key) == 0) {
if (cf_util_get_boolean(mem_child, &g_mcelog_config.persist) < 0) {
ERROR(MCELOG_PLUGIN ": Invalid configuration option: \"%s\".",
mem_child->key);
}
} else if (strcasecmp("PersistentNotification", mem_child->key) == 0) {
if (cf_util_get_boolean(mem_child, &g_mcelog_config.persist) < 0) {
ERROR(MCELOG_PLUGIN ": Invalid configuration option: \"%s\".",
mem_child->key);
llentry_t *dimm = mcelog_dimm(mr, g_mcelog_config.dimms_list);
if (dimm == NULL) {
ERROR(MCELOG_PLUGIN
": Error adding/getting dimm memory item to/from cache");
llentry_t *dimm = mcelog_dimm(mr, g_mcelog_config.dimms_list);
if (dimm == NULL) {
ERROR(MCELOG_PLUGIN
": Error adding/getting dimm memory item to/from cache");
if (!dispatch_corrected_notifs && !dispatch_uncorrected_notifs) {
DEBUG("%s: No new notifications to dispatch", MCELOG_PLUGIN);
if (!dispatch_corrected_notifs && !dispatch_uncorrected_notifs) {
DEBUG("%s: No new notifications to dispatch", MCELOG_PLUGIN);
int err = pthread_mutex_init(&g_mcelog_config.dimms_lock, NULL);
if (err < 0) {
ERROR(MCELOG_PLUGIN ": plugin: failed to initialize cache lock");
int err = pthread_mutex_init(&g_mcelog_config.dimms_lock, NULL);
if (err < 0) {
ERROR(MCELOG_PLUGIN ": plugin: failed to initialize cache lock");
if (plugin_thread_create(&g_mcelog_config.tid, NULL, poll_worker, NULL,
NULL) != 0) {
ERROR(MCELOG_PLUGIN ": Error creating poll thread.");
if (plugin_thread_create(&g_mcelog_config.tid, NULL, poll_worker, NULL,
NULL) != 0) {
ERROR(MCELOG_PLUGIN ": Error creating poll thread.");