Fix folly on OSX and BSD in prep for FastCGI on HHVM
authorJoel Marcey <joelm@fb.com>
Fri, 27 Jun 2014 21:46:19 +0000 (14:46 -0700)
committerNicholas Ormrod <njormrod@fb.com>
Fri, 27 Jun 2014 22:08:05 +0000 (15:08 -0700)
Summary:
A recent change in folly/MemoryMapping.cpp uses MAP_ANONYMOUS, which is
named MAP_ANON on OSX/BSD.

We need folly and third-party changes in order to land a pull request for HHVM
that starts to get FastCGI running on OSX.

See the checklist of the HHVM pull request here: https://github.com/facebook/hhvm/pull/2944#issuecomment-47281003

Closes #67

GitHub Author: Daniel Sloof <goapsychadelic@gmail.com>

@override-unit-failures

Test Plan: fbmake runtests 100%

Reviewed By: pt@fb.com, njormrod@fb.com

FB internal diff: D1407393

folly/MemoryMapping.cpp
folly/Portability.h

index 17f06be3ba62f471196027eaf43eb8120c3c100e..a6ad326a09372de32080e2a27efd6f2093274c16 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "folly/MemoryMapping.h"
 #include "folly/Format.h"
+#include "folly/Portability.h"
 
 #ifdef __linux__
 #include "folly/experimental/io/HugePages.h"
index 68d7d969e9d8e4eb19274e3adb84258a241dff07..989f11d54a1a61b5be727c09ffba73f1d85030c7 100644 (file)
  #endif
 #endif
 
+// A change in folly/MemoryMapping.cpp uses MAP_ANONYMOUS, which is named
+// MAP_ANON on OSX/BSD.
+#if defined(__APPLE__) || defined(__FreeBSD__)
+  #include <sys/mman.h>
+  #ifndef MAP_ANONYMOUS
+    #ifdef MAP_ANON
+      #define MAP_ANONYMOUS MAP_ANON
+    #endif
+  #endif
+#endif
 
 // MaxAlign: max_align_t isn't supported by gcc
 #ifdef __GNUC__