Commit 3342df63 authored by Olivier Bertrand's avatar Olivier Bertrand

- Commit changes on memory mapping that hopefully should now work on Linux.

modified:
  storage/connect/maputil.cpp
  storage/connect/tabdos.cpp
  storage/connect/tabfmt.cpp
  storage/connect/tabvct.cpp
parent 6e6e34b1
...@@ -159,9 +159,9 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName, ...@@ -159,9 +159,9 @@ HANDLE CreateFileMap(PGLOBAL g, LPCSTR fileName,
// Now we are ready to load the file. If mmap() is available we try // Now we are ready to load the file. If mmap() is available we try
// this first. If not available or it failed we try to load it. // this first. If not available or it failed we try to load it.
mm->memory = mmap(NULL, filesize, protmode, MAP_PRIVATE, fd, 0); mm->memory = mmap(NULL, filesize, protmode, MAP_SHARED, fd, 0);
if (mm->memory) { if (mm->memory != MAP_FAILED) {
mm->lenL = (mm->memory != 0) ? filesize : 0; mm->lenL = (mm->memory != 0) ? filesize : 0;
mm->lenH = 0; mm->lenH = 0;
} else { } else {
...@@ -180,7 +180,7 @@ bool CloseMemMap(void *memory, size_t dwSize) ...@@ -180,7 +180,7 @@ bool CloseMemMap(void *memory, size_t dwSize)
if (memory) { if (memory) {
// All this must be redesigned // All this must be redesigned
int rc = msync(memory, dwSize, MS_SYNC); int rc = msync(memory, dwSize, MS_SYNC);
return (munmap(memory, dwSize)) ? true : false; return (munmap(memory, dwSize) < 0) ? true : false;
} else } else
return false; return false;
......
...@@ -284,15 +284,11 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) ...@@ -284,15 +284,11 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
{ {
// Mapping not used for insert // Mapping not used for insert
USETEMP tmp = PlgGetUser(g)->UseTemp; USETEMP tmp = PlgGetUser(g)->UseTemp;
#if defined(WIN32)
bool map = Mapped && mode != MODE_INSERT && bool map = Mapped && mode != MODE_INSERT &&
!(tmp != TMP_NO && Recfm == RECFM_VAR !(tmp != TMP_NO && Recfm == RECFM_VAR
&& mode == MODE_UPDATE) && && mode == MODE_UPDATE) &&
!(tmp == TMP_FORCE && !(tmp == TMP_FORCE &&
(mode == MODE_UPDATE || mode == MODE_DELETE)); (mode == MODE_UPDATE || mode == MODE_DELETE));
#else // !WIN32
bool map = Mapped && mode == MODE_READ;
#endif // !WIN32
PTXF txfp; PTXF txfp;
PTDBASE tdbp; PTDBASE tdbp;
......
...@@ -444,14 +444,10 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode) ...@@ -444,14 +444,10 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
if (Catfunc != FNC_COL) { if (Catfunc != FNC_COL) {
USETEMP tmp = PlgGetUser(g)->UseTemp; USETEMP tmp = PlgGetUser(g)->UseTemp;
#if defined(WIN32)
bool map = Mapped && mode != MODE_INSERT && bool map = Mapped && mode != MODE_INSERT &&
!(tmp != TMP_NO && mode == MODE_UPDATE) && !(tmp != TMP_NO && mode == MODE_UPDATE) &&
!(tmp == TMP_FORCE && !(tmp == TMP_FORCE &&
(mode == MODE_UPDATE || mode == MODE_DELETE)); (mode == MODE_UPDATE || mode == MODE_DELETE));
#else // !WIN32
bool map = Mapped && mode == MODE_READ;
#endif // !WIN32
PTXF txfp; PTXF txfp;
/*******************************************************************/ /*******************************************************************/
......
...@@ -197,13 +197,9 @@ PTDB VCTDEF::GetTable(PGLOBAL g, MODE mode) ...@@ -197,13 +197,9 @@ PTDB VCTDEF::GetTable(PGLOBAL g, MODE mode)
/*********************************************************************/ /*********************************************************************/
// Mapping not used for insert (except for true VEC not split tables) // Mapping not used for insert (except for true VEC not split tables)
// or when UseTemp is forced // or when UseTemp is forced
#if defined(WIN32)
bool map = Mapped && (Estimate || mode != MODE_INSERT) && bool map = Mapped && (Estimate || mode != MODE_INSERT) &&
!(PlgGetUser(g)->UseTemp == TMP_FORCE && !(PlgGetUser(g)->UseTemp == TMP_FORCE &&
(mode == MODE_UPDATE || mode == MODE_DELETE)); (mode == MODE_UPDATE || mode == MODE_DELETE));
#else // !WIN32
bool map = Mapped && mode == MODE_READ;
#endif // !WIN32
PTXF txfp; PTXF txfp;
PTDB tdbp; PTDB tdbp;
......
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