Hi everybody.

Here are some minor patches to AIX port of collectd. The first one
(aix-test-htonll) adds support to check if the htonl and htonll
functions (which are used in AIX port) are available in
configure. Until now the AIX port used these functions without
perform any existence test.

The second one port memcached plugin to AIX. Since AIX don't
have MSG_DONTWAIT flag support, we use MSG_NONBLOCK... and we hope
to work fine ever :)

Finally port the multimeter plugin too, which do not compile in AIX
without an explicit cast for TIOCMBIC (don't ask). May forcing a cast is
not very elegant for other os... What do you think, Florian?
Maybe we could use here a per-os #ifdef?

The work was done by my colleage Manuel (as previously do), so
credits for him, please.

We promise to try port other plugins to AIX in next months :)

Regards,
  Andrés
diff --git a/src/memcached.c b/src/memcached.c
index b332157..e616823 100644
--- a/src/memcached.c
+++ b/src/memcached.c
@@ -38,6 +38,10 @@
 # include <netinet/in.h>
 # include <netinet/tcp.h>
 
+#ifndef MSG_DONTWAIT
+#define MSG_DONTWAIT MSG_NONBLOCK
+#endif
+
 #define MEMCACHED_DEF_HOST "127.0.0.1"
 #define MEMCACHED_DEF_PORT "11211"
 
diff --git a/src/multimeter.c b/src/multimeter.c
index 775eb57..c061595 100644
--- a/src/multimeter.c
+++ b/src/multimeter.c
@@ -170,7 +170,7 @@ static int multimeter_init (void)
 
 			tcflush(fd, TCIFLUSH);
 			tcsetattr(fd, TCSANOW, &tios);
-			ioctl(fd, TIOCMBIC, &rts);
+			ioctl(fd, (int)TIOCMBIC, &rts);
 			
     			if (multimeter_read_value (&value) < -1)
 			{
diff --git a/configure.in b/configure.in
index ded06be..13f1d85 100644
--- a/configure.in
+++ b/configure.in
@@ -931,6 +931,28 @@ if test "x$have_getmntent" = "xgen"; then
 		  [Define if the function getmntent exists. It's the version from libgen.])
 fi
 
+# Check for htoll
+AC_CACHE_CHECK([if have htonll defined],
+  [c_cv_have_htonll],
+  AC_COMPILE_IFELSE(
+    AC_LANG_PROGRAM(
+    [[[[
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <inttypes.h>
+    ]]]],
+    [[[[
+      return htonll(0);
+    ]]]]),
+    [c_cv_have_htonll="yes"],
+    [c_cv_have_htonll="no"]
+  )
+)
+
+if test "x$c_cv_have_htonll" = "xyes"; then
+        AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
+fi
+
 # Check for structures
 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
 	[AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
diff --git a/src/common.c b/src/common.c
index 8c2aeae..2598036 100644
--- a/src/common.c
+++ b/src/common.c
@@ -668,6 +668,7 @@ long long get_kstat_value (kstat_t *ksp, char *name)
 }
 #endif /* HAVE_LIBKSTAT */
 
+#ifndef HAVE_HTONLL
 unsigned long long ntohll (unsigned long long n)
 {
 #if BYTE_ORDER == BIG_ENDIAN
@@ -685,6 +686,7 @@ unsigned long long htonll (unsigned long long n)
 	return (((unsigned long long) htonl (n)) << 32) + htonl (n >> 32);
 #endif
 } /* unsigned long long htonll */
+#endif /* HAVE_HTONLL */
 
 #if FP_LAYOUT_NEED_NOTHING
 /* Well, we need nothing.. */
diff --git a/src/common.h b/src/common.h
index fc809f2..c0bea36 100644
--- a/src/common.h
+++ b/src/common.h
@@ -236,8 +236,10 @@ int get_kstat (kstat_t **ksp_ptr, char *module, int instance, char *name);
 long long get_kstat_value (kstat_t *ksp, char *name);
 #endif
 
+#ifndef HAVE_HTONLL
 unsigned long long ntohll (unsigned long long n);
 unsigned long long htonll (unsigned long long n);
+#endif
 
 #if FP_LAYOUT_NEED_NOTHING
 # define ntohd(d) (d)
_______________________________________________
collectd mailing list
[email protected]
http://mailman.verplant.org/listinfo/collectd

Reply via email to