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.

Author neologix
Recipients neologix, rosslagerwall, superbobry, vstinner
Date 2011-07-21.19:05:08
SpamBayes Score 2.3617504e-06
Marked as misclassified No
Message-id <CAH_1eM2MCMUZpGSqmF2p3_H7RwHp6zRfoZMAeCoizyRL_QOo1g@mail.gmail.com>
In-reply-to <1311246172.63.0.917851479965.issue12556@psf.upfronthosting.co.za>
Content
> By the way, I've checked mmap(2) manpage -- it looks like the C-version has
> nothing
> against mmaping 0-sized files, Why does Python's `mmap` still checks file
> size?

It doesn't check explicitely that the size is non-0, but rather that
the offset is is less than the file size.
Passing mmap(2) a 0 length doesn't make much sense anyway - for
example, Linux returns EINVAL:
http://lxr.free-electrons.com/source/mm/mmap.c?a=avr32#L979
"""
unsigned long do_mmap_pgoff(...)
[...]
        if (!len)
                 return -EINVAL;
"""

>> Do you have an example of a /proc entry with st_size == 0 that can be
>> mmapped
>> (mapping /proc/sys/debug/exception-trace fails with EACCESS)?
> Yes, I've ran into the issue, while trying to mmap /proc/xen/xsd_kva, which
> is an
> interface to XenBus [1]. Unfortunately, I'm not aware of any other cases.

That's what I thought, it's really uncommon: in that case, I'm
reluctant to making such a change, for the reason explained above.
Ross, Victor?
History
Date User Action Args
2011-07-21 19:05:09neologixsetrecipients: + neologix, vstinner, rosslagerwall, superbobry
2011-07-21 19:05:08neologixlinkissue12556 messages
2011-07-21 19:05:08neologixcreate