A recent change to the configure script added this to config.h: #define HAVE_SYS_MMAN_H 1 #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif MAP_ANONYMOUS is defined in sys/mman.h, which is only included if config.h defines HAVE_SYS_MMAN_H. Since config.h must be before sys/mman.h, MAP_ANONYMOUS will never be defined and the ifndef check is pointless. config.h will always define MAP_ANONYMOUS, which will be re-defined when sys/mman.h is included on systems that have MAP_ANONYMOUS (like Linux). This patch makes configure only generate a define for MAP_ANONYMOUS if it's needed.
Hi, On Tue, Feb 08, 2005 at 05:18:39PM -0800, Trent Piepho wrote:
A recent change to the configure script added this to config.h:
#define HAVE_SYS_MMAN_H 1
#ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif
MAP_ANONYMOUS is defined in sys/mman.h, which is only included if config.h defines HAVE_SYS_MMAN_H. Since config.h must be before sys/mman.h, MAP_ANONYMOUS will never be defined and the ifndef check is pointless. config.h will always define MAP_ANONYMOUS, which will be re-defined when sys/mman.h is included on systems that have MAP_ANONYMOUS (like Linux).
Fixed in a different way some time ago... Greetings, Reimar Döffinger
On Sun, 6 Mar 2005, Reimar Döffinger wrote:
MAP_ANONYMOUS is defined in sys/mman.h, which is only included if config.h defines HAVE_SYS_MMAN_H. Since config.h must be before sys/mman.h, MAP_ANONYMOUS will never be defined and the ifndef check is pointless. config.h will always define MAP_ANONYMOUS, which will be re-defined when sys/mman.h is included on systems that have MAP_ANONYMOUS (like Linux).
Fixed in a different way some time ago...
Two weeks after I sent that patch actually. Isn't adding a bunch of ifdefs into all code that uses mmap a lot more intrusive than a configure test that just puts the code, when necessary, into config.h? Isn't that the point of config.h?
Hi,
Isn't adding a bunch of ifdefs into all code that uses mmap a lot more intrusive than a configure test that just puts the code, when necessary, into config.h? Isn't that the point of config.h?
Well, it makes configure larger (which is already a really big monster) and unfortunately some code uses MAP_ANON and some use MAP_ANONYMOUS, so we would actually need two configure checks at the moment :-( Greetings, Reimar Döffinger
On Mon, Mar 07, 2005 at 11:55:15AM +0100, Reimar Döffinger wrote:
Hi,
Isn't adding a bunch of ifdefs into all code that uses mmap a lot more intrusive than a configure test that just puts the code, when necessary, into config.h? Isn't that the point of config.h?
Well, it makes configure larger (which is already a really big monster) and unfortunately some code uses MAP_ANON and some use MAP_ANONYMOUS, so we would actually need two configure checks at the moment :-(
Please remove both and put (void*)-1 wherever it's needed. This is (always) the value of both constants and it eliminates the dependency on stupid #defines that might be missing. Rich
On Mon, 7 Mar 2005 10:25:45 -0500 D Richard Felker III <dalias@aerifal.cx> wrote:
On Mon, Mar 07, 2005 at 11:55:15AM +0100, Reimar Döffinger wrote:
Hi,
Isn't adding a bunch of ifdefs into all code that uses mmap a lot more intrusive than a configure test that just puts the code, when necessary, into config.h? Isn't that the point of config.h?
Well, it makes configure larger (which is already a really big monster) and unfortunately some code uses MAP_ANON and some use MAP_ANONYMOUS, so we would actually need two configure checks at the moment :-(
Please remove both and put (void*)-1 wherever it's needed. This is (always) the value of both constants and it eliminates the dependency on stupid #defines that might be missing.
Huh ? In my bits/mman.h I have : #define MAP_ANONYMOUS 0x20 Aurel
On Mon, Mar 07, 2005 at 04:40:27PM +0100, Aurelien Jacobs wrote:
On Mon, 7 Mar 2005 10:25:45 -0500 D Richard Felker III <dalias@aerifal.cx> wrote:
On Mon, Mar 07, 2005 at 11:55:15AM +0100, Reimar Döffinger wrote:
Hi,
Isn't adding a bunch of ifdefs into all code that uses mmap a lot more intrusive than a configure test that just puts the code, when necessary, into config.h? Isn't that the point of config.h?
Well, it makes configure larger (which is already a really big monster) and unfortunately some code uses MAP_ANON and some use MAP_ANONYMOUS, so we would actually need two configure checks at the moment :-(
Please remove both and put (void*)-1 wherever it's needed. This is (always) the value of both constants and it eliminates the dependency on stupid #defines that might be missing.
Huh ? In my bits/mman.h I have : #define MAP_ANONYMOUS 0x20
Oh, hahahaha. 10000l to me. I was thinking of the error return value for mmap and didn't even read what constant we were talking about. (I know there are a few placed mplayer uses that and has problems, when it should just use (void*)-1...). Sorry, forget what I said about anon maps. Rich
On Mon, 7 Mar 2005, Reimar Döffinger wrote:
Hi,
Isn't adding a bunch of ifdefs into all code that uses mmap a lot more intrusive than a configure test that just puts the code, when necessary, into config.h? Isn't that the point of config.h?
Well, it makes configure larger (which is already a really big monster) and unfortunately some code uses MAP_ANON and some use MAP_ANONYMOUS, so we would actually need two configure checks at the moment :-(
Are there any systems which define MAP_ANONYMOUS but not MAP_ANON? It seems like MAP_ANON was in the code for a while and no one had a problem. Maybe the one occurance of MAP_ANONYMOUS can be changed to match the two uses of MAP_ANON, and then the whole problem goes away.
participants (4)
-
Aurelien Jacobs -
D Richard Felker III -
Reimar Döffinger -
Trent Piepho