rework subsystem initialization (can be added dynamically...)

This commit is contained in:
Pierangelo Masarati 2004-11-08 10:10:15 +00:00
parent 9dd58533ca
commit b3ec75d032
15 changed files with 329 additions and 193 deletions

View file

@ -56,6 +56,11 @@ struct monitorentrypriv {
#define MONITOR_F_VOLATILE 0x40 /* volatile entry */
#define MONITOR_F_VOLATILE_CH 0x80 /* subsystem generates
volatile entries */
int (*mp_update)( Operation *op, Entry *e );
/* update callback
for user-defined entries */
void *mp_private; /* opaque pointer to
private data */
};
struct monitorinfo {
@ -210,7 +215,7 @@ enum {
#define SLAPD_MONITOR_RWW_DN \
SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN
struct monitorsubsys {
typedef struct monitorsubsys {
char *mss_name;
struct berval mss_rdn;
struct berval mss_dn;
@ -223,7 +228,7 @@ struct monitorsubsys {
( ( mp )->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
/* initialize entry and subentries */
int ( *mss_init )( BackendDB * );
int ( *mss_open )( BackendDB *, struct monitorsubsys *ms );
/* update existing dynamic entry and subentries */
int ( *mss_update )( Operation *, Entry * );
/* create new dynamic subentries */
@ -231,36 +236,13 @@ struct monitorsubsys {
struct berval *ndn, Entry *, Entry ** );
/* modify entry and subentries */
int ( *mss_modify )( Operation *, Entry * );
};
extern struct monitorsubsys monitor_subsys[];
} monitorsubsys;
extern BackendDB *be_monitor;
/* increase this bufsize if entries in string form get too big */
#define BACKMONITOR_BUFSIZE 1024
/*
* cache
*/
extern int monitor_cache_cmp LDAP_P(( const void *c1, const void *c2 ));
extern int monitor_cache_dup LDAP_P(( void *c1, void *c2 ));
extern int monitor_cache_add LDAP_P(( struct monitorinfo *mi, Entry *e ));
extern int monitor_cache_get LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep ));
extern int monitor_cache_dn2entry LDAP_P(( Operation *op, struct berval *ndn, Entry **ep, Entry **matched ));
extern int monitor_cache_lock LDAP_P(( Entry *e ));
extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e ));
/*
* update
*/
extern int monitor_entry_update LDAP_P(( Operation *op, Entry *e ));
extern int monitor_entry_create LDAP_P(( Operation *op, struct berval *ndn,
Entry *e_parent, Entry **ep ));
extern int monitor_entry_modify LDAP_P(( Operation *op, Entry *e ));
LDAP_END_DECL
#include "proto-back-monitor.h"

View file

@ -33,24 +33,35 @@
*/
int
monitor_subsys_backend_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
Entry *e_backend, **ep;
int i;
struct monitorentrypriv *mp;
monitorsubsys *ms_database;
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_BACKEND].mss_ndn,
&e_backend ) )
ms_database = monitor_back_get_subsys( SLAPD_MONITOR_DATABASE_NAME );
if ( ms_database == NULL ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_backend_init: "
"unable to get "
"\"" SLAPD_MONITOR_DATABASE_NAME "\" "
"subsystem\n",
0, 0, 0 );
return -1;
}
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_backend ) )
{
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_backend_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_BACKEND].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -77,7 +88,7 @@ monitor_subsys_backend_init(
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
i,
monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
i,
@ -91,7 +102,7 @@ monitor_subsys_backend_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_backend_init: "
"unable to create entry \"cn=Backend %d,%s\"\n",
i, monitor_subsys[SLAPD_MONITOR_BACKEND].mss_ndn.bv_val, 0 );
i, ms->mss_ndn.bv_val, 0 );
return( -1 );
}
@ -123,7 +134,7 @@ monitor_subsys_backend_init(
}
snprintf( buf, sizeof( buf ), "cn=Database %d,%s",
j, monitor_subsys[SLAPD_MONITOR_DATABASE].mss_dn.bv_val );
j, ms_database->mss_dn.bv_val );
dn.bv_val = buf;
dn.bv_len = strlen( buf );
@ -135,8 +146,8 @@ monitor_subsys_backend_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_BACKEND];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_BACKEND].mss_flags
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags
| MONITOR_F_SUB;
if ( monitor_cache_add( mi, e ) ) {
@ -144,7 +155,7 @@ monitor_subsys_backend_init(
"monitor_subsys_backend_init: "
"unable to add entry \"cn=Backend %d,%s\"\n",
i,
monitor_subsys[SLAPD_MONITOR_BACKEND].mss_ndn.bv_val, 0 );
ms->mss_ndn.bv_val, 0 );
return( -1 );
}

View file

@ -30,7 +30,8 @@
int
monitor_subsys_conn_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
@ -44,13 +45,11 @@ monitor_subsys_conn_init(
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_CONN].mss_ndn, &e_conn ) )
{
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_conn ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_conn_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_CONN].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -70,7 +69,7 @@ monitor_subsys_conn_init(
"modifiersName: %s\n"
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
mi->mi_creatorsName.bv_val,
@ -83,7 +82,7 @@ monitor_subsys_conn_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_conn_init: "
"unable to create entry \"cn=Total,%s\"\n",
monitor_subsys[SLAPD_MONITOR_CONN].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -94,8 +93,8 @@ monitor_subsys_conn_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_CONN];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_CONN].mss_flags \
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags \
| MONITOR_F_SUB | MONITOR_F_PERSISTENT;
mp->mp_flags &= ~MONITOR_F_VOLATILE_CH;
@ -103,7 +102,7 @@ monitor_subsys_conn_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_conn_init: "
"unable to add entry \"cn=Total,%s\"\n",
monitor_subsys[SLAPD_MONITOR_CONN].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -122,7 +121,7 @@ monitor_subsys_conn_init(
"modifiersName: %s\n"
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
mi->mi_creatorsName.bv_val,
@ -135,7 +134,7 @@ monitor_subsys_conn_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_conn_init: "
"unable to create entry \"cn=Current,%s\"\n",
monitor_subsys[SLAPD_MONITOR_CONN].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -146,8 +145,8 @@ monitor_subsys_conn_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_CONN];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_CONN].mss_flags \
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags \
| MONITOR_F_SUB | MONITOR_F_PERSISTENT;
mp->mp_flags &= ~MONITOR_F_VOLATILE_CH;
@ -155,7 +154,7 @@ monitor_subsys_conn_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_conn_init: "
"unable to add entry \"cn=Current,%s\"\n",
monitor_subsys[SLAPD_MONITOR_CONN].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -227,7 +226,8 @@ static int
conn_create(
struct monitorinfo *mi,
Connection *c,
Entry **ep
Entry **ep,
monitorsubsys *ms
)
{
struct monitorentrypriv *mp;
@ -292,7 +292,7 @@ conn_create(
"modifiersName: %s\n"
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
c->c_connid, monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
c->c_connid, ms->mss_dn.bv_val,
mi->mi_oc_monitorConnection->soc_cname.bv_val,
mi->mi_oc_monitorConnection->soc_cname.bv_val,
c->c_connid,
@ -309,7 +309,7 @@ conn_create(
"unable to create entry "
"\"cn=Connection %ld,%s\" entry\n",
c->c_connid,
monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val, 0 );
ms->mss_dn.bv_val, 0 );
return( -1 );
}
@ -399,7 +399,7 @@ conn_create(
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
mp->mp_info = &monitor_subsys[ SLAPD_MONITOR_CONN ];
mp->mp_info = ms;
mp->mp_children = NULL;
mp->mp_flags = MONITOR_F_SUB | MONITOR_F_VOLATILE;
@ -423,11 +423,14 @@ monitor_subsys_conn_create(
int connindex;
struct monitorentrypriv *mp;
int rc = 0;
monitorsubsys *ms;
assert( mi != NULL );
assert( e_parent != NULL );
assert( ep != NULL );
ms = (( struct monitorentrypriv *)e_parent->e_private)->mp_info;
*ep = NULL;
if ( ndn == NULL ) {
@ -438,7 +441,7 @@ monitor_subsys_conn_create(
for ( c = connection_first( &connindex );
c != NULL;
c = connection_next( c, &connindex )) {
if ( conn_create( mi, c, &e ) || e == NULL ) {
if ( conn_create( mi, c, &e, ms ) || e == NULL ) {
for ( ; e_tmp != NULL; ) {
mp = ( struct monitorentrypriv * )e_tmp->e_private;
e = mp->mp_next;
@ -484,7 +487,7 @@ monitor_subsys_conn_create(
c != NULL;
c = connection_next( c, &connindex )) {
if ( c->c_connid == connid ) {
if ( conn_create( mi, c, ep ) || *ep == NULL ) {
if ( conn_create( mi, c, ep, ms ) || *ep == NULL ) {
rc = -1;
}

View file

@ -96,26 +96,48 @@ init_restrictedOperation( struct monitorinfo *mi, Entry *e, slap_mask_t restrict
int
monitor_subsys_database_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
Entry *e_database, **ep;
int i;
struct monitorentrypriv *mp;
monitorsubsys *ms_backend,
*ms_overlay;
assert( be != NULL );
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn,
&e_database ) )
{
ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
if ( ms_backend == NULL ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_database_init: "
"unable to get "
"\"" SLAPD_MONITOR_BACKEND_NAME "\" "
"subsystem\n",
0, 0, 0 );
return -1;
}
ms_overlay = monitor_back_get_subsys( SLAPD_MONITOR_OVERLAY_NAME );
if ( ms_overlay == NULL ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_database_init: "
"unable to get "
"\"" SLAPD_MONITOR_OVERLAY_NAME "\" "
"subsystem\n",
0, 0, 0 );
return -1;
}
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_database ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_database_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -159,7 +181,7 @@ monitor_subsys_database_init(
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
i,
monitor_subsys[SLAPD_MONITOR_DATABASE].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
i,
@ -175,7 +197,7 @@ monitor_subsys_database_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_database_init: "
"unable to create entry \"cn=Database %d,%s\"\n",
i, monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val, 0 );
i, ms->mss_ndn.bv_val, 0 );
return( -1 );
}
@ -215,7 +237,7 @@ monitor_subsys_database_init(
snprintf( buf, sizeof( buf ),
"cn=Overlay %d,%s",
j, monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_dn.bv_val );
j, ms_overlay->mss_dn.bv_val );
bv.bv_val = buf;
bv.bv_len = strlen( buf );
attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
@ -241,7 +263,7 @@ monitor_subsys_database_init(
snprintf( buf, sizeof( buf ),
"cn=Backend %d,%s",
j, monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val );
j, ms_backend->mss_dn.bv_val );
bv.bv_val = buf;
bv.bv_len = strlen( buf );
attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
@ -256,15 +278,15 @@ monitor_subsys_database_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_DATABASE];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_DATABASE].mss_flags
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags
| MONITOR_F_SUB;
if ( monitor_cache_add( mi, e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_database_init: "
"unable to add entry \"cn=Database %d,%s\"\n",
i, monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val, 0 );
i, ms->mss_ndn.bv_val, 0 );
return( -1 );
}

View file

@ -30,8 +30,10 @@ monitor_entry_update(
Entry *e
)
{
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
struct monitorinfo *mi =
(struct monitorinfo *)op->o_bd->be_private;
struct monitorentrypriv *mp;
int rc = 0;
assert( mi != NULL );
assert( e != NULL );
@ -39,12 +41,15 @@ monitor_entry_update(
mp = ( struct monitorentrypriv * )e->e_private;
if ( mp->mp_info && mp->mp_info->mss_update ) {
return ( *mp->mp_info->mss_update )( op, e );
rc = ( *mp->mp_info->mss_update )( op, e );
}
return( 0 );
if ( rc == 0 && mp->mp_update ) {
rc = ( *mp->mp_update )( op, e );
}
return rc;
}
int

View file

@ -39,7 +39,7 @@ BackendDB *be_monitor = NULL;
/*
* subsystem data
*/
struct monitorsubsys monitor_subsys[] = {
static struct monitorsubsys known_monitor_subsys[] = {
{
SLAPD_MONITOR_BACKEND_NAME,
BER_BVNULL, BER_BVNULL, BER_BVNULL,
@ -163,12 +163,79 @@ init_module( int argc, char *argv[] )
#endif /* SLAPD_MONITOR */
static struct monitorsubsys **monitor_subsys = NULL;
int
monitor_back_register_subsys( monitorsubsys *ms )
{
int i = 0;
if ( monitor_subsys ) {
for ( ; monitor_subsys[ i ] != NULL; i++ )
/* just count'em */ ;
}
monitor_subsys = ch_realloc( monitor_subsys,
( 2 + i ) * sizeof( monitorsubsys * ) );
if ( monitor_subsys == NULL ) {
return -1;
}
monitor_subsys[ i ] = ms;
monitor_subsys[ i + 1 ] = NULL;
return 0;
}
monitorsubsys *
monitor_back_get_subsys( const char *name )
{
if ( monitor_subsys != NULL ) {
int i;
for ( i = 0; monitor_subsys[ i ] != NULL; i++ ) {
if ( strcasecmp( monitor_subsys[ i ]->mss_name, name ) == 0 ) {
return monitor_subsys[ i ];
}
}
}
return NULL;
}
monitorsubsys *
monitor_back_get_subsys_by_dn( struct berval *ndn, int sub )
{
if ( monitor_subsys != NULL ) {
int i;
if ( sub ) {
for ( i = 0; monitor_subsys[ i ] != NULL; i++ ) {
if ( dnIsSuffix( ndn, &monitor_subsys[ i ]->mss_ndn ) ) {
return monitor_subsys[ i ];
}
}
} else {
for ( i = 0; monitor_subsys[ i ] != NULL; i++ ) {
if ( dn_match( ndn, &monitor_subsys[ i ]->mss_ndn ) ) {
return monitor_subsys[ i ];
}
}
}
}
return NULL;
}
int
monitor_back_initialize(
BackendInfo *bi
)
{
static char *controls[] = {
monitorsubsys *ms;
static char *controls[] = {
LDAP_CONTROL_MANAGEDSAIT,
LDAP_CONTROL_VALUESRETURNFILTER,
NULL
@ -222,6 +289,12 @@ monitor_back_initialize(
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
for ( ms = known_monitor_subsys; ms->mss_name != NULL; ms++ ) {
if ( monitor_back_register_subsys( ms ) ) {
return -1;
}
}
return 0;
}
@ -602,7 +675,7 @@ monitor_back_db_open(
)
{
struct monitorinfo *mi = (struct monitorinfo *)be->be_private;
struct monitorsubsys *ms;
struct monitorsubsys **ms;
Entry *e, **ep;
struct monitorentrypriv *mp;
int i;
@ -732,16 +805,16 @@ monitor_back_db_open(
/*
* Create all the subsystem specific entries
*/
for ( i = 0; monitor_subsys[ i ].mss_name != NULL; i++ ) {
int len = strlen( monitor_subsys[ i ].mss_name );
for ( i = 0; monitor_subsys[ i ] != NULL; i++ ) {
int len = strlen( monitor_subsys[ i ]->mss_name );
struct berval dn;
int rc;
dn.bv_len = len + sizeof( "cn=" ) - 1;
dn.bv_val = ch_calloc( sizeof( char ), dn.bv_len + 1 );
strcpy( dn.bv_val, "cn=" );
strcat( dn.bv_val, monitor_subsys[ i ].mss_name );
rc = dnPretty( NULL, &dn, &monitor_subsys[ i ].mss_rdn, NULL );
strcat( dn.bv_val, monitor_subsys[ i ]->mss_name );
rc = dnPretty( NULL, &dn, &monitor_subsys[ i ]->mss_rdn, NULL );
free( dn.bv_val );
if ( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
@ -752,10 +825,10 @@ monitor_back_db_open(
dn.bv_len += sizeof( SLAPD_MONITOR_DN ); /* 1 for the , */
dn.bv_val = ch_malloc( dn.bv_len + 1 );
strcpy( dn.bv_val , monitor_subsys[ i ].mss_rdn.bv_val );
strcpy( dn.bv_val , monitor_subsys[ i ]->mss_rdn.bv_val );
strcat( dn.bv_val, "," SLAPD_MONITOR_DN );
rc = dnPrettyNormal( NULL, &dn, &monitor_subsys[ i ].mss_dn,
&monitor_subsys[ i ].mss_ndn, NULL );
rc = dnPrettyNormal( NULL, &dn, &monitor_subsys[ i ]->mss_dn,
&monitor_subsys[ i ]->mss_ndn, NULL );
free( dn.bv_val );
if ( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
@ -773,10 +846,10 @@ monitor_back_db_open(
"modifiersName: %s\n"
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_subsys[ i ].mss_dn.bv_val,
monitor_subsys[ i ]->mss_dn.bv_val,
mi->mi_oc_monitorContainer->soc_cname.bv_val,
mi->mi_oc_monitorContainer->soc_cname.bv_val,
monitor_subsys[ i ].mss_name,
monitor_subsys[ i ]->mss_name,
mi->mi_creatorsName.bv_val,
mi->mi_creatorsName.bv_val,
mi->mi_startTime.bv_val,
@ -787,21 +860,21 @@ monitor_back_db_open(
if ( e == NULL) {
Debug( LDAP_DEBUG_ANY,
"unable to create \"%s\" entry\n",
monitor_subsys[ i ].mss_dn.bv_val, 0, 0 );
monitor_subsys[ i ]->mss_dn.bv_val, 0, 0 );
return( -1 );
}
mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_info = &monitor_subsys[ i ];
mp->mp_info = monitor_subsys[ i ];
mp->mp_children = NULL;
mp->mp_flags = monitor_subsys[ i ].mss_flags;
mp->mp_flags = monitor_subsys[ i ]->mss_flags;
if ( monitor_cache_add( mi, e ) ) {
Debug( LDAP_DEBUG_ANY,
"unable to add entry \"%s\" to cache\n",
monitor_subsys[ i ].mss_dn.bv_val, 0, 0 );
monitor_subsys[ i ]->mss_dn.bv_val, 0, 0 );
return -1;
}
@ -814,10 +887,11 @@ monitor_back_db_open(
be->be_private = mi;
/*
* opens the monitor backend
* opens the monitor backend subsystems
*/
for ( ms = monitor_subsys; ms->mss_name != NULL; ms++ ) {
if ( ms->mss_init && ( *ms->mss_init )( be ) ) {
for ( ms = monitor_subsys; ms[ 0 ] != NULL; ms++ ) {
if ( ms[ 0 ]->mss_open && ( *ms[ 0 ]->mss_open )( be, ms[ 0 ] ) )
{
return( -1 );
}
}

View file

@ -28,7 +28,8 @@
int
monitor_subsys_listener_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
@ -53,13 +54,13 @@ monitor_subsys_listener_init(
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_LISTENER].mss_ndn,
&ms->mss_ndn,
&e_listener ) )
{
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_listener_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_LISTENER].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -83,7 +84,7 @@ monitor_subsys_listener_init(
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
i,
monitor_subsys[SLAPD_MONITOR_LISTENER].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
i,
@ -100,7 +101,7 @@ monitor_subsys_listener_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_listener_init: "
"unable to create entry \"cn=Listener %d,%s\"\n",
i, monitor_subsys[SLAPD_MONITOR_LISTENER].mss_ndn.bv_val, 0 );
i, ms->mss_ndn.bv_val, 0 );
return( -1 );
}
@ -129,15 +130,15 @@ monitor_subsys_listener_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_LISTENER];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_LISTENER].mss_flags
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags
| MONITOR_F_SUB;
if ( monitor_cache_add( mi, e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_listener_init: "
"unable to add entry \"cn=Listener %d,%s\"\n",
i, monitor_subsys[SLAPD_MONITOR_LISTENER].mss_ndn.bv_val, 0 );
i, ms->mss_ndn.bv_val, 0 );
return( -1 );
}

View file

@ -70,7 +70,8 @@ static int replace_values( Entry *e, Modification *mod, int *newlevel );
*/
int
monitor_subsys_log_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
@ -86,12 +87,12 @@ monitor_subsys_log_init(
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi, &monitor_subsys[SLAPD_MONITOR_LOG].mss_ndn,
if ( monitor_cache_get( mi, &ms->mss_ndn,
&e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_log_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_LOG].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}

View file

@ -47,7 +47,8 @@ struct monitor_ops_t {
int
monitor_subsys_ops_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
@ -63,12 +64,12 @@ monitor_subsys_ops_init(
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn, &e_op ) )
&ms->mss_ndn, &e_op ) )
{
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_ops_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val,
ms->mss_ndn.bv_val,
0, 0 );
return( -1 );
}
@ -99,7 +100,7 @@ monitor_subsys_ops_init(
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_op[ i ].rdn.bv_val,
monitor_subsys[SLAPD_MONITOR_OPS].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitorOperation->soc_cname.bv_val,
mi->mi_oc_monitorOperation->soc_cname.bv_val,
&monitor_op[ i ].rdn.bv_val[STRLENOF( "cn=" )],
@ -116,7 +117,7 @@ monitor_subsys_ops_init(
"monitor_subsys_ops_init: "
"unable to create entry \"%s,%s\"\n",
monitor_op[ i ].rdn.bv_val,
monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
ms->mss_ndn.bv_val, 0 );
return( -1 );
}
@ -128,8 +129,8 @@ monitor_subsys_ops_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_OPS];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_OPS].mss_flags \
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags \
| MONITOR_F_SUB | MONITOR_F_PERSISTENT;
if ( monitor_cache_add( mi, e ) ) {
@ -137,7 +138,7 @@ monitor_subsys_ops_init(
"monitor_subsys_ops_init: "
"unable to add entry \"%s,%s\"\n",
monitor_op[ i ].rdn.bv_val,
monitor_subsys[SLAPD_MONITOR_OPS].mss_ndn.bv_val, 0 );
ms->mss_ndn.bv_val, 0 );
return( -1 );
}

View file

@ -32,7 +32,8 @@
*/
int
monitor_subsys_overlay_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
@ -40,17 +41,29 @@ monitor_subsys_overlay_init(
int i;
struct monitorentrypriv *mp;
slap_overinst *on;
monitorsubsys *ms_database;
mi = ( struct monitorinfo * )be->be_private;
ms_database = monitor_back_get_subsys( SLAPD_MONITOR_DATABASE_NAME );
if ( ms_database == NULL ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_backend_init: "
"unable to get "
"\"" SLAPD_MONITOR_DATABASE_NAME "\" "
"subsystem\n",
0, 0, 0 );
return -1;
}
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn,
&ms->mss_ndn,
&e_overlay ) )
{
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_overlay_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -74,7 +87,7 @@ monitor_subsys_overlay_init(
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
i,
monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
i,
@ -88,7 +101,7 @@ monitor_subsys_overlay_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_overlay_init: "
"unable to create entry \"cn=Overlay %d,%s\"\n",
i, monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 0 );
i, ms->mss_ndn.bv_val, 0 );
return( -1 );
}
@ -122,7 +135,7 @@ monitor_subsys_overlay_init(
}
snprintf( buf, sizeof( buf ), "cn=Database %d,%s",
j, monitor_subsys[SLAPD_MONITOR_DATABASE].mss_dn.bv_val );
j, ms_database->mss_dn.bv_val );
dn.bv_val = buf;
dn.bv_len = strlen( buf );
@ -134,15 +147,15 @@ monitor_subsys_overlay_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_OVERLAY];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_flags
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags
| MONITOR_F_SUB;
if ( monitor_cache_add( mi, e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_overlay_init: "
"unable to add entry \"cn=Overlay %d,%s\"\n",
i, monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 0 );
i, ms->mss_ndn.bv_val, 0 );
return( -1 );
}

View file

@ -27,76 +27,98 @@
LDAP_BEGIN_DECL
/*
* entry
*/
int monitor_entry_test_flags LDAP_P(( struct monitorentrypriv *mp, int cond ));
/*
* backends
*/
int monitor_subsys_backend_init LDAP_P(( BackendDB *be ));
int monitor_subsys_backend_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
/*
* databases
* cache
*/
int monitor_subsys_database_init LDAP_P(( BackendDB *be ));
int monitor_subsys_database_modify LDAP_P(( Operation *op, Entry *e ));
/*
* threads
*/
int monitor_subsys_thread_init LDAP_P(( BackendDB *be ));
int monitor_subsys_thread_update LDAP_P(( Operation *op, Entry *e ));
extern int monitor_cache_cmp LDAP_P(( const void *c1, const void *c2 ));
extern int monitor_cache_dup LDAP_P(( void *c1, void *c2 ));
extern int monitor_cache_add LDAP_P(( struct monitorinfo *mi, Entry *e ));
extern int monitor_cache_get LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry **ep ));
extern int monitor_cache_dn2entry LDAP_P(( Operation *op, struct berval *ndn, Entry **ep, Entry **matched ));
extern int monitor_cache_lock LDAP_P(( Entry *e ));
extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e ));
/*
* connections
*/
int monitor_subsys_conn_init LDAP_P(( BackendDB *be ));
int monitor_subsys_conn_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_conn_update LDAP_P(( Operation *op, Entry *e ));
int monitor_subsys_conn_create LDAP_P(( Operation *op, struct berval *ndn,
Entry *e_parent, Entry **ep ));
/*
* waiters
* databases
*/
int monitor_subsys_rww_init LDAP_P(( BackendDB *be ));
int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
int monitor_subsys_database_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_database_modify LDAP_P(( Operation *op, Entry *e ));
/*
* entry
*/
extern int monitor_entry_update LDAP_P(( Operation *op, Entry *e ));
extern int monitor_entry_create LDAP_P(( Operation *op, struct berval *ndn,
Entry *e_parent, Entry **ep ));
extern int monitor_entry_modify LDAP_P(( Operation *op, Entry *e ));
int monitor_entry_test_flags LDAP_P(( struct monitorentrypriv *mp, int cond ));
/*
* init
*/
extern int monitor_back_register_subsys LDAP_P(( monitorsubsys *ms ));
extern monitorsubsys * monitor_back_get_subsys LDAP_P(( const char *name ));
extern monitorsubsys * monitor_back_get_subsys_by_dn LDAP_P(( struct berval *ndn, int sub ));
/*
* listener
*/
int monitor_subsys_listener_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
/*
* log
*/
int monitor_subsys_log_init LDAP_P(( BackendDB *be ));
int monitor_subsys_log_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e ));
/*
* operations
*/
int monitor_subsys_ops_init LDAP_P(( BackendDB *be ));
int monitor_subsys_ops_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e ));
/*
* overlay
*/
int monitor_subsys_overlay_init LDAP_P(( BackendDB *be ));
int monitor_subsys_overlay_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
/*
* sent
*/
int monitor_subsys_sent_init LDAP_P(( BackendDB *be ));
int monitor_subsys_sent_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_sent_update LDAP_P(( Operation *op, Entry *e ));
/*
* listener
* threads
*/
int monitor_subsys_listener_init LDAP_P(( BackendDB *be ));
int monitor_subsys_thread_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_thread_update LDAP_P(( Operation *op, Entry *e ));
/*
* time
*/
int monitor_subsys_time_init LDAP_P(( BackendDB *be ));
int monitor_subsys_time_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e ));
/*
* waiters
*/
int monitor_subsys_rww_init LDAP_P(( BackendDB *be, monitorsubsys *ms ));
int monitor_subsys_rww_update LDAP_P(( Operation *op, Entry *e ));
/* NOTE: this macro assumes that bv has been allocated
* by ber_* malloc functions or is { 0L, NULL } */
#if defined(HAVE_BIGNUM)

View file

@ -46,7 +46,8 @@ struct monitor_rww_t {
int
monitor_subsys_rww_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
@ -60,11 +61,11 @@ monitor_subsys_rww_init(
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn, &e_conn ) ) {
&ms->mss_ndn, &e_conn ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_rww_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -87,7 +88,7 @@ monitor_subsys_rww_init(
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_rww[i].rdn.bv_val,
monitor_subsys[SLAPD_MONITOR_RWW].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
&monitor_rww[i].rdn.bv_val[STRLENOF("cn")],
@ -101,7 +102,7 @@ monitor_subsys_rww_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_rww_init: "
"unable to create entry \"cn=Read,%s\"\n",
monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -116,8 +117,8 @@ monitor_subsys_rww_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_RWW];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_RWW].mss_flags \
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags \
| MONITOR_F_SUB | MONITOR_F_PERSISTENT;
if ( monitor_cache_add( mi, e ) ) {
@ -125,7 +126,7 @@ monitor_subsys_rww_init(
"monitor_subsys_rww_init: "
"unable to add entry \"%s,%s\"\n",
monitor_rww[i].rdn.bv_val,
monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0 );
ms->mss_ndn.bv_val, 0 );
return( -1 );
}

View file

@ -49,7 +49,8 @@ struct monitor_sent_t {
int
monitor_subsys_sent_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
@ -62,12 +63,11 @@ monitor_subsys_sent_init(
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_SENT].mss_ndn, &e_sent ) ) {
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_sent ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_sent_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_SENT].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -90,7 +90,7 @@ monitor_subsys_sent_init(
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_sent[i].rdn.bv_val,
monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
&monitor_sent[i].rdn.bv_val[STRLENOF( "cn=" )],
@ -105,7 +105,7 @@ monitor_subsys_sent_init(
"monitor_subsys_sent_init: "
"unable to create entry \"%s,%s\"\n",
monitor_sent[i].rdn.bv_val,
monitor_subsys[SLAPD_MONITOR_SENT].mss_ndn.bv_val, 0 );
ms->mss_ndn.bv_val, 0 );
return( -1 );
}
@ -120,8 +120,8 @@ monitor_subsys_sent_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_SENT];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_SENT].mss_flags \
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags \
| MONITOR_F_SUB | MONITOR_F_PERSISTENT;
if ( monitor_cache_add( mi, e ) ) {
@ -129,7 +129,7 @@ monitor_subsys_sent_init(
"monitor_subsys_sent_init: "
"unable to add entry \"%s,%s\"\n",
monitor_sent[i].rdn.bv_val,
monitor_subsys[SLAPD_MONITOR_SENT].mss_ndn.bv_val, 0 );
ms->mss_ndn.bv_val, 0 );
return( -1 );
}

View file

@ -32,7 +32,8 @@
* */
int
monitor_subsys_thread_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
@ -42,12 +43,10 @@ monitor_subsys_thread_init(
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn, &e_thread ) )
{
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_thread ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_thread_init: unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn.bv_val,
ms->mss_ndn.bv_val,
0, 0 );
return( -1 );
}
@ -69,7 +68,7 @@ monitor_subsys_thread_init(
"modifiersName: %s\n"
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_subsys[SLAPD_MONITOR_THREAD].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_ad_monitoredInfo->ad_cname.bv_val,
@ -84,7 +83,7 @@ monitor_subsys_thread_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_thread_init: "
"unable to create entry \"cn=Max,%s\"\n",
monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -92,15 +91,15 @@ monitor_subsys_thread_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_THREAD];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_THREAD].mss_flags \
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags \
| MONITOR_F_SUB | MONITOR_F_PERSISTENT;
if ( monitor_cache_add( mi, e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_thread_init: "
"unable to add entry \"cn=Max,%s\"\n",
monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -120,7 +119,7 @@ monitor_subsys_thread_init(
"modifiersName: %s\n"
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_subsys[SLAPD_MONITOR_THREAD].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_ad_monitoredInfo->ad_cname.bv_val,
@ -134,7 +133,7 @@ monitor_subsys_thread_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_thread_init: "
"unable to create entry \"cn=Backload,%s\"\n",
monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -142,15 +141,15 @@ monitor_subsys_thread_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_THREAD];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_THREAD].mss_flags \
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags \
| MONITOR_F_SUB | MONITOR_F_PERSISTENT;
if ( monitor_cache_add( mi, e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_thread_init: "
"unable to add entry \"cn=Backload,%s\"\n",
monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}

View file

@ -33,7 +33,8 @@
int
monitor_subsys_time_init(
BackendDB *be
BackendDB *be,
monitorsubsys *ms
)
{
struct monitorinfo *mi;
@ -47,11 +48,11 @@ monitor_subsys_time_init(
mi = ( struct monitorinfo * )be->be_private;
if ( monitor_cache_get( mi,
&monitor_subsys[SLAPD_MONITOR_TIME].mss_ndn, &e_time ) ) {
&ms->mss_ndn, &e_time ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_time_init: "
"unable to get entry \"%s\"\n",
monitor_subsys[SLAPD_MONITOR_TIME].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -69,7 +70,7 @@ monitor_subsys_time_init(
"modifiersName: %s\n"
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_ad_monitorTimestamp->ad_cname.bv_val,
@ -84,7 +85,7 @@ monitor_subsys_time_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_time_init: "
"unable to create entry \"cn=Start,%s\"\n",
monitor_subsys[SLAPD_MONITOR_TIME].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -92,15 +93,15 @@ monitor_subsys_time_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_TIME];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_TIME].mss_flags \
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags \
| MONITOR_F_SUB | MONITOR_F_PERSISTENT;
if ( monitor_cache_add( mi, e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_time_init: "
"unable to add entry \"cn=Start,%s\"\n",
monitor_subsys[SLAPD_MONITOR_TIME].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -120,7 +121,7 @@ monitor_subsys_time_init(
"modifiersName: %s\n"
"createTimestamp: %s\n"
"modifyTimestamp: %s\n",
monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
ms->mss_dn.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_ad_monitorTimestamp->ad_cname.bv_val,
@ -135,7 +136,7 @@ monitor_subsys_time_init(
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_time_init: "
"unable to create entry \"cn=Current,%s\"\n",
monitor_subsys[SLAPD_MONITOR_TIME].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}
@ -143,15 +144,15 @@ monitor_subsys_time_init(
e->e_private = ( void * )mp;
mp->mp_next = NULL;
mp->mp_children = NULL;
mp->mp_info = &monitor_subsys[SLAPD_MONITOR_TIME];
mp->mp_flags = monitor_subsys[SLAPD_MONITOR_TIME].mss_flags \
mp->mp_info = ms;
mp->mp_flags = ms->mss_flags \
| MONITOR_F_SUB | MONITOR_F_PERSISTENT;
if ( monitor_cache_add( mi, e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_time_init: "
"unable to add entry \"cn=Current,%s\"\n",
monitor_subsys[SLAPD_MONITOR_TIME].mss_ndn.bv_val, 0, 0 );
ms->mss_ndn.bv_val, 0, 0 );
return( -1 );
}