This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: allow UNIX mmap size to default to current file size
Type: Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: aimacintyre, georg.brandl, loewis, mboedick
Priority: normal Keywords: patch

Created on 2003-06-05 22:02 by mboedick, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mmap.patch mboedick, 2003-06-05 22:02 patch to allow UNIX mmap to be called with 0 to set mmap size to current file size
Messages (4)
msg43902 - (view) Author: Matthew Boedicker (mboedick) Date: 2003-06-05 22:02
This patch makes the UNIX mmap behave like the Windows
mmap in that if you pass 0 as the mmap size, the map
size will default to the current length of the file
being mmapped.

This allows avoids a call to os.stat if you want to map
the entire file.  It also makes code using this feature
of the Windows mmap to be portable to UNIX.
msg43903 - (view) Author: Andrew I MacIntyre (aimacintyre) * (Python triager) Date: 2003-06-23 13:10
Logged In: YES 
user_id=250749

Tested on FreeBSD 4.8 & 5.1 - updated test_mmap passes.

I don't have any mmap reliant code to check more thoroughly.
msg43904 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-02-23 18:31
Logged In: YES 
user_id=1188172

see new patch #1144555 which applies cleanly on today's CVS
HEAD.
msg43905 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-03-03 11:24
Logged In: YES 
user_id=21627

Thanks for the patches, I have applied #1144555 as

libmmap.tex 1.11
test_mmap.py 1.31
test_mmap 1.10
NEWS 1.1257
mmapmodule.c 2.49

I'm not backporting it to 2.4 as this is a new feature.
History
Date User Action Args
2022-04-10 16:09:03adminsetgithub: 38597
2003-06-05 22:02:52mboedickcreate