From: Florian Forster Date: Tue, 10 Jun 2008 15:10:05 +0000 (+0200) Subject: Merge branch 'collectd-4.4' X-Git-Tag: collectd-4.5.0~122 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=430b0b4d0275f7fea64376fc166e81fc0bcc36bf;hp=1d6a83e9758aeba9f8cebac1d27bd94e46a83450;p=collectd.git Merge branch 'collectd-4.4' --- diff --git a/configure.in b/configure.in index 13228c15..b1b259bc 100644 --- a/configure.in +++ b/configure.in @@ -57,7 +57,7 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_DIRENT -AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h) +AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h) # For ping library AC_CHECK_HEADERS(netinet/in_systm.h, [], [], diff --git a/src/collectd.h b/src/collectd.h index 55aac160..0ccf5336 100644 --- a/src/collectd.h +++ b/src/collectd.h @@ -122,8 +122,13 @@ # endif /* !defined(isnan) */ #endif /* NAN_ZERO_ZERO */ +/* Try really, really hard to determine endianess. Under NexentaStor 1.0.2 this + * information is in , possibly some other Solaris versions do + * this too.. */ #if HAVE_ENDIAN_H # include +#elif HAVE_SYS_ISA_DEFS_H +# include #endif #ifndef BYTE_ORDER @@ -140,6 +145,26 @@ # define BIG_ENDIAN __BIG_ENDIAN # endif #endif +#ifndef LITTLE_ENDIAN +# if defined(_LITTLE_ENDIAN) +# define LITTLE_ENDIAN _LITTLE_ENDIAN +# elif defined(__LITTLE_ENDIAN) +# define LITTLE_ENDIAN __LITTLE_ENDIAN +# endif +#endif +#ifndef BYTE_ORDER +# if defined(BIG_ENDIAN) && !defined(LITTLE_ENDIAN) +# undef BIG_ENDIAN +# define BIG_ENDIAN 4321 +# define LITTLE_ENDIAN 1234 +# define BYTE_ORDER BIG_ENDIAN +# elif !defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN) +# undef LITTLE_ENDIAN +# define BIG_ENDIAN 4321 +# define LITTLE_ENDIAN 1234 +# define BYTE_ORDER LITTLE_ENDIAN +# endif +#endif #if !defined(BYTE_ORDER) || !defined(BIG_ENDIAN) # error "Cannot determine byte order" #endif @@ -220,6 +245,11 @@ #define STATIC_ARRAY_LEN(array) (sizeof (array) / sizeof ((array)[0])) +/* Remove GNU specific __attribute__ settings when using another compiler */ +#if !__GNUC__ +# define __attribute__(x) /**/ +#endif + extern char hostname_g[]; extern int interval_g; diff --git a/src/disk.c b/src/disk.c index c5a0cc85..a6f850a1 100644 --- a/src/disk.c +++ b/src/disk.c @@ -454,7 +454,7 @@ static int disk_read (void) major = atoll (fields[0]); minor = atoll (fields[1]); - disk_name = fields[2]; + disk_name = fields[2 + fieldshift]; for (ds = disklist, pre_ds = disklist; ds != NULL; pre_ds = ds, ds = ds->next) if (strcmp (disk_name, ds->name) == 0) diff --git a/src/network.c b/src/network.c index 6be7a098..b6778fa0 100644 --- a/src/network.c +++ b/src/network.c @@ -183,7 +183,7 @@ static pthread_mutex_t send_buffer_lock = PTHREAD_MUTEX_INITIALIZER; static c_avl_tree_t *cache_tree = NULL; static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER; -static time_t cache_flush_last; +static time_t cache_flush_last = 0; static int cache_flush_interval = 1800; /* @@ -1704,11 +1704,19 @@ static int network_shutdown (void) plugin_unregister_write ("network"); plugin_unregister_shutdown ("network"); + /* Let the init function do it's move again ;) */ + cache_flush_last = 0; + return (0); } /* int network_shutdown */ static int network_init (void) { + /* Check if we were already initialized. If so, just return - there's + * nothing more to do (for now, that is). */ + if (cache_flush_last != 0) + return (0); + plugin_register_shutdown ("network", network_shutdown); send_buffer_ptr = send_buffer; diff --git a/src/plugin.h b/src/plugin.h index ac389c6a..e2de6fff 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -213,7 +213,9 @@ int plugin_dispatch_values (value_list_t *vl); int plugin_dispatch_notification (const notification_t *notif); -void plugin_log (int level, const char *format, ...); +void plugin_log (int level, const char *format, ...) + __attribute__ ((format(printf,2,3))); + #define ERROR(...) plugin_log (LOG_ERR, __VA_ARGS__) #define WARNING(...) plugin_log (LOG_WARNING, __VA_ARGS__) #define NOTICE(...) plugin_log (LOG_NOTICE, __VA_ARGS__) diff --git a/src/wireless.c b/src/wireless.c index 1282b48c..a0644fe4 100644 --- a/src/wireless.c +++ b/src/wireless.c @@ -129,7 +129,9 @@ static int wireless_read (void) power = 1.0; /* invalid */ else if ((power >= 0.0) && (power <= 100.0)) power = wireless_percent_to_power (power); - else if (power > 100.0) + else if ((power > 100.0) && (power <= 256.0)) + power = power - 256.0; + else if (power > 0.0) power = 1.0; /* invalid */ /* noise [dBm] < 0.0 */ @@ -138,7 +140,9 @@ static int wireless_read (void) noise = 1.0; /* invalid */ else if ((noise >= 0.0) && (noise <= 100.0)) noise = wireless_percent_to_power (noise); - else if (noise > 100.0) + else if ((noise > 100.0) && (noise <= 256.0)) + noise = noise - 256.0; + else if (noise > 0.0) noise = 1.0; /* invalid */ wireless_submit (device, "signal_quality", quality);