#include <ac/string.h>
#include <ac/time.h>
-#include "portable.h"
#include "slap.h"
/*
#endif
int ldap_syslog_level = LOG_DEBUG;
-char *default_referral;
-time_t starttime;
-ldap_pvt_thread_t listener_tid;
+struct berval **default_referral = NULL;
int g_argc;
char **g_argv;
ldap_pvt_thread_mutex_t active_threads_mutex;
ldap_pvt_thread_cond_t active_threads_cond;
-time_t currenttime;
-ldap_pvt_thread_mutex_t currenttime_mutex;
-
-ldap_pvt_thread_mutex_t new_conn_mutex;
-
+ldap_pvt_thread_mutex_t gmtime_mutex;
#ifdef SLAPD_CRYPT
ldap_pvt_thread_mutex_t crypt_mutex;
#endif
int num_conns;
-long ops_initiated;
-long ops_completed;
-ldap_pvt_thread_mutex_t ops_mutex;
+long num_ops_initiated;
+long num_ops_completed;
+ldap_pvt_thread_mutex_t num_ops_mutex;
long num_entries_sent;
+long num_refs_sent;
long num_bytes_sent;
+long num_pdu_sent;
ldap_pvt_thread_mutex_t num_sent_mutex;
/*
* these mutexes must be used when calling the entry2str()
static char* slap_name;
int slapMode = SLAP_UNDEFINED_MODE;
+static ldap_pvt_thread_mutex_t currenttime_mutex;
+
int
slap_init( int mode, char *name )
{
case SLAP_TOOL_MODE:
#ifdef SLAPD_BDB2
case SLAP_TIMEDSERVER_MODE:
+ case SLAP_TOOLID_MODE:
#endif
Debug( LDAP_DEBUG_TRACE,
ldap_pvt_thread_mutex_init( &active_threads_mutex );
ldap_pvt_thread_cond_init( &active_threads_cond );
- ldap_pvt_thread_mutex_init( &new_conn_mutex );
ldap_pvt_thread_mutex_init( ¤ttime_mutex );
ldap_pvt_thread_mutex_init( &entry2str_mutex );
ldap_pvt_thread_mutex_init( &replog_mutex );
- ldap_pvt_thread_mutex_init( &ops_mutex );
+ ldap_pvt_thread_mutex_init( &num_ops_mutex );
ldap_pvt_thread_mutex_init( &num_sent_mutex );
+
+ ldap_pvt_thread_mutex_init( &gmtime_mutex );
#ifdef SLAPD_CRYPT
ldap_pvt_thread_mutex_init( &crypt_mutex );
#endif
rc = backend_destroy();
+ ldap_pvt_thread_destroy();
+
/* should destory the above mutex */
return rc;
}
+/* should create a utils.c for these */
+time_t slap_get_time(void)
+{
+ time_t t;
+ ldap_pvt_thread_mutex_lock( ¤ttime_mutex );
+ time( &t );
+ ldap_pvt_thread_mutex_unlock( ¤ttime_mutex );
+ return t;
+}