diff --git a/env/io_posix.cc b/env/io_posix.cc index bf2638e922..231e88daef 100644 --- a/env/io_posix.cc +++ b/env/io_posix.cc @@ -28,7 +28,7 @@ #include #include #include -#ifdef OS_LINUX +#if defined(OS_LINUX) || defined(OS_ANDROID) #include #include #endif @@ -1421,9 +1421,10 @@ IOStatus PosixWritableFile::Close(const IOOptions& /*opts*/, // After ftruncate, we check whether ftruncate has the correct behavior. // If not, we should hack it with FALLOC_FL_PUNCH_HOLE if (result == 0 && - (file_stats.st_size + file_stats.st_blksize - 1) / - file_stats.st_blksize != - file_stats.st_blocks / (file_stats.st_blksize / 512)) { + static_cast((file_stats.st_size + file_stats.st_blksize - 1) / + file_stats.st_blksize) != + static_cast(file_stats.st_blocks / + (file_stats.st_blksize / 512))) { IOSTATS_TIMER_GUARD(allocate_nanos); if (allow_fallocate_) { fallocate(fd_, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, filesize_, diff --git a/env/io_posix.h b/env/io_posix.h index d76ca757cc..60788df9bf 100644 --- a/env/io_posix.h +++ b/env/io_posix.h @@ -30,7 +30,7 @@ // For non linux platform, the following macros are used only as place // holder. #if !(defined OS_LINUX) && !(defined OS_FREEBSD) && !(defined CYGWIN) && \ - !(defined OS_AIX) + !(defined OS_AIX) && !(defined OS_ANDROID) #define POSIX_FADV_NORMAL 0 /* [MC1] no further special treatment */ #define POSIX_FADV_RANDOM 1 /* [MC1] expect random page refs */ #define POSIX_FADV_SEQUENTIAL 2 /* [MC1] expect sequential page refs */