MAP_ANON support on HPUX

Warren_Baird/CSI at cimmetry.com Warren_Baird/CSI at cimmetry.com
Wed Dec 1 17:30:22 CST 2004


Hi All,

I've just discovered that HP-UX's mmap implementation doesn't define 
MAP_ANON, it only defines MAP_ANONYMOUS.  linux defined both, as does 
solaris (and solaris's manpage actually states that MAP_ANON is 
deprecated), but MacOS X seems to only define MAP_ANON

MAP_ANON is only used in two source files:  libs/wine/mmap.c and 
loader/preloader.c.  My proposed patch involves slightly different changes 
in both places : in mmap.c, I just add a new #elif to handle the case, and 
in preloader.c I add a #ifdef block at the top to define MAP_ANON to be 
MAP_ANONYMOUS if MAP_ANON is undefined, but MAP_ANONYMOUS is defined.

The other possible solution would be to put the #ifdef block from 
preloader.c into a common header...  It's not obvious to me where to put 
it, though, which is why I'm proposing this patch.

Should I rework it to use a common header?  If so - any suggestions as to 
which header would be appropriate?

Thanks,

Warren



-------------- next part --------------
--- clean/wine-20040914/loader/preloader.c	2004-07-06 14:46:05.000000000 -0400
+++ wine-20040914/loader/preloader.c	2004-12-01 18:12:29.000000000 -0500
@@ -104,6 +104,14 @@
 #define MAP_NORESERVE 0
 #endif
 
+#ifndef MAP_ANON
+#  ifdef MAP_ANONYMOUS
+#    define MAP_ANON MAP_ANONYMOUS
+#  else
+#    error Neither MAP_ANON nor MAP_ANONYMOUS are defined; is your mmap broken?
+#  endif
+#endif
+
 static struct wine_preload_info preload_info[] =
 {
     { (void *)0x00000000, 0x00110000 },  /* DOS area */
--- clean/wine-20040914/libs/wine/mmap.c	2004-07-23 22:30:09.000000000 -0400
+++ wine-20040914/libs/wine/mmap.c	2004-12-01 18:11:37.000000000 -0500
@@ -152,6 +152,8 @@
 
 #ifdef MAP_ANON
     flags |= MAP_ANON;
+#elif defined(MAP_ANONYMOUS)
+    flags |= MAP_ANONYMOUS;
 #else
     if (fdzero == -1)
     {


More information about the wine-devel mailing list