| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS |
| X-Spam-Check-By: | sourceware.org |
| MIME-Version: | 1.0 |
| Date: | Fri, 16 Jan 2009 12:24:16 +0000 |
| Message-ID: | <ee2e06e90901160424j63c9a2b0u8d6e76bd8bb352c1@mail.gmail.com> |
| Subject: | how to get mmap page size? |
| From: | Jay Foad <jay DOT foad AT gmail DOT com> |
| To: | cygwin AT cygwin DOT com |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
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".
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.
I know that this has been discussed before, e.g. here:
http://www.cygwin.com/ml/cygwin/2002-01/msg00747.html
but I haven't found an answer to this particular question.
Thanks,
Jay.
--
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |