summaryrefslogtreecommitdiff
path: root/mfbt
diff options
context:
space:
mode:
authorathenian200 <athenian200@outlook.com>2019-10-01 21:36:29 -0500
committerathenian200 <athenian200@outlook.com>2019-10-21 04:53:40 -0500
commitecab07c86cdbff575ae061aee2119af4d36e1a6d (patch)
tree40fa50571360bd3630ddb2f3e153c4a7ef468cd7 /mfbt
parentb7bffe3130b76e4d319c0a923903f482953bef87 (diff)
downloadaura-central-ecab07c86cdbff575ae061aee2119af4d36e1a6d.tar.gz
MoonchildProductions%1251 - Part 7: All the posix_m* memory-related stuff, gathered together.
https://bugzilla.mozilla.org/show_bug.cgi?id=1158445 https://bugzilla.mozilla.org/show_bug.cgi?id=963983 https://bugzilla.mozilla.org/show_bug.cgi?id=1542758 Solaris madvise and malign don't perfectly map to their POSIX counterparts, and some Linux versions (especially Android) don't define the POSIX counterparts at all, so options are limited. Ideally posix_madvise and posix_malign should be the safer and more portable options for all platforms.
Diffstat (limited to 'mfbt')
-rw-r--r--mfbt/Poison.cpp4
-rw-r--r--mfbt/tests/TestPoisonArea.cpp4
2 files changed, 8 insertions, 0 deletions
diff --git a/mfbt/Poison.cpp b/mfbt/Poison.cpp
index b2767011d..7972dbea3 100644
--- a/mfbt/Poison.cpp
+++ b/mfbt/Poison.cpp
@@ -129,7 +129,11 @@ ReleaseRegion(void* aRegion, uintptr_t 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;
diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp
index 6f1b61ed3..fb39ccf79 100644
--- a/mfbt/tests/TestPoisonArea.cpp
+++ b/mfbt/tests/TestPoisonArea.cpp
@@ -266,7 +266,11 @@ ReleaseRegion(void* aPage)
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