Hey Paul,

Thank you very much for your exceptionally informative summary! Always very 
nice hearing these stories straight from the horse’s mouth ;-)

All the best,
Yury

> On 29. Jul 2024, at 07:20, Paul Eggert <egg...@cs.ucla.edu> wrote:
> 
> On 2024-07-28 15:40, Bob Friesenhahn wrote:
> 
>> Whoever wrote it had an expectation that it would be used for this purpose.  
>> It would be good to investigate the history of this macro to see if its 
>> purpose was always the same or if its scope was later narrowed.
> 
> AC_FUNC_MMAP has always checked for MAP_FIXED, ever since it was introduced 
> to Autoconf in 1994[1] by Mike Haertel and Jim Avera. Mike wrote in 2010[2] 
> that he built GNU grep to use mmap for speed, so I think the Autoconf macro 
> was for GNU grep, which did use MAP_FIXED. Although that sort of thing made 
> sense on some platforms in the early 1990s, I noticed even at the time that 
> it actually made things slower in significant cases, and in 2010 Paolo 
> Bonzini noticed something similar and removed mmap usage from GNU grep[3]. 
> I've never been tempted to bring it back.
> 
> Because POSIX+XSI requires support for MAP_FIXED[4], it's reasonable for 
> AC_FUNC_MMAP to check for MAP_FIXED, and AIX mmap should support MAP_FIXED if 
> AIX says it conforms to XSI.
> 
> I suppose that an app that needs mmap but not MAP_FIXED (which is allowed by 
> POSIX sans XSI) could write its own special-purpose Autoconf macro for that. 
> That being said, if you're planning to use mmap on AIX good luck; you may 
> need it[5].
> 
> [1]: 
> https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=8202df5faf642cde4e5b1fa02cd9cc4411a7a477
> [2]: 
> https://lists.freebsd.org/pipermail/freebsd-current/2010-August/019310.html
> [3]: 
> https://git.savannah.gnu.org/cgit/grep.git/commit/?id=f17211efe374200d532a9f27173e15b018e5538e
> [4]: 
> https://pubs.opengroup.org/onlinepubs/9799919799/functions/mmap.html#tag_17_345_03
> [5]: https://news.ycombinator.com/item?id=19805675


  • AC_FUNC_MMAP ... Yury V. Zaytsev
    • Re: AC_F... Yury V. Zaytsev
      • Re: ... Bob Friesenhahn
        • ... Paul Eggert
          • ... Bob Friesenhahn
            • ... Zack Weinberg
              • ... Yury V. Zaytsev
              • ... Bob Friesenhahn
                • ... Howard Chu via Discussion list for the autoconf build system
              • ... Paul Eggert
          • ... Yury V. Zaytsev
          • ... Brooks Davis
            • ... Yury V. Zaytsev
              • ... Zack Weinberg
                • ... Howard Chu via Discussion list for the autoconf build system
                • ... Zack Weinberg
                • ... Russ Allbery
                • ... Howard Chu via Discussion list for the autoconf build system
                • ... Russ Allbery
                • ... Paul Eggert
                • ... Tim Rice

Reply via email to