summaryrefslogtreecommitdiff
path: root/Doc/library/mmap.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/mmap.rst')
-rw-r--r--Doc/library/mmap.rst49
1 files changed, 49 insertions, 0 deletions
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst
index a82caf86e8..c7a13abad8 100644
--- a/Doc/library/mmap.rst
+++ b/Doc/library/mmap.rst
@@ -203,6 +203,20 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
exception was raised on error under Unix.
+ .. method:: madvise(option[, start[, length]])
+
+ Send advice *option* to the kernel about the memory region beginning at
+ *start* and extending *length* bytes. *option* must be one of the
+ :ref:`MADV_* constants <madvise-constants>` available on the system. If
+ *start* and *length* are omitted, the entire mapping is spanned. On
+ some systems (including Linux), *start* must be a multiple of the
+ :const:`PAGESIZE`.
+
+ Availability: Systems with the ``madvise()`` system call.
+
+ .. versionadded:: 3.8
+
+
.. method:: move(dest, src, count)
Copy the *count* bytes starting at offset *src* to the destination index
@@ -292,3 +306,38 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
position of the file pointer; the file position is advanced by ``1``. If
the mmap was created with :const:`ACCESS_READ`, then writing to it will
raise a :exc:`TypeError` exception.
+
+.. _madvise-constants:
+
+MADV_* Constants
+++++++++++++++++
+
+.. data:: MADV_NORMAL
+ MADV_RANDOM
+ MADV_SEQUENTIAL
+ MADV_WILLNEED
+ MADV_DONTNEED
+ MADV_REMOVE
+ MADV_DONTFORK
+ MADV_DOFORK
+ MADV_HWPOISON
+ MADV_MERGEABLE
+ MADV_UNMERGEABLE
+ MADV_SOFT_OFFLINE
+ MADV_HUGEPAGE
+ MADV_NOHUGEPAGE
+ MADV_DONTDUMP
+ MADV_DODUMP
+ MADV_FREE
+ MADV_NOSYNC
+ MADV_AUTOSYNC
+ MADV_NOCORE
+ MADV_CORE
+ MADV_PROTECT
+
+ These options can be passed to :meth:`mmap.madvise`. Not every option will
+ be present on every system.
+
+ Availability: Systems with the madvise() system call.
+
+ .. versionadded:: 3.8