]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42232: mmap module add Darwin specific madvise options. (GH-23076)
authorDavid CARLIER <devnexen@gmail.com>
Sat, 21 Nov 2020 11:39:56 +0000 (11:39 +0000)
committerGitHub <noreply@github.com>
Sat, 21 Nov 2020 11:39:56 +0000 (03:39 -0800)
Doc/library/mmap.rst
Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst [new file with mode: 0644]
Modules/mmapmodule.c

index 698c17653786b3c7ef2a6d4b1218df3e0ff7b335..d9825b47c71333da1bfe28bce767224fef9e629a 100644 (file)
@@ -337,6 +337,8 @@ MADV_* Constants
           MADV_NOCORE
           MADV_CORE
           MADV_PROTECT
+          MADV_FREE_REUSABLE
+          MADV_FREE_REUSE
 
    These options can be passed to :meth:`mmap.madvise`.  Not every option will
    be present on every system.
diff --git a/Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst b/Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst
new file mode 100644 (file)
index 0000000..d431a9d
--- /dev/null
@@ -0,0 +1 @@
+Added Darwin specific madvise options to mmap module.
\ No newline at end of file
index 1e9684970f5d38edc20924150bce133531969f9a..1e66962d37b0e0ca38e5159b1ebfe75cb01de1c4 100644 (file)
@@ -1667,6 +1667,14 @@ mmap_exec(PyObject *module)
 #ifdef MADV_PROTECT
     ADD_INT_MACRO(module, MADV_PROTECT);
 #endif
+
+    // Darwin-specific
+#ifdef MADV_FREE_REUSABLE // (As MADV_FREE but reclaims more faithful for task_info/Activity Monitor...)
+    ADD_INT_MACRO(module, MADV_FREE_REUSABLE);
+#endif
+#ifdef MADV_FREE_REUSE // (Reuse pages previously tagged as reusable)
+    ADD_INT_MACRO(module, MADV_FREE_REUSE);
+#endif
 #endif // HAVE_MADVISE
     return 0;
 }