From aec10f734b52bb4d9dbf06a99663c6aaa35961a6 Mon Sep 17 00:00:00 2001 From: Gunnar Kudrjavets Date: Thu, 14 Jan 2016 22:47:15 -0800 Subject: [PATCH] Guard falloc.h inclusion to avoid build breaks Summary: Depending on the order of include paths and versions of various headers we may end up in a situation where we'll encounter a build break caused by redefinition of constants. gcc-4.9-glibc-2.20 header update to include/bits/fcntl-linux.h introduced the definitions of FALLOC_FL_* constants. However, linux/falloc.h from kernel-headers also has FALLOC_FL_* constants defined. Therefore during the compilation we'll get "previously defined" errors. Test Plan: Both in the environment where the build break manifests (to make sure that the change fixed the problem) and in the environment where everything builds fine (to make sure that there are no regressions): make clean make -j 32 Reviewers: sdong, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D52821 --- util/posix_logger.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/posix_logger.h b/util/posix_logger.h index 55cb34a86..1c7d39866 100644 --- a/util/posix_logger.h +++ b/util/posix_logger.h @@ -16,9 +16,13 @@ #include "port/sys_time.h" #include #include + #ifdef OS_LINUX +#ifndef FALLOC_FL_KEEP_SIZE #include #endif +#endif + #include "rocksdb/env.h" #include "util/iostats_context_imp.h" #include