This is the mail archive of the
mailing list for the Cygwin project.
Re: Broken autoconf mmap test
On Mar 25 11:26, Andy Koppe wrote:
> On 25 March 2011 10:17, Corinna Vinschen wrote:
> >> If you guys think that cheating for autoconf on 64 bit systems is a good
> >> idea, I'm willing to implement it.
> > Here's a patch which works fine for me:
> > Index: mmap.cc
> > ===================================================================
> > RCS file: /cvs/src/src/winsup/cygwin/mmap.cc,v
> > retrieving revision 1.166
> > diff -u -p -r1.166 mmap.cc
> > --- mmap.cc Â Â 18 Mar 2011 13:56:56 -0000 Â Â Â1.166
> > +++ mmap.cc Â Â 25 Mar 2011 10:17:09 -0000
> > @@ -801,6 +801,38 @@ mmap64 (void *addr, size_t len, int prot
> > Â Â Â /* mmap /dev/zero is like MAP_ANONYMOUS. */
> > Â Â Â if (fh->get_device () == FH_ZERO)
> > Â Â Â Âflags |= MAP_ANONYMOUS;
> > +
> > + Â Â Â/* The autoconf mmap test maps a file of size 1 byte. ÂIt then tests
> > + Â Â Â Âevery byte of the entire mapped page of 64K for 0-bytes since that's
> > + Â Â Â Âwhat POSIX requires. ÂThe problem is, we can't create that mapping on
> > + Â Â Â Â64 bit systems. ÂThe file mapping will be only a single page, 4K, and
> > + Â Â Â Âsince 64 bit systems don't support the AT_ROUND_TO_PAGE flag, the
> > + Â Â Â Âremainder of the 64K slot will result in a SEGV when accessed.
> > +
> > + Â Â Â ÂSo, what we do here is cheating for autoconf. ÂWe know exactly what
> > + Â Â Â Âautoconf is doing. ÂThe file is called conftest.txt, it has a size of
> > + Â Â Â Â1 byte, the requested mapping size is 64K, the requested protection
> > + Â Â Â Âis PROT_READ | PROT_WRITE, the mapping is MAP_SHARED, the offset is 0.
> > +
> > + Â Â Â ÂIf all these requirements are given, we just return an anonymous map
> > + Â Â Â Âof 64K. ÂThis will help to get over the autoconf test even on 64 bit
> > + Â Â Â Âsystems. */
> This should mention why cheating seems justified, i.e. the assumption
> that "real" programs don't depend on being able to access past EOF.
Prior to doll up the comment, the question is still if we really should
cheat or not.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com