2006-05-18 06:13:49 +00:00
|
|
|
#include <sys/types.h>
|
2019-04-23 13:25:26 +00:00
|
|
|
#ifdef _WIN32
|
2006-05-18 06:13:49 +00:00
|
|
|
#include <windows.h>
|
|
|
|
#else
|
2019-04-23 13:25:26 +00:00
|
|
|
#include <unistd.h>
|
2006-05-18 06:13:49 +00:00
|
|
|
#include <sys/mman.h>
|
|
|
|
#include "open.h"
|
2019-04-23 13:25:26 +00:00
|
|
|
#endif
|
2006-05-18 06:13:49 +00:00
|
|
|
#include "mmap.h"
|
|
|
|
|
2013-08-22 23:42:46 +00:00
|
|
|
int mmap_unmap(const char* mapped,size_t maplen) {
|
2019-04-23 13:25:26 +00:00
|
|
|
#ifdef _WIN32
|
2006-05-18 06:13:49 +00:00
|
|
|
(void)maplen;
|
|
|
|
return UnmapViewOfFile(mapped)?0:-1;
|
|
|
|
#else
|
2015-03-02 21:25:57 +00:00
|
|
|
return maplen ? munmap((char*)mapped,maplen) : 0;
|
2006-05-18 06:13:49 +00:00
|
|
|
#endif
|
|
|
|
}
|