Skip to content

Commit 70e7a46

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 cb61311 commit 70e7a46

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
@@ -1035,9 +1035,9 @@ AC_CHECK_FUNCS(clock_gettime)
10351035

10361036
dnl Checks for pthread functions
10371037
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
1038-
AC_CHECK_FUNCS(pthread_mutexattr_setrobust_np)
1039-
AC_CHECK_FUNCS(pthread_mutex_consistent_np)
1040-
AC_CHECK_FUNCS(pthread_rwlockattr_setkind_np)
1038+
AC_CHECK_FUNCS(pthread_mutexattr_setrobust)
1039+
AC_CHECK_FUNCS(pthread_mutex_consistent)
1040+
AC_CHECK_FUNCS(pthread_rwlockattr_setkind)
10411041
AC_CHECK_FUNCS(pthread_cancel)
10421042
AC_CHECK_FUNCS(pthread_atfork)
10431043
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
@@ -1414,7 +1414,7 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject
14141414
if (!bugFlag)
14151415
{
14161416
#endif
1417-
LOG_PTHREAD_ERROR(pthread_mutexattr_setrobust_np(&mattr, PTHREAD_MUTEX_ROBUST_NP));
1417+
LOG_PTHREAD_ERROR(pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST));
14181418
#ifdef BUGGY_LINUX_MUTEX
14191419
}
14201420
#endif
@@ -2739,7 +2739,7 @@ void SharedMemoryBase::mutexLock()
27392739
{
27402740
// We always perform check for dead process
27412741
// Therefore may safely mark mutex as recovered
2742-
LOG_PTHREAD_ERROR(pthread_mutex_consistent_np(sh_mem_mutex->mtx_mutex));
2742+
LOG_PTHREAD_ERROR(pthread_mutex_consistent(sh_mem_mutex->mtx_mutex));
27432743
state = 0;
27442744
}
27452745
#endif
@@ -2767,7 +2767,7 @@ bool SharedMemoryBase::mutexLockCond()
27672767
{
27682768
// We always perform check for dead process
27692769
// Therefore may safely mark mutex as recovered
2770-
LOG_PTHREAD_ERROR(pthread_mutex_consistent_np(sh_mem_mutex->mtx_mutex));
2770+
LOG_PTHREAD_ERROR(pthread_mutex_consistent(sh_mem_mutex->mtx_mutex));
27712771
state = 0;
27722772
}
27732773
#endif

src/include/cross/android.arm64

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.arme

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

314-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
315-
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
314+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
315+
/* #undef HAVE_PTHREAD_MUTEXATTR_SETROBUST */
316316

317-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
318-
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT_NP */
317+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
318+
/* #undef HAVE_PTHREAD_MUTEX_CONSISTENT */
319319

320-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
321-
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP */
320+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
321+
/* #undef HAVE_PTHREAD_RWLOCKATTR_SETKIND */
322322

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

src/include/cross/android.x86

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_64

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/gen/autoconfig.h.in

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

490-
/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */
491-
#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP 1
490+
/* Define to 1 if you have the `pthread_mutexattr_setrobust' function. */
491+
#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETROBUST 1
492492

493-
/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */
494-
#cmakedefine HAVE_PTHREAD_MUTEX_CONSISTENT_NP 1
493+
/* Define to 1 if you have the `pthread_mutex_consistent' function. */
494+
#cmakedefine HAVE_PTHREAD_MUTEX_CONSISTENT 1
495495

496-
/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */
497-
#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1
496+
/* Define to 1 if you have the `pthread_rwlockattr_setkind' function. */
497+
#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND 1
498498

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

0 commit comments

Comments
 (0)