]> arthur.barton.de Git - netdata.git/commitdiff
Fix misc compiler warnings on FreeBSD
authorVladimir Kobal <vlad@prokk.net>
Mon, 20 Mar 2017 15:54:10 +0000 (17:54 +0200)
committerVladimir Kobal <vlad@prokk.net>
Mon, 20 Mar 2017 15:54:10 +0000 (17:54 +0200)
src/apps_plugin.c
src/common.c
src/common.h
src/web_client.c

index 83694c9f0fce3f996bc983840ab7b923ce836fc1..b1bf06bee9dc2aee1a3d100b5c86a1e0571e9a4e 100644 (file)
@@ -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;
index 72412baae286abb540b85fa44bf7543151a4b39b..88fcf85bc2a981ec35270db4f7281118d46052fc 100644 (file)
@@ -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;
index f2c764b53495389e6e17752c3e82261281b0a7df..b82c078fa3552fe8f0ea5072fc0d679733e54982 100644 (file)
 #include "plugin_nfacct.h"
 
 #if defined(__FreeBSD__)
+#include <pthread_np.h>
 #include "plugin_freebsd.h"
 #define NETDATA_OS_TYPE "freebsd"
 #elif defined(__APPLE__)
index ef39d3b5834e92ff2444848816fca0e6db94f11b..b5b25899f624f30b97c3667ec4b53444e93c7cd8 100644 (file)
@@ -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;