diff --git a/util/env_posix.cc b/util/env_posix.cc index 68cabff697f6e9e8bf3327be68a013f61579ce12..eebf2e66b3447b25365ff613175da7a2cd401c22 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -332,6 +332,7 @@ class PosixMmapFile : public WritableFile { return file_offset_ + used; } +#ifdef OS_LINUX virtual Status Allocate(off_t offset, off_t len) { if (!fallocate(fd_, FALLOC_FL_KEEP_SIZE, offset, len)) { return Status::OK(); @@ -339,6 +340,7 @@ class PosixMmapFile : public WritableFile { return IOError(filename_, errno); } } +#endif }; // Use posix write to write data to a file. @@ -466,6 +468,7 @@ class PosixWritableFile : public WritableFile { return filesize_; } +#ifdef OS_LINUX virtual Status Allocate(off_t offset, off_t len) { if (!fallocate(fd_, FALLOC_FL_KEEP_SIZE, offset, len)) { return Status::OK(); @@ -473,6 +476,7 @@ class PosixWritableFile : public WritableFile { return IOError(filename_, errno); } } +#endif }; static int LockOrUnlock(const std::string& fname, int fd, bool lock) { diff --git a/util/posix_logger.h b/util/posix_logger.h index bb2518ae0e252470ba39cbad4608b84f8c8fd008..5443c7733f6cd5406578fe0a3589d46deaad704b 100644 --- a/util/posix_logger.h +++ b/util/posix_logger.h @@ -14,7 +14,9 @@ #include #include #include +#ifdef OS_LINUX #include +#endif #include "leveldb/env.h" namespace leveldb { @@ -93,6 +95,7 @@ class PosixLogger : public Logger { assert(p <= limit); +#ifdef OS_LINUX // If this write would cross a boundary of kDebugLogChunkSize // space, pre-allocate more space to avoid overly large // allocations from filesystem allocsize options. @@ -106,6 +109,7 @@ class PosixLogger : public Logger { fallocate(fd_, FALLOC_FL_KEEP_SIZE, 0, desired_allocation_chunk * kDebugLogChunkSize); } +#endif fwrite(base, 1, write_size, file_); fflush(file_);