Re: how to get mmap page size?

2009-01-17 Thread Corinna Vinschen
On Jan 16 16:45, Jay Foad wrote: Corinna Vinschen wrote: Right. The reason is that mmap started to map memory top down at one point to fix a problem with Windows Vista. The mechanism to align the map always to 64K is still in Cygwin, but it currently doesn't work for files. I'll have

Re: how to get mmap page size?

2009-01-16 Thread Corinna Vinschen
On Jan 16 12:24, Jay Foad wrote: I have an application that wants to use mmap() to read a file, but only if it can guarantee that this will leave one or more zero bytes after the end of the contents of the file in memory: if ((filesize (pagesize - 1) != 0) use_mmap(); else

RE: how to get mmap page size?

2009-01-16 Thread Phil Betts
Jay Foad wrote on Friday, January 16, 2009 12:24 PM:: I have an application that wants to use mmap() to read a file, but only if it can guarantee that this will leave one or more zero bytes after the end of the contents of the file in memory: if ((filesize (pagesize - 1) != 0)

Re: how to get mmap page size?

2009-01-16 Thread Jay Foad
Corinna Vinschen wrote: mmap always allocates in 64K chunks. That doesn't seem to be true in practice. In the test below I mmap a 1080K file (this is a multiple of 4K but not a multiple of 64K). The first byte after the end of the file isn't readable. $ cat mmaptest.c #include fcntl.h #include

Re: how to get mmap page size?

2009-01-16 Thread Corinna Vinschen
On Jan 16 15:10, Jay Foad wrote: Corinna Vinschen wrote: mmap always allocates in 64K chunks. That doesn't seem to be true in practice. In the test below I mmap a 1080K file (this is a multiple of 4K but not a multiple of 64K). The first byte after the end of the file isn't readable.

Re: how to get mmap page size?

2009-01-16 Thread Jay Foad
Corinna Vinschen wrote: Right. The reason is that mmap started to map memory top down at one point to fix a problem with Windows Vista. The mechanism to align the map always to 64K is still in Cygwin, but it currently doesn't work for files. I'll have a look into fixing that for Cygwin