From: Stuart Henderson Date: Mon, 25 Jan 2021 18:41:54 +0000 (+0000) Subject: Disable inode cache on OSes without pthread_mutexattr_setpshared() (#791) X-Git-Tag: v4.2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e95418f15722647f960d8f773edbbecbb46a73c;p=thirdparty%2Fccache.git Disable inode cache on OSes without pthread_mutexattr_setpshared() (#791) The inode cache requires pthread_mutexattr_setpshared() and build fails on OSes with sys/mman.h that do not have this function. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 11447717d..40e21a571 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ include(GNUInstallDirs) include(GenerateConfigurationFile) include(GenerateVersionFile) -if(HAVE_SYS_MMAN_H) +if(HAVE_SYS_MMAN_H AND HAVE_PTHREAD_MUTEXATTR_SETPSHARED) set(INODE_CACHE_SUPPORTED 1) endif() diff --git a/cmake/GenerateConfigurationFile.cmake b/cmake/GenerateConfigurationFile.cmake index afa3b78ba..6e6b60487 100644 --- a/cmake/GenerateConfigurationFile.cmake +++ b/cmake/GenerateConfigurationFile.cmake @@ -56,6 +56,7 @@ check_c_source_compiles( } ]=] HAVE_PTHREAD_MUTEX_ROBUST) +check_function_exists(pthread_mutexattr_setpshared HAVE_PTHREAD_MUTEXATTR_SETPSHARED) set(CMAKE_REQUIRED_LINK_OPTIONS) include(CheckStructHasMember) diff --git a/cmake/config.h.in b/cmake/config.h.in index 5151e053d..b4e412f7f 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -88,6 +88,9 @@ // Define if you have the "posix_fallocate. #cmakedefine HAVE_POSIX_FALLOCATE +// Define if you have the "pthread_mutexattr_setpshared" function. +#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETPSHARED + // Define if you have the header file. #cmakedefine HAVE_PWD_H diff --git a/src/system.hpp b/src/system.hpp index bf4a26a47..ae4ca521e 100644 --- a/src/system.hpp +++ b/src/system.hpp @@ -171,7 +171,7 @@ DLLIMPORT extern char** environ; # define O_BINARY 0 #endif -#ifdef HAVE_SYS_MMAN_H +#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_PTHREAD_MUTEXATTR_SETPSHARED) # define INODE_CACHE_SUPPORTED #endif