author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sun, 24 Apr 2016 11:25:21 +0000 (13:25 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sun, 24 Apr 2016 11:25:21 +0000 (13:25 +0200) |
processes: warn about process names above OS limit
51 files changed:
diff --git a/configure.ac b/configure.ac
index f623263f00463014638773702f3925ad77af6cf7..5e4c309ac0b110a815a9f6a6de105ab66fe9e501 100644 (file)
--- a/configure.ac
+++ b/configure.ac
#
AC_PROG_CC
AC_PROG_CPP
+AC_PROG_EGREP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
+AC_CACHE_CHECK([if bison is the parser generator],
+ [collectd_cv_prog_bison],
+ [AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '],
+ [collectd_cv_prog_bison=yes], [collectd_cv_prog_bison=no]
+ )]
+)
+
+if test "x$collectd_cv_prog_bison" = "xno" && test ! -f "${srcdir}/src/liboconfig/parser.c"
+then
+ AC_MSG_ERROR([bison is missing and you do not have ${srcdir}/src/liboconfig/parser.c. Please install bison])
+fi
+
AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
if test "x$have_protoc_c" = "xno"
then
#endif
])
-AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h)
+AC_CHECK_HEADERS([ \
+ ctype.h \
+ fs_info.h \
+ fshelp.h \
+ grp.h \
+ kvm.h \
+ limits.h \
+ mntent.h \
+ mnttab.h \
+ paths.h \
+ pwd.h \
+ sys/fs_types.h \
+ sys/fstyp.h \
+ sys/mntent.h \
+ sys/mnttab.h \
+ sys/statfs.h \
+ sys/statvfs.h \
+ sys/un.h \
+ sys/vfs.h \
+ sys/vfstab.h \
+ wordexp.h \
+])
+
+AC_CHECK_HEADERS([xfs/xqm.h], [], [],
+[
+#define _GNU_SOURCE
+])
# For the dns plugin
AC_CHECK_HEADERS(arpa/nameser.h)
AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
[#define _BSD_SOURCE
+#define _DEFAULT_SOURCE
#if HAVE_STDINT_H
# include <stdint.h>
#endif
])
AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
[#define _BSD_SOURCE
+#define _DEFAULT_SOURCE
#if HAVE_STDINT_H
# include <stdint.h>
#endif
index d3f267491df5d67a702290e440c4448dcccc55b7..7f56007fbd40eb10a348e3575436b4c3e0ca2271 100644 (file)
%{?el7:%global _has_lvm2app_h 1}
%{?el7:%global _has_recent_librrd 1}
%{?el7:%global _has_varnish4 1}
-%{?el7:%global _has_broken_libmemcached 1}
%{?el7:%global _has_iproute 1}
+%{?el7:%global _has_libmodbus 1}
+%{?el7:%global _has_xmms 1}
# plugins enabled by default
%define with_aggregation 0%{!?_without_aggregation:1}
%define with_madwifi 0%{!?_without_madwifi:1}
%define with_mbmon 0%{!?_without_mbmon:1}
%define with_md 0%{!?_without_md:1}
-%define with_memcachec 0%{!?_without_memcachec:0%{!?_has_broken_libmemcached:1}}
+%define with_memcachec 0%{!?_without_memcachec:1}
%define with_memcached 0%{!?_without_memcached:1}
%define with_memory 0%{!?_without_memory:1}
%define with_multimeter 0%{!?_without_multimeter:1}
%define with_write_graphite 0%{!?_without_write_graphite:1}
%define with_write_http 0%{!?_without_write_http:1}
%define with_write_riemann 0%{!?_without_write_riemann:1}
+%define with_xmms 0%{!?_without_xmms:0%{?_has_xmms}}
# Plugins not built by default because of dependencies on libraries not
# available in RHEL or EPEL:
%define with_write_mongodb 0%{!?_without_write_mongodb:0}
# plugin write_redis disabled, requires credis
%define with_write_redis 0%{!?_without_write_redis:0}
-# plugin xmms disabled, requires xmms
-%define with_xmms 0%{!?_without_xmms:0}
# plugin zfs_arc disabled, requires FreeBSD/Solaris
%define with_zfs_arc 0%{!?_without_zfs_arc:0}
The riemann plugin submits values to Riemann, an event stream processor.
%endif
+%if %{with_xmms}
+%package xmms
+Summary: XMMS plugin for collectd
+Group: System Environment/Daemons
+Requires: %{name}%{?_isa} = %{version}-%{release}
+BuildRequires: xmms-devel
+%description xmms
+The xmms plugin collects information from the XMMS music player.
+%endif
+
%package collection3
Summary: Web-based viewer for collectd
Group: System Environment/Daemons
%{_includedir}/collectd/network_buffer.h
%{_includedir}/collectd/lcc_features.h
%{_libdir}/pkgconfig/libcollectdclient.pc
+%{_libdir}/libcollectdclient.so
%files -n libcollectdclient
-%{_libdir}/libcollectdclient.so
%{_libdir}/libcollectdclient.so.*
%if %{with_amqp}
%{_libdir}/%{name}/write_riemann.so
%endif
+%if %{with_xmms}
+%files xmms
+%{_libdir}/%{name}/xmms.so
+%endif
+
%files collection3
%{_localstatedir}/www/collection3
%{_sysconfdir}/httpd/conf.d/collection3.conf
%doc contrib/
%changelog
-* Mon Aug 19 2013 Marc Fournier <marc.fournier@camptocamp.com> 5.4.0-1
+* Mon Aug 19 2013 Marc Fournier <marc.fournier@camptocamp.com> 5.4.2-1
- New upstream version
- Build netlink plugin by default
- Enable cgroups, lvm and statsd plugins
- Enable (but don't build by default) mic, aquaero and sigrok plugins
+- Enable modbus, memcachec and xmms plugins on RHEL7
* Tue Aug 06 2013 Marc Fournier <marc.fournier@camptocamp.com> 5.3.1-1
- New upstream version
diff --git a/src/apache.c b/src/apache.c
index 13c8db66801291fb05cac46171ce089e14175e47..ee062206516463371539228c56912db04461f85f 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
st = user_data->data;
+ int status;
+
+ char *content_type;
+ static const char *text_plain = "text/plain";
+
assert (st->url != NULL);
/* (Assured by `config_add') */
if (st->curl == NULL)
{
- int status;
-
status = init_host (st);
if (status != 0)
return (-1);
st->server_type = APACHE;
}
+ status = curl_easy_getinfo (st->curl, CURLINFO_CONTENT_TYPE, &content_type);
+ if ((status == CURLE_OK) && (content_type != NULL) &&
+ (strncasecmp (content_type, text_plain, strlen (text_plain)) != 0))
+ {
+ WARNING ("apache plugin: `Content-Type' response header is not `%s' "
+ "(received: `%s'). Expecting unparseable data. Please check `URL' "
+ "parameter (missing `?auto' suffix ?)",
+ text_plain, content_type);
+ }
+
ptr = st->apache_buffer;
saveptr = NULL;
while ((line = strtok_r (ptr, "\n\r", &saveptr)) != NULL)
diff --git a/src/battery.c b/src/battery.c
index 4178d8b5145f2b728e5c7c949d72ebd8d126a89e..d921484dc74e410191aee2fbc08d37dddfc1db52 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
@@ -111,7 +111,7 @@ static void battery_submit (const char *plugin_instance, const char *type, doubl
} /* void battery_submit */
#if HAVE_IOKIT_PS_IOPOWERSOURCES_H || HAVE_IOKIT_IOKITLIB_H
-double dict_get_double (CFDictionaryRef dict, char *key_string)
+static double dict_get_double (CFDictionaryRef dict, char *key_string)
{
double val_double;
long long val_int;
diff --git a/src/bind.c b/src/bind.c
index f9cf79eca47e9d2a619adc1911223e1f72d58f6d..28d28b68e5fa56fd1584c24f5c2ead252df5dc03 100644 (file)
--- a/src/bind.c
+++ b/src/bind.c
for (i = 0; i < zone_nodes->nodesetval->nodeNr; i++)
{
- xmlNode *node;
-
node = zone_nodes->nodesetval->nodeTab[i];
assert (node != NULL);
diff --git a/src/collectd-exec.pod b/src/collectd-exec.pod
index 217b3ac0092495be6a84098f1d3bcf5be7ee9dc5..57e5b6e2e43a8ab2bb8b126dbbcd79565be2a5de 100644 (file)
--- a/src/collectd-exec.pod
+++ b/src/collectd-exec.pod
an integer if the data-source is a counter, or a double if the data-source is
of type "gauge". You can submit an undefined gauge-value by using B<U>. When
submitting B<U> to a counter the behavior is undefined. The time is given as
-epoch (i.E<nbsp>e. standard UNIX time).
+epoch (i.E<nbsp>e. standard UNIX time) or B<N> to use the current time.
You can mix options and values, but the order is important: Options only
effect following values, so specifying an option as last field is allowed, but
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 18af78bb492dfb3220dce1ff8cc140b0daabd5dc..f712f5f684f45a44546a0bdc2701514d225c1aaa 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
# Lines beginning with a single `#' belong to plugins which have been built #
# but are disabled by default. #
# #
-# Lines begnning with `##' belong to plugins which have not been built due #
+# Lines beginning with `##' belong to plugins which have not been built due #
# to missing dependencies or because they have been deactivated explicitly. #
##############################################################################
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 3b7b9e6495d4f91ea716387d07a1581259ed0e12..416365678e007ff4059a0537e370ac070ed7df3c 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
in combination with recursively including a directory to easily be able to
arbitrarily mix configuration files and other documents (e.g. README files).
The given example is similar to the first example above but includes all files
-matching C<*.conf> in any subdirectory of C</etc/collectd.d>:
-
- Include "/etc/collectd.d" "*.conf"
+matching C<*.conf> in any subdirectory of C</etc/collectd.d>.
=back
=item B<IgnoreSelected> I<true>|I<false>
-If no configuration if given, the B<traffic>-plugin will collect data from
+If no configuration if given, the B<interface>-plugin will collect data from
all interfaces. This may not be practical, especially for loopback- and
similar interfaces. Thus, you can use the B<Interface>-option to pick the
interfaces you're interested in. Sometimes, however, it's easier/preferred
diff --git a/src/collectdctl.c b/src/collectdctl.c
index 0b8d0c1e89ee1547f955c0795bf388d1568eb518..478f2a4b4172d77079bee5aeecef15c78bd396f8 100644 (file)
--- a/src/collectdctl.c
+++ b/src/collectdctl.c
int status;
while (42) {
- int c;
+ int n;
- c = getopt (argc, argv, "s:h");
+ n = getopt (argc, argv, "s:h");
- if (c == -1)
+ if (n == -1)
break;
- switch (c) {
+ switch (n) {
case 's':
snprintf (address, sizeof (address), "unix:%s", optarg);
address[sizeof (address) - 1] = '\0';
diff --git a/src/curl.c b/src/curl.c
index 9d2196ac2c3e57d30858eebcbf83bdb39f4d6970..8b30fa4b0cf668cfb8e83bad92deb617460747ca 100644 (file)
--- a/src/curl.c
+++ b/src/curl.c
static int cc_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
oconfig_item_t *ci)
{
+ struct curl_slist *temp = NULL;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl plugin: `%s' needs exactly one string argument.", name);
return (-1);
}
- *dest = curl_slist_append(*dest, ci->values[0].value.string);
- if (*dest == NULL)
+ temp = curl_slist_append(*dest, ci->values[0].value.string);
+ if (temp == NULL)
return (-1);
+ *dest = temp;
+
return (0);
} /* }}} int cc_config_append_string */
diff --git a/src/curl_json.c b/src/curl_json.c
index 6b8449c9e40a54f3c4e485e23f7d04b7f1a5029f..2314bfe9bd2c98a464b836dd21b175b3feee2460 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
static int cj_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
oconfig_item_t *ci)
{
+ struct curl_slist *temp = NULL;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl_json plugin: `%s' needs exactly one string argument.", name);
return (-1);
}
- *dest = curl_slist_append(*dest, ci->values[0].value.string);
- if (*dest == NULL)
+ temp = curl_slist_append(*dest, ci->values[0].value.string);
+ if (temp == NULL)
return (-1);
+ *dest = temp;
+
return (0);
} /* }}} int cj_config_append_string */
diff --git a/src/curl_xml.c b/src/curl_xml.c
index d34b69efee25a4af6c050470117c03535399bf90..9483738bcf637e8178f99c739688be30c73fa954 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
static int cx_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
oconfig_item_t *ci)
{
+ struct curl_slist *temp = NULL;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl_xml plugin: `%s' needs exactly one string argument.", name);
return (-1);
}
- *dest = curl_slist_append(*dest, ci->values[0].value.string);
- if (*dest == NULL)
+ temp = curl_slist_append(*dest, ci->values[0].value.string);
+ if (temp == NULL)
return (-1);
+ *dest = temp;
+
return (0);
} /* }}} int cx_config_append_string */
diff --git a/src/dns.c b/src/dns.c
index 1fb7cb8ad7a877b40cb5fe40684c970786113146..3421c475d7e6fc49c2419332dbcd8e5d3dd09f06 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
* Mirko Buffoni <briareos at eswat.org>
**/
+#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#include "collectd.h"
diff --git a/src/exec.c b/src/exec.c
index 0445b14a91f879bdfccb2cd44024586741ce5888..d560f465490dae28bb9241fafd04f35444e78625 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
* Peter Holik <peter at holik.at>
**/
+#define _DEFAULT_SOURCE
#define _BSD_SOURCE /* For setgroups */
#include "collectd.h"
index 56ccefbf4e26e0e51f77c74f77e376f395db8ef8..bb36c5e66fc5ac8d5b65f135675cc6011b94393c 100644 (file)
--- a/src/liboconfig/oconfig.c
+++ b/src/liboconfig/oconfig.c
yyset_in (fh);
if (NULL == c_file) {
- int status;
-
status = snprintf (file, sizeof (file), "<fd#%d>", fileno (fh));
if ((status < 0) || (status >= sizeof (file))) {
return (ci_copy);
} /* oconfig_item_t *oconfig_clone */
-void oconfig_free_all (oconfig_item_t *ci)
+static void oconfig_free_all (oconfig_item_t *ci)
{
int i;
diff --git a/src/load.c b/src/load.c
index 0188da7ef38407972f5570f47fabcf622db41b4b..e0c09a3b8cafc78c225ee939cd92d7b8b4522ba5 100644 (file)
--- a/src/load.c
+++ b/src/load.c
* Manuel Sanmartin
**/
+#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#include "collectd.h"
diff --git a/src/logfile.c b/src/logfile.c
index 63448cb6c4e9f61cc611c71ed2c37840d160e17e..a7cda3a1ef44c68df1efdf616a7b6cd25af72a57 100644 (file)
--- a/src/logfile.c
+++ b/src/logfile.c
#define APPEND(bufptr, buflen, key, value) \
if ((buflen > 0) && (strlen (value) > 0)) { \
- int status = ssnprintf (bufptr, buflen, ", %s = %s", key, value); \
+ status = ssnprintf (bufptr, buflen, ", %s = %s", key, value); \
if (status > 0) { \
bufptr += status; \
buflen -= status; \
diff --git a/src/modbus.c b/src/modbus.c
index b5d1e251960534be10793aeb7c44000d16acb225..7349dc564976b2a91aa44b7bb760e8d33a9bf4e0 100644 (file)
--- a/src/modbus.c
+++ b/src/modbus.c
if (host == NULL)
return (EINVAL);
+#if COLLECT_DEBUG
modbus_set_debug (&host->connection, 1);
+#endif
/* We'll do the error handling ourselves. */
modbus_set_error_handling (&host->connection, NOP_ON_ERROR);
return (-1);
}
+#if COLLECT_DEBUG
modbus_set_debug (host->connection, 1);
+#endif
/* We'll do the error handling ourselves. */
modbus_set_error_recovery (host->connection, 0);
diff --git a/src/network.c b/src/network.c
index ae5ed09652729b2fd7b679d8f90936c07eec59f3..0ee6ed0b9834f96a9ad1cd885657c0e5f9719c89 100644 (file)
--- a/src/network.c
+++ b/src/network.c
* Aman Gupta <aman at tmm1.net>
**/
+#define _DEFAULT_SOURCE
#define _BSD_SOURCE /* For struct ip_mreq */
#include "collectd.h"
network_config_ttl = tmp;
else {
WARNING ("network plugin: The `TimeToLive' must be between 1 and 255.");
- return (-1);
+ return (-1);
}
return (0);
diff --git a/src/notify_email.c b/src/notify_email.c
index 24c66ec051b965aa5cbfedd228d774430d951c53..76d48d445825c83834d93095ed35420ce288b7d1 100644 (file)
--- a/src/notify_email.c
+++ b/src/notify_email.c
/* Initiate a connection to the SMTP server and transfer the message. */
if (!smtp_start_session (session)) {
- char buf[MAXSTRING];
ERROR ("notify_email plugin: SMTP server problem: %s",
smtp_strerror (smtp_errno (), buf, sizeof buf));
pthread_mutex_unlock (&session_lock);
diff --git a/src/ntpd.c b/src/ntpd.c
index f192a826847b6530d30166f9f2a01a4bc672c5db..67fff22a82e026f2b75e5785ddd7904dd8983818 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
* Florian octo Forster <octo at collectd.org>
**/
+#define _DEFAULT_SOURCE
#define _BSD_SOURCE /* For NI_MAXHOST */
#include "collectd.h"
/* l_fp to double */
#define M_LFPTOD(r_i, r_uf, d) \
do { \
- register int32_t i; \
- register uint32_t f; \
+ register int32_t ri; \
+ register uint32_t rf; \
\
- i = (r_i); \
- f = (r_uf); \
- if (i < 0) { \
- M_NEG(i, f); \
- (d) = -((double) i + ((double) f) / 4294967296.0); \
+ ri = (r_i); \
+ rf = (r_uf); \
+ if (ri < 0) { \
+ M_NEG(ri, rf); \
+ (d) = -((double) ri + ((double) rf) / 4294967296.0); \
} else { \
- (d) = (double) i + ((double) f) / 4294967296.0; \
+ (d) = (double) ri + ((double) rf) / 4294967296.0; \
} \
} while (0)
poll_s.fd = sd;
poll_s.events = POLLIN | POLLPRI;
poll_s.revents = 0;
-
+
DEBUG ("Polling for %ims", timeout);
status = poll (&poll_s, 1, timeout);
DEBUG ("recv'd %i bytes", status);
- /*
+ /*
* Do some sanity checks first
*/
if (status < RESP_HEADER_SIZE)
@@ -730,7 +731,7 @@ static int ntpd_send_request (int req_code, int req_items, int req_size, char *r
req.err_nitems = ERR_NITEMS (0, req_items);
req.mbz_itemsize = MBZ_ITEMSIZE (req_size);
-
+
if (req_data != NULL)
memcpy ((void *) req.data, (const void *) req_data, req_data_len);
diff --git a/src/perl.c b/src/perl.c
index d247dc0eece612568bce01e2edaee4fdb5326193..945e22586c806e2b3000f18c78e201cbbf74fff4 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
return 0;
if (NULL == aTHX) {
- c_ithread_t *t = NULL;
+ t = NULL;
pthread_mutex_lock (&perl_threads->mutex);
t = c_ithread_create (perl_threads->head->interp);
diff --git a/src/plugin.c b/src/plugin.c
index 6d3d3c9520ac770e4d098475b9c9a22ab14ce8c4..73ec77aba93fa0348e99f75d95f9c24117054972 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
return (status);
}
-static void plugin_free_loaded ()
+static void plugin_free_loaded (void)
{
void *key;
void *value;
void plugin_init_all (void)
{
char const *chain_name;
- long write_threads_num;
llentry_t *le;
int status;
diff --git a/src/plugin.h b/src/plugin.h
index 8f0c6d86105fbfe56547d6b5d78ac9fd7a7f4b26..d54db4bbee49f4dff926c13f77c8cb84b5426fcd 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
int plugin_thread_create (pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
+/*
+ * Plugins need to implement this
+ */
+
+void module_register (void);
+
#endif /* PLUGIN_H */
diff --git a/src/processes.c b/src/processes.c
index 6f34c721374e4ecf11d1a8e75aa723c04501f4ac..7711f25de02d3c94d43b8a72e772e1d2e696621e 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
/* ------- additional functions for KERNEL_LINUX/HAVE_THREAD_INFO ------- */
#if KERNEL_LINUX
-static int ps_read_tasks (int pid)
+static int ps_read_tasks (long pid)
{
char dirname[64];
DIR *dh;
struct dirent *ent;
int count = 0;
- ssnprintf (dirname, sizeof (dirname), "/proc/%i/task", pid);
+ ssnprintf (dirname, sizeof (dirname), "/proc/%li/task", pid);
if ((dh = opendir (dirname)) == NULL)
{
} /* int *ps_read_tasks */
/* Read advanced virtual memory data from /proc/pid/status */
-static procstat_t *ps_read_vmem (int pid, procstat_t *ps)
+static procstat_t *ps_read_vmem (long pid, procstat_t *ps)
{
FILE *fh;
char buffer[1024];
char *fields[8];
int numfields;
- ssnprintf (filename, sizeof (filename), "/proc/%i/status", pid);
+ ssnprintf (filename, sizeof (filename), "/proc/%li/status", pid);
if ((fh = fopen (filename, "r")) == NULL)
return (NULL);
return (ps);
} /* procstat_t *ps_read_vmem */
-static procstat_t *ps_read_io (int pid, procstat_t *ps)
+static procstat_t *ps_read_io (long pid, procstat_t *ps)
{
FILE *fh;
char buffer[1024];
char *fields[8];
int numfields;
- ssnprintf (filename, sizeof (filename), "/proc/%i/io", pid);
+ ssnprintf (filename, sizeof (filename), "/proc/%li/io", pid);
if ((fh = fopen (filename, "r")) == NULL)
return (NULL);
return (ps);
} /* procstat_t *ps_read_io */
-int ps_read_process (int pid, procstat_t *ps, char *state)
+static int ps_read_process (long pid, procstat_t *ps, char *state)
{
char filename[64];
char buffer[1024];
memset (ps, 0, sizeof (procstat_t));
- ssnprintf (filename, sizeof (filename), "/proc/%i/stat", pid);
+ ssnprintf (filename, sizeof (filename), "/proc/%li/stat", pid);
buffer_len = read_file_contents (filename,
buffer, sizeof(buffer) - 1);
fields_len = strsplit (buffer_ptr, fields, STATIC_ARRAY_SIZE (fields));
if (fields_len < 22)
{
- DEBUG ("processes plugin: ps_read_process (pid = %i):"
+ DEBUG ("processes plugin: ps_read_process (pid = %li):"
" `%s' has only %i fields..",
- (int) pid, filename, fields_len);
+ pid, filename, fields_len);
return (-1);
}
/* Leave the rest at zero if this is only a zombi */
if (ps->num_proc == 0)
{
- DEBUG ("processes plugin: This is only a zombie: pid = %i; "
+ DEBUG ("processes plugin: This is only a zombie: pid = %li; "
"name = %s;", pid, ps->name);
return (0);
}
/* No VMem data */
ps->vmem_data = -1;
ps->vmem_code = -1;
- DEBUG("ps_read_process: did not get vmem data for pid %i",pid);
+ DEBUG("ps_read_process: did not get vmem data for pid %li", pid);
}
ps->cpu_user_counter = cpu_user_counter;
ps->io_syscr = -1;
ps->io_syscw = -1;
- DEBUG("ps_read_process: not get io data for pid %i",pid);
+ DEBUG("ps_read_process: not get io data for pid %li", pid);
}
/* success */
return (0);
} /* int ps_read_process (...) */
-static char *ps_get_cmdline (pid_t pid, char *name, char *buf, size_t buf_len)
+static char *ps_get_cmdline (long pid, char *name, char *buf, size_t buf_len)
{
char *buf_ptr;
size_t len;
@@ -1100,8 +1100,7 @@ static char *ps_get_cmdline (pid_t pid, char *name, char *buf, size_t buf_len)
if ((pid < 1) || (NULL == buf) || (buf_len < 2))
return NULL;
- ssnprintf (file, sizeof (file), "/proc/%u/cmdline",
- (unsigned int) pid);
+ ssnprintf (file, sizeof (file), "/proc/%li/cmdline", pid);
errno = 0;
fd = open (file, O_RDONLY);
@@ -1182,7 +1181,7 @@ static char *ps_get_cmdline (pid_t pid, char *name, char *buf, size_t buf_len)
return buf;
} /* char *ps_get_cmdline (...) */
-static int read_fork_rate ()
+static int read_fork_rate (void)
{
FILE *proc_stat;
char buffer[1024];
#endif /*KERNEL_LINUX */
#if KERNEL_SOLARIS
-static char *ps_get_cmdline (pid_t pid, char *name __attribute__((unused)), /* {{{ */
+static char *ps_get_cmdline (long pid, char *name __attribute__((unused)), /* {{{ */
char *buffer, size_t buffer_size)
{
char path[PATH_MAX];
ps->num_proc = 0;
ps->num_lwp = 0;
*state = (char) 'Z';
+
+ sfree(myStatus);
+ sfree(myInfo);
+ sfree(myUsage);
return (0);
} else {
ps->num_proc = 1;
struct dirent *ent;
DIR *proc;
- int pid;
+ long pid;
char cmdline[ARG_MAX];
if (!isdigit (ent->d_name[0]))
continue;
- if ((pid = atoi (ent->d_name)) < 1)
+ if ((pid = atol (ent->d_name)) < 1)
continue;
status = ps_read_process (pid, &ps, &state);
diff --git a/src/python.c b/src/python.c
index 44292f90a997de45364ca369ca230e6bb0b5185a..110a8e024a4ea8bcdd25a76dd80892de3e40f6c3 100644 (file)
--- a/src/python.c
+++ b/src/python.c
@@ -386,7 +386,7 @@ static int cpy_write_callback(const data_set_t *ds, const value_list_t *value_li
}
dict = PyDict_New(); /* New reference. */
if (value_list->meta) {
- int i, num;
+ int num;
char **table;
meta_data_t *meta = value_list->meta;
}
#endif
-static int cpy_init_python() {
+static int cpy_init_python(void) {
char *argv = "";
PyObject *sys;
PyObject *module;
diff --git a/src/sensors.c b/src/sensors.c
index 209482e09f88e37a536641bda22d71e2d71810b4..37d335c9da71f2e7f6fc71dbc491734214e07960 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
return (0);
}
-void sensors_free_features (void)
+static void sensors_free_features (void)
{
featurelist_t *thisft;
featurelist_t *nextft;
diff --git a/src/threshold.c b/src/threshold.c
index a70ec8af441f723a1f381b50c8215c6e9c01b89b..c1af40b81e019e967026cf43c3e40be1a97954c1 100644 (file)
--- a/src/threshold.c
+++ b/src/threshold.c
return (0);
} /* }}} int ut_missing */
-int ut_config (oconfig_item_t *ci)
+static int ut_config (oconfig_item_t *ci)
{ /* {{{ */
int i;
int status = 0;
diff --git a/src/tokyotyrant.c b/src/tokyotyrant.c
index 678a341c1ceeaf15f24a708d12567c1b8ed92f15..b618ae323a3e1daec1db5a150c5f81721fdc7bf5 100644 (file)
--- a/src/tokyotyrant.c
+++ b/src/tokyotyrant.c
return (0);
}
-static void printerr()
+static void printerr (void)
{
int ecode = tcrdbecode(rdb);
ERROR ("tokyotyrant plugin: error: %d, %s",
diff --git a/src/types_list.c b/src/types_list.c
index 887b43d87c420d76a823a64452fe788893ff1bd1..41bb4033f39a9f63fde420e5142361e8b0d5ebe2 100644 (file)
--- a/src/types_list.c
+++ b/src/types_list.c
#include "plugin.h"
#include "configfile.h"
+#include "types_list.h"
static int parse_ds (data_source_t *dsrc, char *buf, size_t buf_len)
{
diff --git a/src/utils_avltree.c b/src/utils_avltree.c
index 139d23ace3da91ad5debb7c4278052b1d6aa572b..a9b3862c0ecf4ba5533d0676c3fcdc3d9363a141 100644 (file)
--- a/src/utils_avltree.c
+++ b/src/utils_avltree.c
{
assert (n->right != NULL);
b_bottom = BALANCE (n->right);
- assert ((b_bottom >= -1) || (b_bottom <= 1));
+ assert ((b_bottom >= -1) && (b_bottom <= 1));
if (b_bottom == 1)
n = rotate_right_left (t, n);
else
{
assert (n->left != NULL);
b_bottom = BALANCE (n->left);
- assert ((b_bottom >= -1) || (b_bottom <= 1));
+ assert ((b_bottom >= -1) && (b_bottom <= 1));
if (b_bottom == -1)
n = rotate_left_right (t, n);
else
diff --git a/src/utils_cache.c b/src/utils_cache.c
index 5598f687a7c77b8647d583ed326cb3148b6c061c..8e915883a2a0860b757020e931f18af9cc7ff37b 100644 (file)
--- a/src/utils_cache.c
+++ b/src/utils_cache.c
if (ce->history_length < num_steps)
{
gauge_t *tmp;
- size_t i;
tmp = realloc (ce->history, sizeof (*ce->history)
* num_steps * ce->values_num);
diff --git a/src/utils_cmd_flush.c b/src/utils_cmd_flush.c
index 9a59310a0f405323e60d405a5588a3fb86f17b11..087fee3d5c285f26f0ad2b44428c1d5e30d59fc4 100644 (file)
--- a/src/utils_cmd_flush.c
+++ b/src/utils_cmd_flush.c
#include "common.h"
#include "plugin.h"
#include "utils_parse_option.h"
+#include "utils_cmd_flush.h"
int handle_flush (FILE *fh, char *buffer)
{
diff --git a/src/utils_cmd_getval.c b/src/utils_cmd_getval.c
index 657483b6cf35c6f00bf62afc3e3c71a7c55c0f2f..8d214aad3322d937e5961d4aefbeebc93dc639f0 100644 (file)
--- a/src/utils_cmd_getval.c
+++ b/src/utils_cmd_getval.c
#include "utils_cache.h"
#include "utils_parse_option.h"
+#include "utils_cmd_getval.h"
#define print_to_socket(fh, ...) \
do { \
index bed8462817ea1b2c15a29d663a70cd37fb318b2b..ec91419d8ad523fe3ff37979934663d285e4959c 100644 (file)
--- a/src/utils_cmd_putnotif.c
+++ b/src/utils_cmd_putnotif.c
#include "plugin.h"
#include "utils_parse_option.h"
+#include "utils_cmd_putnotif.h"
#define print_to_socket(fh, ...) \
do { \
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index c9bf48bbeb01184d5192e263bd7f5334c108cebf..a0d20c5ebe03455dbbbb75d691c1af5bf98586ee 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
#include "plugin.h"
#include "utils_parse_option.h"
+#include "utils_cmd_putval.h"
#define print_to_socket(fh, ...) \
do { \
diff --git a/src/utils_db_query.c b/src/utils_db_query.c
index e8d7b3aa88509a5fdf38708470b9615c33aa73bf..6b3c056cb31d6bad732ec133a658c8645a044069 100644 (file)
--- a/src/utils_db_query.c
+++ b/src/utils_db_query.c
/*
* Query private functions
*/
-void udb_query_free_one (udb_query_t *q) /* {{{ */
+static void udb_query_free_one (udb_query_t *q) /* {{{ */
{
if (q == NULL)
return;
diff --git a/src/utils_dns.c b/src/utils_dns.c
index fcc65a56771021e184ce23addd4a508cef3f9622..2b40676353522922446a300343820de422b96497 100644 (file)
--- a/src/utils_dns.c
+++ b/src/utils_dns.c
* Modifications Copyright (C) 2006 Florian octo Forster
* Copyright (C) 2002 The Measurement Factory, Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* Florian octo Forster <octo at verplant.org>
*/
+#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#include "collectd.h"
diff --git a/src/utils_ignorelist.c b/src/utils_ignorelist.c
index c6ddf0e60310106cd190aede3a1954e390ee4ccf..0828c55f3c82eba852083b5cc08d49a72b65c0df 100644 (file)
--- a/src/utils_ignorelist.c
+++ b/src/utils_ignorelist.c
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Lubos Stanek <lubek at users.sourceforge.net>
diff --git a/src/utils_ignorelist.h b/src/utils_ignorelist.h
index b47b55adb0a10ea4840e0143806b3d5e29e7bba3..db7535fdf97a3688915d022f7f58d5476bf2b903 100644 (file)
--- a/src/utils_ignorelist.h
+++ b/src/utils_ignorelist.h
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Lubos Stanek <lubek at users.sourceforge.net>
diff --git a/src/utils_latency.c b/src/utils_latency.c
index 90479741ab857f6013ec8d8aa04fca9bd2c3d1c8..0b10c3ee91704d95f383a173ea2a2c97d44c80b6 100644 (file)
--- a/src/utils_latency.c
+++ b/src/utils_latency.c
* So, if the required bin width is 300, then new bin width will be 512 as it is
* the next nearest power of 2.
*/
-void change_bin_width (latency_counter_t *lc, cdtime_t latency) /* {{{ */
+static void change_bin_width (latency_counter_t *lc, cdtime_t latency) /* {{{ */
{
/* This function is called because the new value is above histogram's range.
* First find the required bin width:
CDTIME_T_TO_DOUBLE (new_bin_width));
} /* }}} void change_bin_width */
-latency_counter_t *latency_counter_create () /* {{{ */
+latency_counter_t *latency_counter_create (void) /* {{{ */
{
latency_counter_t *lc;
diff --git a/src/utils_latency.h b/src/utils_latency.h
index 3787c779434c191957fe60a8fefae1063567e9a2..e7c2fc36fcf4eddbe88f3d0211166040b1230fcc 100644 (file)
--- a/src/utils_latency.h
+++ b/src/utils_latency.h
struct latency_counter_s;
typedef struct latency_counter_s latency_counter_t;
-latency_counter_t *latency_counter_create ();
+latency_counter_t *latency_counter_create (void);
void latency_counter_destroy (latency_counter_t *lc);
void latency_counter_add (latency_counter_t *lc, cdtime_t latency);
diff --git a/src/utils_llist.c b/src/utils_llist.c
index 11f838d248f6ab799c53654569f683af07db6d2d..4c5645b1cba12461c7811cc12c9b6e52a6e2c1da 100644 (file)
--- a/src/utils_llist.c
+++ b/src/utils_llist.c
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Florian Forster <octo at verplant.org>
diff --git a/src/utils_llist.h b/src/utils_llist.h
index 19d8d947bd66b94acead4079856a558107186f13..6214190fb3dbe8490fd1066e229c4e7ace2c66dd 100644 (file)
--- a/src/utils_llist.h
+++ b/src/utils_llist.h
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Florian Forster <octo at verplant.org>
diff --git a/src/utils_mount.c b/src/utils_mount.c
index 7b4c9276b876d23bd8eb578bc152489579fdc7d3..d303677d4e6b0f88b2153fcd85b17a5ab50b7f3a 100644 (file)
--- a/src/utils_mount.c
+++ b/src/utils_mount.c
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Niki W. Waibel <niki.waibel@gmx.net>
# include "config.h"
#endif
-#include "common.h"
#if HAVE_XFS_XQM_H
+# define _GNU_SOURCE
# include <xfs/xqm.h>
#define XFS_SUPER_MAGIC_STR "XFSB"
#define XFS_SUPER_MAGIC2_STR "BSFX"
#endif
+#include "common.h"
#include "plugin.h"
#include "utils_mount.h"
#elif HAVE_GETVFSSTAT || HAVE_GETFSSTAT
static cu_mount_t *cu_mount_getfsstat (void)
{
-#if HAVE_GETVFSSTAT
-# define STRUCT_STATFS struct statvfs
-# define CMD_STATFS getvfsstat
-# define FLAGS_STATFS ST_NOWAIT
-/* #endif HAVE_GETVFSSTAT */
-#elif HAVE_GETFSSTAT
+#if HAVE_GETFSSTAT
# define STRUCT_STATFS struct statfs
# define CMD_STATFS getfsstat
# define FLAGS_STATFS MNT_NOWAIT
-#endif /* HAVE_GETFSSTAT */
+/* #endif HAVE_GETFSSTAT */
+#elif HAVE_GETVFSSTAT
+# define STRUCT_STATFS struct statvfs
+# define CMD_STATFS getvfsstat
+# define FLAGS_STATFS ST_NOWAIT
+#endif /* HAVE_GETVFSSTAT */
int bufsize;
STRUCT_STATFS *buf;
diff --git a/src/utils_mount.h b/src/utils_mount.h
index 83f789be9cd3acdf7f5535cb2e41ed035e3cbc2b..ef0bf75912bbf9941848ad1b1d52addc2963805e 100644 (file)
--- a/src/utils_mount.h
+++ b/src/utils_mount.h
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
- * You should have received a copy of the GNU General Public
- * Licence along with this program; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
- * USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Niki W. Waibel <niki.waibel@gmx.net>
diff --git a/src/utils_random.c b/src/utils_random.c
index b8738458710786faae5a1745dbbd602b8bb2bad6..fee08717a7d464c809be8f23685117654d6bdab0 100644 (file)
--- a/src/utils_random.c
+++ b/src/utils_random.c
#include "collectd.h"
#include "utils_time.h"
+#include "utils_random.h"
#include <pthread.h>
+
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
static _Bool have_seed = 0;
static unsigned short seed[3];
diff --git a/src/utils_subst.c b/src/utils_subst.c
index a49f6db56e8b75307e7790ae1601edb08c2f6b10..ca1e93349e4171950bec5a9b0d1d2fe63fe77211 100644 (file)
--- a/src/utils_subst.c
+++ b/src/utils_subst.c
#include "collectd.h"
#include "common.h"
+#include "utils_subst.h"
char *subst (char *buf, size_t buflen, const char *string, int off1, int off2,
const char *replacement)
diff --git a/src/write_http.c b/src/write_http.c
index bfb5524c936c699f3545640f7f6d0d17ce9b615b..c2968290055013ada258b019461a7d454130f36a 100644 (file)
--- a/src/write_http.c
+++ b/src/write_http.c
int format;
CURL *curl;
+ struct curl_slist *headers;
char curl_errbuf[CURL_ERROR_SIZE];
char send_buffer[4096];
static int wh_callback_init (wh_callback_t *cb) /* {{{ */
{
- struct curl_slist *headers;
-
if (cb->curl != NULL)
return (0);
curl_easy_setopt (cb->curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (cb->curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION);
- headers = NULL;
- headers = curl_slist_append (headers, "Accept: */*");
+ cb->headers = NULL;
+ cb->headers = curl_slist_append (cb->headers, "Accept: */*");
if (cb->format == WH_FORMAT_JSON)
- headers = curl_slist_append (headers, "Content-Type: application/json");
+ cb->headers = curl_slist_append (cb->headers, "Content-Type: application/json");
else
- headers = curl_slist_append (headers, "Content-Type: text/plain");
- headers = curl_slist_append (headers, "Expect:");
- curl_easy_setopt (cb->curl, CURLOPT_HTTPHEADER, headers);
+ cb->headers = curl_slist_append (cb->headers, "Content-Type: text/plain");
+ cb->headers = curl_slist_append (cb->headers, "Expect:");
+ curl_easy_setopt (cb->curl, CURLOPT_HTTPHEADER, cb->headers);
curl_easy_setopt (cb->curl, CURLOPT_ERRORBUFFER, cb->curl_errbuf);
curl_easy_setopt (cb->curl, CURLOPT_URL, cb->location);
wh_flush_nolock (/* timeout = */ 0, cb);
curl_easy_cleanup (cb->curl);
+
+ if (cb->headers != NULL)
+ {
+ curl_slist_free_all (cb->headers);
+ cb->headers = NULL;
+ }
+
sfree (cb->location);
sfree (cb->user);
sfree (cb->pass);
cb->cacert = NULL;
cb->format = WH_FORMAT_COMMAND;
cb->curl = NULL;
+ cb->headers = NULL;
pthread_mutex_init (&cb->send_lock, /* attr = */ NULL);
diff --git a/src/xmms.c b/src/xmms.c
index 52beb65f8a5d21d32880f81a58be887363390873..51f80d9657953c144b57f15825d6d556b1b940da 100644 (file)
--- a/src/xmms.c
+++ b/src/xmms.c
plugin_dispatch_values (&vl);
} /* void cxmms_submit */
-int cxmms_read (void)
+static int cxmms_read (void)
{
gint rate;
gint freq;
diff --git a/src/zfs_arc.c b/src/zfs_arc.c
index 3a54ad8d57d92c97a6ef9b2050c8b68e02fef682..65a50b4e0986b6fc92a123b1dedeaf2cf0484f2c 100644 (file)
--- a/src/zfs_arc.c
+++ b/src/zfs_arc.c
za_read_derive (ksp, "deleted", "cache_operation", "deleted");
#if __FreeBSD__
za_read_derive (ksp, "allocated","cache_operation", "allocated");
+#if defined(__FreeBSD_version) && (__FreeBSD_version < 1002501)
+ /* stolen removed from sysctl kstat.zfs.misc.arcstats on FreeBSD 10.2+ */
za_read_derive (ksp, "stolen", "cache_operation", "stolen");
+#endif
#endif
/* Issue indicators */