Fix missing check for SYS_membarrier in map header
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Aug 2011 21:54:07 +0000 (17:54 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Aug 2011 21:54:07 +0000 (17:54 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/map/urcu.h

index ea12f346306221e08812e9ad5fd1f2346be619d5..90c2f65a79a04096b244bf95692fdeb0213be417 100644 (file)
 #define RCU_MEMBARRIER
 #endif
 
+/*
+ * RCU_MEMBARRIER is only possibly available on Linux. Fallback to
+ * RCU_MB
+ * otherwise.
+ */
+#if !defined(__linux__) && defined(RCU_MEMBARRIER)
+#undef RCU_MEMBARRIER
+#define RCU_MB
+#endif
+
+#ifdef RCU_MEMBARRIER
+#include <syscall.h>
+
+/* If the headers do not support SYS_membarrier, statically use RCU_MB */
+#ifdef SYS_membarrier
+# define MEMBARRIER_EXPEDITED          (1 << 0)
+# define MEMBARRIER_DELAYED            (1 << 1)
+# define MEMBARRIER_QUERY              (1 << 16)
+# define membarrier(...)               syscall(SYS_membarrier, __VA_ARGS__)
+#else
+# undef RCU_MEMBARRIER
+# define RCU_MB
+#endif
+#endif
+
 #ifdef RCU_MEMBARRIER
 
 #define rcu_read_lock                  rcu_read_lock_memb
This page took 0.026174 seconds and 4 git commands to generate.