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

2024-08-01 Thread Russ Allbery
Howard Chu via Discussion list for the autoconf build system writes: > Russ Allbery wrote: >> Many years ago when I did work on this for INN to make heavier use of >> mmap for its new (at the time) overview system, calling msync() after >> changes to a MAP_SHARED mapping would cause the writes to

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

2024-08-01 Thread Howard Chu via Discussion list for the autoconf build system
Russ Allbery wrote: > "Zack Weinberg" writes: > >> For Autoconf's purposes, what we really need to know is: on OpenBSD, >> what does an application need to do after it modifies a MAP_SHARED >> mapping using memory writes to make those writes visible to read()? I don't believe there is a valid an

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

2024-08-01 Thread Russ Allbery
"Zack Weinberg" writes: > For Autoconf's purposes, what we really need to know is: on OpenBSD, > what does an application need to do after it modifies a MAP_SHARED > mapping using memory writes to make those writes visible to read()? Many years ago when I did work on this for INN to make heavier

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

2024-08-01 Thread Zack Weinberg
On Wed, Jul 31, 2024, at 5:39 PM, Howard Chu wrote: > Zack Weinberg wrote: >> Finally, I got two failures I wasn't expecting to see at all: >> >> test: writes visible via shared map... FAIL: data mismatch >> test: shared map alterations visible via read... FAIL: data mismatch >> amd64-unknown-ope

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

2024-07-31 Thread Yury V. Zaytsev
Hi Zack, > On 31. Jul 2024, at 20:05, Zack Weinberg wrote: > > Thanks for digging into this, Yury. I have access to AIX machines via > the GCC compile farm but I would not have been able to find this. I’m also using the compile farm thanks to the great peoples of GCC who maintain and provide

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

2024-07-31 Thread Yury V. Zaytsev
Hi Perry, > On 1. Aug 2024, at 00:39, Perry Hutchison wrote: > > One could, at build time, include code to do something like (untested): > > if (strcmp(getenv("XPG_SUS_ENV", "ON")) != 0) > { >setenv("XPG_SUS_ENV", "ON", 1); > } > > (and yes, if AIX has already tested XPG_SUS_ENV before

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

2024-07-31 Thread Tim Rice
[trimming CC] On Wed, 31 Jul 2024, Zack Weinberg wrote: [snip] > note: using 4096 bytes as page size. > note: define MMAP_PROBE_PAGESIZE if this is incorrect. > test: zero-fill after EOF (shared mapping)... ok > test: zero-fill after EOF (private mapping)... ok > test: writes visible via shared ma

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

2024-07-31 Thread Paul Eggert
On 2024-07-31 11:05, Zack Weinberg wrote: I'd like to ask everyone who reads this message to run the test program on operating systems not listed above, and on older versions of operating systems that*are* listed above. I just now tried running it on CheriBSD Morello (cfarm240.cfarm.net) and M

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

2024-07-31 Thread pluto--- via Discussion list for the autoconf build system
"Yury V. Zaytsev" wrote: > ... > bash-5.1$ gcc mmap-full.c > bash-5.1$ export XPG_SUS_ENV=ON > bash-5.1$ ./a.out > bash-5.1$ echo $? > 0 > bash-5.1$ unset XPG_SUS_ENV > bash-5.1$ ./a.out > bash-5.1$ echo $? > 10 > > ... all controlled by a variable at runtime > ... nothing one can do at

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

2024-07-31 Thread Howard Chu via Discussion list for the autoconf build system
Zack Weinberg wrote: > On Wed, Jul 31, 2024, at 7:56 AM, Yury V. Zaytsev wrote: >> So it appears to be not as trivial as “mmap on AIX has been broken for >> ages”, but rather it seems that up to some version of AIX (4-5?), it >> used to require unmapping the address first. After that IBM still kept

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

2024-07-31 Thread Zack Weinberg
On Wed, Jul 31, 2024, at 7:56 AM, Yury V. Zaytsev wrote: > So it appears to be not as trivial as “mmap on AIX has been broken for > ages”, but rather it seems that up to some version of AIX (4-5?), it > used to require unmapping the address first. After that IBM still kept > it as the default behav

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

2024-07-31 Thread Yury V. Zaytsev
Hi Brooks, > On 29. Jul 2024, at 23:42, Brooks Davis wrote: > > 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. Thanks for the nudge in the right direction!

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

2024-07-29 Thread Brooks Davis
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

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

2024-07-29 Thread Howard Chu via Discussion list for the autoconf build system
Bob Friesenhahn wrote: >> Can any of you think of other subsets of mmap functionality that are >> worth supplying a test for in autoconf?  Do any of you have time to >> work on patches for any or all of this? > > GraphicsMagick has a GM_FUNC_MMAP_FILEIO macro which does this: > >    This test is

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

2024-07-29 Thread Paul Eggert
On 2024-07-29 06:36, Zack Weinberg wrote: However, perhaps we could have a new family of AC_FUNC_MMAP_* macros that check for specific subsets of mmap functionality that are generally useful That could be trouble for cross-compiles, no? For cross-compiles AC_FUNC_MMAP currently guesses that mm

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

2024-07-29 Thread Bob Friesenhahn
Can any of you think of other subsets of mmap functionality that are worth supplying a test for in autoconf? Do any of you have time to work on patches for any or all of this? GraphicsMagick has a GM_FUNC_MMAP_FILEIO macro which does this:    This test is derived from GNU Autoconf's similar ma

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

2024-07-29 Thread Yury V. Zaytsev
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 wrote: > > On 2024-07-28 15:40, Bob Friesenhahn wrote: > >> Whoever wrote it had an

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

2024-07-29 Thread Yury V. Zaytsev
Hi Zack, > On 29. Jul 2024, at 15:36, Zack Weinberg wrote: > > We should probably also document the AIX issues in the "writing portable > C programs" section of the manual if we don't already. Yes, that would be nice. Something along the lines of…? “N.B. AC_FUNC_MMAP is known to fail on IBM AI

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

2024-07-29 Thread Zack Weinberg
On Mon, Jul 29, 2024, at 9:17 AM, Bob Friesenhahn wrote: >> 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 ma

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

2024-07-29 Thread Bob Friesenhahn
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]. The complaints seem to primarily be about archaic sys

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

2024-07-28 Thread Paul Eggert
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

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

2024-07-28 Thread Bob Friesenhahn
You prompted me to google around a bit more for valid use cases of MAP_FIXED and here is an enlightening StackOverflow post: https://stackoverflow.com/questions/28575893/when-would-one-use-mmap-map-fixed So apparently the Autoconf's test doesn’t do anything wrong, but valid use cases for MAP_F

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

2024-07-28 Thread Yury V. Zaytsev
Hi Bob, You prompted me to google around a bit more for valid use cases of MAP_FIXED and here is an enlightening StackOverflow post: https://stackoverflow.com/questions/28575893/when-would-one-use-mmap-map-fixed So apparently the Autoconf's test doesn’t do anything wrong, but valid use cases f

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

2024-07-28 Thread Yury V. Zaytsev
Hi there, I’m trying to wrap my head around AC_FUNC_MMAP failing on AIX (specifically, version 7.3 is what I tried on GCC compile farm). It appears that it has been failing for decades though, so the problem isn’t exactly new... It returns exit code 10, which means that the following comparison