summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 05b6846)
raw | patch | inline | side by side (parent: 05b6846)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 16 Jun 2008 21:02:36 +0000 (23:02 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 17 Jun 2008 19:57:21 +0000 (21:57 +0200) |
A few plugins have to set custom CFLAGS. When using "<plugin>_la_CFLAGS =",
$(AM_CFLAGS) will no longer be used when compiling <plugin> as that resets the
CFLAGS to the empty string. So, in that case, we have to explicitly add
$(AM_CFLAGS) to the custom CFLAGS of that plugin.
After doing so, a couple of problems have been identified which have been
fixed in this patch as well. That includes a possible SEGFAULT in the snmp
plugin which was missing an argument to WARNING().
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
$(AM_CFLAGS) will no longer be used when compiling <plugin> as that resets the
CFLAGS to the empty string. So, in that case, we have to explicitly add
$(AM_CFLAGS) to the custom CFLAGS of that plugin.
After doing so, a couple of problems have been identified which have been
fixed in this patch as well. That includes a possible SEGFAULT in the snmp
plugin which was missing an argument to WARNING().
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/Makefile.am | patch | blob | history | |
src/netlink.c | patch | blob | history | |
src/notify_desktop.c | patch | blob | history | |
src/plugin.c | patch | blob | history | |
src/rrdtool.c | patch | blob | history | |
src/snmp.c | patch | blob | history | |
src/utils_cache.c | patch | blob | history |
diff --git a/src/Makefile.am b/src/Makefile.am
index 5e1274257285caa5a7486d399da4ec22511f27e3..4e157fa9de7b28f9e6e4d775d7423af8deab39d6 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
types_list.c types_list.h
collectd_CPPFLAGS = $(AM_CPPFLAGS) $(LTDLINCL)
-collectd_CFLAGS =
+collectd_CFLAGS = $(AM_CFLAGS)
collectd_LDFLAGS = -export-dynamic
collectd_LDADD =
collectd_DEPENDENCIES =
pkglib_LTLIBRARIES += apache.la
apache_la_SOURCES = apache.c
apache_la_LDFLAGS = -module -avoid-version
-apache_la_CFLAGS =
+apache_la_CFLAGS = $(AM_CFLAGS)
apache_la_LIBADD =
collectd_LDADD += "-dlopen" apache.la
if BUILD_WITH_LIBCURL
pkglib_LTLIBRARIES += ascent.la
ascent_la_SOURCES = ascent.c
ascent_la_LDFLAGS = -module -avoid-version
-ascent_la_CFLAGS = $(BUILD_WITH_LIBCURL_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
+ascent_la_CFLAGS = $(AM_CFLAGS) \
+ $(BUILD_WITH_LIBCURL_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
ascent_la_LIBADD = $(BUILD_WITH_LIBCURL_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
collectd_LDADD += "-dlopen" apache.la
collectd_DEPENDENCIES += ascent.la
if BUILD_PLUGIN_CPU
pkglib_LTLIBRARIES += cpu.la
cpu_la_SOURCES = cpu.c
-cpu_la_CFLAGS =
+cpu_la_CFLAGS = $(AM_CFLAGS)
cpu_la_LDFLAGS = -module -avoid-version
cpu_la_LIBADD =
if BUILD_WITH_LIBKSTAT
if BUILD_PLUGIN_DISK
pkglib_LTLIBRARIES += disk.la
disk_la_SOURCES = disk.c
-disk_la_CFLAGS =
+disk_la_CFLAGS = $(AM_CFLAGS)
disk_la_LDFLAGS = -module -avoid-version
disk_la_LIBADD =
if BUILD_WITH_LIBKSTAT
if BUILD_PLUGIN_INTERFACE
pkglib_LTLIBRARIES += interface.la
interface_la_SOURCES = interface.c
-interface_la_CFLAGS =
+interface_la_CFLAGS = $(AM_CFLAGS)
interface_la_LDFLAGS = -module -avoid-version
interface_la_LIBADD =
collectd_LDADD += "-dlopen" interface.la
if BUILD_PLUGIN_IPMI
pkglib_LTLIBRARIES += ipmi.la
ipmi_la_SOURCES = ipmi.c
-ipmi_la_CFLAGS = $(BUILD_WITH_OPENIPMI_CFLAGS)
+ipmi_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_OPENIPMI_CFLAGS)
ipmi_la_LDFLAGS = -module -avoid-version
ipmi_la_LIBADD = $(BUILD_WITH_OPENIPMI_LIBS)
collectd_LDADD += "-dlopen" ipmi.la
if BUILD_PLUGIN_LIBVIRT
pkglib_LTLIBRARIES += libvirt.la
libvirt_la_SOURCES = libvirt.c
-libvirt_la_CFLAGS = $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
+libvirt_la_CFLAGS = $(AM_CFLAGS) \
+ $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
libvirt_la_LIBADD = $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
libvirt_la_LDFLAGS = -module -avoid-version
collectd_LDADD += "-dlopen" libvirt.la
if BUILD_PLUGIN_LOAD
pkglib_LTLIBRARIES += load.la
load_la_SOURCES = load.c
-load_la_CFLAGS =
+load_la_CFLAGS = $(AM_CFLAGS)
load_la_LDFLAGS = -module -avoid-version
load_la_LIBADD =
collectd_LDADD += "-dlopen" load.la
pkglib_LTLIBRARIES += memcached.la
memcached_la_SOURCES = memcached.c
memcached_la_LDFLAGS = -module -avoid-version
-memcached_la_CFLAGS =
memcached_la_LIBADD =
if BUILD_WITH_LIBSOCKET
memcached_la_LDFLAGS += -lsocket
if BUILD_PLUGIN_MEMORY
pkglib_LTLIBRARIES += memory.la
memory_la_SOURCES = memory.c
-memory_la_CFLAGS =
+memory_la_CFLAGS = $(AM_CFLAGS)
memory_la_LDFLAGS = -module -avoid-version
memory_la_LIBADD =
collectd_LDADD += "-dlopen" memory.la
pkglib_LTLIBRARIES += mysql.la
mysql_la_SOURCES = mysql.c
mysql_la_LDFLAGS = -module -avoid-version
-mysql_la_CFLAGS =
+mysql_la_CFLAGS = $(AM_CFLAGS)
mysql_la_LIBADD =
collectd_LDADD += "-dlopen" mysql.la
if BUILD_WITH_LIBMYSQL
pkglib_LTLIBRARIES += netlink.la
netlink_la_SOURCES = netlink.c
netlink_la_LDFLAGS = -module -avoid-version
-netlink_la_CFLAGS = $(BUILD_WITH_LIBNETLINK_CFLAGS)
+netlink_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBNETLINK_CFLAGS)
netlink_la_LIBADD = $(BUILD_WITH_LIBNETLINK_LIBS)
collectd_LDADD += "-dlopen" netlink.la
collectd_DEPENDENCIES += netlink.la
if BUILD_PLUGIN_NOTIFY_DESKTOP
pkglib_LTLIBRARIES += notify_desktop.la
notify_desktop_la_SOURCES = notify_desktop.c
-notify_desktop_la_CFLAGS = $(LIBNOTIFY_CFLAGS)
+notify_desktop_la_CFLAGS = $(AM_CFLAGS) $(LIBNOTIFY_CFLAGS)
notify_desktop_la_LDFLAGS = -module -avoid-version $(LIBNOTIFY_LIBS)
collectd_LDADD += "-dlopen" notify_desktop.la
collectd_DEPENDENCIES += notify_desktop.la
pkglib_LTLIBRARIES += perl.la
perl_la_SOURCES = perl.c
perl_la_CFLAGS = $(AM_CFLAGS) \
- $(PERL_CFLAGS) \
- -DXS_VERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
+ $(PERL_CFLAGS) \
+ -DXS_VERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
perl_la_LDFLAGS = -module -avoid-version \
- $(PERL_LDFLAGS)
+ $(PERL_LDFLAGS)
collectd_LDADD += "-dlopen" perl.la
collectd_DEPENDENCIES += perl.la
endif
pkglib_LTLIBRARIES += rrdtool.la
rrdtool_la_SOURCES = rrdtool.c
rrdtool_la_LDFLAGS = -module -avoid-version
-rrdtool_la_CFLAGS = $(BUILD_WITH_LIBRRD_CFLAGS)
+rrdtool_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBRRD_CFLAGS)
rrdtool_la_LIBADD = $(BUILD_WITH_LIBRRD_LDFLAGS)
collectd_LDADD += "-dlopen" rrdtool.la
collectd_DEPENDENCIES += rrdtool.la
if BUILD_PLUGIN_SENSORS
pkglib_LTLIBRARIES += sensors.la
sensors_la_SOURCES = sensors.c
-sensors_la_CFLAGS = $(BUILD_WITH_LIBSENSORS_CFLAGS)
+sensors_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBSENSORS_CFLAGS)
sensors_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBSENSORS_LDFLAGS)
sensors_la_LIBADD = -lsensors
collectd_LDADD += "-dlopen" sensors.la
pkglib_LTLIBRARIES += snmp.la
snmp_la_SOURCES = snmp.c
snmp_la_LDFLAGS = -module -avoid-version
-snmp_la_CFLAGS =
+snmp_la_CFLAGS = $(AM_CFLAGS)
snmp_la_LIBADD =
if BUILD_WITH_LIBNETSNMP
snmp_la_CFLAGS += $(BUILD_WITH_LIBSNMP_CFLAGS)
if BUILD_PLUGIN_SWAP
pkglib_LTLIBRARIES += swap.la
swap_la_SOURCES = swap.c
-swap_la_CFLAGS =
+swap_la_CFLAGS = $(AM_CFLAGS)
swap_la_LDFLAGS = -module -avoid-version
swap_la_LIBADD =
collectd_LDADD += "-dlopen" swap.la
if BUILD_PLUGIN_USERS
pkglib_LTLIBRARIES += users.la
users_la_SOURCES = users.c
-users_la_CFLAGS =
+users_la_CFLAGS = $(AM_CFLAGS)
users_la_LDFLAGS = -module -avoid-version
users_la_LIBADD =
if BUILD_WITH_LIBSTATGRAB
diff --git a/src/netlink.c b/src/netlink.c
index f597b01d3243b5ad890b5e096b51ebca2273841b..d621da5bbb15b40d3d2d6efcb1982f8efcfa09f0 100644 (file)
--- a/src/netlink.c
+++ b/src/netlink.c
} /* void submit_two */
static int link_filter (const struct sockaddr_nl *sa,
- const struct nlmsghdr *nmh, void *args)
+ struct nlmsghdr *nmh, void *args)
{
struct ifinfomsg *msg;
int msg_len;
} /* int link_filter */
static int qos_filter (const struct sockaddr_nl *sa,
- const struct nlmsghdr *nmh, void *args)
+ struct nlmsghdr *nmh, void *args)
{
struct tcmsg *msg;
int msg_len;
diff --git a/src/notify_desktop.c b/src/notify_desktop.c
index 822b50663a3b6060a7f3b1c902f709f360570f14..2e62e88c46fa61c3ea3b5200524d88fdb12ac779 100644 (file)
--- a/src/notify_desktop.c
+++ b/src/notify_desktop.c
*/
#include "collectd.h"
+#include "common.h"
#include "plugin.h"
#include "configfile.h"
diff --git a/src/plugin.c b/src/plugin.c
index 2d431db360b53127b10cbfc5c025142b6c28bb58..4a25aaa773b3dd6ba4f381bb7fcfa3344cae34c7 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
(*callback) (timeout, identifier);
}
+ return (0);
} /* int plugin_flush */
void plugin_shutdown_all (void)
if (this->type == NM_TYPE_STRING)
{
- sfree (this->value_string);
+ free ((char *)this->value_string);
+ this->value_string = NULL;
}
sfree (this);
diff --git a/src/rrdtool.c b/src/rrdtool.c
index b3bc38146c9670f198e153598c70895d4d46c3dc..fd499fd9364bb9b9aaa00e2e89c989c54ea691f7 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
#if HAVE_THREADSAFE_LIBRRD
static int srrd_create (char *filename, unsigned long pdp_step, time_t last_up,
- int argc, char **argv)
+ int argc, const char **argv)
{
int status;
return (status);
} /* int srrd_create */
-static int srrd_update (char *filename, char *template, int argc, char **argv)
+static int srrd_update (char *filename, char *template,
+ int argc, const char **argv)
{
int status;
#else /* !HAVE_THREADSAFE_LIBRRD */
static int srrd_create (char *filename, unsigned long pdp_step, time_t last_up,
- int argc, char **argv)
+ int argc, const char **argv)
{
int status;
return (status);
} /* int srrd_create */
-static int srrd_update (char *filename, char *template, int argc, char **argv)
+static int srrd_update (char *filename, char *template,
+ int argc, const char **argv)
{
int status;
@@ -508,7 +510,7 @@ static int rrd_create_file (char *filename, const data_set_t *ds, const value_li
status = srrd_create (filename,
(stepsize > 0) ? stepsize : vl->interval,
vl->time - 10,
- argc, argv);
+ argc, (const char **)argv);
free (argv);
ds_free (ds_num, ds_def);
pthread_mutex_unlock (&cache_lock);
/* Write the values to the RRD-file */
- srrd_update (queue_entry->filename, NULL, values_num, values);
+ srrd_update (queue_entry->filename, NULL,
+ values_num, (const char **)values);
DEBUG ("rrdtool plugin: queue thread: Wrote %i values to %s",
values_num, queue_entry->filename);
}
DEBUG ("rrdtool plugin: rrd_cache_insert: file = %s; "
- "values_num = %i; age = %u;",
+ "values_num = %i; age = %lu;",
filename, rc->values_num,
- rc->last_value - rc->first_value);
+ (unsigned long)(rc->last_value - rc->first_value));
if ((rc->last_value - rc->first_value) >= cache_timeout)
{
diff --git a/src/snmp.c b/src/snmp.c
index 6f11af045a7f7627b1e7feadf40e100ebb9f76aa..75fa880e76911996fdb854ede9595392a326c9ff 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
if (vb == NULL)
{
ERROR ("snmp plugin: host %s: Expected one more variable for "
- "the instance..");
+ "the instance..", host->name);
return (-1);
}
if ((time_end - time_start) > host->interval)
{
WARNING ("snmp plugin: Host `%s' should be queried every %i seconds, "
- "but reading all values takes %i seconds.",
- host->name, host->interval, time_end - time_start);
+ "but reading all values takes %lu seconds.",
+ host->name, host->interval, (unsigned long)(time_end - time_start));
}
return (0);
diff --git a/src/utils_cache.c b/src/utils_cache.c
index d7d31c53ec64642b97ff329a10a17f2be26a6188..04075f5579dade1175687f793c3f056288267d4a 100644 (file)
--- a/src/utils_cache.c
+++ b/src/utils_cache.c
}
else
{
- WARNING ("uc_check_timeout: ut_check_interesting (%s) returned ",
+ WARNING ("uc_check_timeout: ut_check_interesting (%s) returned "
"invalid status %i.",
keys[i], status);
}