projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'pr/1345'
[collectd.git]
/
src
/
daemon
/
plugin.c
diff --git
a/src/daemon/plugin.c
b/src/daemon/plugin.c
index
299a980
..
831e3fb
100644
(file)
--- a/
src/daemon/plugin.c
+++ b/
src/daemon/plugin.c
@@
-241,13
+241,13
@@
static void destroy_read_heap (void) /* {{{ */
while (42)
{
while (42)
{
-
callback_func_t *c
f;
+
read_func_t *r
f;
-
c
f = c_heap_get_root (read_heap);
- if (
c
f == NULL)
+
r
f = c_heap_get_root (read_heap);
+ if (
r
f == NULL)
break;
break;
-
- destroy_callback (
c
f);
+ sfree (rf->rf_name);
+ destroy_callback (
(callback_func_t *) r
f);
}
c_heap_destroy (read_heap);
}
c_heap_destroy (read_heap);
@@
-889,7
+889,7
@@
static void start_write_threads (size_t num) /* {{{ */
static void stop_write_threads (void) /* {{{ */
{
write_queue_t *q;
static void stop_write_threads (void) /* {{{ */
{
write_queue_t *q;
-
in
t i;
+
size_
t i;
if (write_threads == NULL)
return;
if (write_threads == NULL)
return;
@@
-930,7
+930,7
@@
static void stop_write_threads (void) /* {{{ */
if (i > 0)
{
if (i > 0)
{
- WARNING ("plugin: %
i
value list%s left after shutting down "
+ WARNING ("plugin: %
zu
value list%s left after shutting down "
"the write threads.",
i, (i == 1) ? " was" : "s were");
}
"the write threads.",
i, (i == 1) ? " was" : "s were");
}
@@
-1089,6
+1089,7
@@
int plugin_load (char const *plugin_name, uint32_t flags)
/* success */
plugin_mark_loaded (plugin_name);
ret = 0;
/* success */
plugin_mark_loaded (plugin_name);
ret = 0;
+ INFO ("plugin_load: plugin \"%s\" successfully loaded.", plugin_name);
break;
}
else
break;
}
else
@@
-1243,8
+1244,10
@@
int plugin_register_read (const char *name,
rf->rf_interval = plugin_get_interval ();
status = plugin_insert_read (rf);
rf->rf_interval = plugin_get_interval ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
sfree (rf);
+ }
return (status);
} /* int plugin_register_read */
return (status);
} /* int plugin_register_read */
@@
-1288,8
+1291,10
@@
int plugin_register_complex_read (const char *group, const char *name,
rf->rf_ctx = plugin_get_ctx ();
status = plugin_insert_read (rf);
rf->rf_ctx = plugin_get_ctx ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
sfree (rf);
+ }
return (status);
} /* int plugin_register_complex_read */
return (status);
} /* int plugin_register_complex_read */
@@
-1367,7
+1372,6
@@
int plugin_register_flush (const char *name,
{
ERROR ("plugin_register_flush: malloc failed.");
sfree(flush_name);
{
ERROR ("plugin_register_flush: malloc failed.");
sfree(flush_name);
- plugin_unregister (list_flush, name);
return (-1);
}
return (-1);
}
@@
-1377,7
+1381,6
@@
int plugin_register_flush (const char *name,
ERROR ("plugin_register_flush: strdup failed.");
sfree(cb);
sfree(flush_name);
ERROR ("plugin_register_flush: strdup failed.");
sfree(cb);
sfree(flush_name);
- plugin_unregister (list_flush, name);
return (-1);
}
cb->timeout = ctx.flush_timeout;
return (-1);
}
cb->timeout = ctx.flush_timeout;
@@
-1397,7
+1400,6
@@
int plugin_register_flush (const char *name,
{
sfree(cb->name);
sfree(cb);
{
sfree(cb->name);
sfree(cb);
- plugin_unregister (list_flush, name);
return status;
}
}
return status;
}
}
@@
-1443,7
+1445,7
@@
static void plugin_free_data_sets (void)
int plugin_register_data_set (const data_set_t *ds)
{
data_set_t *ds_copy;
int plugin_register_data_set (const data_set_t *ds)
{
data_set_t *ds_copy;
-
in
t i;
+
size_
t i;
if ((data_sets != NULL)
&& (c_avl_get (data_sets, ds->type, NULL) == 0))
if ((data_sets != NULL)
&& (c_avl_get (data_sets, ds->type, NULL) == 0))
@@
-1624,15
+1626,15
@@
int plugin_unregister_flush (const char *name)
plugin_ctx_t ctx = plugin_get_ctx ();
if (ctx.flush_interval != 0)
plugin_ctx_t ctx = plugin_get_ctx ();
if (ctx.flush_interval != 0)
-
{
+ {
char *flush_name;
flush_name = plugin_flush_callback_name (name);
char *flush_name;
flush_name = plugin_flush_callback_name (name);
- if (flush_name
=
= NULL)
- return (-1);
-
-
plugin_unregister_read
(flush_name);
- sfree(flush_name);
+ if (flush_name
!
= NULL)
+ {
+ plugin_unregister_read(flush_name);
+
sfree
(flush_name);
+ }
}
return plugin_unregister (list_flush, name);
}
return plugin_unregister (list_flush, name);
@@
-1723,8
+1725,6
@@
void plugin_init_all (void)
write_threads_num = 5;
}
write_threads_num = 5;
}
- start_write_threads ((size_t) write_threads_num);
-
if ((list_init == NULL) && (read_heap == NULL))
return;
if ((list_init == NULL) && (read_heap == NULL))
return;
@@
-1760,6
+1760,8
@@
void plugin_init_all (void)
le = le->next;
}
le = le->next;
}
+ start_write_threads ((size_t) write_threads_num);
+
max_read_interval = global_option_get_time ("MaxReadInterval",
DEFAULT_MAX_READ_INTERVAL);
max_read_interval = global_option_get_time ("MaxReadInterval",
DEFAULT_MAX_READ_INTERVAL);
@@
-1834,6
+1836,7
@@
int plugin_read_all_once (void)
return_status = -1;
}
return_status = -1;
}
+ sfree (rf->rf_name);
destroy_callback ((void *) rf);
}
destroy_callback ((void *) rf);
}
@@
-2140,8
+2143,8
@@
static int plugin_dispatch_values_internal (value_list_t *vl)
if (ds->ds_num != vl->values_len)
{
ERROR ("plugin_dispatch_values: ds->type = %s: "
if (ds->ds_num != vl->values_len)
{
ERROR ("plugin_dispatch_values: ds->type = %s: "
- "(ds->ds_num = %
i
) != "
- "(vl->values_len = %
i
)",
+ "(ds->ds_num = %
zu
) != "
+ "(vl->values_len = %
zu
)",
ds->type, ds->ds_num, vl->values_len);
return (-1);
}
ds->type, ds->ds_num, vl->values_len);
return (-1);
}