delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/09/09:05:50

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 9 Nov 2009 15:05:29 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Broken autoconf mmap test (was Re: 1.7] BUG - GREP slows to a crawl with large number of matches on a single file)
Message-ID: <20091109140529.GJ26344@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20091108141548 DOT GB26344 AT calimero DOT vinschen DOT de> <4AF716DB DOT 8060904 AT cwilson DOT fastmail DOT fm> <20091109115903 DOT GE26344 AT calimero DOT vinschen DOT de> <4AF80FFB DOT 4040701 AT byu DOT net>
MIME-Version: 1.0
In-Reply-To: <4AF80FFB.4040701@byu.net>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Nov  9 05:50, Eric Blake wrote:
> According to Corinna Vinschen on 11/9/2009 4:59 AM:
> > MAP_FIXED
> >   [...]
> >   If the specified address cannot be used, mmap() will fail.  Because
> >   requiring a fixed address for a mapping is less portable, the use of
> >   this option is discouraged.
> 
> It's an upstream issue now ;)
> 
> The problem is that I need some more advice from the cygwin list on how
> best to fix the test to pass on cygwin by default.  I'm hoping to release
> autoconf 2.65 this week, so a speedy fix to help this issue go away before
> the release would be extra nice.

This part of the testcase

  data2 = (char *) malloc (2 * pagesize);
  if (!data2)
    return 1;
  data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
                       MAP_PRIVATE | MAP_FIXED, fd, 0L))
    return 1;

is bad.  The chance that the address of data2 is not usable for mmap on
Windows/Cygwin is 100%.  The problem here is that the generic HAVE_MMAP
test tests one certain feature, which is not usable on Windows, and which
is non-portable.  So, on Cygwin this test always fails and all applications
using this test in good faith will never use mmap on Cygwin, just because
the single case of "mmap private fixed at somewhere already mapped" doesn't
work.  In fact, most applications don't need this case.
And grep wouldn't need it either, since the method used in grep would
also work if the area hadn't been malloced before, if it would just use
the address returned by mmap as buffer.

That's why I think we need at least two tests in autoconf, a generic
mmap test and a mmap test for the "mmap private/shared fixed at
somewhere already mapped" case, if an application actually insists on
using that.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019