Entry *mp_children; /* pointer to first child */
struct monitorsubsys *mp_info; /* subsystem info */
#define mp_type mp_info->mss_type
- int mp_flags; /* flags */
+ unsigned long mp_flags; /* flags */
-#define MONITOR_F_NONE 0x00
-#define MONITOR_F_SUB 0x01 /* subentry of subsystem */
-#define MONITOR_F_PERSISTENT 0x10 /* persistent entry */
-#define MONITOR_F_PERSISTENT_CH 0x20 /* subsystem generates
+#define MONITOR_F_NONE 0x00U
+#define MONITOR_F_SUB 0x01U /* subentry of subsystem */
+#define MONITOR_F_PERSISTENT 0x10U /* persistent entry */
+#define MONITOR_F_PERSISTENT_CH 0x20U /* subsystem generates
persistent entries */
-#define MONITOR_F_VOLATILE 0x40 /* volatile entry */
-#define MONITOR_F_VOLATILE_CH 0x80 /* subsystem generates
+#define MONITOR_F_VOLATILE 0x40U /* volatile entry */
+#define MONITOR_F_VOLATILE_CH 0x80U /* subsystem generates
volatile entries */
+/* NOTE: flags with 0xF0000000U mask are reserved for subsystem internals */
+
int (*mp_update)( Operation *op, Entry *e );
/* update callback
for user-defined entries */
struct berval mss_dn;
struct berval mss_ndn;
int mss_flags;
+#define MONITOR_F_OPENED 0x10000000U
#define MONITOR_HAS_VOLATILE_CH( mp ) \
( ( mp )->mp_flags & MONITOR_F_VOLATILE_CH )
*/
BackendDB *be_monitor = NULL;
+static struct monitorsubsys **monitor_subsys = NULL;
+static int monitor_subsys_opened = 0;
+
/*
* subsystem data
+ *
+ * the known subsystems are added to the subsystems
+ * array at backend initialization; other subsystems
+ * may be added by calling monitor_back_register_subsys()
+ * before the database is opened (e.g. by other backends
+ * or by overlays or modules).
*/
static struct monitorsubsys known_monitor_subsys[] = {
{
#endif /* SLAPD_MONITOR */
-static struct monitorsubsys **monitor_subsys = NULL;
-
int
monitor_back_register_subsys( monitorsubsys *ms )
{
monitor_subsys[ i ] = ms;
monitor_subsys[ i + 1 ] = NULL;
+ /* if a subsystem is registered __AFTER__ subsystem
+ * initialization (depending on the sequence the databases
+ * are listed in slapd.conf), init it */
+ if ( monitor_subsys_opened ) {
+
+ /* FIXME: this should only be possible
+ * if be_monitor is already initialized */
+ assert( be_monitor );
+
+ if ( ms->mss_open && ( *ms->mss_open )( be_monitor, ms ) ) {
+ return -1;
+ }
+
+ ms->mss_flags |= MONITOR_F_OPENED;
+ }
+
return 0;
}
Entry *e, **ep;
struct monitorentrypriv *mp;
int i;
- char buf[ BACKMONITOR_BUFSIZE ], *end_of_line;
+ char buf[ BACKMONITOR_BUFSIZE ],
+ *end_of_line;
struct berval bv;
struct tm *tms;
#ifdef HAVE_GMTIME_R
{
return( -1 );
}
+ ms[ 0 ]->mss_flags |= MONITOR_F_OPENED;
}
+ monitor_subsys_opened = 1;
+
return( 0 );
}