|
@@ -10,21 +10,23 @@ mmap(void *addr, int64_t len, int prot, int flags, int fd, int offset)
|
|
/* TODO: This is an incomplete implementation of mmap for windows.
|
|
/* TODO: This is an incomplete implementation of mmap for windows.
|
|
* Currently it is sufficient, but there are a lot of unused parameters.
|
|
* Currently it is sufficient, but there are a lot of unused parameters.
|
|
*/
|
|
*/
|
|
|
|
+ HANDLE fh = (HANDLE)_get_osfhandle(fd);
|
|
|
|
+ HANDLE mh = CreateFileMapping(fh, 0, PAGE_READONLY, 0, 0, 0);
|
|
|
|
+ void *p = MapViewOfFile(mh, FILE_MAP_READ, 0, 0, (size_t)len);
|
|
|
|
+ CloseHandle(mh);
|
|
|
|
+
|
|
|
|
+ /* unused parameters */
|
|
(void)addr;
|
|
(void)addr;
|
|
(void)prot;
|
|
(void)prot;
|
|
(void)flags;
|
|
(void)flags;
|
|
(void)offset;
|
|
(void)offset;
|
|
|
|
|
|
- HANDLE fh = (HANDLE)_get_osfhandle(fd);
|
|
|
|
- HANDLE mh = CreateFileMapping(fh, 0, PAGE_READONLY, 0, 0, 0);
|
|
|
|
- void *p = MapViewOfFile(mh, FILE_MAP_READ, 0, 0, (size_t)len);
|
|
|
|
- CloseHandle(mh);
|
|
|
|
return p;
|
|
return p;
|
|
}
|
|
}
|
|
|
|
|
|
static void munmap(void *addr, int64_t length)
|
|
static void munmap(void *addr, int64_t length)
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ /* unused parameters */
|
|
(void)length;
|
|
(void)length;
|
|
|
|
|
|
UnmapViewOfFile(addr);
|
|
UnmapViewOfFile(addr);
|