Merge "Remove reference to NOT_USING_KLIBC and cygwin."
This commit is contained in:
commit
1158c7d5fe
1 changed files with 1 additions and 14 deletions
|
|
@ -141,20 +141,14 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le
|
||||||
|
|
||||||
// init on first use
|
// init on first use
|
||||||
if (mPageSize == -1) {
|
if (mPageSize == -1) {
|
||||||
#if NOT_USING_KLIBC
|
|
||||||
mPageSize = sysconf(_SC_PAGESIZE);
|
mPageSize = sysconf(_SC_PAGESIZE);
|
||||||
if (mPageSize == -1) {
|
if (mPageSize == -1) {
|
||||||
ALOGE("could not get _SC_PAGESIZE\n");
|
ALOGE("could not get _SC_PAGESIZE\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
// this holds for Linux, Darwin, Cygwin, and doesn't pain the ARM
|
|
||||||
mPageSize = 4096;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
adjust = offset % mPageSize;
|
adjust = offset % mPageSize;
|
||||||
try_again:
|
|
||||||
adjOffset = offset - adjust;
|
adjOffset = offset - adjust;
|
||||||
adjLength = length + adjust;
|
adjLength = length + adjust;
|
||||||
|
|
||||||
|
|
@ -165,13 +159,6 @@ try_again:
|
||||||
|
|
||||||
ptr = mmap(NULL, adjLength, prot, flags, fd, adjOffset);
|
ptr = mmap(NULL, adjLength, prot, flags, fd, adjOffset);
|
||||||
if (ptr == MAP_FAILED) {
|
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",
|
ALOGE("mmap(%lld,%zu) failed: %s\n",
|
||||||
(long long)adjOffset, adjLength, strerror(errno));
|
(long long)adjOffset, adjLength, strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue