/* ######################################################################
MMap Class - Provides 'real' mmap or a faked mmap using read().
/* ######################################################################
MMap Class - Provides 'real' mmap or a faked mmap using read().
// MMap::MMap - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
// MMap::MMap - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
// Map it.
Base = mmap(0,iSize,Prot,Map,Fd.Fd(),0);
if (Base == (void *)-1)
// Map it.
Base = mmap(0,iSize,Prot,Map,Fd.Fd(),0);
if (Base == (void *)-1)
#ifdef _POSIX_SYNCHRONIZED_IO
if ((Flags & ReadOnly) != ReadOnly)
if (msync((char *)Base,iSize,MS_SYNC) != 0)
#ifdef _POSIX_SYNCHRONIZED_IO
if ((Flags & ReadOnly) != ReadOnly)
if (msync((char *)Base,iSize,MS_SYNC) != 0)
unsigned long PSize = sysconf(_SC_PAGESIZE);
if ((Flags & ReadOnly) != ReadOnly)
if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0)
unsigned long PSize = sysconf(_SC_PAGESIZE);
if ((Flags & ReadOnly) != ReadOnly)
if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0)
- Fd->Seek(WorkSpace);
- char C = 0;
- Fd->Write(&C,sizeof(C));
+ if (EndOfFile > WorkSpace)
+ WorkSpace = EndOfFile;
+ else if(WorkSpace > 0)
+ {
+ Fd->Seek(WorkSpace - 1);
+ char C = 0;
+ Fd->Write(&C,sizeof(C));
+ }
+