bpo-42232: mmap module add Darwin specific madvise options. (GH-23076)

This commit is contained in:
David CARLIER 2020-11-21 11:39:56 +00:00 committed by GitHub
parent 1db76394ea
commit 0e62efc51e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -337,6 +337,8 @@ MADV_* Constants
MADV_NOCORE MADV_NOCORE
MADV_CORE MADV_CORE
MADV_PROTECT MADV_PROTECT
MADV_FREE_REUSABLE
MADV_FREE_REUSE
These options can be passed to :meth:`mmap.madvise`. Not every option will These options can be passed to :meth:`mmap.madvise`. Not every option will
be present on every system. be present on every system.

View File

@ -0,0 +1 @@
Added Darwin specific madvise options to mmap module.

View File

@ -1667,6 +1667,14 @@ mmap_exec(PyObject *module)
#ifdef MADV_PROTECT #ifdef MADV_PROTECT
ADD_INT_MACRO(module, MADV_PROTECT); ADD_INT_MACRO(module, MADV_PROTECT);
#endif #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 #endif // HAVE_MADVISE
return 0; return 0;
} }