This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: how to get mmap page size?
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
> use_read();
>
> How do I get the appropriate page size on cygwin?
>
> If I call getpagesize() it returns 64k, the "allocation granularity".
That's what you want. mmap always allocates in 64K chunks.
> Internally cygwin has a getsystempagesize() (introduced here:
> http://cygwin.com/ml/cygwin-cvs/2005-q4/msg00099.html) that returns
> the appropriate page size, 4k, but that doesn't seem to be exposed to
> applications.
And it's not required. The system pagesize is really only used
internally. Applications should rely on getpagesize().
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/