apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sidinsd <sid.schip...@ga.com>
Subject Re: Emulation of /dev/zero on Windows
Date Fri, 12 Aug 2011 16:19:28 GMT

I just read the doc for "MapViewOfFile" and I quote it below;

If a file mapping object is backed by the paging file (CreateFileMapping is
called with the hFile parameter set to INVALID_HANDLE_VALUE), the paging
file must be large enough to hold the entire mapping. If it is not,
MapViewOfFile fails. The initial contents of the pages in a file mapping
object backed by the paging file are 0 (zero). 

So, it seems like in order for APR to support MAP_ANON they would have to
use the Windows APIs as specified above, but I don't think they do. Is there
any thought of APR supporting the MAP_ANON feature of mmap?

sidinsd wrote:
> Thank you for the reply, but I am not as technically knowledgeable as you,
> so I really do not know what the words "previously cross-process,
> unallocated swap-backed heap" mean. I was under the impression that the
> MAP_ANON feature of mmap is just like opening an mmap with an fd that
> points to /dev/zero. So, in other words, any memory that you reference
> using the pointer that mmap returns to you will be initialized to zeros.
> Is that true of the pointer returned by apr_mmap_create under Windows?
> From what I could see, APR uses the Windows APIs CreateFileMapping and
> MapViewOfFile to emulate the mmap function and I don't believe those APIs
> support the zeroing of the memory they obtain, but I'm not really sure of
> that, which is why I am asking the question.
> William A. Rowe Jr. wrote:
>> On 8/12/2011 9:23 AM, sidinsd wrote:
>>> Since APR does not support /dev/zero, but it does support Memory Mapping
>>> of
>>> files (see apr_mmap_create, etc.) how does it support the MAP_ANONYMOUS
>>> feature of the mmap function?
>> It returns previously cross-process, unallocated swap-backed heap.

View this message in context: http://old.nabble.com/Emulation-of--dev-zero-on-Windows-tp32250236p32251635.html
Sent from the APR Dev (Apache Portable Runtime) mailing list archive at Nabble.com.

View raw message