gh-81652: Add MAP_ALIGNED_SUPER FreeBSD and MAP_CONCEAL OpenBSD constants (gh-102191)

This commit is contained in:
Yeojin Kim 2023-02-24 19:26:51 +09:00 committed by GitHub
parent 9f3ecd1aa3
commit 347f7406df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 3 deletions

View file

@ -370,11 +370,19 @@ MAP_* Constants
MAP_ANONYMOUS MAP_ANONYMOUS
MAP_POPULATE MAP_POPULATE
MAP_STACK MAP_STACK
MAP_ALIGNED_SUPER
MAP_CONCEAL
These are the various flags that can be passed to :meth:`mmap.mmap`. Note that some options might not be present on some systems. These are the various flags that can be passed to :meth:`mmap.mmap`. :data:`MAP_ALIGNED_SUPER`
is only available at FreeBSD and :data:`MAP_CONCEAL` is only available at OpenBSD. Note
that some options might not be present on some systems.
.. versionchanged:: 3.10 .. versionchanged:: 3.10
Added MAP_POPULATE constant. Added :data:`MAP_POPULATE` constant.
.. versionadded:: 3.11 .. versionadded:: 3.11
Added MAP_STACK constant. Added :data:`MAP_STACK` constant.
.. versionadded:: 3.12
Added :data:`MAP_ALIGNED_SUPER` constant.
Added :data:`MAP_CONCEAL` constant.

View file

@ -930,6 +930,7 @@ Derek D. Kim
Gihwan Kim Gihwan Kim
Jan Kim Jan Kim
Taek Joo Kim Taek Joo Kim
Yeojin Kim
Sam Kimbrel Sam Kimbrel
Tomohiko Kinebuchi Tomohiko Kinebuchi
James King James King

View file

@ -0,0 +1,2 @@
Add :data:`mmap.MAP_ALIGNED_SUPER` FreeBSD and :data:`mmap.MAP_CONCEAL`
OpenBSD constants to :mod:`mmap`. Patch by Yeojin Kim.

View file

@ -1603,6 +1603,12 @@ mmap_exec(PyObject *module)
// Mostly a no-op on Linux and NetBSD, but useful on OpenBSD // Mostly a no-op on Linux and NetBSD, but useful on OpenBSD
// for stack usage (even on x86 arch) // for stack usage (even on x86 arch)
ADD_INT_MACRO(module, MAP_STACK); ADD_INT_MACRO(module, MAP_STACK);
#endif
#ifdef MAP_ALIGNED_SUPER
ADD_INT_MACRO(module, MAP_ALIGNED_SUPER);
#endif
#ifdef MAP_CONCEAL
ADD_INT_MACRO(module, MAP_CONCEAL);
#endif #endif
if (PyModule_AddIntConstant(module, "PAGESIZE", (long)my_getpagesize()) < 0 ) { if (PyModule_AddIntConstant(module, "PAGESIZE", (long)my_getpagesize()) < 0 ) {
return -1; return -1;