]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/thread.c
more (in)sanity stuff
[openldap] / servers / slapd / back-monitor / thread.c
index 1aa22e51c81b6f91ed5264c5445d8b5d86386007..c76acaa86468941669261ff0e7bd336aa0b81ab4 100644 (file)
 
 #include <ldap_rq.h>
 
+static int 
+monitor_subsys_thread_update( 
+       Operation               *op,
+       SlapReply               *rs,
+       Entry                   *e );
+
 /*
- * initializes log subentry
-*   */
+ * initializes log subentry
+ */
 int
 monitor_subsys_thread_init(
        BackendDB               *be,
@@ -43,6 +49,8 @@ monitor_subsys_thread_init(
        Entry           *e, **ep, *e_thread;
        static char     buf[ BACKMONITOR_BUFSIZE ];
 
+       ms->mss_update = monitor_subsys_thread_update;
+
        mi = ( monitor_info_t * )be->be_private;
 
        if ( monitor_cache_get( mi, &ms->mss_ndn, &e_thread ) ) {
@@ -216,11 +224,11 @@ monitor_subsys_thread_init(
        return( 0 );
 }
 
-int 
+static int 
 monitor_subsys_thread_update( 
        Operation               *op,
-       Entry                   *e
-)
+       SlapReply               *rs,
+       Entry                   *e )
 {
        monitor_info_t  *mi = ( monitor_info_t * )op->o_bd->be_private;
        Attribute               *a;
@@ -235,19 +243,22 @@ monitor_subsys_thread_update(
        assert( mi != NULL );
 
        dnRdn( &e->e_nname, &rdn );
-       if ( dn_match( &rdn, &backload_bv ))
+       if ( dn_match( &rdn, &backload_bv ) ) {
                which = 1;
-       else if ( dn_match( &rdn, &runqueue_bv ))
+
+       } else if ( dn_match( &rdn, &runqueue_bv ) ) {
                which = 2;
-       else
-               return 0;
+
+       } else {
+               return SLAP_CB_CONTINUE;
+       }
 
        a = attr_find( e->e_attrs, mi->mi_ad_monitoredInfo );
        if ( a == NULL ) {
-               return -1;
+               return rs->sr_err = LDAP_OTHER;
        }
 
-       switch( which ) {
+       switch ( which ) {
        case 1:
                snprintf( buf, sizeof( buf ), "%d", 
                        ldap_pvt_thread_pool_backload( &connection_pool ) );
@@ -258,10 +269,11 @@ monitor_subsys_thread_update(
                a->a_vals[ 0 ].bv_len = len;
                AC_MEMCPY( a->a_vals[ 0 ].bv_val, buf, len + 1 );
                break;
+
        case 2:
-               for (i=0; !BER_BVISNULL( a->a_vals+i ); i++) {
+               for ( i = 0; !BER_BVISNULL( a->a_vals + i ); i++) {
                        ch_free( a->a_vals[i].bv_val );
-                       BER_BVZERO( a->a_vals+i );
+                       BER_BVZERO( a->a_vals + i );
                }
                bv.bv_val = buf;
                ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
@@ -276,6 +288,6 @@ monitor_subsys_thread_update(
 
        /* FIXME: touch modifyTimestamp? */
 
-       return( 0 );
+       return SLAP_CB_CONTINUE;
 }