X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-ldbm%2Fdbcache.c;h=4beef6dd6e32082585d2e8f3272ecaa2da6a3821;hb=e002f7adb3cc38a31da59a14dc67c5715f0b0993;hp=c16c8b160dfdfe210188465c5e9f19fe74636ad4;hpb=42e0d83cb3a1a1c5b25183f1ab74ce7edbe25de7;p=openldap diff --git a/servers/slapd/back-ldbm/dbcache.c b/servers/slapd/back-ldbm/dbcache.c index c16c8b160d..4beef6dd6e 100644 --- a/servers/slapd/back-ldbm/dbcache.c +++ b/servers/slapd/back-ldbm/dbcache.c @@ -1,24 +1,23 @@ /* ldbmcache.c - maintain a cache of open ldbm files */ +#include "portable.h" + #include -#include -#include -#include -#include -#include + +#include +#include +#include +#include + #include -#include -#include "portable.h" -#include "slap.h" -#include "ldapconfig.h" -#include "back-ldbm.h" -#ifndef SYSERRLIST_IN_STDIO -extern int sys_nerr; -extern char *sys_errlist[]; +#ifdef HAVE_SYS_PARAM_H +#include #endif -extern time_t currenttime; -extern pthread_mutex_t currenttime_mutex; + +#include "ldapconfig.h" +#include "slap.h" +#include "back-ldbm.h" struct dbcache * ldbm_cache_open( @@ -101,7 +100,7 @@ ldbm_cache_open( pthread_mutex_unlock( &li->li_dbcache_mutex ); return( NULL ); } - li->li_dbcache[i].dbc_name = strdup( buf ); + li->li_dbcache[i].dbc_name = ch_strdup( buf ); li->li_dbcache[i].dbc_refcnt = 1; li->li_dbcache[i].dbc_lastref = curtime; if ( stat( buf, &st ) == 0 ) { @@ -115,7 +114,7 @@ ldbm_cache_open( li->li_dbcache[i].dbc_maxids) + 1; Debug( LDAP_DEBUG_ARGS, - "ldbm_cache_open (blksize %d) (maxids %d) (maxindirect %d)\n", + "ldbm_cache_open (blksize %ld) (maxids %d) (maxindirect %d)\n", li->li_dbcache[i].dbc_blksize, li->li_dbcache[i].dbc_maxids, li->li_dbcache[i].dbc_maxindirect ); Debug( LDAP_DEBUG_TRACE, "<= ldbm_cache_open (opened %d)\n", i, 0, 0 ); @@ -176,6 +175,9 @@ ldbm_cache_fetch( ) { Datum data; +#ifdef HAVE_BERKELEY_DB2 + memset( &data, 0, sizeof( data ) ); +#endif pthread_mutex_lock( &db->dbc_mutex ); #ifdef reentrant_database @@ -216,6 +218,24 @@ ldbm_cache_store( } #endif +#ifdef LDBM_DEBUG + Statslog( LDAP_DEBUG_STATS, + "=> ldbm_cache_store(): key.dptr=%s, key.dsize=%d\n", + key.dptr, key.dsize, 0, 0, 0 ); + + Statslog( LDAP_DEBUG_STATS, + "=> ldbm_cache_store(): key.dptr=0x%08x, data.dptr=0x%0 8x\n", + key.dptr, data.dptr, 0, 0, 0 ); + + Statslog( LDAP_DEBUG_STATS, + "=> ldbm_cache_store(): data.dptr=%s, data.dsize=%d\n", + data.dptr, data.dsize, 0, 0, 0 ); + + Statslog( LDAP_DEBUG_STATS, + "=> ldbm_cache_store(): flags=0x%08x\n", + flags, 0, 0, 0, 0 ); +#endif /* LDBM_DEBUG */ + rc = ldbm_store( db->dbc_db, key, data, flags ); pthread_mutex_unlock( &db->dbc_mutex );