Commit 02bbf1e2 authored by Witold Krecicki's avatar Witold Krecicki Committed by Ondřej Surý

Add --enable-pthread-rwlock option

parent 4501f646
Pipeline #15335 passed with stages
in 17 minutes and 51 seconds
......@@ -556,6 +556,9 @@
/* define if PKCS11 is used for Public-Key Cryptography */
#undef USE_PKCS11
/* Define if you want to use pthread rwlock implementation */
#undef USE_PTHREAD_RWLOCK
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
......
......@@ -900,6 +900,7 @@ enable_devpoll
with_geoip
with_locktype
with_libtool
enable_pthread_rwlock
with_openssl
enable_fips_mode
with_cc_alg
......@@ -1599,6 +1600,8 @@ Optional Features:
--enable-kqueue use BSD kqueue when available [default=yes]
--enable-epoll use Linux epoll when available [default=auto]
--enable-devpoll use /dev/poll when available [default=yes]
--enable-pthread-rwlock use pthread rwlock instead of internal rwlock
implementation (EXPERIMENTAL)
--enable-fips-mode enable FIPS mode in OpenSSL library [default=no]
--enable-native-pkcs11 use native PKCS11 for public-key crypto [default=no]
--enable-backtrace log stack backtrace on abort [default=yes]
......@@ -15615,7 +15618,19 @@ $as_echo "no" >&6; }
esac
for ac_func in pthread_rwlock_rdlock
#
# Do we want to use pthread rwlock? (useful for ThreadSanitizer)
#
# Check whether --enable-pthread_rwlock was given.
if test "${enable_pthread_rwlock+set}" = set; then :
enableval=$enable_pthread_rwlock;
else
enable_pthread_rwlock=no
fi
if test "$enable_pthread_rwlock" = "yes"; then :
for ac_func in pthread_rwlock_rdlock
do :
ac_fn_c_check_func "$LINENO" "pthread_rwlock_rdlock" "ac_cv_func_pthread_rwlock_rdlock"
if test "x$ac_cv_func_pthread_rwlock_rdlock" = xyes; then :
......@@ -15623,10 +15638,17 @@ if test "x$ac_cv_func_pthread_rwlock_rdlock" = xyes; then :
#define HAVE_PTHREAD_RWLOCK_RDLOCK 1
_ACEOF
else
as_fn_error $? "pthread_rwlock_rdlock requested but not found" "$LINENO" 5
fi
done
$as_echo "#define USE_PTHREAD_RWLOCK 1" >>confdefs.h
fi
CRYPTO=OpenSSL
#
......
......@@ -733,7 +733,19 @@ case $use_libtool in
esac
AC_SUBST(INSTALL_LIBRARY)
AC_CHECK_FUNCS([pthread_rwlock_rdlock])
#
# Do we want to use pthread rwlock? (useful for ThreadSanitizer)
#
AC_ARG_ENABLE([pthread_rwlock],
[AS_HELP_STRING([--enable-pthread-rwlock],
[use pthread rwlock instead of internal rwlock implementation (EXPERIMENTAL)])],
[], [enable_pthread_rwlock=no])
AS_IF([test "$enable_pthread_rwlock" = "yes"],
[AC_CHECK_FUNCS([pthread_rwlock_rdlock], [],
[AC_MSG_ERROR([pthread_rwlock_rdlock requested but not found])])
AC_DEFINE([USE_PTHREAD_RWLOCK],[1],[Define if you want to use pthread rwlock implementation])
])
CRYPTO=OpenSSL
......
......@@ -32,14 +32,14 @@ typedef enum {
isc_rwlocktype_write
} isc_rwlocktype_t;
#if HAVE_PTHREAD_RWLOCK_RDLOCK
#if USE_PTHREAD_RWLOCK
struct isc_rwlock {
pthread_rwlock_t rwlock;
atomic_bool downgrade;
};
#else /* HAVE_PTHREAD_RWLOCK_RDLOCK */
#else /* USE_PTHREAD_RWLOCK */
struct isc_rwlock {
/* Unlocked. */
......@@ -78,7 +78,7 @@ struct isc_rwlock {
};
#endif /* HAVE_PTHREAD_RWLOCK_RDLOCK */
#endif /* USE_PTHREAD_RWLOCK */
isc_result_t
isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
......
......@@ -27,7 +27,7 @@
#include <isc/rwlock.h>
#include <isc/util.h>
#if HAVE_PTHREAD_RWLOCK_RDLOCK
#if USE_PTHREAD_RWLOCK
#include <errno.h>
#include <pthread.h>
......@@ -645,4 +645,4 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
return (ISC_R_SUCCESS);
}
#endif /* HAVE_PTHREAD_RWLOCK_RDLOCK */
#endif /* USE_PTHREAD_RWLOCK */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment