summaryrefslogtreecommitdiff
path: root/libutils/FileMap.cpp
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2015-02-19 17:29:27 +0000
committerNarayan Kamath <narayan@google.com>2015-02-19 18:36:27 +0000
commit8bafabf1a033d9d859052c8cf46581eefead5c3c (patch)
treea6e12b8eb02beb71c31666a835ca16b89a284d95 /libutils/FileMap.cpp
parent439c730cd043a3d08ac30c3eb67c4f8b2a50404c (diff)
Remove reference to NOT_USING_KLIBC and cygwin.
The reference to NOT_USING_KLIBC appears to be the only one in our codebase. This change also removes some cygwin specific retry logic - all other supported platforms in this section of the code should support mapping at an offset. Note that i've reversed the sense of the check, we always sysconf since that's recommended practice. Change-Id: Ib985fb665193d7a07a282f7092cd77c0bc508a66
Diffstat (limited to 'libutils/FileMap.cpp')
-rw-r--r--libutils/FileMap.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/libutils/FileMap.cpp b/libutils/FileMap.cpp
index f49b4f94c5..0af066f8bc 100644
--- a/libutils/FileMap.cpp
+++ b/libutils/FileMap.cpp
@@ -141,20 +141,14 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le
// init on first use
if (mPageSize == -1) {
-#if NOT_USING_KLIBC
mPageSize = sysconf(_SC_PAGESIZE);
if (mPageSize == -1) {
ALOGE("could not get _SC_PAGESIZE\n");
return false;
}
-#else
- // this holds for Linux, Darwin, Cygwin, and doesn't pain the ARM
- mPageSize = 4096;
-#endif
}
- adjust = offset % mPageSize;
-try_again:
+ adjust = offset % mPageSize;
adjOffset = offset - adjust;
adjLength = length + adjust;
@@ -165,13 +159,6 @@ try_again:
ptr = mmap(NULL, adjLength, prot, flags, fd, adjOffset);
if (ptr == MAP_FAILED) {
- // Cygwin does not seem to like file mapping files from an offset.
- // So if we fail, try again with offset zero
- if (adjOffset > 0) {
- adjust = offset;
- goto try_again;
- }
-
ALOGE("mmap(%lld,%zu) failed: %s\n",
(long long)adjOffset, adjLength, strerror(errno));
return false;