From 3647f42c27761472e4ee204bade964e8ffad4679 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 21:36:29 -0500 Subject: 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. --- mfbt/Poison.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mfbt/Poison.cpp') 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(aRegion), aSize, POSIX_MADV_NORMAL)) { +#else if (madvise(reinterpret_cast(aRegion), aSize, MADV_NORMAL)) { +#endif return true; } else { return false; -- cgit v1.2.3