Index: base/shared_memory_posix.cc |
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc |
index 7862f42c194fe2701293673efb6417bf2d7140a6..6209b4ee2b960cb626ef9b1f051508111e8ab8b0 100644 |
--- a/base/shared_memory_posix.cc |
+++ b/base/shared_memory_posix.cc |
@@ -16,6 +16,7 @@ |
#include "base/threading/platform_thread.h" |
#include "base/safe_strerror_posix.h" |
#include "base/synchronization/lock.h" |
+#include "base/sys_info.h" |
#include "base/threading/thread_restrictions.h" |
#include "base/utf_string_conversions.h" |
@@ -219,7 +220,7 @@ bool SharedMemory::Open(const std::string& name, bool read_only) { |
#endif // !defined(OS_ANDROID) |
-bool SharedMemory::Map(size_t bytes) { |
+bool SharedMemory::MapFrom(off_t offset, size_t bytes) { |
if (mapped_file_ == -1) |
return false; |
@@ -242,8 +243,10 @@ bool SharedMemory::Map(size_t bytes) { |
} |
#endif |
+ DCHECK_EQ(static_cast<size_t>(0), |
+ offset & (SysInfo::VMAllocationGranularity() - 1)); |
Mark Mentovai
2013/01/15 21:51:42
Is this really any of our business?
Vitaly Buka (NO REVIEWS)
2013/01/15 22:13:05
memory_ will be NULL, if value is not aligned. Jus
|
memory_ = mmap(NULL, bytes, PROT_READ | (read_only_ ? 0 : PROT_WRITE), |
- MAP_SHARED, mapped_file_, 0); |
+ MAP_SHARED, mapped_file_, offset); |
bool mmap_succeeded = memory_ != (void*)-1 && memory_ != NULL; |
if (mmap_succeeded) { |