Changeset 40305 in vbox for trunk/src/VBox/Runtime/r3/posix
- Timestamp:
- Feb 29, 2012 9:34:36 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp
r39083 r40305 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 48 48 # define MAP_ANONYMOUS MAP_ANON 49 49 #endif 50 51 50 52 51 … … 145 144 static RTHEAPPAGE g_MemExecPosixHeap; 146 145 146 147 #ifdef RT_OS_OS2 148 /* 149 * A quick mmap/munmap mockup for avoid duplicating lots of good code. 150 */ 151 # define INCL_BASE 152 # include <os2.h> 153 # define MAP_PRIVATE 0 154 # define MAP_ANONYMOUS 0 155 # define MAP_FAILED (void *)-1 156 157 static void *mmap(void *pvWhere, size_t cb, int fProt, int fFlags, int fd, off_t off) 158 { 159 NOREF(pvWhere); NOREF(fd); NOREF(off); 160 void *pv = NULL; 161 ULONG fAlloc = OBJ_ANY | PAG_COMMIT; 162 if (fProt & PROT_EXEC) 163 fAlloc |= PAG_EXECUTE; 164 if (fProt & PROT_READ) 165 fAlloc |= PAG_READ; 166 if (fProt & PROT_WRITE) 167 fAlloc |= PAG_WRITE; 168 APIRET rc = DosAllocMem(&pv, cb, fAlloc); 169 if (rc == NO_ERROR) 170 return pv; 171 errno = ENOMEM; 172 return MAP_FAILED; 173 } 174 175 static int munmap(void *pv, size_t cb) 176 { 177 APIRET rc = DosFreeMem(pv); 178 if (rc == NO_ERROR) 179 return 0; 180 errno = EINVAL; 181 return -1; 182 } 183 184 #endif 147 185 148 186 /**
Note:
See TracChangeset
for help on using the changeset viewer.