Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
de903b65
Commit
de903b65
authored
Dec 22, 2001
by
Pierangelo Masarati
Browse files
added operations and sent stats to back-monitor; minor cleanup
parent
9705dcfc
Changes
12
Hide whitespace changes
Inline
Side-by-side
servers/slapd/back-monitor/Makefile.in
View file @
de903b65
...
...
@@ -4,11 +4,13 @@ SRCS = init.c search.c compare.c abandon.c modify.c bind.c \
operational.c
\
cache.c entry.c
\
backend.c database.c thread.c conn.c rww.c log.c
\
operation.c sent.c
\
dummy.c
OBJS
=
init.lo search.lo compare.lo abandon.lo modify.lo bind.lo
\
operational.lo
\
cache.lo entry.lo
\
backend.lo database.lo thread.lo conn.lo rww.lo log.lo
\
operation.lo sent.lo
\
dummy.lo
LDAP_INCDIR
=
../../../include
...
...
servers/slapd/back-monitor/back-monitor.h
View file @
de903b65
...
...
@@ -151,6 +151,20 @@ struct monitorinfo {
#define SLAPD_MONITOR_LOG_DN \
SLAPD_MONITOR_LOG_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_OPS 10
#define SLAPD_MONITOR_OPS_NAME "Operations"
#define SLAPD_MONITOR_OPS_RDN \
"cn=" SLAPD_MONITOR_OPS_NAME
#define SLAPD_MONITOR_OPS_DN \
SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_SENT 11
#define SLAPD_MONITOR_SENT_NAME "Sent"
#define SLAPD_MONITOR_SENT_RDN \
"cn=" SLAPD_MONITOR_SENT_NAME
#define SLAPD_MONITOR_SENT_DN \
SLAPD_MONITOR_SENT_RDN "," SLAPD_MONITOR_DN
struct
monitorsubsys
{
int
mss_type
;
char
*
mss_name
;
...
...
servers/slapd/back-monitor/backend.c
View file @
de903b65
...
...
@@ -156,7 +156,7 @@ monitor_subsys_backend_init(
mp
=
(
struct
monitorentrypriv
*
)
e_backend
->
e_private
;
mp
->
mp_children
=
e_tmp
;
monitor_cache_release
(
mi
,
e_backend
);
monitor_cache_release
(
mi
,
e_backend
);
return
(
0
);
}
...
...
servers/slapd/back-monitor/conn.c
View file @
de903b65
...
...
@@ -48,15 +48,17 @@ monitor_subsys_conn_init(
{
struct
monitorinfo
*
mi
;
Entry
*
e
;
struct
berval
*
bv
[
2
],
val
;
Entry
*
e
,
*
e_tmp
,
*
e_conn
;
struct
monitorentrypriv
*
mp
;
char
buf
[
1024
];
struct
berval
val
,
*
bv
[
2
]
=
{
&
val
,
NULL
};
assert
(
be
!=
NULL
);
mi
=
(
struct
monitorinfo
*
)
be
->
be_private
;
if
(
monitor_cache_get
(
mi
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
,
&
e
)
)
{
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
,
&
e
_conn
)
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_conn_init: "
...
...
@@ -72,10 +74,134 @@ monitor_subsys_conn_init(
return
(
-
1
);
}
bv
[
0
]
=
&
val
;
bv
[
1
]
=
NULL
;
e_tmp
=
NULL
;
/*
* Total conns
*/
snprintf
(
buf
,
sizeof
(
buf
),
"dn: cn=Total,%s
\n
"
"objectClass: top
\n
"
"objectClass: LDAPsubEntry
\n
"
#ifdef SLAPD_MONITORSUBENTRY
"objectClass: monitorSubEntry
\n
"
#else
/* !SLAPD_MONITORSUBENTRY */
"objectClass: extensibleObject
\n
"
#endif
/* !SLAPD_MONITORSUBENTRY */
"cn: Total
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_dn
);
e
=
str2entry
(
buf
);
if
(
e
==
NULL
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_conn_init: "
"unable to create entry 'cn=Total,%s'
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
));
#else
Debug
(
LDAP_DEBUG_ANY
,
"monitor_subsys_conn_init: "
"unable to create entry 'cn=Total,%s'
\n
%s%s"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
,
""
,
""
);
#endif
return
(
-
1
);
}
val
.
bv_val
=
"0"
;
val
.
bv_len
=
1
;
attr_merge
(
e
,
monitor_ad_desc
,
bv
);
mp
=
(
struct
monitorentrypriv
*
)
ch_calloc
(
sizeof
(
struct
monitorentrypriv
),
1
);
e
->
e_private
=
(
void
*
)
mp
;
mp
->
mp_next
=
e_tmp
;
mp
->
mp_children
=
NULL
;
mp
->
mp_info
=
&
monitor_subsys
[
SLAPD_MONITOR_CONN
];
mp
->
mp_flags
=
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_flags
\
|
MONITOR_F_SUB
|
MONITOR_F_PERSISTENT
;
mp
->
mp_flags
&=
~
MONITOR_F_VOLATILE_CH
;
if
(
monitor_cache_add
(
mi
,
e
)
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_conn_init: "
"unable to add entry 'cn=Total,%s'
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
));
#else
Debug
(
LDAP_DEBUG_ANY
,
"monitor_subsys_conn_init: "
"unable to add entry 'cn=Total,%s'
\n
%s%s"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
,
""
,
""
);
#endif
return
(
-
1
);
}
e_tmp
=
e
;
/*
* Current conns
*/
snprintf
(
buf
,
sizeof
(
buf
),
"dn: cn=Current,%s
\n
"
"objectClass: top
\n
"
"objectClass: LDAPsubEntry
\n
"
#ifdef SLAPD_MONITORSUBENTRY
"objectClass: monitorSubEntry
\n
"
#else
/* !SLAPD_MONITORSUBENTRY */
"objectClass: extensibleObject
\n
"
#endif
/* !SLAPD_MONITORSUBENTRY */
"cn: Current
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_dn
);
e
=
str2entry
(
buf
);
if
(
e
==
NULL
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_conn_init: "
"unable to create entry 'cn=Current,%s'
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
));
#else
Debug
(
LDAP_DEBUG_ANY
,
"monitor_subsys_conn_init: "
"unable to create entry 'cn=Current,%s'
\n
%s%s"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
,
""
,
""
);
#endif
return
(
-
1
);
}
mp
=
(
struct
monitorentrypriv
*
)
ch_calloc
(
sizeof
(
struct
monitorentrypriv
),
1
);
e
->
e_private
=
(
void
*
)
mp
;
mp
->
mp_next
=
e_tmp
;
mp
->
mp_children
=
NULL
;
mp
->
mp_info
=
&
monitor_subsys
[
SLAPD_MONITOR_CONN
];
mp
->
mp_flags
=
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_flags
\
|
MONITOR_F_SUB
|
MONITOR_F_PERSISTENT
;
mp
->
mp_flags
&=
~
MONITOR_F_VOLATILE_CH
;
if
(
monitor_cache_add
(
mi
,
e
)
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_conn_init: "
"unable to add entry 'cn=Current,%s'
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
));
#else
Debug
(
LDAP_DEBUG_ANY
,
"monitor_subsys_conn_init: "
"unable to add entry 'cn=Current,%s'
\n
%s%s"
,
monitor_subsys
[
SLAPD_MONITOR_CONN
].
mss_ndn
,
""
,
""
);
#endif
return
(
-
1
);
}
e_tmp
=
e
;
mp
=
(
struct
monitorentrypriv
*
)
e_conn
->
e_private
;
mp
->
mp_children
=
e_tmp
;
monitor_cache_release
(
mi
,
e
);
monitor_cache_release
(
mi
,
e
_conn
);
return
(
0
);
}
...
...
@@ -86,53 +212,41 @@ monitor_subsys_conn_update(
Entry
*
e
)
{
Connection
*
c
;
int
connindex
;
int
nconns
,
nwritewaiters
,
nreadwaiters
;
long
n
=
-
1
;
Attribute
*
a
;
struct
berval
*
bv
[
2
],
val
,
**
b
=
NULL
;
char
buf
[
1024
];
assert
(
mi
!=
NULL
);
assert
(
e
!=
NULL
);
assert
(
mi
);
assert
(
e
);
bv
[
0
]
=
&
val
;
bv
[
1
]
=
NULL
;
nconns
=
nwritewaiters
=
nreadwaiters
=
0
;
for
(
c
=
connection_first
(
&
connindex
);
c
!=
NULL
;
c
=
connection_next
(
c
,
&
connindex
),
nconns
++
)
{
if
(
c
->
c_writewaiter
)
{
nwritewaiters
++
;
}
if
(
c
->
c_currentber
!=
NULL
)
{
nreadwaiters
++
;
if
(
strncasecmp
(
e
->
e_ndn
,
"CN=TOTAL"
,
sizeof
(
"CN=TOTAL"
)
-
1
)
==
0
)
{
n
=
connections_nextid
();
}
else
if
(
strncasecmp
(
e
->
e_ndn
,
"CN=CURRENT"
,
sizeof
(
"CN=CURRENT"
)
-
1
)
==
0
)
{
Connection
*
c
;
int
connindex
;
for
(
n
=
0
,
c
=
connection_first
(
&
connindex
);
c
!=
NULL
;
n
++
,
c
=
connection_next
(
c
,
&
connindex
)
)
{
/* No Op */
;
}
connection_done
(
c
);
}
connection_done
(
c
);
#if 0
snprintf( buf, sizeof( buf ), "readwaiters=%d", nreadwaiters );
if ( ( a = attr_find( e->e_attrs, monitor_ad_desc ) ) != NULL ) {
for ( b = a->a_vals; b[0] != NULL; b++ ) {
if ( strncmp( b[0]->bv_val, "readwaiters=",
sizeof( "readwaiters=" ) - 1 ) == 0 ) {
free( b[0]->bv_val );
b[0] = ber_bvstrdup( buf );
break;
}
if
(
n
!=
-
1
)
{
Attribute
*
a
;
char
buf
[
16
];
a
=
attr_find
(
e
->
e_attrs
,
monitor_ad_desc
);
if
(
a
==
NULL
)
{
return
(
-
1
);
}
snprintf
(
buf
,
sizeof
(
buf
),
"%ld"
,
n
);
ber_bvfree
(
a
->
a_vals
[
0
]
);
a
->
a_vals
[
0
]
=
ber_bvstrdup
(
buf
);
}
if ( b == NULL || b[0] == NULL ) {
val.bv_val = buf;
val.bv_len = strlen( buf );
attr_merge( e, monitor_ad_desc, bv );
}
#endif
return
(
0
);
}
...
...
@@ -149,7 +263,7 @@ conn_create(
char
buf2
[
22
];
char
buf3
[
22
];
struct
berval
*
bv
[
2
]
,
val
;
struct
berval
val
,
*
bv
[
2
]
=
{
&
val
,
NULL
}
;
Entry
*
e
;
...
...
@@ -232,9 +346,6 @@ conn_create(
buf3
);
bv
[
0
]
=
&
val
;
bv
[
1
]
=
NULL
;
val
.
bv_val
=
buf
;
val
.
bv_len
=
strlen
(
buf
);
attr_merge
(
e
,
monitor_ad_desc
,
bv
);
...
...
@@ -276,7 +387,8 @@ monitor_subsys_conn_create(
c
!=
NULL
;
c
=
connection_next
(
c
,
&
connindex
))
{
if
(
conn_create
(
c
,
&
e
)
||
e
==
NULL
)
{
// error
connection_done
(
c
);
return
(
-
1
);
}
mp
=
(
struct
monitorentrypriv
*
)
e
->
e_private
;
mp
->
mp_next
=
e_tmp
;
...
...
@@ -301,7 +413,8 @@ monitor_subsys_conn_create(
c
=
connection_next
(
c
,
&
connindex
))
{
if
(
c
->
c_connid
==
connid
)
{
if
(
conn_create
(
c
,
ep
)
||
*
ep
==
NULL
)
{
// error
connection_done
(
c
);
return
(
-
1
);
}
}
}
...
...
servers/slapd/back-monitor/database.c
View file @
de903b65
...
...
@@ -51,7 +51,7 @@ monitor_subsys_database_init(
int
i
;
struct
monitorentrypriv
*
mp
;
AttributeDescription
*
ad_nc
=
slap_schema
.
si_ad_namingContexts
;
struct
berval
*
bv
[
2
]
,
val
;
struct
berval
val
,
*
bv
[
2
]
=
{
&
val
,
NULL
}
;
assert
(
be
!=
NULL
);
assert
(
monitor_ad_desc
!=
NULL
);
...
...
@@ -76,8 +76,6 @@ monitor_subsys_database_init(
return
(
-
1
);
}
bv
[
0
]
=
&
val
;
bv
[
1
]
=
NULL
;
e_tmp
=
NULL
;
for
(
i
=
nBackendDB
;
i
--
;
)
{
char
buf
[
1024
];
...
...
servers/slapd/back-monitor/init.c
View file @
de903b65
...
...
@@ -130,6 +130,22 @@ struct monitorsubsys monitor_subsys[] = {
NULL
,
/* update */
NULL
,
/* create */
monitor_subsys_log_modify
},
{
SLAPD_MONITOR_OPS
,
SLAPD_MONITOR_OPS_NAME
,
NULL
,
NULL
,
NULL
,
MONITOR_F_NONE
,
monitor_subsys_ops_init
,
monitor_subsys_ops_update
,
NULL
,
/* create */
NULL
,
/* modify */
},
{
SLAPD_MONITOR_SENT
,
SLAPD_MONITOR_SENT_NAME
,
NULL
,
NULL
,
NULL
,
MONITOR_F_NONE
,
monitor_subsys_sent_init
,
monitor_subsys_sent_update
,
NULL
,
/* create */
NULL
,
/* modify */
},
{
-
1
,
NULL
}
};
...
...
servers/slapd/back-monitor/operation.c
0 → 100644
View file @
de903b65
/* operation.c - deal with operation subsystem */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/*
* Copyright 2001 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*
* Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
*
* This work has beed deveolped for the OpenLDAP Foundation
* in the hope that it may be useful to the Open Source community,
* but WITHOUT ANY WARRANTY.
*
* Permission is granted to anyone to use this software for any purpose
* on any computer system, and to alter it and redistribute it, subject
* to the following restrictions:
*
* 1. The author and SysNet s.n.c. are not responsible for the consequences
* of use of this software, no matter how awful, even if they arise from
* flaws in it.
*
* 2. The origin of this software must not be misrepresented, either by
* explicit claim or by omission. Since few users ever read sources,
* credits should appear in the documentation.
*
* 3. Altered versions must be plainly marked as such, and must not be
* misrepresented as being the original software. Since few users
* ever read sources, credits should appear in the documentation.
* SysNet s.n.c. cannot be responsible for the consequences of the
* alterations.
*
* 4. This notice may not be removed or altered.
*/
#include
"portable.h"
#include
<stdio.h>
#include
"slap.h"
#include
"back-monitor.h"
int
monitor_subsys_ops_init
(
BackendDB
*
be
)
{
struct
monitorinfo
*
mi
;
Entry
*
e
,
*
e_tmp
,
*
e_op
;
struct
monitorentrypriv
*
mp
;
char
buf
[
1024
];
struct
berval
val
,
*
bv
[
2
]
=
{
&
val
,
NULL
};
assert
(
be
!=
NULL
);
mi
=
(
struct
monitorinfo
*
)
be
->
be_private
;
if
(
monitor_cache_get
(
mi
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
,
&
e_op
)
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_ops_init: "
"unable to get entry '%s'
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
));
#else
Debug
(
LDAP_DEBUG_ANY
,
"monitor_subsys_ops_init: "
"unable to get entry '%s'
\n
%s%s"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
,
""
,
""
);
#endif
return
(
-
1
);
}
e_tmp
=
NULL
;
/*
* Initiated ops
*/
snprintf
(
buf
,
sizeof
(
buf
),
"dn: cn=Initiated,%s
\n
"
"objectClass: top
\n
"
"objectClass: LDAPsubEntry
\n
"
#ifdef SLAPD_MONITORSUBENTRY
"objectClass: monitorSubEntry
\n
"
#else
/* !SLAPD_MONITORSUBENTRY */
"objectClass: extensibleObject
\n
"
#endif
/* !SLAPD_MONITORSUBENTRY */
"cn: Initiated
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_dn
);
e
=
str2entry
(
buf
);
if
(
e
==
NULL
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_ops_init: "
"unable to create entry 'cn=Initiated,%s'
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
));
#else
Debug
(
LDAP_DEBUG_ANY
,
"monitor_subsys_ops_init: "
"unable to create entry 'cn=Initiated,%s'
\n
%s%s"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
,
""
,
""
);
#endif
return
(
-
1
);
}
val
.
bv_val
=
"0"
;
val
.
bv_len
=
1
;
attr_merge
(
e
,
monitor_ad_desc
,
bv
);
mp
=
(
struct
monitorentrypriv
*
)
ch_calloc
(
sizeof
(
struct
monitorentrypriv
),
1
);
e
->
e_private
=
(
void
*
)
mp
;
mp
->
mp_next
=
e_tmp
;
mp
->
mp_children
=
NULL
;
mp
->
mp_info
=
&
monitor_subsys
[
SLAPD_MONITOR_OPS
];
mp
->
mp_flags
=
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_flags
\
|
MONITOR_F_SUB
|
MONITOR_F_PERSISTENT
;
if
(
monitor_cache_add
(
mi
,
e
)
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_ops_init: "
"unable to add entry 'cn=Initiated,%s'
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
));
#else
Debug
(
LDAP_DEBUG_ANY
,
"monitor_subsys_ops_init: "
"unable to add entry 'cn=Initiated,%s'
\n
%s%s"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
,
""
,
""
);
#endif
return
(
-
1
);
}
e_tmp
=
e
;
/*
* Completed ops
*/
snprintf
(
buf
,
sizeof
(
buf
),
"dn: cn=Completed,%s
\n
"
"objectClass: top
\n
"
"objectClass: LDAPsubEntry
\n
"
#ifdef SLAPD_MONITORSUBENTRY
"objectClass: monitorSubEntry
\n
"
#else
/* !SLAPD_MONITORSUBENTRY */
"objectClass: extensibleObject
\n
"
#endif
/* !SLAPD_MONITORSUBENTRY */
"cn: Completed
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_dn
);
e
=
str2entry
(
buf
);
if
(
e
==
NULL
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_ops_init: "
"unable to create entry 'cn=Completed,%s'
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
));
#else
Debug
(
LDAP_DEBUG_ANY
,
"monitor_subsys_ops_init: "
"unable to create entry 'cn=Completed,%s'
\n
%s%s"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
,
""
,
""
);
#endif
return
(
-
1
);
}
val
.
bv_val
=
"0"
;
val
.
bv_len
=
1
;
attr_merge
(
e
,
monitor_ad_desc
,
bv
);
mp
=
(
struct
monitorentrypriv
*
)
ch_calloc
(
sizeof
(
struct
monitorentrypriv
),
1
);
e
->
e_private
=
(
void
*
)
mp
;
mp
->
mp_next
=
e_tmp
;
mp
->
mp_children
=
NULL
;
mp
->
mp_info
=
&
monitor_subsys
[
SLAPD_MONITOR_OPS
];
mp
->
mp_flags
=
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_flags
\
|
MONITOR_F_SUB
|
MONITOR_F_PERSISTENT
;
if
(
monitor_cache_add
(
mi
,
e
)
)
{
#ifdef NEW_LOGGING
LDAP_LOG
((
"operation"
,
LDAP_LEVEL_CRIT
,
"monitor_subsys_ops_init: "
"unable to add entry 'cn=Completed,%s'
\n
"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
));
#else
Debug
(
LDAP_DEBUG_ANY
,
"monitor_subsys_ops_init: "
"unable to add entry 'cn=Completed,%s'
\n
%s%s"
,
monitor_subsys
[
SLAPD_MONITOR_OPS
].
mss_ndn
,
""
,
""
);
#endif
return
(
-
1
);
}
e_tmp
=
e
;
mp
=
(
struct
monitorentrypriv
*
)
e_op
->
e_private
;
mp
->
mp_children
=
e_tmp
;
monitor_cache_release
(
mi
,
e_op
);
return
(
0
);
}
int
monitor_subsys_ops_update
(
struct
monitorinfo
*
mi
,
Entry
*
e
)
{
long
n
=
-
1
;
assert
(
mi
);
assert
(
e
);
if
(
strncasecmp
(
e
->
e_ndn
,
"CN=INITIATED"
,
sizeof
(
"CN=INITIATED"
)
-
1
)
==
0
)
{
ldap_pvt_thread_mutex_lock
(
&
num_ops_mutex
);
n
=
num_ops_initiated
;
ldap_pvt_thread_mutex_unlock
(
&
num_ops_mutex
);
}
else
if
(
strncasecmp
(
e
->
e_ndn
,
"CN=COMPLETED"
,
sizeof
(
"CN=COMPLETED"
)
-
1
)
==
0
)
{
ldap_pvt_thread_mutex_lock
(
&
num_ops_mutex
);
n
=
num_ops_completed
;
ldap_pvt_thread_mutex_unlock
(
&
num_ops_mutex
);
}
if
(
n
!=
-
1
)
{
Attribute
*
a
;
char
buf
[
16
];
a
=
attr_find
(
e
->
e_attrs
,
monitor_ad_desc
);
if
(
a
==
NULL
)
{
return
(
-
1
);
}
snprintf
(
buf
,
sizeof
(
buf
),
"%ld"
,
n
);
ber_bvfree
(
a
->
a_vals
[
0
]
);
a
->
a_vals
[
0
]
=
ber_bvstrdup
(
buf