summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/mmap.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:53:13 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:53:13 +0000
commit35c22def87d657492c0db70746391b000753c8ed (patch)
tree764730f032118789cb272aa9ee21db6463db998e /apt-pkg/contrib/mmap.cc
parentd8ea5ec978b2fa1074d84abc4d4e5bab19f2a1ae (diff)
Fixes for mmap and yodl
Author: jgg Date: 1999-03-18 04:32:45 GMT Fixes for mmap and yodl
Diffstat (limited to 'apt-pkg/contrib/mmap.cc')
-rw-r--r--apt-pkg/contrib/mmap.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index cc58862ef..7a5065ffb 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: mmap.cc,v 1.13 1999/03/18 04:10:21 doogie Exp $
+// $Id: mmap.cc,v 1.14 1999/03/18 04:32:46 jgg Exp $
/* ######################################################################
MMap Class - Provides 'real' mmap or a faked mmap using read().
@@ -31,7 +31,6 @@
#include <sys/mman.h>
#include <sys/stat.h>
-#include <sys/user.h>
#include <unistd.h>
#include <fcntl.h>
/*}}}*/
@@ -119,10 +118,10 @@ bool MMap::Sync()
/* */
bool MMap::Sync(unsigned long Start,unsigned long Stop)
{
-
-#ifdef _POSIX_SYNCHRONIZED_IO
+#ifdef _POSIX_SYNCHRONIZED_IO
+ unsigned long PSize = sysconf(_SC_PAGESIZE);
if ((Flags & ReadOnly) != ReadOnly)
- if (msync((char *)Base+(int)(Start/PAGE_SIZE)*PAGE_SIZE,Stop - Start,MS_SYNC) != 0)
+ if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0)
return _error->Error("msync","Unable to write mmap");
#endif
return true;