From: Mathieu Desnoyers Date: Wed, 17 Aug 2011 21:54:07 +0000 (-0400) Subject: Fix missing check for SYS_membarrier in map header X-Git-Tag: v0.6.5~49 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4a0b347ad068737b5ab0565cd4506f2f3b21e1f2;p=urcu.git Fix missing check for SYS_membarrier in map header Signed-off-by: Mathieu Desnoyers --- 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