[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 12:02:39 PST 2022


daltenty updated this revision to Diff 397365.
daltenty added a comment.

Fix indent


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116603/new/

https://reviews.llvm.org/D116603

Files:
  llvm/lib/Support/CMakeLists.txt
  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,14 @@
 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 madvise, treat this as a no-op.
+    return;
+#elif defined(_AIX)
+    ::madvise((caddr_t)Mapping, Size, POSIX_MADV_DONTNEED);
+#else
     ::madvise(Mapping, Size, MADV_DONTNEED);
+#endif
 }

 int mapped_file_region::alignment() {
Index: llvm/lib/Support/CMakeLists.txt
===================================================================
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -1,5 +1,12 @@
 include(GetLibraryName)

+# Path requires definitions in headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  remove_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_ALL_SOURCE")
+endif()
+
+
 # Ensure that libSupport does not carry any static global initializer.
 # libSupport can be embedded in use cases where we don't want to load all
 # cl::opt unless we want to parse the command line.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116603.397365.patch
Type: text/x-patch
Size: 1257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220104/2fe331fa/attachment.bin>


More information about the llvm-commits mailing list