bug? mmap doesn't like 0-length files
cs at zip.com.au
Tue Nov 23 03:59:29 CET 2010
On 22Nov2010 20:33, Neal Becker <ndbecker2 at gmail.com> wrote:
| mmap.mmap (f.fileno(), 0, prot=mmap.PROT_READ)
| error: [Errno 22] Invalid argument
| According to http://docs.python.org/library/mmap.html, mmap on _windows_
| doesn't accept 0-length file. But this was tested on linux. Is this a bug?
| I don't see anything in linux man-page about the underlying C mmap function
| not accepting 0-length files.
On a local Gentoo Linux box mmap(2) says in the ERRORS section:
EINVAL We don't like addr, length, or offset (e.g., they are too
large, or not aligned on a page boundary).
EINVAL (since Linux 2.6.12) length was 0.
EINVAL flags contained neither MAP_PRIVATE or MAP_SHARED, or contained both
of these values.
Sure looks like a length of 0 is disliked.
Cameron Simpson <cs at zip.com.au> DoD#743
Carpe Daemon - Seize the Background Process
- Paul Tomblin <ab401 at freenet2.carleton.ca>
More information about the Python-list