Port: Add OSX libuuid compat
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/3 Port: Add OSX mman.h compat
Signed-off-by Michael Jeanson <[email protected]>
--- formats/lttng-live/lttng-live-comm.c | 2 +- include/babeltrace/compat/mman.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 include/babeltrace/compat/mman.h
formats/lttng-live/lttng-live-comm.c +1 -1
@@ -31,7 +31,6 @@#include <errno.h> #include <inttypes.h> #include <fcntl.h> -#include <sys/mman.h> #include <poll.h> #include <babeltrace/ctf/ctf-index.h>
@@ -53,6 +52,7 @@#include <babeltrace/compat/memstream.h> #include <babeltrace/compat/send.h> #include <babeltrace/compat/string.h> +#include <babeltrace/compat/mman.h> #include "lttng-live.h" #include "lttng-viewer-abi.h"
include/babeltrace/compat/mman.h new file +36 -0
@@ -0,0 +1,36 @@ +#ifndef _BABELTRACE_COMPAT_MMAN_H +#define _BABELTRACE_COMPAT_MMAN_H + +/* +* babeltrace/compat/mman.h +* +* Copyright (C) 2015 Michael Jeanson <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#include <sys/mman.h> + +#ifndef MAP_ANONYMOUS +# ifdef MAP_ANON +# define MAP_ANONYMOUS MAP_ANON +# endif +#endif + +#endif /* _BABELTRACE_COMPAT_MMAN_H */
Signature · 1 line
1.9.1
PATCH 3/3 Port: Add OSX libuuid compat
In reply to a message not in the archiveOSX has the libuuid symbols built in the system libraries.
Signed-off-by Michael Jeanson <[email protected]>
--- configure.ac | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-)
configure.ac +28 -20
@@ -148,29 +148,37 @@ AM_CONDITIONAL([BABELTRACE_BUILD_WITH_MINGW], [test "x$MINGW32" = "xyes"]) # Check what libraries are required on this platform to link sockets programs. AX_LIB_SOCKET_NSL -# Check for libuuid -AC_CHECK_LIB([uuid], [uuid_generate], +# Check for uuid in system libs +AC_CHECK_FUNCS([uuid_generate], [ - AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.]) - have_libuuid=yes + AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.]) + link_with_libuuid=no ], [ - # libuuid not found, check for uuid_create in libc. - AC_CHECK_LIB([c], [uuid_create], - [ - AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBC_UUID], 1, [Has libc uuid support.]) - have_libc_uuid=yes - ], - [ - # for MinGW32 we have our own internal implemenation of uuid using Windows functions. - if test "x$MINGW32" = xno; then - AC_MSG_ERROR([Cannot find libuuid uuid_generate nor libc uuid_create. Use [LDFLAGS]=-Ldir to specify their location.]) - fi - ]) -] -) -AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"]) -AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"]) + # Check for libuuid + AC_CHECK_LIB([uuid], [uuid_generate], + [ + AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.]) + link_with_libuuid=yes + ], + [ + # libuuid not found, check for uuid_create in libc. + AC_CHECK_LIB([c], [uuid_create], + [ + AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBC_UUID], 1, [Has libc uuid support.]) + link_with_libc_uuid=yes + ], + [ + # for MinGW32 we have our own internal implemenation of uuid using Windows functions. + if test "x$MINGW32" = xno; then + AC_MSG_ERROR([Cannot find libuuid uuid_generate nor libc uuid_create. Use [LDFLAGS]=-Ldir to specify their location.]) + fi + ]) + ]) +]) + +AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBUUID], [test "x$link_with_libuuid" = "xyes"]) +AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBC_UUID], [test "x$link_with_libc_uuid" = "xyes"]) # Check for fmemopen AC_CHECK_LIB([c], [fmemopen],
Signature · 1 line
1.9.1
Jérémie Galarneau
AppliedRe: [PATCH babeltrace 1/3] Port: Add OSX endian.h compat
In reply to a message not in the archiveMerged, thanks!
Jérémie
Quoted 59 lines · Michael Jeanson
From: Alexis Martin <[email protected]>
Signed-off-by Michael Jeanson <[email protected]>--- include/babeltrace/endian.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)include/babeltrace/endian.h +38
-1@@ -81,6 +81,44 @@#define BIG_ENDIAN __BIG_ENDIAN#define PDP_ENDIAN __PDP_ENDIAN#define BYTE_ORDER __BYTE_ORDER + +#elif defined(__APPLE__) +# include <machine/endian.h> +# include <libkern/OSByteOrder.h> + +# if BYTE_ORDER ==LITTLE_ENDIAN +# define htobe16 (x) OSSwapConstInt16(x) +# define htole16 (x) (x) +# define be16toh (x) OSSwapConstInt16(x) +# define le16toh (x) (x) + +# define htobe32 (x) OSSwapConstInt32(x) +# define htole32 (x) (x) +# define be32toh (x) OSSwapConstInt32(x) +# define le32toh (x) (x) + +# define htobe64 (x) OSSwapConstInt64(x) +# define htole64 (x) (x) +# define be64toh (x) OSSwapConstInt64(x) +# define le64toh (x) (x) + +# else /* BYTE_ORDER == LITTLE_ENDIAN */ +# define htobe16 (x) (x) +# define htole16 (x) OSSwapConstInt16(x) +# define be16toh (x) (x) +# define le16toh (x) OSSwapConstInt16(x) + +# define htobe32 (x) (x) +# define htole32 (x) OSSwapConstInt32(x) +# define be32toh (x) (x) +# define le32toh (x) OSSwapConstInt32(x) + +# define htobe64 (x) (x) +# define htole64 (x) OSSwapConstInt64(x) +# define be64toh (x) (x) +# define le64toh (x) OSSwapConstInt64(x) +# endif +#else #include <endian.h> --1.9.1
Signature · 8 lines
Jérémie Galarneau EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jérémie Galarneau
AppliedRe: [PATCH babeltrace 2/3] Port: Add OSX mman.h compat
Merged, thanks!
Jérémie
Quoted 72 lines · Michael Jeanson
Signed-off-by Michael Jeanson <[email protected]>--- formats/lttng-live/lttng-live-comm.c | 2 +- include/babeltrace/compat/mman.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 include/babeltrace/compat/mman.hformats/lttng-live/lttng-live-comm.c +1
-1@@ -31,7 +31,6 @@#include <errno.h> #include <inttypes.h> #include <fcntl.h> -#include <sys/mman.h> #include <poll.h> #include <babeltrace/ctf/ctf-index.h> @@ -53,6 +52,7 @@#include <babeltrace/compat/memstream.h> #include <babeltrace/compat/send.h> #include <babeltrace/compat/string.h> +#include <babeltrace/compat/mman.h> #include "lttng-live.h" #include "lttng-viewer-abi.h" include/babeltrace/compat/mman.h new file +36
-1@@ -0,0 +1,36 @@ +#ifndef _BABELTRACE_COMPAT_MMAN_H +#define _BABELTRACE_COMPAT_MMAN_H + +/* +* babeltrace/compat/mman.h +* +* Copyright (C) 2015 Michael Jeanson <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ + +#include <sys/mman.h> + +#ifndef MAP_ANONYMOUS +# ifdef MAP_ANON +# define MAP_ANONYMOUS MAP_ANON +# endif +#endif + +#endif /* _BABELTRACE_COMPAT_MMAN_H */ --1.9.1
Signature · 8 lines
Jérémie Galarneau EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jérémie Galarneau
AppliedMerged, thanks!
Jérémie
Quoted 72 lines · Michael Jeanson
OSX has the libuuid symbols built in the system libraries.
Signed-off-by Michael Jeanson <[email protected]>--- configure.ac | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-)configure.ac +28
-21@@ -148,29 +148,37 @@ AM_CONDITIONAL([BABELTRACE_BUILD_WITH_MINGW], [test "x$MINGW32" = "xyes"]) # Check what libraries are required on this platform to link sockets programs. AX_LIB_SOCKET_NSL -# Check for libuuid -AC_CHECK_LIB([uuid], [uuid_generate], +# Check for uuid in system libs +AC_CHECK_FUNCS([uuid_generate], [ - AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.]) - have_libuuid=yes + AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.]) + link_with_libuuid=no ], [ - # libuuid not found, check for uuid_create in libc. - AC_CHECK_LIB([c], [uuid_create], - [ - AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBC_UUID], 1, [Has libc uuid support.]) - have_libc_uuid=yes - ], - [ - # for MinGW32 we have our own internal implemenation of uuid using Windows functions. - if test "x$MINGW32" = xno; then - AC_MSG_ERROR([Cannot find libuuid uuid_generate nor libc uuid_create. Use [LDFLAGS]=-Ldir to specify their location.]) - fi - ]) -] -) -AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"]) -AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBC_UUID], [test "x$have_libc_uuid" = "xyes"]) + # Check for libuuid + AC_CHECK_LIB([uuid], [uuid_generate], + [ + AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.]) + link_with_libuuid=yes + ], + [ + # libuuid not found, check for uuid_create in libc. + AC_CHECK_LIB([c], [uuid_create], + [ + AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBC_UUID], 1, [Has libc uuid support.]) + link_with_libc_uuid=yes + ], + [ + # for MinGW32 we have our own internal implemenation of uuid using Windows functions. + if test "x$MINGW32" = xno; then + AC_MSG_ERROR([Cannot find libuuid uuid_generate nor libc uuid_create. Use [LDFLAGS]=-Ldir to specify their location.]) + fi + ]) + ]) +]) + +AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBUUID], [test "x$link_with_libuuid" = "xyes"]) +AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBC_UUID], [test "x$link_with_libc_uuid" = "xyes"]) # Check for fmemopen AC_CHECK_LIB([c], [fmemopen], --1.9.1
Signature · 8 lines
Jérémie Galarneau EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev