folly: fix sysMembarrier() with newer kernel headers
authorPádraig Brady <pbrady@fb.com>
Fri, 10 Nov 2017 03:55:39 +0000 (19:55 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 10 Nov 2017 04:11:27 +0000 (20:11 -0800)
Summary:
When __NR_membarrier is defined (on newer kernels),
we don't define the constants, but also by default
don't include the membarrier header to define the necessary constants.
Therefore split the definition of the syscall value and
the constants used with it, to ensure both are defined.

Reviewed By: yfeldblum

Differential Revision: D6292178

fbshipit-source-id: 31ba9d4a698a4f5e14ae34de0acf8f851d75527d

folly/portability/SysMembarrier.cpp

index ba1774d..9b3735c 100644 (file)
 #define FOLLY_USE_SYS_MEMBARRIER 1
 #if !defined(__NR_membarrier)
 #define __NR_membarrier 324
 #define FOLLY_USE_SYS_MEMBARRIER 1
 #if !defined(__NR_membarrier)
 #define __NR_membarrier 324
+#endif
+#if FOLLY_HAVE_LINUX_MEMBARRIER_H
+#include <linux/membarrier.h> // @manual
+#else
 #define MEMBARRIER_CMD_QUERY 0
 #define MEMBARRIER_CMD_SHARED 1
 #define MEMBARRIER_CMD_QUERY 0
 #define MEMBARRIER_CMD_SHARED 1
-#elif FOLLY_HAVE_LINUX_MEMBARRIER_H
-#include <linux/membarrier.h> // @manual
 #endif
 #endif
 
 #endif
 #endif