Index: mojo/edk/embedder/platform_shared_buffer.cc |
diff --git a/mojo/edk/embedder/platform_shared_buffer.cc b/mojo/edk/embedder/platform_shared_buffer.cc |
index 467e5e6a8a184204473264bb60690ce42f63b856..fbdc0075950657e86b38b62f774f897037aa5ae2 100644 |
--- a/mojo/edk/embedder/platform_shared_buffer.cc |
+++ b/mojo/edk/embedder/platform_shared_buffer.cc |
@@ -5,6 +5,10 @@ |
#include "mojo/edk/embedder/platform_shared_buffer.h" |
#include <stddef.h> |
+#if defined(OS_NACL) |
+// For getpagesize() on NaCl. |
+#include <unistd.h> |
+#endif |
#include <utility> |
@@ -288,7 +292,13 @@ bool PlatformSharedBufferMapping::Map() { |
// Mojo shared buffers can be mapped at any offset. However, |
// base::SharedMemory must be mapped at a page boundary. So calculate what the |
// nearest whole page offset is, and build a mapping that's offset from that. |
- size_t offset_rounding = offset_ % base::SysInfo::VMAllocationGranularity(); |
+#if defined(OS_NACL) |
+ // base::SysInfo isn't available under NaCl. |
+ size_t page_size = getpagesize(); |
+#else |
+ size_t page_size = base::SysInfo::VMAllocationGranularity(); |
+#endif |
+ size_t offset_rounding = offset_ % page_size; |
size_t real_offset = offset_ - offset_rounding; |
size_t real_length = length_ + offset_rounding; |