summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/mmap.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-09-13 17:46:48 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-09-13 17:46:48 +0200
commit650faab01603caac04494d54cf6b10a65c00ea13 (patch)
treed89d9ec876c195d8f757e1351858ea7c200dd269 /apt-pkg/contrib/mmap.cc
parentea54214002c09eeb4dd498d97a564471ec9993c5 (diff)
Support large files in the complete toolset. Indexes of this
size are pretty unlikely for now, but we need it for deb packages which could become bigger than 4GB now (LP: #815895)
Diffstat (limited to 'apt-pkg/contrib/mmap.cc')
-rw-r--r--apt-pkg/contrib/mmap.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index 3cd87eda4..a110a7019 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -95,7 +95,7 @@ bool MMap::Map(FileFd &Fd)
return false;
}
else
- return _error->Errno("mmap",_("Couldn't make mmap of %lu bytes"),
+ return _error->Errno("mmap",_("Couldn't make mmap of %llu bytes"),
iSize);
}
@@ -166,7 +166,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
return true;
#ifdef _POSIX_SYNCHRONIZED_IO
- unsigned long PSize = sysconf(_SC_PAGESIZE);
+ unsigned long long PSize = sysconf(_SC_PAGESIZE);
if ((Flags & ReadOnly) != ReadOnly)
{
if (SyncToFd != 0)
@@ -177,7 +177,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
}
else
{
- if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
+ if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
return _error->Errno("msync", _("Unable to synchronize mmap"));
}
}
@@ -197,7 +197,7 @@ DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &Work
if (_error->PendingError() == true)
return;
- unsigned long EndOfFile = Fd->Size();
+ unsigned long long EndOfFile = Fd->Size();
if (EndOfFile > WorkSpace)
WorkSpace = EndOfFile;
else if(WorkSpace > 0)
@@ -285,7 +285,7 @@ DynamicMMap::~DynamicMMap()
return;
}
- unsigned long EndOfFile = iSize;
+ unsigned long long EndOfFile = iSize;
iSize = WorkSpace;
Close(false);
if(ftruncate(Fd->Fd(),EndOfFile) < 0)
@@ -295,9 +295,9 @@ DynamicMMap::~DynamicMMap()
// DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space /*{{{*/
// ---------------------------------------------------------------------
/* This allocates a block of memory aligned to the given size */
-unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln)
+unsigned long DynamicMMap::RawAllocate(unsigned long long Size,unsigned long Aln)
{
- unsigned long Result = iSize;
+ unsigned long long Result = iSize;
if (Aln != 0)
Result += Aln - (iSize%Aln);
@@ -412,7 +412,7 @@ bool DynamicMMap::Grow() {
if (GrowFactor <= 0)
return _error->Error(_("Unable to increase size of the MMap as automatic growing is disabled by user."));
- unsigned long const newSize = WorkSpace + GrowFactor;
+ unsigned long long const newSize = WorkSpace + GrowFactor;
if(Fd != 0) {
Fd->Seek(newSize - 1);