]> arthur.barton.de Git - netdata.git/commitdiff
all required system headers in common.h; some progress on health variables
authorCosta Tsaousis <costa@tsaousis.gr>
Sat, 6 Aug 2016 00:52:03 +0000 (03:52 +0300)
committerCosta Tsaousis <costa@tsaousis.gr>
Sat, 6 Aug 2016 00:52:03 +0000 (03:52 +0300)
65 files changed:
CMakeLists.txt
src/Makefile.am
src/appconfig.c
src/appconfig.h
src/apps_plugin.c
src/avl.c
src/common.c
src/common.h
src/daemon.c
src/dictionary.c
src/dictionary.h
src/global_statistics.c
src/health.c [new file with mode: 0644]
src/health.h [new file with mode: 0644]
src/log.c
src/log.h
src/main.c
src/main.h
src/plugin_checks.c
src/plugin_idlejitter.c
src/plugin_nfacct.c
src/plugin_proc.c
src/plugin_tc.c
src/plugins_d.c
src/plugins_d.h
src/popen.c
src/popen.h
src/proc_diskstats.c
src/proc_interrupts.c
src/proc_loadavg.c
src/proc_meminfo.c
src/proc_net_dev.c
src/proc_net_ip_vs_stats.c
src/proc_net_netstat.c
src/proc_net_rpc_nfsd.c
src/proc_net_snmp.c
src/proc_net_snmp6.c
src/proc_net_stat_conntrack.c
src/proc_net_stat_synproxy.c
src/proc_self_mountinfo.c
src/proc_self_mountinfo.h
src/proc_softirqs.c
src/proc_stat.c
src/proc_sys_kernel_random_entropy_avail.c
src/proc_vmstat.c
src/procfile.c
src/registry.c
src/registry.h
src/rrd.c
src/rrd.h
src/rrd2json.c
src/rrd2json.h
src/storage_number.c
src/storage_number.h
src/sys_fs_cgroup.c
src/sys_kernel_mm_ksm.c
src/unit_test.c
src/url.c
src/web_buffer.c
src/web_buffer.h
src/web_buffer_svg.c
src/web_buffer_svg.h
src/web_client.c
src/web_client.h
src/web_server.c

index 30ea5fbf41056ae04636c6ec0acca0d87e1c88c8..e4bc52d46e35dfdca27c2328e45c81aa2fba5979 100755 (executable)
@@ -82,7 +82,7 @@ set(NETDATA_SOURCE_FILES
         src/web_client.h
         src/web_server.c
         src/web_server.h
-        config.h)
+        config.h src/health.h src/health.c)
 
 set(APPS_PLUGIN_SOURCE_FILES
         src/appconfig.c
index 664be8b0bcbd8363d250a3c252e74623f1d4bc36..2b698f8af3c4c1a29cfd7897ea0c531be7b6f5c0 100644 (file)
@@ -33,6 +33,7 @@ netdata_SOURCES = \
        daemon.c daemon.h \
        dictionary.c dictionary.h \
        global_statistics.c global_statistics.h \
+       health.c health.h \
        log.c log.h \
        main.c main.h \
        plugin_checks.c plugin_checks.h \
index 748c6eff179a10ec1bb85d6afbb266c9073c43d1..dd90aa87b6027c1bfa810d4bf13ced4e02f16bdc 100644 (file)
@@ -1,22 +1,4 @@
-
-/*
- * TODO
- *
- * 1. Re-write this using DICTIONARY
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avl.h"
 #include "common.h"
-#include "appconfig.h"
-#include "log.h"
 
 #define CONFIG_FILE_LINE_MAX ((CONFIG_MAX_NAME + CONFIG_MAX_VALUE + 1024) * 2)
 
index b5245e554ce876d626f4c808ef2fd461b5f1ce84..08aae8348891c08fda9298a9a68046b50a59b973 100644 (file)
@@ -1,5 +1,3 @@
-#include "web_buffer.h"
-
 #ifndef NETDATA_CONFIG_H
 #define NETDATA_CONFIG_H 1
 
index 6b43216cb71a23b0b466e4f215109c20dd56555c..188d5a9546057fbe8ec20fdb11c65459b346ac1f 100644 (file)
@@ -1,44 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-
-#include <sys/resource.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <stdarg.h>
-#include <locale.h>
-#include <ctype.h>
-#include <fcntl.h>
-
-#include <malloc.h>
-#include <dirent.h>
-#include <arpa/inet.h>
-
-#include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
-
-#include "avl.h"
-
 #include "common.h"
-#include "log.h"
-#include "procfile.h"
-#include "../config.h"
-#include "web_buffer.h"
-
-#ifdef NETDATA_INTERNAL_CHECKS
-#include <sys/prctl.h>
-#endif
 
 #define MAX_COMPARE_NAME 100
 #define MAX_NAME 100
index cf9705e257d01fbe8809e042caffa98d2ef968a2..71d206f23e45894f0d1cdb83364d18cef666cd8c 100644 (file)
--- a/src/avl.c
+++ b/src/avl.c
@@ -1,10 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-// #include <assert.h>
-
-#include "avl.h"
-#include "log.h"
+#include "common.h"
 
 /* ------------------------------------------------------------------------- */
 /*
index 2566aa586ae67cde864e4ce5c0b38f867d9cc364..07aa209821cc1b7b312eead94d9bcbab776ddbc4 100644 (file)
@@ -1,21 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <sys/syscall.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <time.h>
-
-#include "log.h"
 #include "common.h"
-#include "appconfig.h"
-#include "../config.h"
 
 char *global_host_prefix = "";
 int enable_ksm = 1;
index f6736df68470c2cb178b17c6f653c11d7bb49b00..bf6773b43c893cd288b55965c2e5f517bfb2ecb2 100644 (file)
+#ifndef NETDATA_COMMON_H
+#define NETDATA_COMMON_H 1
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <pthread.h>
+#include <errno.h>
+
+#include <stdio.h>
+#include <stdlib.h>
 #include <stdarg.h>
-#include <sys/time.h>
+#include <stddef.h>
+
+#include <ctype.h>
+#include <string.h>
+#include <strings.h>
+
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <grp.h>
+#include <pwd.h>
+#include <locale.h>
+#include <malloc.h>
+#include <netdb.h>
+#include <poll.h>
+#include <signal.h>
+#include <syslog.h>
+#include <sys/mman.h>
 #include <sys/resource.h>
-#include <stdio.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+#include <sys/syscall.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include <uuid/uuid.h>
 
-#ifndef NETDATA_COMMON_H
-#define NETDATA_COMMON_H 1
+#ifdef STORAGE_WITH_MATH
+#include <math.h>
+#endif
 
 #if defined(HAVE_INTTYPES_H)
 #include <inttypes.h>
 #elif defined(HAVE_STDINT_H)
 #include <stdint.h>
 #endif
-#include <sys/types.h>
-#include <unistd.h>
 
+#ifdef NETDATA_INTERNAL_CHECKS
+#include <sys/prctl.h>
+#endif
+
+#ifdef NETDATA_WITH_ZLIB
+#include <zlib.h>
+#endif
+
+#include "avl.h"
+#include "log.h"
+#include "global_statistics.h"
+#include "storage_number.h"
+#include "web_buffer.h"
+#include "web_buffer_svg.h"
+#include "url.h"
+#include "popen.h"
+
+#include "procfile.h"
+#include "appconfig.h"
+#include "dictionary.h"
+#include "proc_self_mountinfo.h"
+#include "plugin_checks.h"
+#include "plugin_idlejitter.h"
+#include "plugin_nfacct.h"
+#include "plugin_proc.h"
+#include "plugin_tc.h"
+#include "plugins_d.h"
+
+#include "health.h"
+
+#include "rrd.h"
+#include "rrd2json.h"
+
+#include "web_client.h"
+#include "web_server.h"
+
+#include "registry.h"
+#include "daemon.h"
+#include "main.h"
+#include "unit_test.h"
+
+#if __GNUC__
+#if __x86_64__ || __ppc64__
+#define ENVIRONMENT64
+#else
+#define ENVIRONMENT32
+#endif
+#endif
+
+#ifdef abs
+#undef abs
+#endif
 #define abs(x) ((x < 0)? -x : x)
+
 #define usecdiff(now, last) (((((now)->tv_sec * 1000000ULL) + (now)->tv_usec) - (((last)->tv_sec * 1000000ULL) + (last)->tv_usec)))
 
 extern void netdata_fix_chart_id(char *s);
index b14b4d9a4a2d8adbded457fe9e686a855d6df1df..eb4b8d458ae7b2db55dfea3c115f9320d9bb4d2e 100644 (file)
@@ -1,29 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
-#include <pthread.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-
 #include "common.h"
-#include "appconfig.h"
-#include "log.h"
-#include "web_client.h"
-#include "plugins_d.h"
-#include "rrd.h"
-#include "popen.h"
-#include "main.h"
-#include "daemon.h"
 
 char pidfile[FILENAME_MAX + 1] = "";
 
index 8bc048276b45e7667cacf4a4af27af863e5c7657..a360803b2b65c37bf2d2e0a99e755477c9c761c8 100644 (file)
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avl.h"
 #include "common.h"
-#include "log.h"
-
-#include "dictionary.h"
 
 // ----------------------------------------------------------------------------
 // dictionary statistics
index c32d8bd92d82514ca6694e88ebaf0f6e5c3d8147..7613e2853303ef80a710f175dbdd59d428f0b614 100644 (file)
@@ -1,8 +1,3 @@
-#include <pthread.h>
-
-#include "web_buffer.h"
-#include "avl.h"
-
 #ifndef NETDATA_DICTIONARY_H
 #define NETDATA_DICTIONARY_H 1
 
index 40d3c3e3da83a6b38e9ea66a3da31a0fc8ae7425..e2852962a44507a30a9e57222e38ede8d0d3631a 100644 (file)
@@ -1,9 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pthread.h>
-
-#include "global_statistics.h"
+#include "common.h"
 
 struct global_statistics global_statistics = { 0, 0ULL, 0ULL, 0ULL, 0ULL, 0ULL, 0ULL};
 
diff --git a/src/health.c b/src/health.c
new file mode 100644 (file)
index 0000000..47659cc
--- /dev/null
@@ -0,0 +1,53 @@
+#include "common.h"
+
+int rrdvar_compare(void* a, void* b) {
+    if(((RRDVAR *)a)->hash < ((RRDVAR *)b)->hash) return -1;
+    else if(((RRDVAR *)a)->hash > ((RRDVAR *)b)->hash) return 1;
+    else return strcmp(((RRDVAR *)a)->name, ((RRDVAR *)b)->name);
+}
+
+#define rrdvar_index_add(tree, rv) (RRDVAR *)avl_insert_lock(tree, (avl *)(rv))
+#define rrdvar_index_del(tree, rv) (RRDVAR *)avl_remove_lock(tree, (avl *)(rv))
+
+static RRDVAR *rrdvar_index_find(avl_tree_lock *tree, const char *name, uint32_t hash) {
+    RRDVAR tmp;
+    tmp.name = (char *)name;
+    tmp.hash = (hash)?hash:simple_hash(tmp.name);
+
+    return (RRDVAR *)avl_search_lock(tree, (avl *)&tmp);
+}
+
+
+RRDVAR *rrdvar_get(RRDHOST *host, RRDCONTEXT *co, RRDSET *st, const char *name) {
+    uint32_t hash = simple_hash(name);
+
+    RRDVAR *ret = NULL;
+    RRDVAR *rv = rrdvar_index_find(&st->variables_root_index, name, hash);
+    if(!rv) {
+        rv = calloc(1, sizeof(RRDVAR));
+        if(!rv) fatal("Cannot allocate memory for RRDVAR");
+
+        rv->name = strdup(name);
+        if(!rv->name) fatal("Cannot allocate memory for RRDVAR name");
+
+        rv->hash = hash;
+
+        ret = rrdvar_index_add(&st->variables_root_index, rv);
+        if(ret != rv) {
+            error("Duplicate RRDVAR '%s' found on chart '%s'", name, st->id);
+            free(rv->name);
+            free(rv);
+            rv = ret;
+        }
+
+        ret = rrdvar_index_add(&co->variables_root_index, rv);
+        if(ret != rv)
+            debug(D_VARIABLES, "Variable '%s' in context '%s' does not come from chart '%s'", name, co->id, st->id);
+
+        ret = rrdvar_index_add(&host->variables_root_index, rv);
+        if(ret != rv)
+            debug(D_VARIABLES, "Variable '%s' in host '%s' does not come from chart '%s'", name, host->hostname, st->id);
+    }
+
+    return rv;
+}
diff --git a/src/health.h b/src/health.h
new file mode 100644 (file)
index 0000000..d4b55a5
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef NETDATA_HEALTH_H
+#define NETDATA_HEALTH_H
+
+extern int rrdvar_compare(void *a, void *b);
+
+/*
+ * RRDVAR
+ * a variable
+ *
+ * There are 4 scopes: local (chart), context, host and global variables
+ *
+ * Standard global variables:
+ *  $now
+ *
+ * Standard host variables:
+ *  - none -
+ *
+ * Standard context variables:
+ *  - none -
+ *
+ * Standard local variables:
+ *  $last_updated
+ *  $last_collected_value
+ *  $last_value
+ *
+ */
+
+typedef struct rrdvar {
+    avl avl;
+
+    char *name;
+    uint32_t hash;
+
+    calculated_number *value;
+
+    time_t last_updated;
+} RRDVAR;
+
+typedef struct rrdcalc {
+    avl avl;
+
+    int group;          // grouping method: average, max, etc.
+    int before;         // ending point in time-series
+    int after;          // starting point in time-series
+    int update_every;   // update frequency for the calculation
+
+    const char *name;
+    calculated_number value;
+
+    RRDVAR *local;
+    RRDVAR *context;
+    RRDVAR *host;
+
+    struct rrdcalc *next;
+    struct rrdcalc *prev;
+} RRDCALC;
+
+#endif //NETDATA_HEALTH_H
index 62f07adde5017a29e8c940a9ff74074851fe69d9..3c42afaeb90c1498431c4bb3985401a2d0647e98 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -1,17 +1,5 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <time.h>
-#include <syslog.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "log.h"
 #include "common.h"
 
-
 // ----------------------------------------------------------------------------
 // LOG
 
index 2c0f5cd7a1884c96afc520ad2ad4f122294e36a8..95b6b301ed7a9496d4d0c1bfa89fbe634b152353 100644 (file)
--- a/src/log.h
+++ b/src/log.h
@@ -1,9 +1,3 @@
-#include <stdio.h>
-#include <stdarg.h>
-#include <time.h>
-
-#include "main.h"
-
 #ifndef NETDATA_LOG_H
 #define NETDATA_LOG_H 1
 
@@ -29,6 +23,7 @@
 #define D_MEMORY                       0x00080000
 #define D_CGROUP            0x00100000
 #define D_REGISTRY                     0x00200000
+#define D_VARIABLES         0x00400000
 
 //#define DEBUG (D_WEB_CLIENT_ACCESS|D_LISTENER|D_RRD_STATS)
 //#define DEBUG 0xffffffff
index 41590c56daf1dde0d9ec47836df41d648e1a28f5..04758092db3d12085a76fa69e4b1bfe6c4b63ed7 100644 (file)
@@ -1,40 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <errno.h>
-#include <getopt.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/prctl.h>
-#include <sys/wait.h>
-#include <syslog.h>
-#include <unistd.h>
-
-#include "appconfig.h"
 #include "common.h"
-#include "daemon.h"
-#include "log.h"
-#include "popen.h"
-#include "rrd.h"
-#include "rrd2json.h"
-#include "web_client.h"
-#include "web_server.h"
-
-#include "unit_test.h"
-
-#include "plugin_checks.h"
-#include "plugin_idlejitter.h"
-#include "plugin_nfacct.h"
-#include "registry.h"
-#include "plugin_proc.h"
-#include "plugin_tc.h"
-#include "plugins_d.h"
-
-#include "main.h"
 
 extern void *cgroups_main(void *ptr);
 
index a41aa0c2bdcb1e01c25f1378ef82fa60a9c2763d..b1acf8a6abc02dc0392d79d2a5c518df6130d300 100644 (file)
@@ -1,10 +1,6 @@
-#include <getopt.h>
-
 #ifndef NETDATA_MAIN_H
 #define NETDATA_MAIN_H 1
 
-#include <signal.h>
-
 extern volatile sig_atomic_t netdata_exit;
 
 /**
index 379fb9a84616aefa04794ccbae238808526c707a..217cdc512ef03e9659c50f1dbc7c98fd0e0f3593 100644 (file)
@@ -1,17 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pthread.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <strings.h>
-#include <unistd.h>
-
 #include "common.h"
-#include "appconfig.h"
-#include "log.h"
-#include "rrd.h"
-#include "plugin_checks.h"
 
 void *checks_main(void *ptr)
 {
index 56c22a160187b129115c252221b2a230c8748ab7..abdb03d1d91b4ffed8157334a0d17d1fd2e087b8 100644 (file)
@@ -1,18 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pthread.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <strings.h>
-#include <unistd.h>
-
-#include "global_statistics.h"
 #include "common.h"
-#include "appconfig.h"
-#include "log.h"
-#include "rrd.h"
-#include "plugin_idlejitter.h"
 
 #define CPU_IDLEJITTER_SLEEP_TIME_MS 20
 
index 6cde66e0c70f77e7e86313e419b569383a1b057a..b61f9e53de83d8c57d1973d47e043d9711a6aa8a 100644 (file)
@@ -1,28 +1,8 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #ifdef INTERNAL_PLUGIN_NFACCT
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
 #include <libmnl/libmnl.h>
 #include <libnetfilter_acct/libnetfilter_acct.h>
 
-#include "main.h"
-#include "global_statistics.h"
 #include "common.h"
-#include "appconfig.h"
-#include "log.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 struct mynfacct {
        const char *name;
index e7b8d50c87d64c2695c4b63373eb92418f496cdf..1f69b284bc96145f882a310d7cfc030db2d5ffa7 100644 (file)
@@ -1,20 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pthread.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <strings.h>
-#include <unistd.h>
-
-#include "global_statistics.h"
 #include "common.h"
-#include "appconfig.h"
-#include "log.h"
-#include "rrd.h"
-#include "plugin_proc.h"
-#include "main.h"
-#include "registry.h"
 
 void *proc_main(void *ptr)
 {
index 251cfeeb4922e6b9ebc89b7089b1b2c3985a37d2..201cfcad570d61478c0249bf45d3c4bbd6d2a0ed 100644 (file)
@@ -1,20 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/resource.h>
-
-#include "avl.h"
-#include "log.h"
 #include "common.h"
-#include "appconfig.h"
-#include "rrd.h"
-#include "popen.h"
-#include "plugin_tc.h"
-#include "main.h"
 
 #define RRD_TYPE_TC                                    "tc"
 #define RRD_TYPE_TC_LEN                                strlen(RRD_TYPE_TC)
index 23757bbe7d9f8af448045f90fdff798f2df2fa68..aa233cfb410fc321f26b1ff608fd04d677a7ba7b 100644 (file)
@@ -1,22 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <sys/types.h>
-#include <dirent.h>
-#include <pthread.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-
-#include "main.h"
 #include "common.h"
-#include "appconfig.h"
-#include "log.h"
-#include "rrd.h"
-#include "popen.h"
-#include "plugins_d.h"
-#include "../config.h"
 
 struct plugind *pluginsd_root = NULL;
 
index 1a10dc0dc507dfce60dc4cfebf002e1aad8607b9..7e49b184146c03e87c9e19e4977968047113ff7b 100644 (file)
@@ -1,7 +1,3 @@
-#include <sys/types.h>
-#include <unistd.h>
-
-
 #ifndef NETDATA_PLUGINS_D_H
 #define NETDATA_PLUGINS_D_H 1
 
index 4e2874f4cd8b2609d19455785f36dd4e1a347ad3..a603c72db302bcc4f465c46a9dcc4040d38a377c 100644 (file)
@@ -1,14 +1,3 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <signal.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "log.h"
-#include "popen.h"
 #include "common.h"
 
 /*
index 10680f0c8295903104a195f9576e8b9ba5958e9b..90845e1fb524e797632e0a8594d14c5bc088c6b9 100644 (file)
@@ -1,7 +1,3 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-
 #ifndef NETDATA_POPEN_H
 #define NETDATA_POPEN_H 1
 
index 3e3df2465a7b517a40fd18902072a8ac3da62c44..87140adaff529069207a684b36427eed5b3fde12 100644 (file)
@@ -1,25 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <dirent.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/statvfs.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
-
-#include "proc_self_mountinfo.h"
 
 #define RRD_TYPE_DISK "disk"
 
index ad00c2022af532178f03cdc1c5b6cc5fd9788fb8..b4a62f0429740bfe01b65649abd0cefeaed264c5 100644 (file)
@@ -1,17 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
 #include "common.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
-#include "log.h"
 
 #define MAX_INTERRUPT_NAME 50
 
index c8e893b9990bf7f52eddfdfc9574a8feb87e7840..54c08c2b0260f64ae798008658cc934c51c2e486 100644 (file)
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "log.h"
 #include "common.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 int do_proc_loadavg(int update_every, unsigned long long dt) {
        static procfile *ff = NULL;
index 611b4ed219ce396212409636b561406552fbc9bf..fc22ddf005a9aa95a9167317fae50212e708db2b 100644 (file)
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 #define MAX_PROC_MEMINFO_LINE 4096
 #define MAX_PROC_MEMINFO_NAME 1024
index 12d8078c72178321ead1a9afd2081af1a6ef0bbe..2c02b0697d3f836a38b4bd3ac62c6a4bdde3d858 100644 (file)
@@ -1,15 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "common.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 int do_proc_net_dev(int update_every, unsigned long long dt) {
        static procfile *ff = NULL;
index ffb5da7b56702f781d64abcc8bc12f18c60b9354..ff038b9276a65cc78a93a4c7e08fecb9e8dab33d 100644 (file)
@@ -1,14 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-
 #include "common.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 #define RRD_TYPE_NET_IPVS                      "ipvs"
 #define RRD_TYPE_NET_IPVS_LEN          strlen(RRD_TYPE_NET_IPVS)
index 70d8cd68d0e6f018b648a06ce2bbdd00739ef7fd..1f3bff303c71906673e926c3ab4cdd86cd81e25b 100644 (file)
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 int do_proc_net_netstat(int update_every, unsigned long long dt) {
        static int do_bandwidth = -1, do_inerrors = -1, do_mcast = -1, do_bcast = -1, do_mcast_p = -1, do_bcast_p = -1;
index b5d766e057adcc04193c5dcad98330f5c104e02f..69a18773b31b41759f1a303f7d09af7e1d8ce4c3 100644 (file)
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 struct nfsd_procs {
        char name[30];
index 69b2938aae159f005267d1f525cfbf6fc1ce2025..815eeac7df0deebdfb97a6a6ca773add7aa938d5 100644 (file)
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 #define RRD_TYPE_NET_SNMP                      "ipv4"
 #define RRD_TYPE_NET_SNMP_LEN          strlen(RRD_TYPE_NET_SNMP)
index 4586ee7d0d638dd9216f81833159bb5be55ad755..0d770ddd49e978b79690e480fad9acbe178ee422 100644 (file)
@@ -1,17 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 #define RRD_TYPE_NET_SNMP6                     "ipv6"
 #define RRD_TYPE_NET_SNMP6_LEN         strlen(RRD_TYPE_NET_SNMP6)
index 1fcf6ffceaf27491401ea539bf5265fcc4c3ee4d..3af66f19ff2534d4fe9dd3f7478006747c54d0d6 100644 (file)
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 #define RRD_TYPE_NET_STAT_NETFILTER            "netfilter"
 #define RRD_TYPE_NET_STAT_CONNTRACK    "conntrack"
index d90a376f0914bbe3a9b903ad74b9302fde6d1b20..c3874eeeef6fb0092f59b040ad8fd0106cf40b99 100644 (file)
@@ -1,15 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-
 #include "common.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
-#include "log.h"
 
 #define RRD_TYPE_NET_STAT_NETFILTER                    "netfilter"
 #define RRD_TYPE_NET_STAT_SYNPROXY                     "synproxy"
index ac5baa4e6e3b281280ff631c35ddaee8a7052e4d..b4b2f684dfa20fee2c77ea3b8a67b6f29376f610 100644 (file)
@@ -1,19 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <ctype.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-
-#include "proc_self_mountinfo.h"
 
 // find the mount info with the given major:minor
 // in the supplied linked list of mountinfo structures
index 51712a58aa792dfc92ef981b1ef6390af54fc379..af98ca4a58f0ad8d14a48049d9c8513843f8426f 100644 (file)
@@ -1,5 +1,3 @@
-#include "procfile.h"
-
 #ifndef NETDATA_PROC_SELF_MOUNTINFO_H
 #define NETDATA_PROC_SELF_MOUNTINFO_H 1
 
index 96b5d3d30224fa42b18ce5917d838b4135bc7ee3..020bc5e35a111715d12bae587d53a0e050de8147 100644 (file)
@@ -1,17 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
 #include "common.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
-#include "log.h"
 
 #define MAX_INTERRUPT_NAME 50
 
index a1e9c2f520c10fa72ca3658fd51a900f7601b0a9..9450f38190edb3afaf80faf223bd164adedf24db 100644 (file)
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 int do_proc_stat(int update_every, unsigned long long dt) {
        (void)dt;
index d7d1e826110ef937f612eda3b2c4e7e38857976d..a08f494cd6461c730c68f20d19e508d24a6f8037 100644 (file)
@@ -1,14 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-
 #include "common.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 int do_proc_sys_kernel_random_entropy_avail(int update_every, unsigned long long dt) {
        static procfile *ff = NULL;
index c69b389b6c875af18105087321046f2bfba41d47..dcddb14db9c4e7d170af53537dc1fc154e328fef 100644 (file)
@@ -1,17 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
 int do_proc_vmstat(int update_every, unsigned long long dt) {
        static procfile *ff = NULL;
index 25f9d2e749639077cd7f879c6f819f66600ac6a9..49f715d474e334c723771df12e1a7daad32cd8fe 100644 (file)
@@ -1,26 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <malloc.h>
-#include <ctype.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
 #include "common.h"
-#include "log.h"
-#include "procfile.h"
-#include "../config.h"
 
 #define PF_PREFIX "PROCFILE"
 
index 26004d4d9076d5596bbf4c78336105c57ce0ea8d..0c184a73fb64213a3c4c52c1dbd45fe6de55a023 100644 (file)
@@ -1,28 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <uuid/uuid.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#include "log.h"
 #include "common.h"
-#include "dictionary.h"
-#include "appconfig.h"
-
-#include "web_client.h"
-#include "rrd.h"
-#include "rrd2json.h"
-#include "registry.h"
-
 
 // ----------------------------------------------------------------------------
 // TODO
index 9e7a13ecbf80168edf179dd957017170fc876fcb..c2b57a23df4c1c6f4c86968d3bc992ee16de111b 100644 (file)
@@ -1,5 +1,3 @@
-#include "web_client.h"
-
 #ifndef NETDATA_REGISTRY_H
 #define NETDATA_REGISTRY_H 1
 
index c7e4917bdbbb40feab9c8d13a4577f8c4b7ca493..5ba5d39a3990fa5f973015998141b3f47e7c8601 100644 (file)
--- a/src/rrd.c
+++ b/src/rrd.c
@@ -1,25 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stddef.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-#include <pthread.h>
-#include <errno.h>
-#include <ctype.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <stdlib.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-
-#include "main.h"
-#include "rrd.h"
 
 #define RRD_DEFAULT_GAP_INTERPOLATIONS 1
 
@@ -54,6 +33,10 @@ RRDHOST localhost = {
         .rrdcontext_root_index = {
             { NULL, rrdcontext_compare },
             AVL_LOCK_INITIALIZER
+        },
+        .variables_root_index = {
+            { NULL, rrdvar_compare },
+            AVL_LOCK_INITIALIZER
         }
 };
 
@@ -82,10 +65,15 @@ RRDCONTEXT *rrdcontext_create(const char *id) {
     if(!rc) {
         rc = calloc(1, sizeof(RRDCONTEXT));
         if(!rc) fatal("Cannot allocate RRDCONTEXT memory");
+
         rc->id = strdup(id);
         if(!rc->id) fatal("Cannot allocate RRDCONTEXT.id memory");
+
         rc->hash = simple_hash(rc->id);
-        // avl_init_lock(&rc->variables_root_index, compar);
+
+        // initialize the variables index
+        avl_init_lock(&rc->variables_root_index, rrdvar_compare);
+
         RRDCONTEXT *ret = rrdcontext_index_add(&localhost, rc);
         if(ret != rc)
             fatal("INTERNAL ERROR: Expected to INSERT RRDCONTEXT '%s' into index, but inserted '%s'.", rc->id, (ret)?ret->id:"NONE");
@@ -102,6 +90,9 @@ void rrdcontext_free(RRDCONTEXT *rc) {
         if(ret != rc)
             fatal("INTERNAL ERROR: Expected to DELETE RRDCONTEXT '%s' from index, but deleted '%s'.", rc->id, (ret)?ret->id:"NONE");
 
+        if(rc->variables_root_index.avl_tree.root != NULL)
+            fatal("INTERNAL ERROR: Variables index of RRDCONTEXT '%s' that is freed, is not empty.", rc->id);
+
         free((void *)rc->id);
         free(rc);
     }
@@ -511,6 +502,7 @@ RRDSET *rrdset_create(const char *type, const char *id, const char *name, const
                        config_get_number(st->id, "gap when lost iterations above", RRD_DEFAULT_GAP_INTERPOLATIONS) + 2);
 
        avl_init_lock(&st->dimensions_index, rrddim_compare);
+    avl_init_lock(&st->variables_root_index, rrdvar_compare);
 
        pthread_rwlock_init(&st->rwlock, NULL);
        pthread_rwlock_wrlock(&localhost.rrdset_root_rwlock);
index b291bdcac8a970ac959cc60bc2b0058c5e03667f..e61c58daf717ca75fd7d97272b9ab49e09121791 100644 (file)
--- a/src/rrd.h
+++ b/src/rrd.h
@@ -1,10 +1,3 @@
-#include <sys/time.h>
-#include <pthread.h>
-#include <stdint.h>
-
-#include "avl.h"
-#include "storage_number.h"
-
 #ifndef NETDATA_RRD_H
 #define NETDATA_RRD_H 1
 
@@ -93,7 +86,7 @@ struct rrdcontext {
 
     size_t use_count;
 
-    // avl_tree_lock variables_root_index;
+    avl_tree_lock variables_root_index;
 };
 typedef struct rrdcontext RRDCONTEXT;
 
@@ -267,6 +260,11 @@ struct rrdset {
 
        avl_tree_lock dimensions_index;                                         // the root of the dimensions index
        RRDDIM *dimensions;                                                             // the actual data for every dimension
+
+    // ------------------------------------------------------------------------
+    // local variables
+
+    avl_tree_lock variables_root_index;
 };
 typedef struct rrdset RRDSET;
 
@@ -285,7 +283,7 @@ struct rrdhost {
     avl_tree_lock rrdset_root_index_name;
 
     avl_tree_lock rrdcontext_root_index;
-    // avl_tree_lock variables_root_index;
+    avl_tree_lock variables_root_index;
 };
 typedef struct rrdhost RRDHOST;
 
index 5da41736bdddc41f8eaa2ded47ebfec4f285fad8..f6c742010029641862b4c2ebd67c6281b4289d6c 100644 (file)
@@ -1,15 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <math.h>
-
-#include "log.h"
 #include "common.h"
-#include "rrd2json.h"
 
 #define HOSTNAME_MAX 1024
 char *hostname = "unknown";
index 42a7e20097a74974a2ba554a73e9dfe88815c82a..bb7b04064971f402a9de756d4ae84185261c4746 100644 (file)
@@ -1,8 +1,3 @@
-#include <time.h>
-
-#include "web_buffer.h"
-#include "rrd.h"
-
 #ifndef NETDATA_RRD2JSON_H
 #define NETDATA_RRD2JSON_H 1
 
index df80bf725cfb310795a2b3c2201f3c514d0b2560..70eb638462825dc1faa3585a13a0ccdf76e3e7d6 100644 (file)
@@ -1,21 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef STORAGE_WITH_MATH
-#include <math.h>
-#endif
-
 #include "common.h"
-#include "log.h"
-#include "storage_number.h"
-
-#if __GNUC__
-#if __x86_64__ || __ppc64__
-#define ENVIRONMENT64
-#else
-#define ENVIRONMENT32
-#endif
-#endif
 
 extern char *print_number_lu_r(char *str, unsigned long uvalue);
 extern char *print_number_llu_r(char *str, unsigned long long uvalue);
index 1b7da79f17026cc6086914f558c3927a22a13d4d..7ff839433f8639a655b029b88b2f503630720d1c 100644 (file)
@@ -1,5 +1,3 @@
-#include <stdint.h>
-
 #ifndef NETDATA_STORAGE_NUMBER_H
 #define NETDATA_STORAGE_NUMBER_H
 
index 5bc408c95a58ae79afbbb876a2fb03a48e0254d2..8c83190b18e5b21fc88bb86ef3eb13427f6290b6 100644 (file)
@@ -1,23 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <string.h>
-#include <sys/stat.h>
-
 #include "common.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "log.h"
-#include "rrd.h"
-#include "main.h"
-#include "popen.h"
-#include "proc_self_mountinfo.h"
 
 // ----------------------------------------------------------------------------
 // cgroup globals
index 8064cb1818e5742a02d67ab87cf3118b9a899f2b..f6cf52f9cbb2033561c7fabc89ff86b146df3e5b 100644 (file)
@@ -1,21 +1,9 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "procfile.h"
-#include "rrd.h"
-#include "plugin_proc.h"
 
-typedef struct name_value {
+typedef struct ksm_name_value {
        char filename[FILENAME_MAX + 1];
        unsigned long long value;
-} NAME_VALUE;
+} KSM_NAME_VALUE;
 
 #define PAGES_SHARED 0
 #define PAGES_SHARING 1
@@ -23,7 +11,7 @@ typedef struct name_value {
 #define PAGES_VOLATILE 3
 #define PAGES_TO_SCAN 4
 
-NAME_VALUE values[] = {
+KSM_NAME_VALUE values[] = {
                [PAGES_SHARED] = { "/sys/kernel/mm/ksm/pages_shared", 0ULL },
                [PAGES_SHARING] = { "/sys/kernel/mm/ksm/pages_sharing", 0ULL },
                [PAGES_UNSHARED] = { "/sys/kernel/mm/ksm/pages_unshared", 0ULL },
index dbf9190ba4c7d66de2b9ace17379700a08d0ec03..1a8ef012acd19083f0bd89c1ccb5c101d3190fc9 100644 (file)
@@ -1,17 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/resource.h>
-#include <math.h>
-
 #include "common.h"
-#include "storage_number.h"
-#include "rrd.h"
-#include "log.h"
-#include "web_buffer.h"
 
 int check_storage_number(calculated_number n, int debug) {
        char buffer[100];
index bd22b8187fe05d335d3400a26386bd6c0c7cdbd8..26d53cb81167f5ab32a689a1a3ac6077f5ebd192 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -1,13 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
 #include "common.h"
-#include "log.h"
-#include "url.h"
 
 // ----------------------------------------------------------------------------
 // URL encode / decode
index 582890e1b566abe794a67c05447dab69da69d094..a7c16ec5fe2335cd7dc2c97bdcc8ff1b29b4b830 100644 (file)
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef STORAGE_WITH_MATH
-#include <math.h>
-#endif
-
 #include "common.h"
-#include "web_buffer.h"
-#include "log.h"
 
 #define BUFFER_OVERFLOW_EOF "EOF"
 
index 399eb84a52e189789ed065e208565fa5855fea63..6b10c525cfa43138f1327f6ecaba4aae30008129 100644 (file)
@@ -1,7 +1,3 @@
-#include <stdarg.h>
-#include <time.h>
-#include "storage_number.h"
-
 #ifndef NETDATA_WEB_BUFFER_H
 #define NETDATA_WEB_BUFFER_H 1
 
index 250bbc8985ef8d35a88d8ea73122c633a060960f..087c79a3f037cf6850f4a285adf7913b285494f5 100644 (file)
@@ -1,17 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <math.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "url.h"
-#include "web_buffer.h"
-#include "web_buffer_svg.h"
 
 #define BADGE_HORIZONTAL_PADDING 4
 #define VERDANA_KERNING 0.5
index b853e97dde49d1c3c75ec5f3f7a4c558225bc7ba..1281847eb49c4721c7d00cfe3cd61257f8981215 100644 (file)
@@ -1,6 +1,3 @@
-#include "web_buffer.h"
-#include "dictionary.h"
-
 #ifndef NETDATA_WEB_BUFFER_SVG_H
 #define NETDATA_WEB_BUFFER_SVG_H 1
 
index ea4a942e78d404913950a97d1fa94f25d5132a04..71419ceabbd3398b3c0c5ddb673bce20c3c30928 100644 (file)
@@ -1,38 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-#include <pthread.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <malloc.h>
-#include <pwd.h>
-#include <grp.h>
-#include <ctype.h>
-#include <poll.h>
-
-// TCP_CORK
-#include <netinet/tcp.h>
-
 #include "common.h"
-#include "log.h"
-#include "main.h"
-#include "appconfig.h"
-#include "url.h"
-#include "web_buffer.h"
-#include "web_server.h"
-#include "global_statistics.h"
-#include "rrd.h"
-#include "rrd2json.h"
-#include "registry.h"
-#include "web_buffer_svg.h"
-#include "web_client.h"
 
 #define INITIAL_WEB_DATA_LENGTH 16384
 #define WEB_REQUEST_LENGTH 16384
index a3198857672d0ba3f13b78544340953670915bbe..a8339a3254549ecfe116620587e99e9773db183b 100644 (file)
@@ -1,19 +1,3 @@
-
-#ifdef NETDATA_WITH_ZLIB
-#include <zlib.h>
-#endif
-
-#include <sys/time.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-#include "web_buffer.h"
-#include "dictionary.h"
-
 #ifndef NETDATA_WEB_CLIENT_H
 #define NETDATA_WEB_CLIENT_H 1
 
index 14ac610fdb325884d4e5be48ead158ccfd51aeb1..1af02b3b24c5dd1244606689bcb8cfb01ff76cd5 100644 (file)
@@ -1,32 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-#include <pthread.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <netinet/tcp.h>
-#include <malloc.h>
-#include <poll.h>
-#include <ctype.h>
-
 #include "common.h"
-#include "log.h"
-#include "appconfig.h"
-#include "url.h"
-#include "web_buffer.h"
-#include "web_client.h"
-#include "web_server.h"
-#include "global_statistics.h"
-#include "rrd.h"
-#include "rrd2json.h"
-#include "../config.h"
 
 int listen_backlog = LISTEN_BACKLOG;
 int listen_fds_count = 0;