Skip to contentSkip to conversation

handle MAP_FLAGMASK

PATCH In review Christoph Egger 2 participants 2 messages Nov 26, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 handle MAP_FLAGMASK

Hi,

NetBSD doesn't have MAP_FLAGMASK. Attached patch fixes this.

Signature · 12 lines
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy
mmap.c +4 -0
Index: bsd-user/mmap.c
===================================================================
@@ -30,6 +30,10 @@
 
 //#define DEBUG_MMAP
 
+#ifndef MAP_FLAGMASK
+#define MAP_FLAGMASK	~MAP_ALIGNMENT_MASK
+#endif
+
 #if defined(USE_NPTL)
 pthread_mutex_t mmap_mutex;
 static int __thread mmap_lock_count;
#1 lore raw
Quoted 4 lines · Christoph Egger

Hi,

NetBSD doesn't have MAP_FLAGMASK. Attached patch fixes this.

The code blindly uses native definitions, but the BSDs differ in some cases.

FreeBSD:
#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
#define MAP_STACK 0x0400 /* region grows down, like a stack */
#define MAP_NOSYNC 0x0800 /* page to but do not sync underlying file */

NetBSD:
#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
#define MAP_TRYFIXED 0x0400 /* attempt hint address, even within break */
#define MAP_WIRED 0x0800 /* mlock() mapping when it is established */

OpenBSD:
#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
#define MAP_TRYFIXED 0x0400 /* attempt hint address, even within heap */

Same for madvise flags.

So we need TARGET_FREEBSD_MAP_HASSEMAPHORE etc. and specific handling for each OS, like the syscalls are handled.