Skip to content

Commit ec6c04c

Browse files
committed
Use portable variant of some pthread functions instead non-portable one (non-portable was needed for ancient glibc versions)
(cherry picked from commit 00665ba)
1 parent 1f2fcff commit ec6c04c

File tree

9 files changed

+39
-39
lines changed

9 files changed

+39
-39
lines changed

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,9 +1167,9 @@ AC_CHECK_FUNCS(clock_gettime)
11671167

11681168
dnl Checks for pthread functions
11691169
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
1170-
AC_CHECK_FUNCS(pthread_mutexattr_setrobust_np)
1171-
AC_CHECK_FUNCS(pthread_mutex_consistent_np)
1172-
AC_CHECK_FUNCS(pthread_rwlockattr_setkind_np)
1170+
AC_CHECK_FUNCS(pthread_mutexattr_setrobust)
1171+
AC_CHECK_FUNCS(pthread_mutex_consistent)
1172+
AC_CHECK_FUNCS(pthread_rwlockattr_setkind)
11731173
AC_CHECK_FUNCS(pthread_cancel)
11741174
AC_CHECK_FUNCS(pthread_atfork)
11751175
AC_CHECK_FUNCS(sigset)

src/common/classes/rwlock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ class RWLock : public Reasons
209209
void init()
210210
{
211211
int code;
212-
#if defined(LINUX) && !defined(USE_VALGRIND) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP)
212+
#if defined(LINUX) && !defined(USE_VALGRIND) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND)
213213
pthread_rwlockattr_t attr;
214214
if ((code = pthread_rwlockattr_init(&attr)))
215215
system_call_failed::raise("pthread_rwlockattr_init", code);
216216
// Do not worry if target misses support for this option
217-
pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
217+
pthread_rwlockattr_setkind(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE);
218218
if ((code = pthread_rwlock_init(&lock, NULL)))
219219
system_call_failed::raise("pthread_rwlock_init", code);
220220
if ((code = pthread_rwlockattr_destroy(&attr)))

src/common/isc_s_proto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
#ifdef UNIX
5757

58-
#if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP) && defined(HAVE_PTHREAD_MUTEX_CONSISTENT_NP)
58+
#if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST) && defined(HAVE_PTHREAD_MUTEX_CONSISTENT)
5959
#define USE_ROBUST_MUTEX
6060
#endif // ROBUST mutex
6161

src/common/isc_sync.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject
14281428
if (!bugFlag)
14291429
{
14301430
#endif
1431-
LOG_PTHREAD_ERROR(pthread_mutexattr_setrobust_np(&mattr, PTHREAD_MUTEX_ROBUST_NP));
1431+
LOG_PTHREAD_ERROR(pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST));
14321432
#ifdef BUGGY_LINUX_MUTEX
14331433
}
14341434
#endif
@@ -2753,7 +2753,7 @@ void SharedMemoryBase::mutexLock()
27532753
{
27542754
// We always perform check for dead process
27552755
// Therefore may safely mark mutex as recovered
2756-
LOG_PTHREAD_ERROR(pthread_mutex_consistent_np(sh_mem_mutex->mtx_mutex));
2756+
LOG_PTHREAD_ERROR(pthread_mutex_consistent(sh_mem_mutex->mtx_mutex));
27572757
state = 0;
27582758
}
27592759
#endif
@@ -2781,7 +2781,7 @@ bool SharedMemoryBase::mutexLockCond()
27812781
{
27822782
// We always perform check for dead process
27832783
// Therefore may safely mark mutex as recovered
2784-
LOG_PTHREAD_ERROR(pthread_mutex_consistent_np(sh_mem_mutex->mtx_mutex));
2784+
LOG_PTHREAD_ERROR(pthread_mutex_consistent(sh_mem_mutex->mtx_mutex));
27852785
state = 0;
27862786
}
27872787
#endif

src/include/cross/android.arm64

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@
299299
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
300300
/* undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL */
301301

302-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
303-
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
302+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
303+
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST */
304304

305-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
306-
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT_NP */
305+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
306+
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT */
307307

308-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
309-
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP */
308+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
309+
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND */
310310

311311
/* Define to 1 if you have the <pwd.h> header file. */
312312
#define HAVE_PWD_H 1

src/include/cross/android.arme

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,14 @@
305305
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
306306
/* undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL */
307307

308-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
309-
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
308+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
309+
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST */
310310

311-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
312-
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT_NP */
311+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
312+
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT */
313313

314-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
315-
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP */
314+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
315+
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND */
316316

317317
/* Define to 1 if you have the <pwd.h> header file. */
318318
#define HAVE_PWD_H 1

src/include/cross/android.x86

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@
299299
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
300300
/* undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL */
301301

302-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
303-
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
302+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
303+
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST */
304304

305-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
306-
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT_NP */
305+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
306+
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT */
307307

308-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
309-
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP */
308+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
309+
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND */
310310

311311
/* Define to 1 if you have the <pwd.h> header file. */
312312
#define HAVE_PWD_H 1

src/include/cross/android.x86_64

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@
299299
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
300300
/* undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL */
301301

302-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
303-
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
302+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
303+
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST */
304304

305-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
306-
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT_NP */
305+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
306+
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT */
307307

308-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
309-
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP */
308+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
309+
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND */
310310

311311
/* Define to 1 if you have the <pwd.h> header file. */
312312
#define HAVE_PWD_H 1

src/include/gen/autoconfig.h.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,14 @@
481481
/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */
482482
#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 1
483483

484-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
485-
#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP 1
484+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
485+
#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETROBUST 1
486486

487-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
488-
#cmakedefine HAVE_PTHREAD_MUTEX_CONSISTENT_NP 1
487+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
488+
#cmakedefine HAVE_PTHREAD_MUTEX_CONSISTENT 1
489489

490-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
491-
#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1
490+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
491+
#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND 1
492492

493493
/* Define to 1 if you have the `qsort_r' function. */
494494
#cmakedefine HAVE_QSORT_R 1

0 commit comments

Comments
 (0)