From c2a02618bbdec48981e924963df14cbb6ac3afbb Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 6 Dec 2007 01:51:32 +0000 Subject: [PATCH] BDB 4.2 compatibility for log_printf (requires modern C preprocessor) --- servers/slapd/back-bdb/back-bdb.h | 9 +++++++++ servers/slapd/back-bdb/cache.c | 4 ++-- servers/slapd/back-bdb/delete.c | 8 ++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index 9b9020b1d3..6e49d132a2 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -312,6 +312,15 @@ struct bdb_op_info { #define TXN_ID(txn) (txn)->locker #endif +/* env->log_printf appeared in 4.4 */ +#if DB_VERSION_FULL >= 0x04040000 +#define LOG_PRINTF(env,txn,fmt,...) (env)->log_printf((env),(txn),(fmt),__VA_ARGS__) +#else +extern int __db_logmsg(const DB_ENV *env, DB_TXN *txn, const char *op, u_int32_t flags, + const char *fmt,...); +#define LOG_PRINTF(env,txn,fmt,...) __db_logmsg((env),(txn),"DIAGNOSTIC",0,(fmt),__VA_ARGS__) +#endif + #endif #ifndef DB_BUFFER_SMALL diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 58794b89a2..93be806635 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -438,7 +438,7 @@ bdb_cache_find_ndn( bdb_cache_entryinfo_unlock( eip ); #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) - bdb->bi_dbenv->log_printf( bdb->bi_dbenv, NULL, "slapd Reading %s", + LOG_PRINTF( bdb->bi_dbenv, NULL, "slapd Reading %s", ei.bei_nrdn.bv_val ); #endif @@ -450,7 +450,7 @@ bdb_cache_find_ndn( } #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) - bdb->bi_dbenv->log_printf( bdb->bi_dbenv, NULL, "slapd Read got %s(%d)", + LOG_PRINTF( bdb->bi_dbenv, NULL, "slapd Read got %s(%d)", ei.bei_nrdn.bv_val, ei.bei_id ); #endif diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index 8233f7ee6b..b419c1cb07 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -373,7 +373,7 @@ retry: /* transaction retry */ } #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) - bdb->bi_dbenv->log_printf( bdb->bi_dbenv, lt2, "slapd Starting delete %s(%d)", + LOG_PRINTF( bdb->bi_dbenv, lt2, "slapd Starting delete %s(%d)", e->e_nname.bv_val, e->e_id ); #endif @@ -498,7 +498,7 @@ retry: /* transaction retry */ } #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) - bdb->bi_dbenv->log_printf( bdb->bi_dbenv, lt2, "slapd Commit1 delete %s(%d)", + LOG_PRINTF( bdb->bi_dbenv, lt2, "slapd Commit1 delete %s(%d)", e->e_nname.bv_val, e->e_id ); #endif @@ -529,7 +529,7 @@ retry: /* transaction retry */ } else { #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) - bdb->bi_dbenv->log_printf( bdb->bi_dbenv, ltid, "slapd Cache delete %s(%d)", + LOG_PRINTF( bdb->bi_dbenv, ltid, "slapd Cache delete %s(%d)", e->e_nname.bv_val, e->e_id ); #endif @@ -546,7 +546,7 @@ retry: /* transaction retry */ op->o_private = NULL; #if defined(LDAP_DEBUG) && defined(LDAP_DEVEL) - bdb->bi_dbenv->log_printf( bdb->bi_dbenv, NULL, "slapd Committed delete %s(%d)", + LOG_PRINTF( bdb->bi_dbenv, NULL, "slapd Committed delete %s(%d)", e->e_nname.bv_val, e->e_id ); #endif -- 2.39.5