Commit 18aab924 authored by Michael Lee's avatar Michael Lee Committed by Facebook Github Bot 1

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
parent 09a84b28
...@@ -357,7 +357,7 @@ using namespace FOLLY_GFLAGS_NAMESPACE; ...@@ -357,7 +357,7 @@ using namespace FOLLY_GFLAGS_NAMESPACE;
namespace folly { namespace folly {
#ifdef __linux__ #if defined(__linux__) && !FOLLY_MOBILE
constexpr auto kIsLinux = true; constexpr auto kIsLinux = true;
#else #else
constexpr auto kIsLinux = false; constexpr auto kIsLinux = false;
......
...@@ -22,12 +22,14 @@ ...@@ -22,12 +22,14 @@
#include <folly/portability/SysSyscall.h> #include <folly/portability/SysSyscall.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#if !defined(__NR_membarrier) && FOLLY_X64 && !FOLLY_MOBILE && \ #if FOLLY_X64 && !FOLLY_MOBILE && defined(__linux__)
defined(__linux__) #define FOLLY_USE_SYS_MEMBARRIER 1
#if !defined(__NR_membarrier)
#define __NR_membarrier 324 #define __NR_membarrier 324
#define MEMBARRIER_CMD_QUERY 0 #define MEMBARRIER_CMD_QUERY 0
#define MEMBARRIER_CMD_SHARED 1 #define MEMBARRIER_CMD_SHARED 1
#endif #endif
#endif
namespace folly { namespace folly {
namespace detail { namespace detail {
...@@ -37,7 +39,7 @@ bool sysMembarrierAvailable() { ...@@ -37,7 +39,7 @@ bool sysMembarrierAvailable() {
return false; return false;
} }
#ifdef __NR_membarrier #if FOLLY_USE_SYS_MEMBARRIER
auto r = syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, /* flags = */ 0); auto r = syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, /* flags = */ 0);
if (r == -1) { if (r == -1) {
return false; return false;
...@@ -50,7 +52,7 @@ bool sysMembarrierAvailable() { ...@@ -50,7 +52,7 @@ bool sysMembarrierAvailable() {
} }
int sysMembarrier() { int sysMembarrier() {
#ifdef __NR_membarrier #if FOLLY_USE_SYS_MEMBARRIER
return syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, /* flags = */ 0); return syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, /* flags = */ 0);
#else #else
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment