[PATCH] D116603: [AIX][z/OS][Support] Provide alternate mapped_file_region::dontNeedImpl implementations
David Tenty via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 4 10:35:11 PST 2022
daltenty updated this revision to Diff 397337.
daltenty added a comment.
Add HAVE_SYS_MMAN_H guard
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116603/new/
https://reviews.llvm.org/D116603
Files:
llvm/lib/Support/Unix/Path.inc
Index: llvm/lib/Support/Unix/Path.inc
===================================================================
--- llvm/lib/Support/Unix/Path.inc
+++ llvm/lib/Support/Unix/Path.inc
@@ -873,7 +873,16 @@
void mapped_file_region::dontNeedImpl() {
assert(Mode == mapped_file_region::readonly);
if (Mapping)
+#if defined(__MVS__) || !defined(HAVE_SYS_MMAN_H)
+ // If we don't have either madvise or posix_madvise, treat this as a nop.
+ return;
+#elif defined(_AIX)
+ // Prefer the POSIX implementation on AIX, since the signature for madvise is non-standardised
+ // and only exists with certain feature test macros.
+ ::posix_madvise(Mapping, Size, POSIX_MADV_DONTNEED);
+#else
::madvise(Mapping, Size, MADV_DONTNEED);
+#endif
}
int mapped_file_region::alignment() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116603.397337.patch
Type: text/x-patch
Size: 789 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220104/238679da/attachment.bin>
More information about the llvm-commits
mailing list