From 43c386b72ee834c88a1a22500ce1fc36a8208277 Mon Sep 17 00:00:00 2001 From: James Golick Date: Tue, 10 Dec 2013 22:34:19 -0800 Subject: [PATCH] only try to use fallocate if it's actually present on the system --- build_tools/build_detect_platform | 12 ++++++++++++ util/env_posix.cc | 8 ++++---- util/posix_logger.h | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index 59e2e46195..96a1fb3319 100755 --- a/build_tools/build_detect_platform +++ b/build_tools/build_detect_platform @@ -189,6 +189,18 @@ EOF COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_ATOMIC_PRESENT" fi + # Test whether fallocate is available + $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null < + int main() { + int fd = open("/dev/null", 0); + fallocate(fd, 0, 0, 1024); + } +EOF + if [ "$?" = 0 ]; then + COMMON_FLAGS="$PLATFORM_LDFLAGS -DROCKSDB_FALLOCATE_PRESENT" + fi + # Test whether Snappy library is installed # http://code.google.com/p/snappy/ $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <