Bug 1158445 - posix_madvise() should be used instead of madvise on Solaris. r=froydnj, r=jandem, a=jcristau
authorPetr Sumbera <petr.sumbera@oracle.com>
Fri, 09 Jun 2017 00:59:32 -0700
changeset 414101 3ac23bd293016dc152f0956e1bb64072193ee8e3
parent 414100 1279eb02d4ae04eee9ba9b3376439c4fbf72a556
child 414102 5754e0bd12f5c7df91d32d398a659367f38ef0c9
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, jandem, jcristau
bugs1158445
milestone55.0
Bug 1158445 - posix_madvise() should be used instead of madvise on Solaris. r=froydnj, r=jandem, a=jcristau
mfbt/Poison.cpp
mfbt/tests/TestPoisonArea.cpp
--- a/mfbt/Poison.cpp
+++ b/mfbt/Poison.cpp
@@ -124,17 +124,21 @@ static void
 ReleaseRegion(void* aRegion, uintptr_t aSize)
 {
   munmap(aRegion, aSize);
 }
 
 static bool
 ProbeRegion(uintptr_t aRegion, uintptr_t aSize)
 {
+#ifdef XP_SOLARIS
+  if (posix_madvise(reinterpret_cast<void*>(aRegion), aSize, POSIX_MADV_NORMAL)) {
+#else
   if (madvise(reinterpret_cast<void*>(aRegion), aSize, MADV_NORMAL)) {
+#endif
     return true;
   } else {
     return false;
   }
 }
 
 static uintptr_t
 GetDesiredRegionSize()
--- a/mfbt/tests/TestPoisonArea.cpp
+++ b/mfbt/tests/TestPoisonArea.cpp
@@ -264,17 +264,21 @@ static void
 ReleaseRegion(void* aPage)
 {
   munmap(aPage, PageSize());
 }
 
 static bool
 ProbeRegion(uintptr_t aPage)
 {
+#ifdef XP_SOLARIS
+  return !!posix_madvise(reinterpret_cast<void*>(aPage), PageSize(), POSIX_MADV_NORMAL);
+#else
   return !!madvise(reinterpret_cast<void*>(aPage), PageSize(), MADV_NORMAL);
+#endif
 }
 
 static int
 MakeRegionExecutable(void* aPage)
 {
   return mprotect((caddr_t)aPage, PageSize(), PROT_READ|PROT_WRITE|PROT_EXEC);
 }