diff options
author | Yabin Cui <yabinc@google.com> | 2014-11-11 10:31:30 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2014-11-11 10:31:30 -0800 |
commit | 266092c52dea85daaa14c671c1a2f133330f0ed8 (patch) | |
tree | 5fccc608bda46f762ce00bb0aae0613590cbeb4a /libutils | |
parent | b0d30271699ecd48be791bbd002d2366b831a624 (diff) | |
download | system_core-266092c52dea85daaa14c671c1a2f133330f0ed8.zip system_core-266092c52dea85daaa14c671c1a2f133330f0ed8.tar.gz system_core-266092c52dea85daaa14c671c1a2f133330f0ed8.tar.bz2 |
kill HAVE_POSIX_FILEMAP
Bug: 18315579
Change-Id: I0bd5fb946b12cb90e0c9c73a478df41609b8c3e2
Diffstat (limited to 'libutils')
-rw-r--r-- | libutils/FileMap.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/libutils/FileMap.cpp b/libutils/FileMap.cpp index f8d6bda..6d92f74 100644 --- a/libutils/FileMap.cpp +++ b/libutils/FileMap.cpp @@ -23,7 +23,7 @@ #include <utils/FileMap.h> #include <utils/Log.h> -#if defined(HAVE_WIN32_FILEMAP) && !defined(__USE_MINGW_ANSI_STDIO) +#if defined(__MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO) # define PRId32 "I32d" # define PRIx32 "I32x" # define PRId64 "I64d" @@ -33,7 +33,7 @@ #include <stdio.h> #include <stdlib.h> -#ifdef HAVE_POSIX_FILEMAP +#if !defined(__MINGW32__) #include <sys/mman.h> #endif @@ -64,12 +64,7 @@ FileMap::~FileMap(void) if (mFileName != NULL) { free(mFileName); } -#ifdef HAVE_POSIX_FILEMAP - if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) { - ALOGD("munmap(%p, %zu) failed\n", mBasePtr, mBaseLength); - } -#endif -#ifdef HAVE_WIN32_FILEMAP +#if defined(__MINGW32__) if (mBasePtr && UnmapViewOfFile(mBasePtr) == 0) { ALOGD("UnmapViewOfFile(%p) failed, error = %" PRId32 "\n", mBasePtr, GetLastError() ); @@ -77,6 +72,10 @@ FileMap::~FileMap(void) if (mFileMapping != INVALID_HANDLE_VALUE) { CloseHandle(mFileMapping); } +#else + if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) { + ALOGD("munmap(%p, %zu) failed\n", mBasePtr, mBaseLength); + } #endif } @@ -90,7 +89,7 @@ FileMap::~FileMap(void) bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t length, bool readOnly) { -#ifdef HAVE_WIN32_FILEMAP +#if defined(__MINGW32__) int adjust; off64_t adjOffset; size_t adjLength; @@ -128,8 +127,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le mFileMapping = INVALID_HANDLE_VALUE; return false; } -#endif -#ifdef HAVE_POSIX_FILEMAP +#else // !defined(__MINGW32__) int prot, flags, adjust; off64_t adjOffset; size_t adjLength; @@ -179,7 +177,7 @@ try_again: return false; } mBasePtr = ptr; -#endif // HAVE_POSIX_FILEMAP +#endif // !defined(__MINGW32__) mFileName = origFileName != NULL ? strdup(origFileName) : NULL; mBaseLength = adjLength; |