Commit 07beddc4 authored by Olivier Bertrand's avatar Olivier Bertrand

- Working on the problem of writing to mapped files on Linux

modified:
  storage/connect/maputil.cpp*
parents 079f053c 274b2f8c
......@@ -133,7 +133,7 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName,
case MODE_UPDATE:
case MODE_DELETE:
openMode = (del) ? (O_RDWR | O_TRUNC) : O_RDWR;
protmode = PROT_WRITE;
protmode = PROT_READ | PROT_WRITE;
break;
case MODE_INSERT:
openMode = (O_WRONLY | O_CREAT | O_APPEND);
......@@ -167,6 +167,8 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName,
} else {
strcpy(g->Message, "Memory mapping failed");
return INVALID_HANDLE_VALUE;
} // endif memory
} /* endif fd */
// mmap() call was successful. ??????????
......@@ -175,7 +177,13 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName,
bool CloseMemMap(void *memory, size_t dwSize)
{
return (memory) ? ((munmap(memory, dwSize)) ? true : false) : false;
if (memory) {
// All this must be redesigned
int rc = msync(memory, dwSize, MS_SYNC);
return (munmap(memory, dwSize)) ? true : false;
} else
return false;
} // end of CloseMemMap
#endif // UNIX
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment