Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Trouble getting MAP_ANONYMOUS definition: (5 Items)
   
Trouble getting MAP_ANONYMOUS definition  
I'm in the process of building an open source package using GNU's "configure" build process. One file in the project 
includes mman.h in order to get access to the MAP_ANON definition. Unfortunately, for this build(e.g. ./configure && make), even though MAP_ANON is defined in mman.h it is NOT being defined because apparently __EXT_QNX isn't being defined in sys/platform.h. Looking at mman.h I see the following:

#if defined(__EXT_QNX)
...
#define MAP_BELOW16M    0x00040000     /* allocate below 16M     */
#define MAP_ANON        0x00080000     /* anonymous memory       */
...
#endif

Looking in sys/platform.h I see the following:

#if defined(_QNX_SOURCE) || \
    (defined(__EXT) && !defined(__NO_EXT_QNX) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) && (_POSIX_C_SOURCE+0 <= 0))

#define __EXT_QNX
#endif

After doing some tests, it appears _XOPEN_SOURCE *is* defined and _POSIX_C_SOURCE+0 <= 0 is *not* true so __EXT_QNX will
 not be defined during this particular build session.

Can anyone suggest how to force __EXT_QNX to be defined? What in the GNU 'configure' build process could be upsetting 
these definitions? Who originally sets _XOPEN_SOURCE and _POSIX_C_SOURCE?

Any suggestions would be appreciated. Right now I'm forced to re-define MAP_ANON is the source code instead of relying 
on the value defined in mman.h. This is an ugly hack that I'd rather avoid.

Re: Trouble getting MAP_ANONYMOUS definition  
Probably the quickest thing to do would be to add _QNX_SOURCE to CFLAGS,
unless there is some specific reason not to do so.

On Wed, 2009-06-03 at 11:50 -0400, Glenn Schmottlach wrote:
> I'm in the process of building an open source package using GNU's "configure" build process. One file in the project 
includes mman.h in order to get access to the MAP_ANON definition. Unfortunately, for this build(e.g. ./configure && make), even though MAP_ANON is defined in mman.h it is NOT being defined because apparently __EXT_QNX isn't being defined in sys/platform.h. Looking at mman.h I see the following:
> 
> #if defined(__EXT_QNX)
> ...
> #define MAP_BELOW16M    0x00040000     /* allocate below 16M     */
> #define MAP_ANON        0x00080000     /* anonymous memory       */
> ...
> #endif
> 
> Looking in sys/platform.h I see the following:
> 
> #if defined(_QNX_SOURCE) || \
>     (defined(__EXT) && !defined(__NO_EXT_QNX) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) && (_POSIX_C_SOURCE+0 <= 0))
> #define __EXT_QNX
> #endif
> 
> After doing some tests, it appears _XOPEN_SOURCE *is* defined and _POSIX_C_SOURCE+0 <= 0 is *not* true so __EXT_QNX 
will not be defined during this particular build session.
> 
> Can anyone suggest how to force __EXT_QNX to be defined? What in the GNU 'configure' build process could be upsetting 
these definitions? Who originally sets _XOPEN_SOURCE and _POSIX_C_SOURCE?
> 
> Any suggestions would be appreciated. Right now I'm forced to re-define MAP_ANON is the source code instead of relying
 on the value defined in mman.h. This is an ugly hack that I'd rather avoid.
> 
> 
> 
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post30708
> 
Re: Trouble getting MAP_ANONYMOUS definition  
I tried that but it didn't work. Unfortunately, the "make" part is being driven by a python script which may be doing 
something funky. For now, I guess I'll have to leave the hard-coded value.
Re: Trouble getting MAP_ANONYMOUS definition  
On Wed, Jun 03, 2009 at 12:29:54PM -0400, Glenn Schmottlach wrote:
> I tried that but it didn't work. Unfortunately, the "make" part is being driven by a python script which may be doing 
something funky. For now, I guess I'll have to leave the hard-coded value.

Which package is it?

-seanb
Re: Trouble getting MAP_ANONYMOUS definition  
It's libffi which is buried in a Python 2.6.2 build. The Python setup.py script actually runs the ./configure script for
 libffi. Without my hack, MAP_ANON isn't defined. It's an annoyance that I'd like to understand why it's occurring. I 
ran into it while cross-compiling Python for x86, SH, and ARM with the ctypes module (see my earlier post on this 
subject).