mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-21 07:09:34 -05:00
ITS#8614 - slapd must be built threaded
This commit is contained in:
parent
9282e6edea
commit
c91bbe6eea
11 changed files with 32 additions and 106 deletions
10
configure.in
10
configure.in
|
|
@ -1680,14 +1680,10 @@ dnl When in thread environment, use
|
||||||
dnl #if defined( HAVE_REENTRANT_FUNCTIONS ) || defined( HAVE_FUNC_R )
|
dnl #if defined( HAVE_REENTRANT_FUNCTIONS ) || defined( HAVE_FUNC_R )
|
||||||
dnl func_r(...);
|
dnl func_r(...);
|
||||||
dnl #else
|
dnl #else
|
||||||
dnl # if defined( HAVE_THREADS )
|
|
||||||
dnl /* lock */
|
dnl /* lock */
|
||||||
dnl # endif
|
|
||||||
dnl func(...);
|
dnl func(...);
|
||||||
dnl # if defined( HAVE_THREADS )
|
|
||||||
dnl /* unlock */
|
dnl /* unlock */
|
||||||
dnl #endif
|
dnl #endif
|
||||||
dnl #endif
|
|
||||||
dnl
|
dnl
|
||||||
dnl HAVE_REENTRANT_FUNCTIONS is derived from:
|
dnl HAVE_REENTRANT_FUNCTIONS is derived from:
|
||||||
dnl _POSIX_REENTRANT_FUNCTIONS
|
dnl _POSIX_REENTRANT_FUNCTIONS
|
||||||
|
|
@ -1696,8 +1692,6 @@ dnl _POSIX_THREADSAFE_FUNCTIONS
|
||||||
dnl
|
dnl
|
||||||
dnl and is currently defined in <ldap_pvt_thread.h>
|
dnl and is currently defined in <ldap_pvt_thread.h>
|
||||||
dnl
|
dnl
|
||||||
dnl HAVE_THREADS is defined by <ldap_pvt_thread.h> iff -UNO_THREADS
|
|
||||||
dnl
|
|
||||||
dnl libldap/*.c should only include <ldap_pvt_thread.h> iff
|
dnl libldap/*.c should only include <ldap_pvt_thread.h> iff
|
||||||
dnl LDAP_R_COMPILE is defined. ie:
|
dnl LDAP_R_COMPILE is defined. ie:
|
||||||
dnl #ifdef LDAP_R_COMPILE
|
dnl #ifdef LDAP_R_COMPILE
|
||||||
|
|
@ -1728,6 +1722,10 @@ dnl LIBS="$save_LIBS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $ol_link_threads = no ; then
|
if test $ol_link_threads = no ; then
|
||||||
|
if test $ol_enable_slapd != no; then
|
||||||
|
AC_MSG_ERROR([slapd requires thread support])
|
||||||
|
fi
|
||||||
|
|
||||||
if test $ol_with_threads = yes ; then
|
if test $ol_with_threads = yes ; then
|
||||||
AC_MSG_ERROR([no suitable thread support])
|
AC_MSG_ERROR([no suitable thread support])
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
#include <ldap_rq.h>
|
#include <ldap_rq.h>
|
||||||
|
|
||||||
#ifndef NO_THREADS
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MT_UNKNOWN,
|
MT_UNKNOWN,
|
||||||
MT_RUNQUEUE,
|
MT_RUNQUEUE,
|
||||||
|
|
@ -96,7 +95,6 @@ monitor_subsys_thread_update(
|
||||||
Operation *op,
|
Operation *op,
|
||||||
SlapReply *rs,
|
SlapReply *rs,
|
||||||
Entry *e );
|
Entry *e );
|
||||||
#endif /* ! NO_THREADS */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initializes log subentry
|
* initializes log subentry
|
||||||
|
|
@ -106,7 +104,6 @@ monitor_subsys_thread_init(
|
||||||
BackendDB *be,
|
BackendDB *be,
|
||||||
monitor_subsys_t *ms )
|
monitor_subsys_t *ms )
|
||||||
{
|
{
|
||||||
#ifndef NO_THREADS
|
|
||||||
monitor_info_t *mi;
|
monitor_info_t *mi;
|
||||||
monitor_entry_t *mp;
|
monitor_entry_t *mp;
|
||||||
Entry *e, **ep, *e_thread;
|
Entry *e, **ep, *e_thread;
|
||||||
|
|
@ -210,11 +207,9 @@ monitor_subsys_thread_init(
|
||||||
|
|
||||||
monitor_cache_release( mi, e_thread );
|
monitor_cache_release( mi, e_thread );
|
||||||
|
|
||||||
#endif /* ! NO_THREADS */
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_THREADS
|
|
||||||
static int
|
static int
|
||||||
monitor_subsys_thread_update(
|
monitor_subsys_thread_update(
|
||||||
Operation *op,
|
Operation *op,
|
||||||
|
|
@ -354,4 +349,3 @@ monitor_subsys_thread_update(
|
||||||
|
|
||||||
return SLAP_CB_CONTINUE;
|
return SLAP_CB_CONTINUE;
|
||||||
}
|
}
|
||||||
#endif /* ! NO_THREADS */
|
|
||||||
|
|
|
||||||
|
|
@ -453,11 +453,7 @@ static ConfigTable config_back_cf_table[] = {
|
||||||
"EQUALITY caseIgnoreMatch "
|
"EQUALITY caseIgnoreMatch "
|
||||||
"SYNTAX OMsDirectoryString X-ORDERED 'VALUES' )", NULL, NULL },
|
"SYNTAX OMsDirectoryString X-ORDERED 'VALUES' )", NULL, NULL },
|
||||||
{ "listener-threads", "count", 2, 0, 0,
|
{ "listener-threads", "count", 2, 0, 0,
|
||||||
#ifdef NO_THREADS
|
|
||||||
ARG_IGNORED, NULL,
|
|
||||||
#else
|
|
||||||
ARG_UINT|ARG_MAGIC|CFG_LTHREADS, &config_generic,
|
ARG_UINT|ARG_MAGIC|CFG_LTHREADS, &config_generic,
|
||||||
#endif
|
|
||||||
"( OLcfgGlAt:93 NAME 'olcListenerThreads' "
|
"( OLcfgGlAt:93 NAME 'olcListenerThreads' "
|
||||||
"EQUALITY integerMatch "
|
"EQUALITY integerMatch "
|
||||||
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
||||||
|
|
@ -727,20 +723,12 @@ static ConfigTable config_back_cf_table[] = {
|
||||||
"DESC 'Custom TCP buffer size' "
|
"DESC 'Custom TCP buffer size' "
|
||||||
"SYNTAX OMsDirectoryString )", NULL, NULL },
|
"SYNTAX OMsDirectoryString )", NULL, NULL },
|
||||||
{ "threads", "count", 2, 2, 0,
|
{ "threads", "count", 2, 2, 0,
|
||||||
#ifdef NO_THREADS
|
|
||||||
ARG_IGNORED, NULL,
|
|
||||||
#else
|
|
||||||
ARG_INT|ARG_MAGIC|CFG_THREADS, &config_generic,
|
ARG_INT|ARG_MAGIC|CFG_THREADS, &config_generic,
|
||||||
#endif
|
|
||||||
"( OLcfgGlAt:66 NAME 'olcThreads' "
|
"( OLcfgGlAt:66 NAME 'olcThreads' "
|
||||||
"EQUALITY integerMatch "
|
"EQUALITY integerMatch "
|
||||||
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
||||||
{ "threadqueues", "count", 2, 2, 0,
|
{ "threadqueues", "count", 2, 2, 0,
|
||||||
#ifdef NO_THREADS
|
|
||||||
ARG_IGNORED, NULL,
|
|
||||||
#else
|
|
||||||
ARG_INT|ARG_MAGIC|CFG_THREADQS, &config_generic,
|
ARG_INT|ARG_MAGIC|CFG_THREADQS, &config_generic,
|
||||||
#endif
|
|
||||||
"( OLcfgGlAt:95 NAME 'olcThreadQueues' "
|
"( OLcfgGlAt:95 NAME 'olcThreadQueues' "
|
||||||
"EQUALITY integerMatch "
|
"EQUALITY integerMatch "
|
||||||
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
||||||
|
|
|
||||||
|
|
@ -1772,13 +1772,6 @@ connection_input( Connection *conn , conn_readinfo *cri )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NO_THREADS
|
|
||||||
if ( conn->c_struct_state != SLAP_C_USED ) {
|
|
||||||
/* connection must have got closed underneath us */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
assert( conn->c_struct_state == SLAP_C_USED );
|
assert( conn->c_struct_state == SLAP_C_USED );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,19 +107,11 @@ static ldap_pvt_thread_mutex_t emfile_mutex;
|
||||||
static int emfile;
|
static int emfile;
|
||||||
|
|
||||||
static volatile int waking;
|
static volatile int waking;
|
||||||
#ifdef NO_THREADS
|
|
||||||
#define WAKE_LISTENER(l,w) do { \
|
|
||||||
if ((w) && ++waking < 5) { \
|
|
||||||
tcp_write( SLAP_FD2SOCK(wake_sds[l][1]), "0", 1 ); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#else /* ! NO_THREADS */
|
|
||||||
#define WAKE_LISTENER(l,w) do { \
|
#define WAKE_LISTENER(l,w) do { \
|
||||||
if (w) { \
|
if (w) { \
|
||||||
tcp_write( SLAP_FD2SOCK(wake_sds[l][1]), "0", 1 ); \
|
tcp_write( SLAP_FD2SOCK(wake_sds[l][1]), "0", 1 ); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif /* ! NO_THREADS */
|
|
||||||
|
|
||||||
volatile sig_atomic_t slapd_shutdown = 0;
|
volatile sig_atomic_t slapd_shutdown = 0;
|
||||||
volatile sig_atomic_t slapd_gentle_shutdown = 0;
|
volatile sig_atomic_t slapd_gentle_shutdown = 0;
|
||||||
|
|
@ -2738,9 +2730,9 @@ loop:
|
||||||
ldap_pvt_thread_mutex_unlock( &slap_daemon[tid].sd_mutex );
|
ldap_pvt_thread_mutex_unlock( &slap_daemon[tid].sd_mutex );
|
||||||
|
|
||||||
if ( at
|
if ( at
|
||||||
#if defined(HAVE_YIELDING_SELECT) || defined(NO_THREADS)
|
#if defined(HAVE_YIELDING_SELECT)
|
||||||
&& ( tv.tv_sec || tv.tv_usec )
|
&& ( tv.tv_sec || tv.tv_usec )
|
||||||
#endif /* HAVE_YIELDING_SELECT || NO_THREADS */
|
#endif /* HAVE_YIELDING_SELECT */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
tvp = &tv;
|
tvp = &tv;
|
||||||
|
|
|
||||||
|
|
@ -110,12 +110,7 @@ static struct slab_object * slap_replenish_sopool(struct slab_heap* sh);
|
||||||
static void print_slheap(int level, void *ctx);
|
static void print_slheap(int level, void *ctx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Keep memory context in a thread-local var, or in a global when no threads */
|
/* Keep memory context in a thread-local var */
|
||||||
#ifdef NO_THREADS
|
|
||||||
static struct slab_heap *slheap;
|
|
||||||
# define SET_MEMCTX(thrctx, memctx, sfree) ((void) (slheap = (memctx)))
|
|
||||||
# define GET_MEMCTX(thrctx, memctxp) (*(memctxp) = slheap)
|
|
||||||
#else
|
|
||||||
# define memctx_key ((void *) slap_sl_mem_init)
|
# define memctx_key ((void *) slap_sl_mem_init)
|
||||||
# define SET_MEMCTX(thrctx, memctx, kfree) \
|
# define SET_MEMCTX(thrctx, memctx, kfree) \
|
||||||
ldap_pvt_thread_pool_setkey(thrctx,memctx_key, memctx,kfree, NULL,NULL)
|
ldap_pvt_thread_pool_setkey(thrctx,memctx_key, memctx,kfree, NULL,NULL)
|
||||||
|
|
@ -123,8 +118,6 @@ static struct slab_heap *slheap;
|
||||||
((void) (*(memctxp) = NULL), \
|
((void) (*(memctxp) = NULL), \
|
||||||
(void) ldap_pvt_thread_pool_getkey(thrctx,memctx_key, memctxp,NULL), \
|
(void) ldap_pvt_thread_pool_getkey(thrctx,memctx_key, memctxp,NULL), \
|
||||||
*(memctxp))
|
*(memctxp))
|
||||||
#endif /* NO_THREADS */
|
|
||||||
|
|
||||||
|
|
||||||
/* Destroy the context, or if key==NULL clean it up for reuse. */
|
/* Destroy the context, or if key==NULL clean it up for reuse. */
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ AC_WITH_TLS=@WITH_TLS@
|
||||||
AC_TLS_TYPE=@WITH_TLS_TYPE@
|
AC_TLS_TYPE=@WITH_TLS_TYPE@
|
||||||
AC_WITH_MODULES_ENABLED=@WITH_MODULES_ENABLED@
|
AC_WITH_MODULES_ENABLED=@WITH_MODULES_ENABLED@
|
||||||
AC_ACI_ENABLED=aci@WITH_ACI_ENABLED@
|
AC_ACI_ENABLED=aci@WITH_ACI_ENABLED@
|
||||||
AC_THREADS=threads@BUILD_THREAD@
|
|
||||||
AC_LIBS_DYNAMIC=lib@BUILD_LIBS_DYNAMIC@
|
AC_LIBS_DYNAMIC=lib@BUILD_LIBS_DYNAMIC@
|
||||||
|
|
||||||
# sanitize
|
# sanitize
|
||||||
|
|
@ -78,7 +77,7 @@ export AC_ldap AC_mdb AC_meta AC_asyncmeta AC_monitor AC_null AC_perl AC_relay A
|
||||||
AC_refint AC_retcode AC_rwm AC_unique AC_syncprov AC_translucent \
|
AC_refint AC_retcode AC_rwm AC_unique AC_syncprov AC_translucent \
|
||||||
AC_valsort \
|
AC_valsort \
|
||||||
AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED AC_ACI_ENABLED \
|
AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED AC_ACI_ENABLED \
|
||||||
AC_THREADS AC_LIBS_DYNAMIC AC_WITH_TLS AC_TLS_TYPE
|
AC_LIBS_DYNAMIC AC_WITH_TLS AC_TLS_TYPE
|
||||||
|
|
||||||
if test ! -x ../servers/slapd/slapd ; then
|
if test ! -x ../servers/slapd/slapd ; then
|
||||||
echo "Could not locate slapd(8)"
|
echo "Could not locate slapd(8)"
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ WITH_TLS=${AC_WITH_TLS-no}
|
||||||
WITH_TLS_TYPE=${AC_TLS_TYPE-no}
|
WITH_TLS_TYPE=${AC_TLS_TYPE-no}
|
||||||
|
|
||||||
ACI=${AC_ACI_ENABLED-acino}
|
ACI=${AC_ACI_ENABLED-acino}
|
||||||
THREADS=${AC_THREADS-threadsno}
|
|
||||||
SLEEP0=${SLEEP0-1}
|
SLEEP0=${SLEEP0-1}
|
||||||
SLEEP1=${SLEEP1-7}
|
SLEEP1=${SLEEP1-7}
|
||||||
SLEEP2=${SLEEP2-15}
|
SLEEP2=${SLEEP2-15}
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,6 @@ if test $RWM = "rwmno" ; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $THREADS = "threadsno" ; then
|
|
||||||
echo "Need threads support, test skipped"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $WITH_SASL = "yes" ; then
|
if test $WITH_SASL = "yes" ; then
|
||||||
if test $USE_SASL != "no" ; then
|
if test $USE_SASL != "no" ; then
|
||||||
if test $USE_SASL = "yes" ; then
|
if test $USE_SASL = "yes" ; then
|
||||||
|
|
|
||||||
|
|
@ -38,23 +38,16 @@ if test "x$RELAYS" = "x" ; then
|
||||||
# back-ldap
|
# back-ldap
|
||||||
if test $BACKLDAP = ldapno ; then
|
if test $BACKLDAP = ldapno ; then
|
||||||
echo "ldap backend not available, test skipped"
|
echo "ldap backend not available, test skipped"
|
||||||
else
|
|
||||||
if test $THREADS = "threadsno" ; then
|
|
||||||
echo "Need threads support, test skipped"
|
|
||||||
else
|
else
|
||||||
if test "x$RELAYS" != "x" ; then
|
if test "x$RELAYS" != "x" ; then
|
||||||
RELAYS="${RELAYS} "
|
RELAYS="${RELAYS} "
|
||||||
fi
|
fi
|
||||||
RELAYS="${RELAYS}ldap"
|
RELAYS="${RELAYS}ldap"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# back-meta
|
# back-meta
|
||||||
if test $BACKMETA = metano ; then
|
if test $BACKMETA = metano ; then
|
||||||
echo "meta backend not available, test skipped"
|
echo "meta backend not available, test skipped"
|
||||||
else
|
|
||||||
if test $THREADS = "threadsno" ; then
|
|
||||||
echo "Need threads support, test skipped"
|
|
||||||
else
|
else
|
||||||
if test "x$RELAYS" != "x" ; then
|
if test "x$RELAYS" != "x" ; then
|
||||||
RELAYS="${RELAYS} "
|
RELAYS="${RELAYS} "
|
||||||
|
|
@ -62,7 +55,6 @@ if test "x$RELAYS" = "x" ; then
|
||||||
RELAYS="${RELAYS}meta"
|
RELAYS="${RELAYS}meta"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$RELAYS" = "x" ; then
|
if test "x$RELAYS" = "x" ; then
|
||||||
echo "no relaying capable backend is available"
|
echo "no relaying capable backend is available"
|
||||||
|
|
@ -79,17 +71,6 @@ if test -f $tmpfile ; then
|
||||||
fi
|
fi
|
||||||
first=1
|
first=1
|
||||||
for RELAY in $RELAYS ; do
|
for RELAY in $RELAYS ; do
|
||||||
RUNIT=yes
|
|
||||||
if test $THREADS = "threadsno" ; then
|
|
||||||
case $RELAY in
|
|
||||||
ldap|meta)
|
|
||||||
echo "Need threads support, test skipped"
|
|
||||||
RUNIT=no
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $RUNIT = yes ; then
|
|
||||||
if test $first = 1 ; then
|
if test $first = 1 ; then
|
||||||
first=0
|
first=0
|
||||||
else
|
else
|
||||||
|
|
@ -108,7 +89,6 @@ for RELAY in $RELAYS ; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. $SRCDIR/scripts/relay
|
. $SRCDIR/scripts/relay
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ">>>>> Test succeeded"
|
echo ">>>>> Test succeeded"
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,6 @@ if test $MONITORDB = no; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $THREADS = threadsno ; then
|
|
||||||
echo "Need threads support, test skipped"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p $TESTDIR $DBDIR1 $DBDIR2 $DBDIR3
|
mkdir -p $TESTDIR $DBDIR1 $DBDIR2 $DBDIR3
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue