libowfat/mmap/mmap_unmap.c

19 lines
347 B
C

#include <sys/types.h>
#include <unistd.h>
#ifdef __MINGW32__
#include <windows.h>
#else
#include <sys/mman.h>
#endif
#include "open.h"
#include "mmap.h"
int mmap_unmap(const char* mapped,size_t maplen) {
#ifdef __MINGW32__
(void)maplen;
return UnmapViewOfFile(mapped)?0:-1;
#else
return maplen ? munmap((char*)mapped,maplen) : 0;
#endif
}