Code

Merge pull request #1580 from rubenk/freebsd-zfs-arc
authorRuben Kerkhof <ruben@tilaa.nl>
Sun, 6 Mar 2016 10:20:42 +0000 (11:20 +0100)
committerRuben Kerkhof <ruben@tilaa.nl>
Sun, 6 Mar 2016 10:20:42 +0000 (11:20 +0100)
zfs_arc: 'stolen' was removed after FreeBSD 10.2

34 files changed:
configure.ac
src/battery.c
src/bind.c
src/collectdctl.c
src/dns.c
src/exec.c
src/liboconfig/oconfig.c
src/load.c
src/logfile.c
src/network.c
src/notify_email.c
src/ntpd.c
src/perl.c
src/plugin.c
src/plugin.h
src/processes.c
src/python.c
src/sensors.c
src/threshold.c
src/tokyotyrant.c
src/types_list.c
src/utils_avltree.c
src/utils_cache.c
src/utils_cmd_flush.c
src/utils_cmd_getval.c
src/utils_cmd_putnotif.c
src/utils_cmd_putval.c
src/utils_db_query.c
src/utils_dns.c
src/utils_latency.c
src/utils_latency.h
src/utils_random.c
src/utils_subst.c
src/xmms.c

index 5c6720c3901f3d30a71db162f8e170b405470284..fb9ef34cdc80266d08302f7828802f8c1ee6aecf 100644 (file)
@@ -1398,6 +1398,7 @@ AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
 
 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
@@ -1419,6 +1420,7 @@ AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
 ])
 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
 [#define _BSD_SOURCE
+#define _DEFAULT_SOURCE
 #if HAVE_STDINT_H
 # include <stdint.h>
 #endif
index 4178d8b5145f2b728e5c7c949d72ebd8d126a89e..d921484dc74e410191aee2fbc08d37dddfc1db52 100644 (file)
@@ -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;
index f9cf79eca47e9d2a619adc1911223e1f72d58f6d..28d28b68e5fa56fd1584c24f5c2ead252df5dc03 100644 (file)
@@ -726,8 +726,6 @@ static int bind_xml_stats_search_zones (int version, xmlDoc *doc, /* {{{ */
 
   for (i = 0; i < zone_nodes->nodesetval->nodeNr; i++)
   {
-    xmlNode *node;
-
     node = zone_nodes->nodesetval->nodeTab[i];
     assert (node != NULL);
 
index 0b8d0c1e89ee1547f955c0795bf388d1568eb518..478f2a4b4172d77079bee5aeecef15c78bd396f8 100644 (file)
@@ -551,14 +551,14 @@ int main (int argc, char **argv) {
   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';
index 1fb7cb8ad7a877b40cb5fe40684c970786113146..3421c475d7e6fc49c2419332dbcd8e5d3dd09f06 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -21,6 +21,7 @@
  *   Mirko Buffoni <briareos at eswat.org>
  **/
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE
 
 #include "collectd.h"
index 0445b14a91f879bdfccb2cd44024586741ce5888..d560f465490dae28bb9241fafd04f35444e78625 100644 (file)
@@ -23,6 +23,7 @@
  *   Peter Holik <peter at holik.at>
  **/
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE /* For setgroups */
 
 #include "collectd.h"
index 56ccefbf4e26e0e51f77c74f77e376f395db8ef8..bb36c5e66fc5ac8d5b65f135675cc6011b94393c 100644 (file)
@@ -45,8 +45,6 @@ oconfig_item_t *oconfig_parse_fh (FILE *fh)
   yyset_in (fh);
 
   if (NULL == c_file) {
-    int status;
-
     status = snprintf (file, sizeof (file), "<fd#%d>", fileno (fh));
 
     if ((status < 0) || (status >= sizeof (file))) {
@@ -188,7 +186,7 @@ oconfig_item_t *oconfig_clone (const oconfig_item_t *ci_orig)
   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;
 
index 0188da7ef38407972f5570f47fabcf622db41b4b..e0c09a3b8cafc78c225ee939cd92d7b8b4522ba5 100644 (file)
@@ -21,6 +21,7 @@
  *   Manuel Sanmartin
  **/
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE
 
 #include "collectd.h"
index 63448cb6c4e9f61cc611c71ed2c37840d160e17e..a7cda3a1ef44c68df1efdf616a7b6cd25af72a57 100644 (file)
@@ -196,7 +196,7 @@ static int logfile_notification (const notification_t *n,
 
 #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; \
index ae5ed09652729b2fd7b679d8f90936c07eec59f3..0ee6ed0b9834f96a9ad1cd885657c0e5f9719c89 100644 (file)
@@ -22,6 +22,7 @@
  *   Aman Gupta <aman at tmm1.net>
  **/
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE /* For struct ip_mreq */
 
 #include "collectd.h"
@@ -2985,7 +2986,7 @@ static int network_config_set_ttl (const oconfig_item_t *ci) /* {{{ */
     network_config_ttl = tmp;
   else {
     WARNING ("network plugin: The `TimeToLive' must be between 1 and 255.");
-    return (-1);    
+    return (-1);
   }
 
   return (0);
index 24c66ec051b965aa5cbfedd228d774430d951c53..76d48d445825c83834d93095ed35420ce288b7d1 100644 (file)
@@ -293,7 +293,6 @@ static int notify_email_notification (const notification_t *n,
 
   /* 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);
index f192a826847b6530d30166f9f2a01a4bc672c5db..67fff22a82e026f2b75e5785ddd7904dd8983818 100644 (file)
@@ -19,6 +19,7 @@
  *   Florian octo Forster <octo at collectd.org>
  **/
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE /* For NI_MAXHOST */
 
 #include "collectd.h"
@@ -160,16 +161,16 @@ struct resp_pkt
 /* 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)
 
@@ -481,7 +482,7 @@ static int ntpd_receive_response (int *res_items, int *res_size,
                poll_s.fd      = sd;
                poll_s.events  = POLLIN | POLLPRI;
                poll_s.revents = 0;
-               
+
                DEBUG ("Polling for %ims", timeout);
                status = poll (&poll_s, 1, timeout);
 
@@ -521,7 +522,7 @@ static int ntpd_receive_response (int *res_items, int *res_size,
 
                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);
 
index d247dc0eece612568bce01e2edaee4fdb5326193..945e22586c806e2b3000f18c78e201cbbf74fff4 100644 (file)
@@ -2079,7 +2079,7 @@ static int perl_shutdown (void)
                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);
index 6d3d3c9520ac770e4d098475b9c9a22ab14ce8c4..73ec77aba93fa0348e99f75d95f9c24117054972 100644 (file)
@@ -870,7 +870,7 @@ static int plugin_mark_loaded (char const *name)
        return (status);
 }
 
-static void plugin_free_loaded ()
+static void plugin_free_loaded (void)
 {
        void *key;
        void *value;
@@ -1458,7 +1458,6 @@ int plugin_unregister_notification (const char *name)
 void plugin_init_all (void)
 {
        char const *chain_name;
-       long write_threads_num;
        llentry_t *le;
        int status;
 
index 8f0c6d86105fbfe56547d6b5d78ac9fd7a7f4b26..d54db4bbee49f4dff926c13f77c8cb84b5426fcd 100644 (file)
@@ -399,4 +399,10 @@ cdtime_t plugin_get_interval (void);
 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 */
index c5162081c1dd8aee0a1289bdfcd1b0fd12449419..89e663a57e636315c47687764fdcea2acf64a3ef 100644 (file)
@@ -922,7 +922,7 @@ static procstat_t *ps_read_io (long pid, procstat_t *ps)
        return (ps);
 } /* procstat_t *ps_read_io */
 
-int ps_read_process (long pid, procstat_t *ps, char *state)
+static int ps_read_process (long pid, procstat_t *ps, char *state)
 {
        char  filename[64];
        char  buffer[1024];
@@ -1165,7 +1165,7 @@ static char *ps_get_cmdline (long 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];
index 44292f90a997de45364ca369ca230e6bb0b5185a..110a8e024a4ea8bcdd25a76dd80892de3e40f6c3 100644 (file)
@@ -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;
 
@@ -1017,7 +1017,7 @@ PyMODINIT_FUNC PyInit_collectd(void) {
 }
 #endif
 
-static int cpy_init_python() {
+static int cpy_init_python(void) {
        char *argv = "";
        PyObject *sys;
        PyObject *module;
index 209482e09f88e37a536641bda22d71e2d71810b4..37d335c9da71f2e7f6fc71dbc491734214e07960 100644 (file)
@@ -262,7 +262,7 @@ static int sensors_config (const char *key, const char *value)
        return (0);
 }
 
-void sensors_free_features (void)
+static void sensors_free_features (void)
 {
        featurelist_t *thisft;
        featurelist_t *nextft;
index a70ec8af441f723a1f381b50c8215c6e9c01b89b..c1af40b81e019e967026cf43c3e40be1a97954c1 100644 (file)
@@ -958,7 +958,7 @@ static int ut_missing (const value_list_t *vl,
   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;
index 678a341c1ceeaf15f24a708d12567c1b8ed92f15..b618ae323a3e1daec1db5a150c5f81721fdc7bf5 100644 (file)
@@ -79,7 +79,7 @@ static int tt_config (const char *key, const char *value)
        return (0);
 }
 
-static void printerr()
+static void printerr (void)
 {
        int ecode = tcrdbecode(rdb);
        ERROR ("tokyotyrant plugin: error: %d, %s",
index 887b43d87c420d76a823a64452fe788893ff1bd1..41bb4033f39a9f63fde420e5142361e8b0d5ebe2 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "plugin.h"
 #include "configfile.h"
+#include "types_list.h"
 
 static int parse_ds (data_source_t *dsrc, char *buf, size_t buf_len)
 {
index 139d23ace3da91ad5debb7c4278052b1d6aa572b..a9b3862c0ecf4ba5533d0676c3fcdc3d9363a141 100644 (file)
@@ -241,7 +241,7 @@ static void rebalance (c_avl_tree_t *t, c_avl_node_t *n)
                {
                        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
@@ -251,7 +251,7 @@ static void rebalance (c_avl_tree_t *t, c_avl_node_t *n)
                {
                        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
index 5598f687a7c77b8647d583ed326cb3148b6c061c..8e915883a2a0860b757020e931f18af9cc7ff37b 100644 (file)
@@ -737,7 +737,6 @@ int uc_get_history_by_name (const char *name,
   if (ce->history_length < num_steps)
   {
     gauge_t *tmp;
-    size_t i;
 
     tmp = realloc (ce->history, sizeof (*ce->history)
        * num_steps * ce->values_num);
index 9a59310a0f405323e60d405a5588a3fb86f17b11..087fee3d5c285f26f0ad2b44428c1d5e30d59fc4 100644 (file)
@@ -25,6 +25,7 @@
 #include "common.h"
 #include "plugin.h"
 #include "utils_parse_option.h"
+#include "utils_cmd_flush.h"
 
 int handle_flush (FILE *fh, char *buffer)
 {
index 657483b6cf35c6f00bf62afc3e3c71a7c55c0f2f..8d214aad3322d937e5961d4aefbeebc93dc639f0 100644 (file)
@@ -25,6 +25,7 @@
 
 #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)
@@ -24,6 +24,7 @@
 #include "plugin.h"
 
 #include "utils_parse_option.h"
+#include "utils_cmd_putnotif.h"
 
 #define print_to_socket(fh, ...) \
   do { \
index c9bf48bbeb01184d5192e263bd7f5334c108cebf..a0d20c5ebe03455dbbbb75d691c1af5bf98586ee 100644 (file)
@@ -24,6 +24,7 @@
 #include "plugin.h"
 
 #include "utils_parse_option.h"
+#include "utils_cmd_putval.h"
 
 #define print_to_socket(fh, ...) \
     do { \
index e8d7b3aa88509a5fdf38708470b9615c33aa73bf..6b3c056cb31d6bad732ec133a658c8645a044069 100644 (file)
@@ -543,7 +543,7 @@ static int udb_result_create (const char *query_name, /* {{{ */
 /*
  * 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;
index fcc65a56771021e184ce23addd4a508cef3f9622..2b40676353522922446a300343820de422b96497 100644 (file)
@@ -3,10 +3,10 @@
  * 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,
@@ -33,6 +33,7 @@
  *   Florian octo Forster <octo at verplant.org>
  */
 
+#define _DEFAULT_SOURCE
 #define _BSD_SOURCE
 
 #include "collectd.h"
index 90479741ab857f6013ec8d8aa04fca9bd2c3d1c8..efca6d296b8f743514e023e177325017bdc8d6e5 100644 (file)
  *   Florian Forster <ff at octo.it>
  **/
 
+#include <math.h>
+#include <limits.h>
+
 #include "collectd.h"
 #include "plugin.h"
 #include "utils_latency.h"
 #include "common.h"
 
-#include <math.h>
-#include <limits.h>
-
 #ifndef LLONG_MAX
 # define LLONG_MAX 9223372036854775807LL
 #endif
@@ -76,7 +76,7 @@ struct latency_counter_s
 * 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:
@@ -117,7 +117,7 @@ void change_bin_width (latency_counter_t *lc, cdtime_t latency) /* {{{ */
       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;
 
index 3787c779434c191957fe60a8fefae1063567e9a2..e7c2fc36fcf4eddbe88f3d0211166040b1230fcc 100644 (file)
@@ -30,7 +30,7 @@
 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);
index b8738458710786faae5a1745dbbd602b8bb2bad6..548d1d81c81aefadda6f9ee790e05650ddbd0104 100644 (file)
  *   Florian Forster <octo at collectd.org>
  **/
 
+#include <pthread.h>
+
 #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;
index a49f6db56e8b75307e7790ae1601edb08c2f6b10..ca1e93349e4171950bec5a9b0d1d2fe63fe77211 100644 (file)
@@ -25,6 +25,7 @@
 
 #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)
index 52beb65f8a5d21d32880f81a58be887363390873..51f80d9657953c144b57f15825d6d556b1b940da 100644 (file)
@@ -43,7 +43,7 @@ static void cxmms_submit (const char *type, gauge_t value)
        plugin_dispatch_values (&vl);
 } /* void cxmms_submit */
 
-int cxmms_read (void)
+static int cxmms_read (void)
 {
   gint rate;
   gint freq;