From: Michael Lee Date: Wed, 10 Aug 2016 23:45:18 +0000 (-0700) Subject: Gate SysMembarrier to not FOLLY_MOBILE platforms X-Git-Tag: v2016.08.15.00~18 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=18aab9241fad1238171b1d849f7765ec6100c593;p=folly.git Gate SysMembarrier to not FOLLY_MOBILE platforms Summary: Gate `kIsLinux` to not include `FOLLY_MOBILE` because "mobile" linux does not really behave like real linux. Differential Revision: D3697717 fbshipit-source-id: 1b0f4208d2f71c35399c30f20a71bfa4ba4724e8 --- diff --git a/folly/Portability.h b/folly/Portability.h index 5776a007..56dc7c95 100644 --- a/folly/Portability.h +++ b/folly/Portability.h @@ -357,7 +357,7 @@ using namespace FOLLY_GFLAGS_NAMESPACE; namespace folly { -#ifdef __linux__ +#if defined(__linux__) && !FOLLY_MOBILE constexpr auto kIsLinux = true; #else constexpr auto kIsLinux = false; diff --git a/folly/portability/SysMembarrier.cpp b/folly/portability/SysMembarrier.cpp index cc4b43ac..9a3d3073 100644 --- a/folly/portability/SysMembarrier.cpp +++ b/folly/portability/SysMembarrier.cpp @@ -22,12 +22,14 @@ #include #include -#if !defined(__NR_membarrier) && FOLLY_X64 && !FOLLY_MOBILE && \ - defined(__linux__) +#if FOLLY_X64 && !FOLLY_MOBILE && defined(__linux__) +#define FOLLY_USE_SYS_MEMBARRIER 1 +#if !defined(__NR_membarrier) #define __NR_membarrier 324 #define MEMBARRIER_CMD_QUERY 0 #define MEMBARRIER_CMD_SHARED 1 #endif +#endif namespace folly { namespace detail { @@ -37,7 +39,7 @@ bool sysMembarrierAvailable() { return false; } -#ifdef __NR_membarrier +#if FOLLY_USE_SYS_MEMBARRIER auto r = syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, /* flags = */ 0); if (r == -1) { return false; @@ -50,7 +52,7 @@ bool sysMembarrierAvailable() { } int sysMembarrier() { -#ifdef __NR_membarrier +#if FOLLY_USE_SYS_MEMBARRIER return syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, /* flags = */ 0); #else return -1;