munmap slowness; IsBadReadPtr considered harmful

Brian Ford ford@vss.fsi.com
Wed Feb 25 00:04:00 GMT 2004


On Tue, 24 Feb 2004, Brian Ford wrote:

> On Tue, 24 Feb 2004, Brian Ford wrote:
>
> >   for (end = (char *)addr + len, addr = (void *)((DWORD)addr % getpagesize());
> >
> Doh!  Scratch that.  Obvious bug.
>
> Something more like:
>        addr = (void *)((DWORD)addr & getpagesize () - 1);
>
> I'll repost the final version when I actually have this tested well.
> Sorry!
>
It's too late in the day and my brain is turned off.  I'm an idiot, I
know.

Make that:

addr = (void *)((DWORD)addr & ~(getpagesize () - 1));

Thanks.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444



More information about the Cygwin-developers mailing list