From 4a0b347ad068737b5ab0565cd4506f2f3b21e1f2 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 17 Aug 2011 17:54:07 -0400 Subject: [PATCH] Fix missing check for SYS_membarrier in map header Signed-off-by: Mathieu Desnoyers --- urcu/map/urcu.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/urcu/map/urcu.h b/urcu/map/urcu.h index ea12f34..90c2f65 100644 --- a/urcu/map/urcu.h +++ b/urcu/map/urcu.h @@ -38,6 +38,31 @@ #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 + +/* 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 -- 2.34.1