Log In
Log In
Places
All Projects
Status Monitor
Collapse sidebar
zimbra:collaboration:8.7
zimbra-openldap
ITS8054.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ITS8054.patch of Package zimbra-openldap
--- openldap-2.4.42/include/ldap_log.h.orig 2015-11-10 01:01:26.985735377 -0600 +++ openldap-2.4.42/include/ldap_log.h 2015-11-10 00:48:08.855541248 -0600 @@ -190,6 +190,21 @@ if ( ldap_syslog & (level) ) \ syslog( LDAP_LEVEL_MASK((severity)), (fmt), (arg1), (arg2), (arg3), (arg4), (arg5) ); \ } while ( 0 ) +#define Log6( level, severity, fmt, arg1, arg2, arg3, arg4, arg5, arg6 ) \ + do { \ + if ( ldap_debug & (level) ) \ + lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3), (arg4), (arg5), (arg6) ); \ + if ( ldap_syslog & (level) ) \ + syslog( LDAP_LEVEL_MASK((severity)), (fmt), (arg1), (arg2), (arg3), (arg4), (arg5), (arg6) ); \ + } while ( 0 ) +#define Log7( level, severity, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7 ) \ + do { \ + if ( ldap_debug & (level) ) \ + lutil_debug( ldap_debug, (level), (fmt), (arg1), (arg2), (arg3), (arg4), (arg5), (arg6), (arg7) ); \ + if ( ldap_syslog & (level) ) \ + syslog( LDAP_LEVEL_MASK((severity)), (fmt), (arg1), (arg2), (arg3), (arg4), (arg5), (arg6), (arg7) ); \ + } while ( 0 ) + #define Debug( level, fmt, arg1, arg2, arg3 ) \ Log3( (level), ldap_syslog_level, (fmt), (arg1), (arg2), (arg3) ) #define LogTest(level) ( ( ldap_debug | ldap_syslog ) & (level) ) --- openldap-2.4.42/servers/slapd/operation.c.orig 2015-11-10 01:01:45.205734770 -0600 +++ openldap-2.4.42/servers/slapd/operation.c 2015-11-10 01:00:50.616141579 -0600 @@ -38,8 +38,7 @@ #endif static ldap_pvt_thread_mutex_t slap_op_mutex; -static time_t last_time; -static int last_incr; +static struct timeval last_time; void slap_op_init(void) { @@ -159,16 +158,31 @@ void slap_op_time(time_t *t, int *nop) { + struct timeval tv; +#if SLAP_STATS_ETIME + gettimeofday( &tv, NULL ); +#else + tv.tv_sec = slap_get_time(); + tv.tv_usec = 0; +#endif ldap_pvt_thread_mutex_lock( &slap_op_mutex ); - *t = slap_get_time(); - if ( *t == last_time ) { - *nop = ++last_incr; - } else { - last_time = *t; - last_incr = 0; - *nop = 0; + /* Usually tv.tv_sec cannot be < last_time.tv_sec + * but it might happen if we wrapped around tv_usec. + */ + if ( tv.tv_sec <= last_time.tv_sec && + tv.tv_usec <= last_time.tv_usec ) { + tv.tv_sec = last_time.tv_sec; + tv.tv_usec = last_time.tv_usec + 1; } + if (tv.tv_usec >= 1000000) { + tv.tv_usec -= 1000000; + tv.tv_sec++; + last_time.tv_sec = tv.tv_sec; + } + last_time.tv_usec = tv.tv_usec; ldap_pvt_thread_mutex_unlock( &slap_op_mutex ); + *t = tv.tv_sec; + *nop = tv.tv_usec; } Operation * --- openldap-2.4.42/servers/slapd/result.c.orig 2015-11-10 01:01:49.685734621 -0600 +++ openldap-2.4.42/servers/slapd/result.c 2015-11-10 00:44:38.219548266 -0600 @@ -37,6 +37,24 @@ #include "slap.h" +#if SLAP_STATS_ETIME +#define ETIME_SETUP \ + struct timeval now; \ + (void) gettimeofday( &now, NULL ); \ + now.tv_sec -= op->o_time; \ + now.tv_usec -= op->o_tincr; \ + if ( now.tv_usec < 0 ) { \ + --now.tv_sec; now.tv_usec += 1000000; \ + } +#define ETIME_LOGFMT "etime=%d.%06d " +#define StatslogEtime(lvl,fmt,pfx,tag,err,etxt,xtra) \ + Statslog7(lvl,fmt,pfx,tag,err,(int)now.tv_sec,(int)now.tv_usec,etxt,xtra) +#else +#define ETIME_SETUP +#define ETIME_LOGFMT "" +#define StatslogEtime Statslog +#endif /* SLAP_STATS_ETIME */ + const struct berval slap_dummy_bv = BER_BVNULL; int slap_null_cb( Operation *op, SlapReply *rs ) @@ -794,8 +812,9 @@ } if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { - Statslog( LDAP_DEBUG_STATS, - "%s DISCONNECT tag=%lu err=%d text=%s\n", + ETIME_SETUP; + StatslogEtime( LDAP_DEBUG_STATS, + "%s DISCONNECT tag=%lu err=%d "ETIME_LOGFMT"text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_text ? rs->sr_text : "", 0 ); } @@ -859,14 +878,15 @@ } if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { + ETIME_SETUP; if ( op->o_tag == LDAP_REQ_SEARCH ) { - Statslog( LDAP_DEBUG_STATS, - "%s SEARCH RESULT tag=%lu err=%d nentries=%d text=%s\n", + StatslogEtime( LDAP_DEBUG_STATS, + "%s SEARCH RESULT tag=%lu err=%d "ETIME_LOGFMT"nentries=%d text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_nentries, rs->sr_text ? rs->sr_text : "" ); } else { - Statslog( LDAP_DEBUG_STATS, - "%s RESULT tag=%lu err=%d text=%s\n", + StatslogEtime( LDAP_DEBUG_STATS, + "%s RESULT tag=%lu err=%d "ETIME_LOGFMT"text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_text ? rs->sr_text : "", 0 ); } @@ -892,8 +912,9 @@ rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0; if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { - Statslog( LDAP_DEBUG_STATS, - "%s RESULT tag=%lu err=%d text=%s\n", + ETIME_SETUP; + StatslogEtime( LDAP_DEBUG_STATS, + "%s RESULT tag=%lu err=%d "ETIME_LOGFMT"text=%s\n", op->o_log_prefix, rs->sr_tag, rs->sr_err, rs->sr_text ? rs->sr_text : "", 0 ); } @@ -916,8 +937,9 @@ rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0; if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) { - Statslog( LDAP_DEBUG_STATS, - "%s RESULT oid=%s err=%d text=%s\n", + ETIME_SETUP; + StatslogEtime( LDAP_DEBUG_STATS, + "%s RESULT oid=%s err=%d "ETIME_LOGFMT"text=%s\n", op->o_log_prefix, rs->sr_rspoid ? rs->sr_rspoid : "", rs->sr_err, rs->sr_text ? rs->sr_text : "", 0 ); } --- openldap-2.4.42/servers/slapd/slap.h.orig 2015-11-10 01:01:38.853734982 -0600 +++ openldap-2.4.42/servers/slapd/slap.h 2015-11-10 00:44:38.219548266 -0600 @@ -74,6 +74,10 @@ #define SLAP_CONTROL_X_SESSION_TRACKING #define SLAP_DISTPROC +#ifndef SLAP_STATS_ETIME +#define SLAP_STATS_ETIME 1 /* microsecond op timing */ +#endif + #ifdef ENABLE_REWRITE #define SLAP_AUTH_REWRITE 1 /* use librewrite for sasl-regexp */ #endif @@ -2960,6 +2964,10 @@ #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \ Log5( (level), ldap_syslog_level, (fmt), (connid), (opid), (arg1), (arg2), (arg3) ) +#define Statslog6( level, fmt, a1, a2, a3, a4, a5, a6 ) \ + Log6( (level), ldap_syslog_level, (fmt), (a1), (a2), (a3), (a4), (a5), (a6) ) +#define Statslog7( level, fmt, a1, a2, a3, a4, a5, a6, a7 ) \ + Log7( (level), ldap_syslog_level, (fmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7) ) #define StatslogTest( level ) ((ldap_debug | ldap_syslog) & (level)) #else /* !LDAP_SYSLOG */ #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \ @@ -2967,10 +2975,22 @@ if ( ldap_debug & (level) ) \ lutil_debug( ldap_debug, (level), (fmt), (connid), (opid), (arg1), (arg2), (arg3) );\ } while (0) +#define Statslog6( level, fmt, a1, a2, a3, a4, a5, a6 ) \ + do { \ + if ( ldap_debug & (level) ) \ + lutil_debug( ldap_debug, (level), (fmt), (a1), (a2), (a3), (a4), (a5), (a6) ); \ + } while (0) +#define Statslog7( level, fmt, a1, a2, a3, a4, a5, a6, a7 ) \ + do { \ + if ( ldap_debug & (level) ) \ + lutil_debug( ldap_debug, (level), (fmt), (a1), (a2), (a3), (a4), (a5), (a6), (a7) ); \ + } while (0) #define StatslogTest( level ) (ldap_debug & (level)) #endif /* !LDAP_SYSLOG */ #else /* !LDAP_DEBUG */ #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) ((void) 0) +#define Statslog6( level, fmt, a1, a2, a3, a4, a5, a6 ) ((void) 0) +#define Statslog7( level, fmt, a1, a2, a3, a4, a5, a6, a7 ) ((void) 0) #define StatslogTest( level ) (0) #endif /* !LDAP_DEBUG */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Contact
Support
@OBShq
The Open Build Service is an
openSUSE project
.
Log In
Places
Places
All Projects
Status Monitor