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.
This commit is contained in:
athenian200 2019-10-01 21:36:29 -05:00 committed by Roy Tam
commit b652dd59ae
6 changed files with 33 additions and 6 deletions

View file

@ -678,7 +678,11 @@ MarkPagesUnused(void* p, size_t size)
return false;
MOZ_ASSERT(OffsetFromAligned(p, pageSize) == 0);
int result = madvise(p, size, MADV_DONTNEED);
#if defined(XP_SOLARIS)
int result = posix_madvise(p, size, POSIX_MADV_DONTNEED);
#else
int result = madvise(p, size, MADV_DONTNEED);
#endif
return result != -1;
}