Android: add a compat layer for 'syscall.h'
authorPierre-Luc St-Charles <pierre-luc.st-charles@polymtl.ca>
Wed, 27 Nov 2013 15:48:31 +0000 (07:48 -0800)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 27 Nov 2013 16:33:13 +0000 (11:33 -0500)
Path to include syscall.h is different on Android.

Signed-off-by: Charles Briere <charlesbriere.flatzo@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile.am
tests/common/thread-id.h
urcu.c
urcu/futex.h
urcu/syscall-compat.h [new file with mode: 0644]

index 581c00d186e757c905dd105eb5c2a1491cc0314d..d169ef0653bdfd593af11f4da707ef50026f9b4d 100644 (file)
@@ -20,7 +20,7 @@ nobase_dist_include_HEADERS = urcu/compiler.h urcu/hlist.h urcu/list.h \
                urcu/wfqueue.h urcu/rculfstack.h urcu/rculfqueue.h \
                urcu/ref.h urcu/cds.h urcu/urcu_ref.h urcu/urcu-futex.h \
                urcu/uatomic_arch.h urcu/rculfhash.h urcu/wfcqueue.h \
-               urcu/lfstack.h \
+               urcu/lfstack.h urcu/syscall-compat.h \
                $(top_srcdir)/urcu/map/*.h \
                $(top_srcdir)/urcu/static/*.h \
                urcu/tls-compat.h
index 9378edcf2ce9246f12f0260eaf294ad2de1ceaf2..47a74570efa23c1868ac7a6d426878de05ff3ce2 100644 (file)
@@ -17,9 +17,8 @@
  * provided the above notices are retained, and a notice that the code was
  * modified is included with the above copyright notice.
  */
-
 #ifdef __linux__
-# include <syscall.h>
+# include <urcu/syscall-compat.h>
 
 # if defined(_syscall0)
 _syscall0(pid_t, gettid)
diff --git a/urcu.c b/urcu.c
index 759b94bdb9e9550e178caa04904e6048c7810b2c..69ebcaa9cb0fbfa07a264ab94fa5261513c72424 100644 (file)
--- a/urcu.c
+++ b/urcu.c
@@ -66,7 +66,7 @@
  * RCU_MEMBARRIER is only possibly available on Linux.
  */
 #if defined(RCU_MEMBARRIER) && defined(__linux__)
-#include <syscall.h>
+#include <urcu/syscall-compat.h>
 #endif
 
 /* If the headers do not support SYS_membarrier, fall back on RCU_MB */
index cdaa430003ad6dfca0f5d7537ff4a1d021889a7e..bb270c2933fcaf174a67207858addbc35e09982c 100644 (file)
@@ -45,7 +45,7 @@ extern "C" {
  */
 
 #ifdef CONFIG_RCU_HAVE_FUTEX
-#include <syscall.h>
+#include <urcu/syscall-compat.h>
 #define futex(...)     syscall(__NR_futex, __VA_ARGS__)
 #define futex_noasync(uaddr, op, val, timeout, uaddr2, val3)   \
                futex(uaddr, op, val, timeout, uaddr2, val3)
diff --git a/urcu/syscall-compat.h b/urcu/syscall-compat.h
new file mode 100644 (file)
index 0000000..55576f0
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef _URCU_SYSCALL_COMPAT_H
+#define _URCU_SYSCALL_COMPAT_H
+
+/*
+ * urcu/syscall-compat.h
+ *
+ * Userspace RCU library - Syscall Compatibility Header
+ *
+ * Copyright 2013 - Pierre-Luc St-Charles <pierre-luc.st-charles@polymtl.ca>
+ *
+ * Note: this file is only used to simplify the code required to
+ * include the 'syscall.h' system header across multiple platforms,
+ * which might not always be located at the same place (or needed at all).
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#if defined(__ANDROID__)
+#include <sys/syscall.h>
+#elif defined(__linux__)
+#include <syscall.h>
+#endif
+
+#endif /* _URCU_SYSCALL_COMPAT_H */
This page took 0.04015 seconds and 4 git commands to generate.