Re: AC_FUNC_MMAP test fails on AIX for MAP_FIXED: who's at fault?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 28, 2024 at 10:20:01PM -0700, Paul Eggert 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.

It's worth noting that while the comment always said that AC_FUNC_MMAP checked
MAP_FIXED on a previously mapped address, the test was broken for 14
years after some cygwin support changes in 2009 [6].  This was fixed in
December 2023 [7].  Unfortunately, this does mean there has been a behavior
a change for AIX (at least unless "application has requested SPEC1170
complaint behavior" per the manpages).

> 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].

I wonder if AIX builds are producing SPEC1170-requesting programs
most of the time, but not when building the autoconf code fragments?
Otherwise I'd expect things to be failing more.

-- Brooks

> 
> [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
> 

[6]: https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=19629fa9fcb209d60012a75ba087a295d4b3c734
[7]: https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=5d3f81d4b33218e00ac90bfa92d08eff06de9200





[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux