summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/mmap.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-05-13 01:14:50 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-05-13 01:14:50 +0200
commitf895e2ce115affb58504ca7c8801e8deb2b01657 (patch)
treeb346f7bc375fc9e25a6cb6a16ac1015cbb174ca7 /apt-pkg/contrib/mmap.cc
parentfc3eb5b295879cf899182f89b41d6bc66b27ad98 (diff)
MAP_ANON is deprecated in favor of MAP_ANONYMOUS, but telesphoreo needs
to ships a patch for this so pretend to be nice and make it work (TM)
Diffstat (limited to 'apt-pkg/contrib/mmap.cc')
-rw-r--r--apt-pkg/contrib/mmap.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index 9945b1606..19381ae47 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -237,11 +237,19 @@ DynamicMMap::DynamicMMap(unsigned long Flags,unsigned long const &WorkSpace,
if ((this->Flags & Fallback) != Fallback) {
// Set the permissions.
int Prot = PROT_READ;
+#ifdef MAP_ANONYMOUS
int Map = MAP_PRIVATE | MAP_ANONYMOUS;
+#else
+ int Map = MAP_PRIVATE | MAP_ANON;
+#endif
if ((this->Flags & ReadOnly) != ReadOnly)
Prot |= PROT_WRITE;
if ((this->Flags & Public) == Public)
+#ifdef MAP_ANONYMOUS
Map = MAP_SHARED | MAP_ANONYMOUS;
+#else
+ Map = MAP_SHARED | MAP_ANON;
+#endif
// use anonymous mmap() to get the memory
Base = (unsigned char*) mmap(0, WorkSpace, Prot, Map, -1, 0);