summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@tsaousis.gr>2017-03-20 18:32:15 +0200
committerGitHub <noreply@github.com>2017-03-20 18:32:15 +0200
commit20bfde3a9e75258da8d6b7e6278b72739f5d6b18 (patch)
tree1c7ff62a48befa79a06a028b75f5ee1de69909ca
parenteac17765b77d438479024788e0d2a0055ef5b92d (diff)
parent2471055410a7386a8e503b9a72a13c4117c8690b (diff)
Merge pull request #1983 from vlvkobal/master
Fix misc compiler warnings on FreeBSD
-rw-r--r--src/apps_plugin.c12
-rw-r--r--src/common.c3
-rw-r--r--src/common.h1
-rw-r--r--src/web_client.c4
4 files changed, 18 insertions, 2 deletions
diff --git a/src/apps_plugin.c b/src/apps_plugin.c
index 83694c9f0f..b1bf06bee9 100644
--- a/src/apps_plugin.c
+++ b/src/apps_plugin.c
@@ -1080,6 +1080,7 @@ static inline int read_proc_pid_statm(struct pid_stat *p, void *ptr) {
return 1;
+#ifndef __FreeBSD__
cleanup:
p->statm_size = 0;
p->statm_resident = 0;
@@ -1089,6 +1090,7 @@ cleanup:
// p->statm_data = 0;
// p->statm_dirty = 0;
return 0;
+#endif
}
static inline int read_proc_pid_io(struct pid_stat *p, void *ptr) {
@@ -1142,6 +1144,7 @@ static inline int read_proc_pid_io(struct pid_stat *p, void *ptr) {
return 1;
+#ifndef __FreeBSD__
cleanup:
p->io_logical_bytes_read = 0;
p->io_logical_bytes_written = 0;
@@ -1151,12 +1154,13 @@ cleanup:
p->io_storage_bytes_written = 0;
// p->io_cancelled_write_bytes = 0;
return 0;
+#endif
}
static inline int read_proc_stat() {
#ifdef __FreeBSD__
long cp_time[CPUSTATES];
- int i;
+ static kernel_uint_t utime_raw = 0, stime_raw = 0, ntime_raw = 0;
if (unlikely(CPUSTATES != 5)) {
error("FREEBSD: There are %d CPU states (5 was expected)", CPUSTATES);
@@ -1166,8 +1170,8 @@ static inline int read_proc_stat() {
#else
static char filename[FILENAME_MAX + 1] = "";
static procfile *ff = NULL;
-#endif
static kernel_uint_t utime_raw = 0, stime_raw = 0, gtime_raw = 0, gntime_raw = 0, ntime_raw = 0;
+#endif
static usec_t collected_usec = 0, last_collected_usec = 0;
#ifndef __FreeBSD__
@@ -2000,6 +2004,7 @@ static inline void link_all_processes_to_their_parents(void) {
// to avoid filling up all disk space
// if debug is enabled, all errors are printed
+#ifndef __FreeBSD__
static int compar_pid(const void *pid1, const void *pid2) {
struct pid_stat *p1 = all_pids[*((pid_t *)pid1)];
@@ -2010,6 +2015,7 @@ static int compar_pid(const void *pid1, const void *pid2) {
else
return 1;
}
+#endif
static inline int collect_data_for_pid(pid_t pid, void *ptr) {
if(unlikely(pid < INIT_PID || pid > pid_max)) {
@@ -2096,7 +2102,9 @@ static int collect_data_for_all_processes(void) {
#endif
if(all_pids_count) {
+#ifndef __FreeBSD__
size_t slc = 0;
+#endif
for(p = root_of_pids; p ; p = p->next) {
p->read = 0; // mark it as not read, so that collect_data_for_pid() will read it
p->updated = 0;
diff --git a/src/common.c b/src/common.c
index 72412baae2..88fcf85bc2 100644
--- a/src/common.c
+++ b/src/common.c
@@ -914,6 +914,9 @@ char *trim(char *s) {
}
void *mymmap(const char *filename, size_t size, int flags, int ksm) {
+#ifndef MADV_MERGEABLE
+ (void)ksm;
+#endif
static int log_madvise_1 = 1;
#ifdef MADV_MERGEABLE
static int log_madvise_2 = 1, log_madvise_3 = 1;
diff --git a/src/common.h b/src/common.h
index f2c764b534..b82c078fa3 100644
--- a/src/common.h
+++ b/src/common.h
@@ -189,6 +189,7 @@
#include "plugin_nfacct.h"
#if defined(__FreeBSD__)
+#include <pthread_np.h>
#include "plugin_freebsd.h"
#define NETDATA_OS_TYPE "freebsd"
#elif defined(__APPLE__)
diff --git a/src/web_client.c b/src/web_client.c
index ef39d3b583..b5b25899f6 100644
--- a/src/web_client.c
+++ b/src/web_client.c
@@ -25,6 +25,8 @@ static inline int web_client_crock_socket(struct web_client *w) {
return -1;
}
}
+#else
+ (void)w;
#endif /* TCP_CORK */
return 0;
@@ -40,6 +42,8 @@ static inline int web_client_uncrock_socket(struct web_client *w) {
return -1;
}
}
+#else
+ (void)w;
#endif /* TCP_CORK */
return 0;