From f6afb94e88f4fb2a47384559fe14ad82a3ec7f20 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 6 Oct 2015 12:09:02 -0400 Subject: [PATCH] Port: Add Solaris endian.h compat MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- formats/ctf/writer/writer.c | 1 + formats/lttng-live/lttng-live-comm.c | 1 + include/babeltrace/endian.h | 36 ++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/formats/ctf/writer/writer.c b/formats/ctf/writer/writer.c index 3630b36b..b0a35c69 100644 --- a/formats/ctf/writer/writer.c +++ b/formats/ctf/writer/writer.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c index a44516de..ae4f00b7 100644 --- a/formats/lttng-live/lttng-live-comm.c +++ b/formats/lttng-live/lttng-live-comm.c @@ -38,6 +38,7 @@ #include #include +#include #include #include #include diff --git a/include/babeltrace/endian.h b/include/babeltrace/endian.h index f15a44fb..77686398 100644 --- a/include/babeltrace/endian.h +++ b/include/babeltrace/endian.h @@ -29,6 +29,42 @@ #ifdef __FreeBSD__ #include + +#elif defined(__sun__) +#include + +#ifndef __BIG_ENDIAN +#define __BIG_ENDIAN 4321 +#endif +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN 1234 +#endif + +#ifdef _LITTLE_ENDIAN +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#ifdef _BIG_ENDIAN +#define __BYTE_ORDER __BIG_ENDIAN +#endif + +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define BIG_ENDIAN __BIG_ENDIAN +#define BYTE_ORDER __BYTE_ORDER + +#define betoh16(x) BE_16(x) +#define letoh16(x) LE_16(x) +#define betoh32(x) BE_32(x) +#define letoh32(x) LE_32(x) +#define betoh64(x) BE_64(x) +#define letoh64(x) LE_64(x) +#define htobe16(x) BE_16(x) +#define be16toh(x) BE_16(x) +#define htobe32(x) BE_32(x) +#define be32toh(x) BE_32(x) +#define htobe64(x) BE_64(x) +#define be64toh(x) BE_64(x) + #elif defined(__MINGW32__) #ifndef __BIG_ENDIAN #define __BIG_ENDIAN 4321 -- 2.34.1