@@ -14,7 +14,8 @@ where :class:`bytearray` are expected; for example, you can use the :mod:`re`
1414module to search through a memory-mapped file. You can also change a single
1515byte by doing ``obj[index] = 97 ``, or change a subsequence by assigning to a
1616slice: ``obj[i1:i2] = b'...' ``. You can also read and write data starting at
17- the current file position, and :meth: `seek ` through the file to different positions.
17+ the current file position, and :meth: `~mmap.mmap.seek ` through the file to
18+ different positions.
1819
1920A memory-mapped file is created by the :class: `~mmap.mmap ` constructor, which is
2021different on Unix and on Windows. In either case you must provide a file
@@ -103,7 +104,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
103104 *prot *, if specified, gives the desired memory protection; the two most
104105 useful values are :const: `PROT_READ ` and :const: `PROT_WRITE `, to specify
105106 that the pages may be read or written. *prot * defaults to
106- :const: `PROT_READ \| PROT_WRITE `.
107+ :const: `PROT_READ ` \| :const: ` PROT_WRITE `.
107108
108109 *access * may be specified in lieu of *flags * and *prot * as an optional
109110 keyword parameter. It is an error to specify both *flags *, *prot * and
@@ -386,9 +387,55 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
386387 the mmap was created with :const: `ACCESS_READ `, then writing to it will
387388 raise a :exc: `TypeError ` exception.
388389
390+ .. _access-constants :
391+
392+ ACCESS_* constants
393+ ++++++++++++++++++
394+
395+ .. data :: ACCESS_DEFAULT
396+ ACCESS_READ
397+ ACCESS_WRITE
398+ ACCESS_COPY
399+
400+ These constants specify the access mode for a memory mapping.
401+ :const: `ACCESS_READ ` provides read-only access, :const: `ACCESS_WRITE `
402+ provides write-through access, and :const: `ACCESS_COPY ` provides
403+ copy-on-write access. :const: `ACCESS_DEFAULT ` defers to the *prot *
404+ argument of :class: `mmap `.
405+
406+ .. _page-size-constants :
407+
408+ Page size constants
409+ +++++++++++++++++++
410+
411+ .. data :: PAGESIZE
412+ ALLOCATIONGRANULARITY
413+
414+ :const: `PAGESIZE ` is the system memory page size in bytes.
415+ :const: `ALLOCATIONGRANULARITY ` is the minimum alignment in bytes required
416+ for the *offset * argument of :class: `mmap `. On Unix,
417+ :const: `ALLOCATIONGRANULARITY ` is equal to :const: `PAGESIZE `.
418+
419+ .. _prot-constants :
420+
421+ PROT_* constants
422+ ++++++++++++++++
423+
424+ .. data :: PROT_READ
425+ PROT_WRITE
426+ PROT_EXEC
427+
428+ Memory protection flags accepted by the *prot * argument of :class: `mmap `.
429+ :const: `PROT_READ ` allows pages to be read, :const: `PROT_WRITE ` allows pages
430+ to be written, and :const: `PROT_EXEC ` allows pages to be executed. Values
431+ can be combined using the bitwise OR operator. Not every option is present
432+ on every system.
433+
434+ .. availability :: Unix.
435+
389436.. _madvise-constants :
390437
391- MADV_* Constants
438+ MADV_* constants
392439++++++++++++++++
393440
394441.. data :: MADV_NORMAL
@@ -425,7 +472,7 @@ MADV_* Constants
425472
426473.. _map-constants :
427474
428- MAP_* Constants
475+ MAP_* constants
429476+++++++++++++++
430477
431478.. data :: MAP_SHARED
@@ -472,7 +519,7 @@ MAP_* Constants
472519
473520.. _ms-constants :
474521
475- MS_* Constants
522+ MS_* constants
476523++++++++++++++
477524
478525.. data :: MS_SYNC
0 commit comments