[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdelibs/frameworks] tier1/kcoreaddons/src/lib/caching: Port POSIX ::mmap calls to QT_MMAP calls
From: Martin Klapetek <mklapetek () kde ! org>
Date: 2013-08-26 15:52:00
Message-ID: E1VDz5E-000335-Vo () scm ! kde ! org
[Download RAW message or body]
Git commit 6713c121aedf1cfc7055536b227bed6be91a13b4 by Martin Klapetek.
Committed on 26/08/2013 at 15:51.
Pushed by mklapetek into branch 'frameworks'.
Port POSIX ::mmap calls to QT_MMAP calls
REVIEW: 112225
M +5 -4 tier1/kcoreaddons/src/lib/caching/kshareddatacache.cpp
http://commits.kde.org/kdelibs/6713c121aedf1cfc7055536b227bed6be91a13b4
diff --git a/tier1/kcoreaddons/src/lib/caching/kshareddatacache.cpp \
b/tier1/kcoreaddons/src/lib/caching/kshareddatacache.cpp index 96342a0..7ff1d50 \
100644
--- a/tier1/kcoreaddons/src/lib/caching/kshareddatacache.cpp
+++ b/tier1/kcoreaddons/src/lib/caching/kshareddatacache.cpp
@@ -25,6 +25,7 @@
#include "kshareddatacache_p.h" // Various auxiliary support code
#include "qstandardpaths.h"
+#include <qplatformdefs.h>
#include <krandom.h>
@@ -1065,7 +1066,7 @@ class KSharedDataCache::Private
// Use mmap directly instead of QFile::map since the QFile (and its
// shared mapping) will disappear unless we hang onto the QFile for no
// reason (see the note below, we don't care about the file per se...)
- mapAddress = ::mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, \
file.handle(), 0); + mapAddress = QT_MMAP(NULL, size, PROT_READ | \
PROT_WRITE, MAP_SHARED, file.handle(), 0);
// So... it is possible that someone else has mapped this cache already
// with a larger size. If that's the case we need to at least match
@@ -1096,7 +1097,7 @@ class KSharedDataCache::Private
unsigned actualPageSize = mapped->cachePageSize();
::munmap(mapAddress, size);
size = SharedMemory::totalSize(cacheSize, actualPageSize);
- mapAddress = ::mmap(NULL, size, PROT_READ | PROT_WRITE, \
MAP_SHARED, file.handle(), 0); + mapAddress = QT_MMAP(NULL, size, \
PROT_READ | PROT_WRITE, MAP_SHARED, file.handle(), 0); }
}
}
@@ -1120,7 +1121,7 @@ class KSharedDataCache::Private
qWarning() << "Failed to establish shared memory mapping, will fallback"
<< "to private memory -- memory usage will increase";
- mapAddress = ::mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | \
MAP_ANONYMOUS, -1, 0); + mapAddress = QT_MMAP(NULL, size, PROT_READ | \
PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); }
// Well now we're really hosed. We can still work, but we can't even cache
@@ -1315,7 +1316,7 @@ class KSharedDataCache::Private
return;
}
- void *newMap = ::mmap(0, testSize, PROT_READ | PROT_WRITE,
+ void *newMap = QT_MMAP(0, testSize, PROT_READ | PROT_WRITE,
MAP_SHARED, f.handle(), 0);
if (newMap == MAP_FAILED) {
qCritical() << "Unopen to re-map the cache into memory"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic