|
|
@ -12,7 +12,7 @@ extern char* mmap_shared(const char* filename,unsigned long* filesize) {
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
HANDLE fd,m;
|
|
|
|
HANDLE fd,m;
|
|
|
|
char* map;
|
|
|
|
char* map;
|
|
|
|
fd=CreateFile(filename,GENERIC_WRITE,FILE_SHARE_WRITE,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
|
|
|
|
fd=CreateFile(filename,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_WRITE,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
|
|
|
|
if (fd==INVALID_HANDLE_VALUE)
|
|
|
|
if (fd==INVALID_HANDLE_VALUE)
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
m=CreateFileMapping(fd,0,PAGE_READWRITE,0,0,NULL);
|
|
|
|
m=CreateFileMapping(fd,0,PAGE_READWRITE,0,0,NULL);
|
|
|
@ -27,7 +27,7 @@ extern char* mmap_shared(const char* filename,unsigned long* filesize) {
|
|
|
|
char *map;
|
|
|
|
char *map;
|
|
|
|
if (fd>=0) {
|
|
|
|
if (fd>=0) {
|
|
|
|
*filesize=lseek(fd,0,SEEK_END);
|
|
|
|
*filesize=lseek(fd,0,SEEK_END);
|
|
|
|
map=mmap(0,*filesize,PROT_WRITE,MAP_SHARED,fd,0);
|
|
|
|
map=mmap(0,*filesize,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
|
|
|
|
if (map==(char*)-1)
|
|
|
|
if (map==(char*)-1)
|
|
|
|
map=0;
|
|
|
|
map=0;
|
|
|
|
close(fd);
|
|
|
|
close(fd);
|
|
|
|