python / cpython

The Python programming language
https://www.python.org/
Other
59.96k stars 29.02k forks source link

Windows mmap docs need cleaning #33687

Closed tim-one closed 23 years ago

tim-one commented 23 years ago
BPO 228251
Nosy @tim-one, @freddrake, @akuchling

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = 'https://github.com/akuchling' closed_at = created_at = labels = ['docs'] title = 'Windows mmap docs need cleaning' updated_at = user = 'https://github.com/tim-one' ``` bugs.python.org fields: ```python activity = actor = 'akuchling' assignee = 'akuchling' closed = True closed_date = None closer = None components = ['Documentation'] creation = creator = 'tim.peters' dependencies = [] files = [] hgrepos = [] issue_num = 228251 keywords = [] message_count = 3.0 messages = ['2882', '2883', '2884'] nosy_count = 3.0 nosy_names = ['tim.peters', 'fdrake', 'akuchling'] pr_nums = [] priority = 'high' resolution = 'fixed' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue228251' versions = [] ```

tim-one commented 23 years ago

WRT the docs for the Windows flavor of mmap.mmap():

1) Doc needed: The file *must* be opened for update (r+, w+, rb+ or wb+). That's because CreateFileMapping is called with PAGE_READWRITE, and that won't let you increase permissions over the original open mode. Violating this yields baffling "The parameter is wrong" Windows errors from mmap.mmap().

2) Doc needed: Passing a size of 0 makes the maximum size of the mapping the actual current size of the file. Don't know whether that's also true on Unices (ask AMK?); on Windows it's intentional; and it's handy to know so it's worth documenting.

3) Doc bug: The docs read as if omitting the optional tagname is different than supplying a tagname of None. I don't believe that's true; needs mild rewording.

Fred and AMK and c.l.py got a longer version of this msg. I think the example of using mmap with re would be worth including too (but it would be nice to have an example that isn't Windows-specific! someone should try that on Linux too, and fiddle as needed).

freddrake commented 23 years ago

I've updated the documentation according to Tim's comments in Doc/lib/libmmap.tex revision 1.4.

Andrew: do you know anything about passing a length of zero on Unix? I wasn't able to find anything in the mmap() man page, and don't have ready access to any other reference material at this time.

akuchling commented 23 years ago

As far as I can tell, length==0 is an error on Unix. It certainly doesn't seem to mean anything special on Unix.