* Added locking of currenttime_mutex to protect call(s) to localtime().
*/
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "slap.h"
-#include "ldapconfig.h"
+#include "portable.h"
-#if defined( SLAPD_MONITOR_DN )
+#include <stdio.h>
-extern int nbackends;
-extern Backend *backends;
-extern int active_threads;
-extern int dtblsize;
-extern Connection *c;
-extern long ops_initiated;
-extern long ops_completed;
-extern long num_entries_sent;
-extern long num_bytes_sent;
-extern time_t currenttime;
-extern time_t starttime;
-extern int num_conns;
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
-extern pthread_mutex_t new_conn_mutex;
-extern pthread_mutex_t currenttime_mutex;
+#include "ldapconfig.h"
+#include "slap.h"
-extern char Versionstr[];
+#if defined( SLAPD_MONITOR_DN )
void
monitor_info( Connection *conn, Operation *op )
/* initialize reader/writer lock */
entry_rdwr_init(e);
e->e_attrs = NULL;
- e->e_dn = strdup( SLAPD_MONITOR_DN );
+ e->e_dn = ch_strdup( SLAPD_MONITOR_DN );
val.bv_val = Versionstr;
if (( p = strchr( Versionstr, '\n' )) == NULL ) {
nreadwaiters++;
}
pthread_mutex_lock( ¤ttime_mutex );
-#ifdef LDAP_Y2K
+#ifndef LDAP_LOCALTIME
ltm = gmtime( &c[i].c_starttime );
strftime( buf2, sizeof(buf2), "%Y%m%d%H%M%SZ", ltm );
#else
pthread_mutex_unlock( ¤ttime_mutex );
pthread_mutex_lock( &c[i].c_dnmutex );
- sprintf( buf, "%d : %s : %ld : %ld : %s : %s%s", i,
+ sprintf( buf, "%d : %s : %d : %d : %s : %s%s", i,
buf2, c[i].c_opsinitiated, c[i].c_opscompleted,
c[i].c_dn ? c[i].c_dn : "NULLDN",
c[i].c_gettingber ? "r" : "",
attr_merge( e, "bytessent", vals );
pthread_mutex_lock( ¤ttime_mutex );
-#ifdef LDAP_Y2K
+#ifndef LDAP_LOCALTIME
ltm = gmtime( ¤ttime );
strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
#else
attr_merge( e, "currenttime", vals );
pthread_mutex_lock( ¤ttime_mutex );
-#ifdef LDAP_Y2K
+#ifndef LDAP_LOCALTIME
ltm = gmtime( &starttime );
strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
#else
val.bv_len = strlen( buf );
attr_merge( e, "nbackends", vals );
-#ifdef THREAD_SUNOS5_LWP
+#ifdef HAVE_THR
sprintf( buf, "%d", thr_getconcurrency() );
val.bv_val = buf;
val.bv_len = strlen( buf );