mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
bpo-26836: Add os.memfd_create() (#13567)
* bpo-26836: Add os.memfd_create() * Use the glibc wrapper for memfd_create() Co-Authored-By: Christian Heimes <christian@python.org> * Fix deletions caused by autoreconf. * Use MFD_CLOEXEC as the default value for *flags*. * Add memset_s to configure.ac. * Revert memset_s changes. * Apply the requested changes. * Tweak the docs.
This commit is contained in:
parent
0c2f930564
commit
43fdbd2729
10 changed files with 259 additions and 12 deletions
|
@ -2982,6 +2982,44 @@ features:
|
|||
Added support for :class:`bytes` paths.
|
||||
|
||||
|
||||
.. function:: memfd_create(name[, flags=os.MFD_CLOEXEC])
|
||||
|
||||
Create an anonymous file and return a file descriptor that refers to it.
|
||||
*flags* must be one of the ``os.MFD_*`` constants available on the system
|
||||
(or a bitwise ORed combination of them). By default, the new file
|
||||
descriptor is :ref:`non-inheritable <fd_inheritance>`.
|
||||
|
||||
.. availability:: Linux 3.17 or newer with glibc 2.27 or newer.
|
||||
|
||||
.. versionadded:: 3.8
|
||||
|
||||
|
||||
.. data:: MFD_CLOEXEC
|
||||
MFD_ALLOW_SEALING
|
||||
MFD_HUGETLB
|
||||
MFD_HUGE_SHIFT
|
||||
MFD_HUGE_MASK
|
||||
MFD_HUGE_64KB
|
||||
MFD_HUGE_512KB
|
||||
MFD_HUGE_1MB
|
||||
MFD_HUGE_2MB
|
||||
MFD_HUGE_8MB
|
||||
MFD_HUGE_16MB
|
||||
MFD_HUGE_32MB
|
||||
MFD_HUGE_256MB
|
||||
MFD_HUGE_512MB
|
||||
MFD_HUGE_1GB
|
||||
MFD_HUGE_2GB
|
||||
MFD_HUGE_16GB
|
||||
|
||||
These flags can be passed to :func:`memfd_create`.
|
||||
|
||||
.. availability:: Linux 3.17 or newer with glibc 2.27 or newer. The
|
||||
``MFD_HUGE*`` flags are only available since Linux 4.14.
|
||||
|
||||
.. versionadded:: 3.8
|
||||
|
||||
|
||||
Linux extended attributes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue