From: Pierre-Luc St-Charles <[email protected]>

Signed-off-by: Pierre-Luc St-Charles <[email protected]>
---
 configure.ac                   | 10 ++++++++++
 src/bin/lttng-relayd/cmd-2-2.c |  1 +
 src/bin/lttng-relayd/main.c    |  1 +
 src/common/compat/endian.h     |  6 +++++-
 src/common/relayd/relayd.c     |  1 +
 5 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index eee025a..618d203 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,6 +123,16 @@ AC_CHECK_LIB([pthread], [pthread_create], [],
 ]
 )
 
+# Check low-level endian compat functions
+AC_CHECK_DECL(be64toh, [], 
+[
+       AC_CHECK_DECL(betoh64, [AC_DEFINE_UNQUOTED([LTTNG_HAVE_BETOH64], 1, 
[Has BSD-style endian conversion operations.])], 
+       [
+               AC_MSG_ERROR([Cannot find be64toh, betoh64 or any similar 
functions.])
+       ])
+]
+)
+
 # Check libpopt
 AC_CHECK_LIB([popt], [poptGetContext], [],
 [
diff --git a/src/bin/lttng-relayd/cmd-2-2.c b/src/bin/lttng-relayd/cmd-2-2.c
index 0450fbf..09ff7f5 100644
--- a/src/bin/lttng-relayd/cmd-2-2.c
+++ b/src/bin/lttng-relayd/cmd-2-2.c
@@ -22,6 +22,7 @@
 
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
+#include <common/compat/endian.h>
 
 #include "cmd-generic.h"
 #include "cmd-2-1.h"
diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c
index 9a2b3bd..0bf3ead 100644
--- a/src/bin/lttng-relayd/main.c
+++ b/src/bin/lttng-relayd/main.c
@@ -43,6 +43,7 @@
 #include <common/common.h>
 #include <common/compat/poll.h>
 #include <common/compat/socket.h>
+#include <common/compat/endian.h>
 #include <common/defaults.h>
 #include <common/futex.h>
 #include <common/sessiond-comm/sessiond-comm.h>
diff --git a/src/common/compat/endian.h b/src/common/compat/endian.h
index 2850866..b7f66cc 100644
--- a/src/common/compat/endian.h
+++ b/src/common/compat/endian.h
@@ -15,11 +15,15 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifdef _COMPAT_ENDIAN_H
+#ifndef _COMPAT_ENDIAN_H
 #define _COMPAT_ENDIAN_H
 
 #ifdef __linux__
 #include <endian.h>
+#ifdef LTTNG_HAVE_BETOH64
+#define be64toh(x) betoh64(x)
+#define be32toh(x) betoh32(x)
+#endif // LTTNG_HAVE_BETOH64
 #elif defined(__FreeBSD__)
 #include <machine/endian.h>
 #else
diff --git a/src/common/relayd/relayd.c b/src/common/relayd/relayd.c
index 82bcf5f..ba7bd13 100644
--- a/src/common/relayd/relayd.c
+++ b/src/common/relayd/relayd.c
@@ -26,6 +26,7 @@
 #include <common/common.h>
 #include <common/defaults.h>
 #include <common/sessiond-comm/relayd.h>
+#include <common/compat/endian.h>
 
 #include "relayd.h"
 
-- 
1.8.1.msysgit.1


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to