From 759b44135a6e8e5fe04f27f5c3ae7511596a6e09 Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Thu, 3 Dec 2015 07:47:17 +0000 Subject: [PATCH] Check pthread prtability in configure as additional change for #307 --- configure.ac | 23 +++++++++++++++++++++++ src/fdcache.cpp | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index db9a005..70d8c65 100644 --- a/configure.ac +++ b/configure.ac @@ -228,6 +228,29 @@ dnl ---------------------------------------------- dnl malloc_trim function AC_CHECK_FUNCS([malloc_trim]) +dnl ---------------------------------------------- +dnl check symbols/macros/enums +dnl ---------------------------------------------- +dnl PTHREAD_MUTEX_RECURSIVE +AC_MSG_CHECKING([pthread mutex recursive]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_MUTEX_RECURSIVE;]]) + ], + [AC_DEFINE(S3FS_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE, [Define if you have PTHREAD_MUTEX_RECURSIVE]) + AC_MSG_RESULT(PTHREAD_MUTEX_RECURSIVE) + ], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_MUTEX_RECURSIVE_NP;]]) + ], + [AC_DEFINE(S3FS_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, [Define if you have PTHREAD_MUTEX_RECURSIVE_NP]) + AC_MSG_RESULT(PTHREAD_MUTEX_RECURSIVE_NP) + ], + [AC_MSG_ERROR([do not have PTHREAD_MUTEX_RECURSIVE symbol])]) + ] +) + dnl ---------------------------------------------- dnl output files dnl ---------------------------------------------- diff --git a/src/fdcache.cpp b/src/fdcache.cpp index f9634db..2593b5a 100644 --- a/src/fdcache.cpp +++ b/src/fdcache.cpp @@ -619,7 +619,7 @@ FdEntity::FdEntity(const char* tpath, const char* cpath) try{ pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); // recursive mutex + pthread_mutexattr_settype(&attr, S3FS_MUTEX_RECURSIVE); // recursive mutex pthread_mutex_init(&fdent_lock, &attr); is_lock_init = true; }catch(exception& e){