From a478cb08860ed09152b40189f8fc17c7af9f9387 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Sun, 11 Feb 2018 15:20:35 +0000 Subject: [PATCH 1/5] Add restriction on the offset parameter for mmap.flush --- Doc/library/mmap.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 184119df591883..305febad47d88f 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -189,7 +189,8 @@ To map anonymous memory, -1 should be passed as the fileno along with the length use of this call there is no guarantee that changes are written back before the object is destroyed. If *offset* and *size* are specified, only changes to the given range of bytes will be flushed to disk; otherwise, the - whole extent of the mapping is flushed. + whole extent of the mapping is flushed. *offset* must be a multiple of the + PAGESIZE. **(Windows version)** A nonzero value returned indicates success; zero indicates failure. From 8a65d8ad25349497bdfeb7406bf5c2d4157b328c Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Mon, 12 Feb 2018 21:03:07 +0000 Subject: [PATCH 2/5] Correct style --- Doc/library/mmap.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 305febad47d88f..b8984389f5c099 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -94,8 +94,8 @@ To map anonymous memory, -1 should be passed as the fileno along with the length *offset* may be specified as a non-negative integer offset. mmap references will be relative to the offset from the beginning of the file. *offset* - defaults to 0. *offset* must be a multiple of the PAGESIZE or - ALLOCATIONGRANULARITY. + defaults to 0. *offset* must be a multiple of the :const:`PAGESIZE` or + :const:`ALLOCATIONGRANULARITY`. To ensure validity of the created memory mapping the file specified by the descriptor *fileno* is internally automatically synchronized @@ -189,8 +189,8 @@ To map anonymous memory, -1 should be passed as the fileno along with the length use of this call there is no guarantee that changes are written back before the object is destroyed. If *offset* and *size* are specified, only changes to the given range of bytes will be flushed to disk; otherwise, the - whole extent of the mapping is flushed. *offset* must be a multiple of the - PAGESIZE. + whole extent of the mapping is flushed. *offset* must be a multiple of the + :const:`PAGESIZE` or :const:`ALLOCATIONGRANULARITY`. **(Windows version)** A nonzero value returned indicates success; zero indicates failure. From 2d90d9218bfbd0982fd18605892f2fd9e55d4320 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Wed, 22 Aug 2018 20:19:45 +0100 Subject: [PATCH 3/5] fixup! Correct style --- Doc/library/mmap.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index b8984389f5c099..652e4873fd6a90 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -94,8 +94,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length *offset* may be specified as a non-negative integer offset. mmap references will be relative to the offset from the beginning of the file. *offset* - defaults to 0. *offset* must be a multiple of the :const:`PAGESIZE` or - :const:`ALLOCATIONGRANULARITY`. + defaults to 0. *offset* must be a multiple of :const:`PAGESIZE`. To ensure validity of the created memory mapping the file specified by the descriptor *fileno* is internally automatically synchronized From f334ea42cfbb8f431c06acc453ac5588334d4588 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Fri, 24 Aug 2018 17:20:07 +0100 Subject: [PATCH 4/5] Add formatting for ALLOCATIONGRANULARITY occurrences --- Doc/library/mmap.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 652e4873fd6a90..917c1026269254 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -65,7 +65,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length *offset* may be specified as a non-negative integer offset. mmap references will be relative to the offset from the beginning of the file. *offset* - defaults to 0. *offset* must be a multiple of the ALLOCATIONGRANULARITY. + defaults to 0. *offset* must be a multiple of the :const:`ALLOCATIONGRANULARITY`. .. class:: mmap(fileno, length, flags=MAP_SHARED, prot=PROT_WRITE|PROT_READ, access=ACCESS_DEFAULT[, offset]) From 39488c56c83e32708090a0b91adc527564a366a6 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Fri, 24 Aug 2018 17:20:40 +0100 Subject: [PATCH 5/5] Explain that ALLOCATIONGRANULARITY is the same as PAGESIZE in Unix --- Doc/library/mmap.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 917c1026269254..62cc816543947d 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -94,7 +94,8 @@ To map anonymous memory, -1 should be passed as the fileno along with the length *offset* may be specified as a non-negative integer offset. mmap references will be relative to the offset from the beginning of the file. *offset* - defaults to 0. *offset* must be a multiple of :const:`PAGESIZE`. + defaults to 0. *offset* must be a multiple of :const:`ALLOCATIONGRANULARITY` + which is equal to :const:`PAGESIZE` on Unix systems. To ensure validity of the created memory mapping the file specified by the descriptor *fileno* is internally automatically synchronized