[lttng-dev] [PATCH lttng-tools 09/24] Add : Compatibility layer for syscall.h
Charles Briere
c.briere at samsung.com
Mon Oct 27 16:49:29 EDT 2014
From: Charles Briere <c.briere at samsung.com>
Signed-off-by: Charles Briere <c.briere at samsung.com>
---
configure.ac | 6 ++++--
src/common/compat/syscall.h | 36 ++++++++++++++++++++++++++++++++++++
src/common/compat/tid.h | 1 +
src/common/futex.c | 2 +-
4 files changed, 42 insertions(+), 3 deletions(-)
create mode 100644 src/common/compat/syscall.h
diff --git a/configure.ac b/configure.ac
index 3460f98..1189d8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,8 +57,10 @@ AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
AC_CHECK_HEADERS([ \
sys/types.h unistd.h fcntl.h string.h pthread.h limits.h \
signal.h stdlib.h sys/un.h sys/socket.h stdlib.h stdio.h \
- getopt.h sys/ipc.h sys/shm.h popt.h grp.h \
-])
+ getopt.h sys/ipc.h sys/shm.h popt.h grp.h syscall.h \
+ ],[],
+ [AC_CHECK_HEADERS([sys/syscall.h])]
+)
# Babeltrace viewer check
AC_ARG_WITH([babeltrace-bin],
diff --git a/src/common/compat/syscall.h b/src/common/compat/syscall.h
new file mode 100644
index 0000000..62dabf6
--- /dev/null
+++ b/src/common/compat/syscall.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014 (c) - Charles Briere <c.briere at samsung.com>
+ *
+ * syscall compatibility layer.
+ *
+ * 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.
+ */
+
+#ifndef LTTNG_SYSCALL_H
+#define LTTNG_SYSCALL_H
+
+#include <config.h>
+
+# if defined(HAVE_SYSCALL_H)
+# include <syscall.h>
+# elif defined(HAVE_SYS_SYSCALL_H)
+# include <sys/syscall.h>
+# endif
+
+#endif
diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h
index 7645b90..5142ae8 100644
--- a/src/common/compat/tid.h
+++ b/src/common/compat/tid.h
@@ -26,6 +26,7 @@
#define LTTNG_TID_H
#include <config.h>
+#include <common/compat/syscall.h>
#if !HAVE_DECL_GETTID
# if defined(_syscall0)
diff --git a/src/common/futex.c b/src/common/futex.c
index 0b27a5b..b373ed5 100644
--- a/src/common/futex.c
+++ b/src/common/futex.c
@@ -18,7 +18,7 @@
#define _GNU_SOURCE
#include <limits.h>
-#include <sys/syscall.h>
+#include <common/compat/syscall.h>
#include <unistd.h>
#include <urcu.h>
#include <urcu/futex.h>
--
2.1.2
More information about the lttng-dev
mailing list