]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Disable inode cache on OSes without pthread_mutexattr_setpshared() (#791)
authorStuart Henderson <sthen@users.noreply.github.com>
Mon, 25 Jan 2021 18:41:54 +0000 (18:41 +0000)
committerGitHub <noreply@github.com>
Mon, 25 Jan 2021 18:41:54 +0000 (19:41 +0100)
The inode cache requires pthread_mutexattr_setpshared() and build fails on OSes
with sys/mman.h that do not have this function.

CMakeLists.txt
cmake/GenerateConfigurationFile.cmake
cmake/config.h.in
src/system.hpp

index 11447717d783ca4c542c002995c9279522c1aee0..40e21a57120414e9b88dec92fc6c85676a84d280 100644 (file)
@@ -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()
 
index afa3b78ba505b39b5cc7821b1c722c9bd9f03c4b..6e6b60487119a96e42d9462709aa7af4f32c1aaf 100644 (file)
@@ -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)
index 5151e053d10412009e812e4203777c10787b93b9..b4e412f7f07f5dcb2e0f4de227bbd3c99e753b4b 100644 (file)
@@ -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 <pwd.h> header file.
 #cmakedefine HAVE_PWD_H
 
index bf4a26a47bbd5db623eead69fc26e9ed6b4b6687..ae4ca521e4b674b8e905fb887f19a3846c06f4df 100644 (file)
@@ -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