[Fedora-directory-commits] CVSROOT loginfo,1.19,1.20
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/CVSROOT
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv22461
Modified Files:
loginfo
Log Message:
test commit filters
Index: loginfo
===================================================================
RCS file: /cvs/dirsec/CVSROOT/loginfo,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- loginfo 27 Oct 2008 16:53:04 -0000 1.19
+++ loginfo 27 Oct 2008 17:04:31 -0000 1.20
@@ -21,7 +21,7 @@
# v = new version number (post-checkin)
# t = tag or branch name
#
-# test mail filtering2
+# test mail filtering3
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
15 years, 5 months
[Fedora-directory-commits] ldapserver Makefile.am, 1.76, 1.77 Makefile.in, 1.100, 1.101
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17390
Modified Files:
Makefile.am Makefile.in
Log Message:
Fixing the build on Solaris (ldap_agent_bin-main.o)
Index: Makefile.am
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.am,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- Makefile.am 23 Oct 2008 22:42:54 -0000 1.76
+++ Makefile.am 26 Oct 2008 04:04:56 -0000 1.77
@@ -970,6 +970,10 @@
ldap_agent_bin_CPPFLAGS = $(AM_CPPFLAGS) @netsnmp_inc@ @ldapsdk_inc@ @nss_inc@ @nspr_inc@
ldap_agent_bin_LDADD = $(LDAPSDK_LINK) $(SASL_LINK) $(NSS_LINK) $(NSPR_LINK) $(NETSNMP_LINK)
+if SOLARIS
+ldap_agent_bin_LDADD += -lrt
+endif
+
#------------------------
# ldclt
Index: Makefile.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.in,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- Makefile.in 23 Oct 2008 22:48:01 -0000 1.100
+++ Makefile.in 26 Oct 2008 04:04:56 -0000 1.101
@@ -47,7 +47,8 @@
pwdhash-bin$(EXEEXT) rsearch-bin$(EXEEXT)
noinst_PROGRAMS = makstrdb$(EXEEXT)
@SOLARIS_TRUE@am__append_1 = ldap/servers/slapd/slapi_counter_sunos_sparcv9.S
-@SOLARIS_TRUE@am__append_2 = ldap/servers/slapd/tools/ldclt/opCheck.c
+@SOLARIS_TRUE@am__append_2 = -lrt
+@SOLARIS_TRUE@am__append_3 = ldap/servers/slapd/tools/ldclt/opCheck.c
DIST_COMMON = $(am__configure_deps) $(dist_man_MANS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(top_srcdir)/configure compile \
@@ -628,7 +629,8 @@
ldap_agent_bin_OBJECTS = $(am_ldap_agent_bin_OBJECTS)
ldap_agent_bin_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
am__ldclt_bin_SOURCES_DIST = ldap/servers/slapd/tools/ldaptool-sasl.c \
ldap/servers/slapd/tools/ldclt/data.c \
ldap/servers/slapd/tools/ldclt/ldapfct.c \
@@ -1907,7 +1909,8 @@
ldap/servers/slapd/agtmmap.c
ldap_agent_bin_CPPFLAGS = $(AM_CPPFLAGS) @netsnmp_inc@ @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-ldap_agent_bin_LDADD = $(LDAPSDK_LINK) $(SASL_LINK) $(NSS_LINK) $(NSPR_LINK) $(NETSNMP_LINK)
+ldap_agent_bin_LDADD = $(LDAPSDK_LINK) $(SASL_LINK) $(NSS_LINK) \
+ $(NSPR_LINK) $(NETSNMP_LINK) $(am__append_2)
#------------------------
# ldclt
@@ -1923,7 +1926,7 @@
ldap/servers/slapd/tools/ldclt/threadMain.c \
ldap/servers/slapd/tools/ldclt/utils.c \
ldap/servers/slapd/tools/ldclt/version.c \
- ldap/servers/slapd/tools/ldclt/workarounds.c $(am__append_2)
+ ldap/servers/slapd/tools/ldclt/workarounds.c $(am__append_3)
ldclt_bin_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/ldap/servers/slapd/tools @ldapsdk_inc@ @sasl_inc@ @nss_inc@ @nspr_inc@
ldclt_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBNSL) $(LIBSOCKET) $(LIBDL)
15 years, 5 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd slapi_counter.c, 1.2, 1.3
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17904
Modified Files:
slapi_counter.c
Log Message:
Fixed typos in the HP-UX code: slapi_counter_get => slapi_counter_get_value
Index: slapi_counter.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi_counter.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- slapi_counter.c 22 Oct 2008 20:24:37 -0000 1.2
+++ slapi_counter.c 25 Oct 2008 17:22:52 -0000 1.3
@@ -182,7 +182,7 @@
} else {
/* For other values, we have to use cmpxchg. */
do {
- prev = slapi_counter_get(counter);
+ prev = slapi_counter_get_value(counter);
newvalue = prev + addvalue;
/* Put prev in a register for cmpxchg to compare against */
_Asm_mov_to_ar(_AREG_CCV, prev);
@@ -239,7 +239,7 @@
} else {
/* For other values, we have to use cmpxchg. */
do {
- prev = slapi_counter_get(counter);
+ prev = slapi_counter_get_value(counter);
newvalue = prev - subvalue;
/* Put prev in a register for cmpxchg to compare against */
_Asm_mov_to_ar(_AREG_CCV, prev);
15 years, 6 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm proto-back-ldbm.h, 1.15, 1.16
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15311
Modified Files:
proto-back-ldbm.h
Log Message:
Resolves: 207457
Summary: Convert counters to 64-bit capable Slapi_Counter type.
Index: proto-back-ldbm.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- proto-back-ldbm.h 9 Oct 2008 17:40:14 -0000 1.15
+++ proto-back-ldbm.h 24 Oct 2008 23:28:22 -0000 1.16
@@ -69,7 +69,7 @@
void cache_set_max_entries(struct cache *cache, long entries);
size_t cache_get_max_size(struct cache *cache);
long cache_get_max_entries(struct cache *cache);
-void cache_get_stats(struct cache *cache, u_long *hits, u_long *tries,
+void cache_get_stats(struct cache *cache, PRUint64 *hits, PRUint64 *tries,
long *entries,long *maxentries,
size_t *size, size_t *maxsize);
void cache_debug_hash(struct cache *cache, char **out);
15 years, 6 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd add.c, 1.14, 1.15 agtmmap.c, 1.11, 1.12 agtmmap.h, 1.11, 1.12 bind.c, 1.16, 1.17 compare.c, 1.8, 1.9 connection.c, 1.21, 1.22 defbackend.c, 1.6, 1.7 delete.c, 1.9, 1.10 fe.h, 1.9, 1.10 globals.c, 1.8, 1.9 init.c, 1.7, 1.8 libglobs.c, 1.27, 1.28 libslapd.def, 1.18, 1.19 main.c, 1.26, 1.27 modify.c, 1.17, 1.18 modrdn.c, 1.10, 1.11 monitor.c, 1.7, 1.8 proto-slap.h, 1.39, 1.40 result.c, 1.14, 1.15 search.c, 1.10, 1.11 slap.h, 1.37, 1.38 slapi-private.h,
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9308/ldap/servers/slapd
Modified Files:
add.c agtmmap.c agtmmap.h bind.c compare.c connection.c
defbackend.c delete.c fe.h globals.c init.c libglobs.c
libslapd.def main.c modify.c modrdn.c monitor.c proto-slap.h
result.c search.c slap.h slapi-private.h snmp_collator.c
Log Message:
Resolves: 207457
Summary: Convert counters to 64-bit capable Slapi_Counter type.
Index: add.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/add.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- add.c 17 Oct 2008 22:12:47 -0000 1.14
+++ add.c 24 Oct 2008 22:36:58 -0000 1.15
@@ -93,7 +93,7 @@
ber = operation->o_ber;
/* count the add request */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsAddEntryOps);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsAddEntryOps);
/*
* Parse the add request. It looks like this:
Index: agtmmap.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/agtmmap.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- agtmmap.c 8 Oct 2008 17:29:03 -0000 1.11
+++ agtmmap.c 24 Oct 2008 22:36:58 -0000 1.12
@@ -87,8 +87,8 @@
* mode -> Must be one of O_RDONLY / O_RDWR.
* O_RDWR creates the file if it does not exist.
* Outputs:
- * hdl -> Opaque handle to the mapped file. Should be passed
- * Passed to a subsequent agt_mupdate_stats() or
+ * hdl -> Opaque handle to the mapped file. Should be
+ * passed to a subsequent agt_mupdate_stats() or
* agt_mread_stats() or agt_mclose_stats() call.
* Return Values:
* Returns 0 on successfully doing the memmap or error codes
Index: agtmmap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/agtmmap.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- agtmmap.h 18 Oct 2007 01:22:29 -0000 1.11
+++ agtmmap.h 24 Oct 2008 22:36:58 -0000 1.12
@@ -123,32 +123,32 @@
/*
* Ops Table attributes
*/
- PRUint32 dsAnonymousBinds;
- PRUint32 dsUnAuthBinds;
- PRUint32 dsSimpleAuthBinds;
- PRUint32 dsStrongAuthBinds;
- PRUint32 dsBindSecurityErrors;
- PRUint32 dsInOps;
- PRUint32 dsReadOps;
- PRUint32 dsCompareOps;
- PRUint32 dsAddEntryOps;
- PRUint32 dsRemoveEntryOps;
- PRUint32 dsModifyEntryOps;
- PRUint32 dsModifyRDNOps;
- PRUint32 dsListOps;
- PRUint32 dsSearchOps;
- PRUint32 dsOneLevelSearchOps;
- PRUint32 dsWholeSubtreeSearchOps;
- PRUint32 dsReferrals;
- PRUint32 dsChainings;
- PRUint32 dsSecurityErrors;
- PRUint32 dsErrors;
- PRUint32 dsConnections; /* Number of currently connected clients */
- PRUint32 dsConnectionSeq; /* Monotonically increasing number bumped on each new conn est */
- PRUint32 dsBytesRecv; /* Count of bytes read from clients */
- PRUint32 dsBytesSent; /* Count of bytes sent to clients */
- PRUint32 dsEntriesReturned; /* Number of entries returned by the server */
- PRUint32 dsReferralsReturned; /* Number of entries returned by the server */
+ PRUint64 dsAnonymousBinds;
+ PRUint64 dsUnAuthBinds;
+ PRUint64 dsSimpleAuthBinds;
+ PRUint64 dsStrongAuthBinds;
+ PRUint64 dsBindSecurityErrors;
+ PRUint64 dsInOps;
+ PRUint64 dsReadOps;
+ PRUint64 dsCompareOps;
+ PRUint64 dsAddEntryOps;
+ PRUint64 dsRemoveEntryOps;
+ PRUint64 dsModifyEntryOps;
+ PRUint64 dsModifyRDNOps;
+ PRUint64 dsListOps;
+ PRUint64 dsSearchOps;
+ PRUint64 dsOneLevelSearchOps;
+ PRUint64 dsWholeSubtreeSearchOps;
+ PRUint64 dsReferrals;
+ PRUint64 dsChainings;
+ PRUint64 dsSecurityErrors;
+ PRUint64 dsErrors;
+ PRUint64 dsConnections; /* Number of currently connected clients */
+ PRUint64 dsConnectionSeq; /* Monotonically increasing number bumped on each new conn est */
+ PRUint64 dsBytesRecv; /* Count of bytes read from clients */
+ PRUint64 dsBytesSent; /* Count of bytes sent to clients */
+ PRUint64 dsEntriesReturned; /* Number of entries returned by the server */
+ PRUint64 dsReferralsReturned; /* Number of entries returned by the server */
};
struct entries_stats_t
@@ -156,11 +156,11 @@
/*
* Entries Table Attributes
*/
- PRUint32 dsMasterEntries;
- PRUint32 dsCopyEntries;
- PRUint32 dsCacheEntries;
- PRUint32 dsCacheHits;
- PRUint32 dsSlaveHits;
+ PRUint64 dsMasterEntries;
+ PRUint64 dsCopyEntries;
+ PRUint64 dsCacheEntries;
+ PRUint64 dsCacheHits;
+ PRUint64 dsSlaveHits;
};
struct int_stats_t
Index: bind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/bind.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- bind.c 17 Oct 2008 22:12:47 -0000 1.16
+++ bind.c 24 Oct 2008 22:36:58 -0000 1.17
@@ -345,7 +345,7 @@
* All SASL auth methods are categorized as strong binds,
* although they are not necessarily stronger than simple.
*/
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsStrongAuthBinds);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsStrongAuthBinds);
if ( saslmech == NULL || *saslmech == '\0' ) {
send_ldap_result( pb, LDAP_AUTH_METHOD_NOT_SUPPORTED, NULL,
"SASL mechanism absent", 0, NULL );
@@ -423,13 +423,13 @@
}
break;
case LDAP_AUTH_SIMPLE:
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsSimpleAuthBinds);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsSimpleAuthBinds);
/* accept null binds */
if (dn == NULL || *dn == '\0') {
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds);
/* by definition its anonymous is also UnAuthenticated so increment
that counter */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
/* call preop plugins */
if (plugin_call_plugins( pb, SLAPI_PLUGIN_PRE_BIND_FN ) == 0){
@@ -455,7 +455,7 @@
if ( isroot && method == LDAP_AUTH_SIMPLE ) {
if ( cred.bv_len == 0 ) {
/* unauthenticated bind */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
} else {
/* a passwd was supplied -- check it */
@@ -473,7 +473,7 @@
send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL,
NULL, 0, NULL );
/* increment BindSecurityErrorcount */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
value_done(&cv);
goto free_and_return;
}
@@ -617,11 +617,11 @@
if(cred.bv_len == 0) {
/* its an UnAuthenticated Bind, DN specified but no pw */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
}else{
/* password must have been invalid */
/* increment BindSecurityError count */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
}
}
Index: compare.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/compare.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- compare.c 17 Oct 2008 22:12:47 -0000 1.8
+++ compare.c 24 Oct 2008 22:36:58 -0000 1.9
@@ -77,7 +77,7 @@
LDAPDebug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 );
/* count the compare request */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsCompareOps);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsCompareOps);
/* have to init this here so we can "done" it below if we short circuit */
slapi_sdn_init(&sdn);
Index: connection.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/connection.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- connection.c 17 Oct 2008 22:12:47 -0000 1.21
+++ connection.c 24 Oct 2008 22:36:58 -0000 1.22
@@ -220,8 +220,8 @@
conn->c_connid = slapi_counter_increment(num_conns);
if (! in_referral_mode) {
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq);
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsConnections);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsConnections);
}
/*
@@ -650,7 +650,7 @@
static void inc_op_count(Connection* conn)
{
PR_AtomicIncrement(&conn->c_opscompleted);
- PR_AtomicIncrement(&ops_completed);
+ slapi_counter_increment(ops_completed);
}
static int connection_increment_reference(Connection *conn)
@@ -828,8 +828,8 @@
slapi_pblock_set (pb, SLAPI_DESTROY_CONTENT, &destroy_content);
if (! config_check_referral_mode()) {
- PR_AtomicIncrement(&ops_initiated);
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsInOps);
+ slapi_counter_increment(ops_initiated);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsInOps);
}
if ( (tag = ber_get_int( op->o_ber, &msgid ))
@@ -2064,8 +2064,8 @@
connection_make_new_pb(&pb,conn);
PR_Unlock(conn->c_mutex);
if (! config_check_referral_mode()) {
- PR_AtomicIncrement(&ops_initiated);
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsInOps);
+ slapi_counter_increment(ops_initiated);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsInOps);
}
}
/* Once we're here we have a pb */
@@ -2171,7 +2171,7 @@
/* number of ops on this connection */
PR_AtomicIncrement(&conn->c_opscompleted);
/* total number of ops for the server */
- PR_AtomicIncrement(&ops_completed);
+ slapi_counter_increment(ops_completed);
/* If this op isn't a persistent search, remove it */
if ( !( pb->pb_op->o_flags & OP_FLAG_PS )) {
/* delete from connection operation queue & decr refcnt */
@@ -2247,8 +2247,8 @@
PR_Unlock( op_thread_lock );
if (! config_check_referral_mode()) {
- PR_AtomicIncrement(&ops_initiated);
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsInOps);
+ slapi_counter_increment(ops_initiated);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsInOps);
}
return 0;
}
@@ -2567,7 +2567,7 @@
}
if (! config_check_referral_mode()) {
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsConnections);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsConnections);
}
conn->c_gettingber = 0;
Index: defbackend.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/defbackend.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- defbackend.c 18 Oct 2007 00:08:34 -0000 1.6
+++ defbackend.c 24 Oct 2008 22:36:58 -0000 1.7
@@ -216,7 +216,7 @@
slapi_pblock_get( pb, SLAPI_BIND_METHOD, &method );
slapi_pblock_get( pb, SLAPI_BIND_CREDENTIALS, &cred );
if ( method == LDAP_AUTH_SIMPLE && cred->bv_len == 0 ) {
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds);
rc = SLAPI_BIND_ANONYMOUS;
} else {
send_nobackend_ldap_result( pb );
Index: delete.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/delete.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- delete.c 17 Oct 2008 22:12:47 -0000 1.9
+++ delete.c 24 Oct 2008 22:36:58 -0000 1.10
@@ -80,7 +80,7 @@
ber = operation->o_ber;
/* count the delete request */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsRemoveEntryOps);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsRemoveEntryOps);
/*
* Parse the delete request. It looks like this:
Index: fe.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/fe.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- fe.h 17 Oct 2008 22:12:47 -0000 1.9
+++ fe.h 24 Oct 2008 22:36:58 -0000 1.10
@@ -56,9 +56,8 @@
#endif /* DONT_DECLARE_SLAPD_LDAP_DEBUG */
#endif
#endif
-extern PRInt32 ops_initiated;
-extern PRInt32 ops_completed;
-extern PRLock *ops_mutex;
+extern Slapi_Counter *ops_initiated;
+extern Slapi_Counter *ops_completed;
extern PRThread *listener_tid;
extern PRThread *listener_tid;
extern Slapi_Counter *num_conns;
Index: globals.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/globals.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- globals.c 17 Oct 2008 22:12:47 -0000 1.8
+++ globals.c 24 Oct 2008 22:36:58 -0000 1.9
@@ -88,9 +88,8 @@
/*
* global variables that need mutex protection
*/
-PRInt32 ops_initiated;
-PRInt32 ops_completed;
-PRLock *ops_mutex;
+Slapi_Counter *ops_initiated;
+Slapi_Counter *ops_completed;
Slapi_Counter *num_conns;
@@ -171,4 +170,17 @@
sep->sep_slapd_ssl_init2 = (caddr_t)slapd_ssl_init2;
set_dll_entry_points( sep );
+ /* To apply the nsslapd-counters config value properly,
+ these values are initialized here after config file is read */
+ if (config_get_slapi_counters()) {
+ ops_initiated = slapi_counter_new();
+ ops_completed = slapi_counter_new();
+ g_set_num_entries_sent( slapi_counter_new() );
+ g_set_num_bytes_sent( slapi_counter_new() );
+ } else {
+ ops_initiated = NULL;
+ ops_completed = NULL;
+ g_set_num_entries_sent( NULL );
+ g_set_num_bytes_sent( NULL );
+ }
}
Index: init.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/init.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- init.c 17 Oct 2008 22:12:47 -0000 1.7
+++ init.c 24 Oct 2008 22:36:58 -0000 1.8
@@ -73,16 +73,12 @@
/* We don't worry about free'ing this stuff
* since the only time we want to do that is when
* the process is exiting. */
- ops_mutex = PR_NewLock();
num_conns = slapi_counter_new();
- g_set_num_sent_mutex( PR_NewLock() );
g_set_current_conn_count_mutex( PR_NewLock() );
slapd_re_init();
- if ( ops_mutex == NULL ||
- g_get_num_sent_mutex() == NULL ||
- g_get_current_conn_count_mutex() == NULL )
+ if ( g_get_current_conn_count_mutex() == NULL )
{
LDAPDebug( LDAP_DEBUG_ANY,
"init: PR_NewLock failed\n", 0, 0, 0 );
Index: libglobs.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/libglobs.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- libglobs.c 23 Oct 2008 22:42:55 -0000 1.27
+++ libglobs.c 24 Oct 2008 22:36:58 -0000 1.28
@@ -488,6 +488,10 @@
NULL, 0,
(void**)&global_slapdFrontendConfig.ldapi_auto_dn_suffix, CONFIG_STRING, NULL},
#endif
+ {CONFIG_SLAPI_COUNTER_ATTRIBUTE, config_set_slapi_counters,
+ NULL, 0,
+ (void**)&global_slapdFrontendConfig.slapi_counters, CONFIG_ON_OFF,
+ config_get_slapi_counters},
{CONFIG_ACCESSLOG_MINFREEDISKSPACE_ATTRIBUTE, NULL,
log_set_mindiskspace, SLAPD_ACCESS_LOG,
(void**)&global_slapdFrontendConfig.accesslog_minfreespace, CONFIG_INT, NULL},
@@ -836,6 +840,7 @@
#if defined(ENABLE_AUTO_DN_SUFFIX)
cfg->ldapi_auto_dn_suffix = slapi_ch_strdup("cn=peercred,cn=external,cn=auth");
#endif
+ cfg->slapi_counters = LDAP_ON;
cfg->threadnumber = SLAPD_DEFAULT_MAX_THREADS;
cfg->maxthreadsperconn = SLAPD_DEFAULT_MAX_THREADS_PER_CONN;
cfg->reservedescriptors = SLAPD_DEFAULT_RESERVE_FDS;
@@ -1398,6 +1403,22 @@
}
#endif
+/*
+ * Set nsslapd-counters: on | off to the internal config variable slapi_counters.
+ * If set to off, slapi_counters is not initialized and the counters are not
+ * incremented. Note: counters which are necessary for the server's running
+ * are not disabled.
+ */
+int config_set_slapi_counters( const char *attrname, char *value, char *errorbuf, int apply )
+{
+ int retVal = LDAP_SUCCESS;
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+
+ retVal = config_set_onoff(attrname, value,
+ &(slapdFrontendConfig->slapi_counters), errorbuf, apply);
+
+ return retVal;
+}
int
config_set_securelistenhost( const char *attrname, char *value, char *errorbuf, int apply ) {
@@ -3438,6 +3459,17 @@
}
#endif
+int config_get_slapi_counters()
+{
+ int retVal;
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+ CFG_LOCK_READ(slapdFrontendConfig);
+ retVal = slapdFrontendConfig->slapi_counters;
+ CFG_UNLOCK_READ(slapdFrontendConfig);
+
+ return retVal;
+}
+
char *
config_get_workingdir() {
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
Index: libslapd.def
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/libslapd.def,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- libslapd.def 4 Oct 2007 16:27:47 -0000 1.18
+++ libslapd.def 24 Oct 2008 22:36:58 -0000 1.19
@@ -211,8 +211,6 @@
g_set_num_bytes_sent @173
g_get_num_entries_sent @174
g_set_num_entries_sent @175
- g_get_num_sent_mutex @176
- g_set_num_sent_mutex @177
g_get_default_referral @178
g_set_default_referral @179
slapi_ch_bvdup @180
Index: main.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- main.c 15 Oct 2008 06:30:05 -0000 1.26
+++ main.c 24 Oct 2008 22:36:58 -0000 1.27
@@ -1039,7 +1039,12 @@
slapdFrontendConfig->configdir);
eq_init(); /* must be done before plugins started */
- snmp_collator_start();
+
+ /* Start the SNMP collator if counters are enabled. */
+ if (config_get_slapi_counters()) {
+ snmp_collator_start();
+ }
+
ps_init_psearch_system(); /* must come before plugin_startall() */
/* Initailize the mapping tree */
Index: modify.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/modify.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- modify.c 17 Oct 2008 22:12:47 -0000 1.17
+++ modify.c 24 Oct 2008 22:36:58 -0000 1.18
@@ -138,7 +138,7 @@
ber = operation->o_ber;
/* count the modify request */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsModifyEntryOps);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsModifyEntryOps);
/*
* Parse the modify request. It looks like this:
Index: modrdn.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/modrdn.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- modrdn.c 17 Oct 2008 22:12:47 -0000 1.10
+++ modrdn.c 24 Oct 2008 22:36:58 -0000 1.11
@@ -79,7 +79,7 @@
LDAPDebug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
/* count the modrdn request */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsModifyRDNOps);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsModifyRDNOps);
slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
ber = operation->o_ber;
Index: monitor.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/monitor.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- monitor.c 20 Sep 2007 16:54:38 -0000 1.7
+++ monitor.c 24 Oct 2008 22:36:58 -0000 1.8
@@ -93,30 +93,22 @@
connection_table_as_entry(the_connection_table, e);
- PR_Lock( ops_mutex );
- sprintf( buf, "%ld", (long) ops_initiated );
- PR_Unlock( ops_mutex );
+ sprintf( buf, "%" PRIu64, slapi_counter_get_value(ops_initiated) );
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "opsinitiated", vals );
- PR_Lock( ops_mutex );
- sprintf( buf, "%ld", (long) ops_completed );
- PR_Unlock( ops_mutex );
+ sprintf( buf, "%" PRIu64, slapi_counter_get_value(ops_completed) );
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "opscompleted", vals );
- PR_Lock( g_get_num_sent_mutex() );
- len = PR_snprintf ( buf, BUFSIZ, "%llu", g_get_num_entries_sent() );
- PR_Unlock( g_get_num_sent_mutex() );
+ len = PR_snprintf ( buf, BUFSIZ, "%" PRIu64, g_get_num_entries_sent() );
val.bv_val = buf;
val.bv_len = ( unsigned long ) len;
attrlist_replace( &e->e_attrs, "entriessent", vals );
- PR_Lock( g_get_num_sent_mutex() );
- len = PR_snprintf ( buf, BUFSIZ, "%llu", g_get_num_bytes_sent() );
- PR_Unlock( g_get_num_sent_mutex() );
+ len = PR_snprintf ( buf, BUFSIZ, "%" PRIu64, g_get_num_bytes_sent() );
val.bv_val = buf;
val.bv_len = ( unsigned long ) len;
attrlist_replace( &e->e_attrs, "bytessent", vals );
Index: proto-slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/proto-slap.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- proto-slap.h 24 Oct 2008 00:21:18 -0000 1.39
+++ proto-slap.h 24 Oct 2008 22:36:58 -0000 1.40
@@ -255,6 +255,7 @@
#if defined(ENABLE_AUTO_DN_SUFFIX)
int config_set_ldapi_auto_dn_suffix( const char *attrname, char *value, char *errorbuf, int apply );
#endif
+int config_set_slapi_counters( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_srvtab( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_sizelimit( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_lastmod( const char *attrname, char *value, char *errorbuf, int apply );
@@ -370,6 +371,7 @@
#if defined(ENABLE_AUTO_DN_SUFFIX)
char *config_get_ldapi_auto_dn_suffix();
#endif
+int config_get_slapi_counters();
char *config_get_srvtab();
int config_get_sizelimit();
char *config_get_pw_storagescheme();
@@ -821,14 +823,12 @@
/*
* result.c
*/
-void g_set_num_entries_sent( PRUint64 val );
+void g_set_num_entries_sent( Slapi_Counter *counter );
PRUint64 g_get_num_entries_sent();
-void g_set_num_bytes_sent( PRUint64 val );
+void g_set_num_bytes_sent( Slapi_Counter *counter );
PRUint64 g_get_num_bytes_sent();
-void g_set_num_sent_mutex( PRLock *plock );
void g_set_default_referral( struct berval **ldap_url );
struct berval **g_get_default_referral();
-PRLock *g_get_num_sent_mutex();
void disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error );
int send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e, LDAPControl **ectrls,
char **attrs, int attrsonly );
Index: result.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/result.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- result.c 17 Oct 2008 22:12:47 -0000 1.14
+++ result.c 24 Oct 2008 22:36:58 -0000 1.15
@@ -60,9 +60,8 @@
#include <ssl.h>
-PRUint64 num_entries_sent;
-PRUint64 num_bytes_sent;
-PRLock *num_sent_mutex;
+Slapi_Counter *num_entries_sent;
+Slapi_Counter *num_bytes_sent;
static long current_conn_count;
static PRLock *current_conn_count_mutex;
@@ -82,34 +81,24 @@
#define SLAPI_SEND_VATTR_FLAG_REALONLY 0x01
#define SLAPI_SEND_VATTR_FLAG_VIRTUALONLY 0x02
-void g_set_num_entries_sent( PRUint64 val )
+void g_set_num_entries_sent( Slapi_Counter *counter )
{
- num_entries_sent = val;
+ num_entries_sent = counter;
}
PRUint64 g_get_num_entries_sent()
{
- return( num_entries_sent );
+ return( slapi_counter_get_value(num_entries_sent) );
}
-void g_set_num_bytes_sent( PRUint64 val )
+void g_set_num_bytes_sent( Slapi_Counter *counter )
{
- num_bytes_sent = val;
+ num_bytes_sent = counter;
}
PRUint64 g_get_num_bytes_sent()
{
- return( num_bytes_sent );
-}
-
-void g_set_num_sent_mutex( PRLock *plock )
-{
- num_sent_mutex = plock;
-}
-
-PRLock *g_get_num_sent_mutex()
-{
- return( num_sent_mutex );
+ return( slapi_counter_get_value(num_bytes_sent) );
}
static void
@@ -327,8 +316,7 @@
|| err == LDAP_INSUFFICIENT_ACCESS
|| err == LDAP_AUTH_UNKNOWN )
{
- if(g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors!=NULL)
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors);
}else if( err != LDAP_REFERRAL
&& err != LDAP_OPT_REFERRALS
&& err != LDAP_PARTIAL_RESULTS)
@@ -338,8 +326,7 @@
--referrals
-- partially seviced operations will not be conted as an error
*/
- if(g_get_global_snmp_vars()->ops_tbl.dsErrors!=NULL)
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsErrors);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsErrors);
}
}
@@ -413,7 +400,7 @@
int len;
/* count the referral */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsReferrals);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsReferrals);
/*
* figure out how much space we need
@@ -486,7 +473,7 @@
*/
/* count the referral */
if (! config_check_referral_mode())
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsReferrals);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsReferrals);
rc = ber_printf( ber, "{it{esst{s", operation->o_msgid, tag, err,
matched ? matched : "", text ? text : "", LDAP_TAG_REFERRAL,
urls[0]->bv_val );
@@ -677,7 +664,7 @@
char *attrs[2] = { NULL, NULL };
/* count the referral */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsReferrals);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsReferrals);
attrs[0] = refAttr;
if ( e != NULL &&
@@ -1526,14 +1513,13 @@
"flush_ber() wrote %u bytes to socket %d\n",
bytes, conn->c_sd, 0 );
LL_I2L ( b, bytes ) ;
- LL_ADD ( num_bytes_sent, num_bytes_sent, b);
+ slapi_counter_add(num_bytes_sent, b);
if ( type == _LDAP_SEND_ENTRY ) {
- LL_I2L ( b, 1 );
- LL_ADD ( num_entries_sent, num_entries_sent, b );
+ slapi_counter_increment(num_entries_sent);
}
if (! config_check_referral_mode())
- (*(g_get_global_snmp_vars()->ops_tbl.dsBytesSent))+= bytes;
+ slapi_counter_add(g_get_global_snmp_vars()->ops_tbl.dsBytesSent, bytes);
}
}
@@ -1542,11 +1528,11 @@
plugin_call_plugins( pb, SLAPI_PLUGIN_POST_RESULT_FN );
break;
case _LDAP_SEND_REFERRAL:
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsReferralsReturned);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsReferralsReturned);
plugin_call_plugins( pb, SLAPI_PLUGIN_POST_REFERRAL_FN );
break;
case _LDAP_SEND_ENTRY:
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned);
plugin_call_plugins( pb, SLAPI_PLUGIN_POST_ENTRY_FN );
break;
}
Index: search.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/search.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- search.c 17 Oct 2008 22:12:47 -0000 1.10
+++ search.c 24 Oct 2008 22:36:58 -0000 1.11
@@ -87,7 +87,7 @@
ber = operation->o_ber;
/* count the search request */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsSearchOps);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsSearchOps);
/*
* Parse the search request. It looks like this:
@@ -141,11 +141,11 @@
/* check and record the scope for snmp */
if ( scope == LDAP_SCOPE_ONELEVEL) {
/* count the one level search request */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsOneLevelSearchOps);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsOneLevelSearchOps);
} else if (scope == LDAP_SCOPE_SUBTREE) {
/* count the subtree search request */
- snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsWholeSubtreeSearchOps);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsWholeSubtreeSearchOps);
}
/* filter - returns a "normalized" version */
Index: slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slap.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- slap.h 17 Oct 2008 22:12:47 -0000 1.37
+++ slap.h 24 Oct 2008 22:36:58 -0000 1.38
@@ -152,6 +152,7 @@
#define SLAPD_LOGGING 1
#define NUM_SNMP_INT_TBL_ROWS 5
+#define SNMP_FIELD_LENGTH 100
/* include NSPR header files */
#include "nspr.h"
@@ -1529,57 +1530,56 @@
#include "proto-slap.h"
LDAPMod** entry2mods(Slapi_Entry *, LDAPMod **, int *, int);
-/* SNMP Variables */
+/* SNMP Counter Variables */
struct snmp_ops_tbl_t{
- PRUint32 *dsAnonymousBinds;
- PRUint32 *dsUnAuthBinds;
- PRUint32 *dsSimpleAuthBinds;
- PRUint32 *dsStrongAuthBinds;
- PRUint32 *dsBindSecurityErrors;
- PRUint32 *dsInOps;
- PRUint32 *dsReadOps;
- PRUint32 *dsCompareOps;
- PRUint32 *dsAddEntryOps;
- PRUint32 *dsRemoveEntryOps;
- PRUint32 *dsModifyEntryOps;
- PRUint32 *dsModifyRDNOps;
- PRUint32 *dsListOps;
- PRUint32 *dsSearchOps;
- PRUint32 *dsOneLevelSearchOps;
- PRUint32 *dsWholeSubtreeSearchOps;
- PRUint32 *dsReferrals;
- PRUint32 *dsChainings;
- PRUint32 *dsSecurityErrors;
- PRUint32 *dsErrors;
- PRUint32 *dsConnections; /* Number of currently connected clients */
- PRUint32 *dsConnectionSeq; /* Monotonically increasing number bumped on each new conn est */
- PRUint32 *dsBytesRecv; /* Count of bytes read from clients */
- PRUint32 *dsBytesSent; /* Count of bytes sent to clients */
- PRUint32 *dsEntriesReturned;
- PRUint32 *dsReferralsReturned;
+ Slapi_Counter *dsAnonymousBinds;
+ Slapi_Counter *dsUnAuthBinds;
+ Slapi_Counter *dsSimpleAuthBinds;
+ Slapi_Counter *dsStrongAuthBinds;
+ Slapi_Counter *dsBindSecurityErrors;
+ Slapi_Counter *dsInOps;
+ Slapi_Counter *dsReadOps;
+ Slapi_Counter *dsCompareOps;
+ Slapi_Counter *dsAddEntryOps;
+ Slapi_Counter *dsRemoveEntryOps;
+ Slapi_Counter *dsModifyEntryOps;
+ Slapi_Counter *dsModifyRDNOps;
+ Slapi_Counter *dsListOps;
+ Slapi_Counter *dsSearchOps;
+ Slapi_Counter *dsOneLevelSearchOps;
+ Slapi_Counter *dsWholeSubtreeSearchOps;
+ Slapi_Counter *dsReferrals;
+ Slapi_Counter *dsChainings;
+ Slapi_Counter *dsSecurityErrors;
+ Slapi_Counter *dsErrors;
+ Slapi_Counter *dsConnections; /* Number of currently connected clients */
+ Slapi_Counter *dsConnectionSeq; /* Monotonically increasing number bumped on each new conn est */
+ Slapi_Counter *dsBytesRecv; /* Count of bytes read from clients */
+ Slapi_Counter *dsBytesSent; /* Count of bytes sent to clients */
+ Slapi_Counter *dsEntriesReturned;
+ Slapi_Counter *dsReferralsReturned;
};
struct snmp_entries_tbl_t{
- /* entries table */
- PRUint32 *dsMasterEntries;
- PRUint32 *dsCopyEntries;
- PRUint32 *dsCacheEntries;
- PRUint32 *dsCacheHits;
- PRUint32 *dsSlaveHits;
+ /* entries table */
+ Slapi_Counter *dsMasterEntries;
+ Slapi_Counter *dsCopyEntries;
+ Slapi_Counter *dsCacheEntries;
+ Slapi_Counter *dsCacheHits;
+ Slapi_Counter *dsSlaveHits;
};
struct snmp_int_tbl_t{
-
/* interaction table */
- PRUint32 *dsIntIndex;
- char *dsName;
- time_t *dsTimeOfCreation;
- time_t *dsTimeOfLastAttempt;
- time_t *dsTimeOfLastSuccess;
- PRUint32 *dsFailuresSinceLastSuccess;
- PRUint32 *dsFailures;
- PRUint32 *dsSuccesses;
- char *dsURL;
+ PRUint32 dsIntIndex;
+ char dsName[SNMP_FIELD_LENGTH];
+ time_t dsTimeOfCreation;
+ time_t dsTimeOfLastAttempt;
+ time_t dsTimeOfLastSuccess;
+ PRUint32 dsFailuresSinceLastSuccess;
+ PRUint32 dsFailures;
+ PRUint32 dsSuccesses;
+ char dsURL[SNMP_FIELD_LENGTH];
};
/* operation statistics */
@@ -1709,6 +1709,7 @@
#define CONFIG_LDAPI_GIDNUMBER_TYPE_ATTRIBUTE "nsslapd-ldapigidnumbertype"
#define CONFIG_LDAPI_SEARCH_BASE_DN_ATTRIBUTE "nsslapd-ldapientrysearchbase"
#define CONFIG_LDAPI_AUTO_DN_SUFFIX_ATTRIBUTE "nsslapd-ldapiautodnsuffix"
+#define CONFIG_SLAPI_COUNTER_ATTRIBUTE "nsslapd-counters"
#define CONFIG_SECURITY_ATTRIBUTE "nsslapd-security"
#define CONFIG_SSL3CIPHERS_ATTRIBUTE "nsslapd-SSL3ciphers"
#define CONFIG_ACCESSLOG_ATTRIBUTE "nsslapd-accesslog"
@@ -1979,6 +1980,7 @@
char *ldapi_gidnumber_type; /* type that contains gid number */
char *ldapi_search_base_dn; /* base dn to search for mapped entries */
char *ldapi_auto_dn_suffix; /* suffix to be appended to auto gen DNs */
+ int slapi_counters; /* switch to turn slapi_counters on/off */
#ifndef _WIN32
struct passwd *localuserinfo; /* userinfo of localuser */
#endif /* _WIN32 */
Index: slapi-private.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-private.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- slapi-private.h 3 Oct 2008 04:28:22 -0000 1.27
+++ slapi-private.h 24 Oct 2008 22:36:58 -0000 1.28
@@ -1208,14 +1208,6 @@
#define PRLDAP_SET_PORT(myaddr,myport) \
((myaddr)->raw.family == PR_AF_INET6 ? ((myaddr)->ipv6.port = PR_htons(myport)) : ((myaddr)->inet.port = PR_htons(myport)))
-/*
- * snmp_collator.c
- * wrapper functions to ease the cast burdon between net-snmp APIs which expect
- * unsigned int and PR_AtomicIncrement/PR_AtomicSet which expect signed int.
- */
-void snmp_increment_counter(PRUint32 *counter);
-void snmp_set_counter(PRUint32 *counter, PRInt32 newval);
-
#ifdef __cplusplus
}
#endif
Index: snmp_collator.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/snmp_collator.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- snmp_collator.c 17 Oct 2008 22:12:47 -0000 1.15
+++ snmp_collator.c 24 Oct 2008 22:36:58 -0000 1.16
@@ -48,6 +48,7 @@
#include <sys/ipc.h>
#include <sys/msg.h>
#include <dirent.h>
+#include <semaphore.h>
#endif
#include <time.h>
#include <signal.h>
@@ -62,6 +63,14 @@
#include "prcvar.h"
#include "plstr.h"
+#ifdef HPUX
+/* HP-UX doesn't define SEM_FAILED like other platforms, so
+ * we define it ourselves. */
+#define SEM_FAILED ((sem_t *)(-1))
+#endif
+
+#define SNMP_NUM_SEM_WAITS 10
+
#include "snmp_collator.h"
#include "../snmp/ntagt/nslagtcom_nt.h"
@@ -70,12 +79,18 @@
/* strlen of url portions ie "ldap://:/" */
#define URL_CHARS_LEN 9
-char *make_ds_url(char *host, int port);
-void print_snmp_interaction_table();
-int search_interaction_table(char *dsURL, int *isnew);
+static char *make_ds_url(char *host, int port);
+static void print_snmp_interaction_table();
+static int search_interaction_table(char *dsURL, int *isnew);
static void loadConfigStats();
static Slapi_Entry *getConfigEntry( Slapi_Entry **e );
static void freeConfigEntry( Slapi_Entry **e );
+static void snmp_update_ops_table();
+static void snmp_update_entries_table();
+static void snmp_update_interactions_table();
+static void snmp_update_cache_stats();
+static void snmp_collator_create_semaphore();
+static void snmp_collator_sem_wait();
/* snmp stats stuff */
struct agt_stats_t *stats=NULL;
@@ -94,12 +109,14 @@
static TCHAR szSpoolRootDir[_MAX_PATH];
#else
static char szStatsFile[_MAX_PATH];
+static char stats_sem_name[_MAX_PATH];
#endif /* _WIN32*/
static Slapi_Eq_Context snmp_eq_ctx;
static int snmp_collator_stopped = 0;
-/* lock stuff */
+/* synchronization stuff */
static PRLock *interaction_table_mutex;
+static sem_t *stats_sem;
/***********************************************************************************
@@ -110,88 +127,80 @@
*
************************************************************************************/
-int snmp_collator_init(){
- int i;
+static int snmp_collator_init(){
+ int i;
+
+ /*
+ * Create the global SNMP counters
+ */
+ g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsSimpleAuthBinds = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsStrongAuthBinds = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsInOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsReadOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsCompareOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsAddEntryOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsRemoveEntryOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsModifyEntryOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsModifyRDNOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsListOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsSearchOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsOneLevelSearchOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsWholeSubtreeSearchOps = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsReferrals = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsChainings = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsErrors = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsConnections = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsBytesRecv = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsBytesSent = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned = slapi_counter_new();
+ g_get_global_snmp_vars()->ops_tbl.dsReferralsReturned = slapi_counter_new();
+ g_get_global_snmp_vars()->entries_tbl.dsMasterEntries = slapi_counter_new();
+ g_get_global_snmp_vars()->entries_tbl.dsCopyEntries = slapi_counter_new();
+ g_get_global_snmp_vars()->entries_tbl.dsCacheEntries = slapi_counter_new();
+ g_get_global_snmp_vars()->entries_tbl.dsCacheHits = slapi_counter_new();
+ g_get_global_snmp_vars()->entries_tbl.dsSlaveHits = slapi_counter_new();
+
+ /* Initialize the global interaction table */
+ for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++)
+ {
+ g_get_global_snmp_vars()->int_tbl[i].dsIntIndex = i + 1;
+ strncpy(g_get_global_snmp_vars()->int_tbl[i].dsName, "Not Available",
+ sizeof(g_get_global_snmp_vars()->int_tbl[i].dsName));
+ g_get_global_snmp_vars()->int_tbl[i].dsTimeOfCreation = 0;
+ g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt = 0;
+ g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastSuccess = 0;
+ g_get_global_snmp_vars()->int_tbl[i].dsFailuresSinceLastSuccess = 0;
+ g_get_global_snmp_vars()->int_tbl[i].dsFailures = 0;
+ g_get_global_snmp_vars()->int_tbl[i].dsSuccesses = 0;
+ strncpy(g_get_global_snmp_vars()->int_tbl[i].dsURL, "Not Available",
+ sizeof(g_get_global_snmp_vars()->int_tbl[i].dsURL));
+ }
+
+ /* Get the semaphore */
+ snmp_collator_sem_wait();
- /*
- * Initialize the mmap structure
- */
+ /* Initialize the mmap structure */
memset((void *) stats, 0, sizeof(*stats));
+
+ /* Load header stats table */
strncpy(stats->hdr_stats.dsVersion, SLAPD_VERSION_STR,
(sizeof(stats->hdr_stats.dsVersion)/sizeof(char)) - 1);
stats->hdr_stats.restarted = 0;
stats->hdr_stats.startTime = time(0); /* This is a bit off, hope it's ok */
-
- /* load config stats */
loadConfigStats();
- /* point these at the mmaped data */
- g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds = &(stats->ops_stats.dsAnonymousBinds);
- g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds = &(stats->ops_stats.dsUnAuthBinds);
- g_get_global_snmp_vars()->ops_tbl.dsSimpleAuthBinds = &(stats->ops_stats.dsSimpleAuthBinds);
- g_get_global_snmp_vars()->ops_tbl.dsStrongAuthBinds = &(stats->ops_stats.dsStrongAuthBinds);
- g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors = &(stats->ops_stats.dsBindSecurityErrors);
- g_get_global_snmp_vars()->ops_tbl.dsInOps = &(stats->ops_stats.dsInOps);
- g_get_global_snmp_vars()->ops_tbl.dsReadOps = &(stats->ops_stats.dsReadOps);
- g_get_global_snmp_vars()->ops_tbl.dsCompareOps = &(stats->ops_stats.dsCompareOps);
- g_get_global_snmp_vars()->ops_tbl.dsAddEntryOps = &(stats->ops_stats.dsAddEntryOps);
- g_get_global_snmp_vars()->ops_tbl.dsRemoveEntryOps = &(stats->ops_stats.dsRemoveEntryOps);
- g_get_global_snmp_vars()->ops_tbl.dsModifyEntryOps = &(stats->ops_stats.dsModifyEntryOps);
- g_get_global_snmp_vars()->ops_tbl.dsModifyRDNOps = &(stats->ops_stats.dsModifyRDNOps);
- g_get_global_snmp_vars()->ops_tbl.dsListOps = &(stats->ops_stats.dsListOps);
- g_get_global_snmp_vars()->ops_tbl.dsSearchOps = &(stats->ops_stats.dsSearchOps);
- g_get_global_snmp_vars()->ops_tbl.dsOneLevelSearchOps = &(stats->ops_stats.dsOneLevelSearchOps);
- g_get_global_snmp_vars()->ops_tbl.dsWholeSubtreeSearchOps = &(stats->ops_stats.dsWholeSubtreeSearchOps);
- g_get_global_snmp_vars()->ops_tbl.dsReferrals = &(stats->ops_stats.dsReferrals);
- g_get_global_snmp_vars()->ops_tbl.dsChainings = &(stats->ops_stats.dsChainings);
- g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors = &(stats->ops_stats.dsSecurityErrors);
- g_get_global_snmp_vars()->ops_tbl.dsErrors = &(stats->ops_stats.dsErrors);
- g_get_global_snmp_vars()->ops_tbl.dsConnections = &(stats->ops_stats.dsConnections);
- g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq = &(stats->ops_stats.dsConnectionSeq);
- g_get_global_snmp_vars()->ops_tbl.dsBytesRecv = &(stats->ops_stats.dsBytesRecv);
- g_get_global_snmp_vars()->ops_tbl.dsBytesSent = &(stats->ops_stats.dsBytesSent);
- g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned = &(stats->ops_stats.dsEntriesReturned);
- g_get_global_snmp_vars()->ops_tbl.dsReferralsReturned = &(stats->ops_stats.dsReferralsReturned);
-
- /* entries table */
-
- g_get_global_snmp_vars()->entries_tbl.dsMasterEntries = &(stats->entries_stats.dsMasterEntries);
- g_get_global_snmp_vars()->entries_tbl.dsCopyEntries = &(stats->entries_stats.dsCopyEntries);
- g_get_global_snmp_vars()->entries_tbl.dsCacheEntries = &(stats->entries_stats.dsCacheEntries);
- g_get_global_snmp_vars()->entries_tbl.dsCacheHits = &(stats->entries_stats.dsCacheHits);
- g_get_global_snmp_vars()->entries_tbl.dsSlaveHits = &(stats->entries_stats.dsSlaveHits);
-
- /* interaction table */
+ /* update the mmap'd tables */
+ snmp_update_ops_table();
+ snmp_update_entries_table();
+ snmp_update_interactions_table();
- /* set pointers to table */
- for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++)
- {
- stats->int_stats[i].dsIntIndex=i;
- g_get_global_snmp_vars()->int_tbl[i].dsIntIndex = &(stats->int_stats[i].dsIntIndex);
- g_get_global_snmp_vars()->int_tbl[i].dsName = stats->int_stats[i].dsName;
- g_get_global_snmp_vars()->int_tbl[i].dsTimeOfCreation = &(stats->int_stats[i].dsTimeOfCreation);
- g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt = &(stats->int_stats[i].dsTimeOfLastAttempt);
- g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastSuccess = &(stats->int_stats[i].dsTimeOfLastSuccess);
- g_get_global_snmp_vars()->int_tbl[i].dsFailuresSinceLastSuccess
- = &(stats->int_stats[i].dsFailuresSinceLastSuccess);
- g_get_global_snmp_vars()->int_tbl[i].dsFailures = &(stats->int_stats[i].dsFailures);
- g_get_global_snmp_vars()->int_tbl[i].dsSuccesses = &(stats->int_stats[i].dsSuccesses);
- g_get_global_snmp_vars()->int_tbl[i].dsURL = stats->int_stats[i].dsURL;
- }
-
- /* initialize table contents */
- for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++)
- {
- *(g_get_global_snmp_vars()->int_tbl[i].dsIntIndex) = i + 1;
- strcpy(g_get_global_snmp_vars()->int_tbl[i].dsName, "Not Available");
- *(g_get_global_snmp_vars()->int_tbl[i].dsTimeOfCreation) = 0;
- *(g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt) = 0;
- *(g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastSuccess) = 0;
- *(g_get_global_snmp_vars()->int_tbl[i].dsFailuresSinceLastSuccess) = 0;
- *(g_get_global_snmp_vars()->int_tbl[i].dsFailures) = 0;
- *(g_get_global_snmp_vars()->int_tbl[i].dsSuccesses) = 0;
- strcpy(g_get_global_snmp_vars()->int_tbl[i].dsURL, "Not Available");
- }
+ /* Release the semaphore */
+ sem_post(stats_sem);
/* create lock for interaction table */
interaction_table_mutex = PR_NewLock();
@@ -202,7 +211,7 @@
/***********************************************************************************
- * given the name, wether or not it was successfull and the URL updates snmp
+ * given the name, whether or not it was successful and the URL updates snmp
* interaction table appropriately
*
*
@@ -231,32 +240,34 @@
if(isnew){
/* fillin the new row from scratch*/
- *(g_get_global_snmp_vars()->int_tbl[index].dsIntIndex) = index;
- strcpy(g_get_global_snmp_vars()->int_tbl[index].dsName, dsName);
- *(g_get_global_snmp_vars()->int_tbl[index].dsTimeOfCreation) = time(0);
- *(g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastAttempt) = time(0);
+ g_get_global_snmp_vars()->int_tbl[index].dsIntIndex = index;
+ strncpy(g_get_global_snmp_vars()->int_tbl[index].dsName, dsName,
+ sizeof(g_get_global_snmp_vars()->int_tbl[index].dsName));
+ g_get_global_snmp_vars()->int_tbl[index].dsTimeOfCreation = time(0);
+ g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastAttempt = time(0);
if(error == 0){
- *(g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastSuccess) = time(0);
- *(g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess) = 0;
- *(g_get_global_snmp_vars()->int_tbl[index].dsFailures) = 0;
- *(g_get_global_snmp_vars()->int_tbl[index].dsSuccesses) = 1;
+ g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastSuccess = time(0);
+ g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess = 0;
+ g_get_global_snmp_vars()->int_tbl[index].dsFailures = 0;
+ g_get_global_snmp_vars()->int_tbl[index].dsSuccesses = 1;
}else{
- *(g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastSuccess) = 0;
- *(g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess) = 1;
- *(g_get_global_snmp_vars()->int_tbl[index].dsFailures) = 1;
- *(g_get_global_snmp_vars()->int_tbl[index].dsSuccesses) = 0;
+ g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastSuccess = 0;
+ g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess = 1;
+ g_get_global_snmp_vars()->int_tbl[index].dsFailures = 1;
+ g_get_global_snmp_vars()->int_tbl[index].dsSuccesses = 0;
}
- strcpy(g_get_global_snmp_vars()->int_tbl[index].dsURL, dsURL);
+ strncpy(g_get_global_snmp_vars()->int_tbl[index].dsURL, dsURL,
+ sizeof(g_get_global_snmp_vars()->int_tbl[index].dsURL));
}else{
/* just update the appropriate fields */
- *(g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastAttempt) = time(0);
+ g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastAttempt = time(0);
if(error == 0){
- *(g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastSuccess) = time(0);
- *(g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess) = 0;
- *(g_get_global_snmp_vars()->int_tbl[index].dsSuccesses) += 1;
+ g_get_global_snmp_vars()->int_tbl[index].dsTimeOfLastSuccess = time(0);
+ g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess = 0;
+ g_get_global_snmp_vars()->int_tbl[index].dsSuccesses += 1;
}else{
- *(g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess) +=1;
- *(g_get_global_snmp_vars()->int_tbl[index].dsFailures) +=1;
+ g_get_global_snmp_vars()->int_tbl[index].dsFailuresSinceLastSuccess +=1;
+ g_get_global_snmp_vars()->int_tbl[index].dsFailures +=1;
}
}
@@ -274,7 +285,7 @@
*
* this should point to root DSE
************************************************************************************/
-char *make_ds_url(char *host, int port){
+static char *make_ds_url(char *host, int port){
char *url;
@@ -291,14 +302,14 @@
* so caller can rewrite this row
************************************************************************************/
-int search_interaction_table(char *dsURL, int *isnew)
+static int search_interaction_table(char *dsURL, int *isnew)
{
int i;
int index = 0;
time_t oldestattempt;
time_t currentattempt;
- oldestattempt = *(g_get_global_snmp_vars()->int_tbl[0].dsTimeOfLastAttempt);
+ oldestattempt = g_get_global_snmp_vars()->int_tbl[0].dsTimeOfLastAttempt;
*isnew = 1;
for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++){
@@ -314,7 +325,7 @@
break;
}else{
/* not found so figure out oldest row */
- currentattempt = *(g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt);
+ currentattempt = g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt;
if(currentattempt <= oldestattempt){
index=i;
@@ -328,19 +339,19 @@
}
/* for debuging until subagent part working, print contents of interaction table */
-void print_snmp_interaction_table()
+static void print_snmp_interaction_table()
{
int i;
for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++)
{
- fprintf(stderr, " dsIntIndex: %d \n", *(g_get_global_snmp_vars()->int_tbl[i].dsIntIndex));
+ fprintf(stderr, " dsIntIndex: %d \n", g_get_global_snmp_vars()->int_tbl[i].dsIntIndex);
fprintf(stderr, " dsName: %s \n", g_get_global_snmp_vars()->int_tbl[i].dsName);
- fprintf(stderr, " dsTimeOfCreation: %ld \n", *(g_get_global_snmp_vars()->int_tbl[i].dsTimeOfCreation));
- fprintf(stderr, " dsTimeOfLastAttempt: %ld \n", *(g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt));
- fprintf(stderr, " dsTimeOfLastSuccess: %ld \n", *(g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastSuccess));
- fprintf(stderr, "dsFailuresSinceLastSuccess: %d \n", *(g_get_global_snmp_vars()->int_tbl[i].dsFailuresSinceLastSuccess));
- fprintf(stderr, " dsFailures: %d \n", *(g_get_global_snmp_vars()->int_tbl[i].dsFailures));
- fprintf(stderr, " dsSuccesses: %d \n", *(g_get_global_snmp_vars()->int_tbl[i].dsSuccesses));
+ fprintf(stderr, " dsTimeOfCreation: %ld \n", g_get_global_snmp_vars()->int_tbl[i].dsTimeOfCreation);
+ fprintf(stderr, " dsTimeOfLastAttempt: %ld \n", g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt);
+ fprintf(stderr, " dsTimeOfLastSuccess: %ld \n", g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastSuccess);
+ fprintf(stderr, "dsFailuresSinceLastSuccess: %d \n", g_get_global_snmp_vars()->int_tbl[i].dsFailuresSinceLastSuccess);
+ fprintf(stderr, " dsFailures: %d \n", g_get_global_snmp_vars()->int_tbl[i].dsFailures);
+ fprintf(stderr, " dsSuccesses: %d \n", g_get_global_snmp_vars()->int_tbl[i].dsSuccesses);
fprintf(stderr, " dsURL: %s \n", g_get_global_snmp_vars()->int_tbl[i].dsURL);
fprintf(stderr, "\n");
}
@@ -418,6 +429,8 @@
}
PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/%s%s",
statspath, instname, AGT_STATS_EXTENSION);
+ PR_snprintf(stats_sem_name, sizeof(stats_sem_name), "%s%s",
+ instname, AGT_STATS_EXTENSION);
tmpstatsfile = szStatsFile;
slapi_ch_free_string(&statspath);
slapi_ch_free_string(&instdir);
@@ -427,27 +440,22 @@
{
if (err != EEXIST) /* Ignore if file already exists */
{
- printf("Failed to open stats file (%s) (error %d).\n",
- szStatsFile, err);
+ LDAPDebug( LDAP_DEBUG_ANY, "Failed to open stats file (%s) (error %d).\n",
+ szStatsFile, err, 0 );
exit(1);
}
}
-/* read config entry for entity table data */
+ /* Create semaphore for stats file access */
+ snmp_collator_create_semaphore();
-/* point stats struct at mmap data */
+ /* point stats struct at mmap data */
stats = (struct agt_stats_t *) mmap_tbl [hdl].fp;
-/* initialize stats data */
-
+ /* initialize stats data */
snmp_collator_init();
-/*
-* now that memmap is open and things point the right way
-* an atomic set or increment anywhere in slapd should set
-* the snmp memmap vars correctly and be able to be polled by snmp
-*/
- /* Arrange to be called back periodically */
+ /* Arrange to be called back periodically to update the mmap'd stats file. */
snmp_eq_ctx = slapi_eq_repeat(snmp_collator_update, NULL, (time_t)0,
SLAPD_SNMP_UPDATE_INTERVAL);
return 0;
@@ -472,6 +480,9 @@
slapi_eq_cancel(snmp_eq_ctx);
snmp_collator_stopped = 1;
+ /* acquire the semaphore */
+ snmp_collator_sem_wait();
+
/* close the memory map */
if ((err = agt_mclose_stats(hdl)) != 0)
{
@@ -485,6 +496,10 @@
tmpstatsfile, errno);
}
+ /* close and delete semaphore */
+ sem_close(stats_sem);
+ sem_unlink(stats_sem_name);
+
/* delete lock */
PR_DestroyLock(interaction_table_mutex);
@@ -498,166 +513,304 @@
return 0;
}
+/*
+ * snmp_collator_create_semaphore()
+ *
+ * Create a semaphore to synchronize access to the stats file with
+ * the SNMP sub-agent. NSPR doesn't support a trywait function
+ * for semaphores, so we just use POSIX semaphores directly.
+ */
+static void
+snmp_collator_create_semaphore()
+{
+ /* First just try to create the semaphore. This should usually just work. */
+ if ((stats_sem = sem_open(stats_sem_name, O_CREAT | O_EXCL, SLAPD_DEFAULT_FILE_MODE, 1)) == SEM_FAILED) {
+ if (errno == EEXIST) {
+ /* It appears that we didn't exit cleanly last time and left the semaphore
+ * around. Recreate it since we don't know what state it is in. */
+ sem_unlink(stats_sem_name);
+ if ((stats_sem = sem_open(stats_sem_name, O_CREAT | O_EXCL, SLAPD_DEFAULT_FILE_MODE, 1)) == SEM_FAILED) {
+ /* No dice */
+ LDAPDebug( LDAP_DEBUG_ANY, "Failed to create semaphore for stats file (%s). Error %d.\n",
+ szStatsFile, errno, 0 );
+ exit(1);
+ }
+ } else {
+ /* Some other problem occurred creating the semaphore. */
+ LDAPDebug( LDAP_DEBUG_ANY, "Failed to create semaphore for stats file (%s). Error %d.\n",
+ szStatsFile, errno, 0 );
+ exit(1);
+ }
+ }
+
+ /* If we've reached this point, everything should be good. */
+ return;
+}
+
+/*
+ * snmp_collator_sem_wait()
+ *
+ * A wrapper used to get the semaphore. We don't want to block,
+ * but we want to retry a specified number of times in case the
+ * semaphore is help by the sub-agent.
+ */
+static void
+snmp_collator_sem_wait()
+{
+ int i = 0;
+ int got_sem = 0;
+
+ for (i=0; i < SNMP_NUM_SEM_WAITS; i++) {
+ if (sem_trywait(stats_sem) == 0) {
+ got_sem = 1;
+ break;
+ }
+ PR_Sleep(PR_SecondsToInterval(1));
+ }
+
+ if (!got_sem) {
+ /* If we've been unable to get the semaphore, there's
+ * something wrong (likely the sub-agent went out to
+ * lunch). We remove the old semaphore and recreate
+ * a new one to avoid hanging up the server. */
+ sem_close(stats_sem);
+ sem_unlink(stats_sem_name);
+ snmp_collator_create_semaphore();
+ }
+}
+
/***********************************************************************************
*
* int snmp_collator_update()
*
-* our architecture changed from mail server and we right to mmapped
-* area as soon as operation completed, rather than maintining the same data twice
-* and doing a polled update. However, to keep traps working correctly (as they depend)
-* on the time in the header, it is more efficient to write the header info
-* in a polled fashion (ever 1 sec)
+* Event callback function that updates the mmap'd stats file
+* for the SNMP sub-agent. This will use a semaphore while
+* updating the stats file to prevent the SNMP sub-agent from
+* reading it in the middle of an update.
*
************************************************************************************/
void
snmp_collator_update(time_t start_time, void *arg)
{
- Slapi_Backend *be, *be_next;
- char *cookie = NULL;
- Slapi_PBlock *search_result_pb = NULL;
- Slapi_Entry **search_entries;
- Slapi_Attr *attr = NULL;
- Slapi_Value *sval = NULL;
- int search_result;
-
- if (snmp_collator_stopped) {
- return;
- }
+ if (snmp_collator_stopped) {
+ return;
+ }
+
+ /* force an update of the backend cache stats. */
+ snmp_update_cache_stats();
+
+ /* get the semaphore */
+ snmp_collator_sem_wait();
/* just update the update time in the header */
if( stats != NULL){
stats->hdr_stats.updateTime = time(0);
}
+ /* update the mmap'd tables */
+ snmp_update_ops_table();
+ snmp_update_entries_table();
+ snmp_update_interactions_table();
+
+ /* release the semaphore */
+ sem_post(stats_sem);
+}
+
+/*
+ * snmp_update_ops_table()
+ *
+ * Updates the mmap'd operations table. The semaphore
+ * should be acquired before you call this.
+ */
+static void
+snmp_update_ops_table()
+{
+ stats->ops_stats.dsAnonymousBinds = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds);
+ stats->ops_stats.dsUnAuthBinds = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
+ stats->ops_stats.dsSimpleAuthBinds = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsSimpleAuthBinds);
+ stats->ops_stats.dsStrongAuthBinds = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsStrongAuthBinds);
+ stats->ops_stats.dsBindSecurityErrors = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
+ stats->ops_stats.dsInOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsInOps);
+ stats->ops_stats.dsReadOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsReadOps);
+ stats->ops_stats.dsCompareOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsCompareOps);
+ stats->ops_stats.dsAddEntryOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsAddEntryOps);
+ stats->ops_stats.dsRemoveEntryOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsRemoveEntryOps);
+ stats->ops_stats.dsModifyEntryOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsModifyEntryOps);
+ stats->ops_stats.dsModifyRDNOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsModifyRDNOps);
+ stats->ops_stats.dsListOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsListOps);
+ stats->ops_stats.dsSearchOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsSearchOps);
+ stats->ops_stats.dsOneLevelSearchOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsOneLevelSearchOps);
+ stats->ops_stats.dsWholeSubtreeSearchOps = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsWholeSubtreeSearchOps);
+ stats->ops_stats.dsReferrals = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsReferrals);
+ stats->ops_stats.dsChainings = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsChainings);
+ stats->ops_stats.dsSecurityErrors = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors);
+ stats->ops_stats.dsErrors = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsErrors);
+ stats->ops_stats.dsConnections = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnections);
+ stats->ops_stats.dsConnectionSeq = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq);
+ stats->ops_stats.dsBytesRecv = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBytesRecv);
+ stats->ops_stats.dsBytesSent = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBytesSent);
+ stats->ops_stats.dsEntriesReturned = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned);
+ stats->ops_stats.dsReferralsReturned = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsReferralsReturned);
+}
+
+/*
+ * snmp_update_entries_table()
+ *
+ * Updated the mmap'd entries table. The semaphore should
+ * be acquired before you call this.
+ */
+static void
+snmp_update_entries_table()
+{
+ stats->entries_stats.dsMasterEntries = slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsMasterEntries);
+ stats->entries_stats.dsCopyEntries = slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsCopyEntries);
+ stats->entries_stats.dsCacheEntries = slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsCacheEntries);
+ stats->entries_stats.dsCacheHits = slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsCacheHits);
+ stats->entries_stats.dsSlaveHits = slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsSlaveHits);
+}
+
+/*
+ * snmp_update_interactions_table()
+ *
+ * Updates the mmap'd interactions table. The semaphore should
+ * be acquired before you call this.
+ */
+static void
+snmp_update_interactions_table()
+{
+ int i;
+
+ for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++) {
+ stats->int_stats[i].dsIntIndex = i;
+ strncpy(stats->int_stats[i].dsName, g_get_global_snmp_vars()->int_tbl[i].dsName,
+ sizeof(stats->int_stats[i].dsName));
+ stats->int_stats[i].dsTimeOfCreation = g_get_global_snmp_vars()->int_tbl[i].dsTimeOfCreation;
+ stats->int_stats[i].dsTimeOfLastAttempt = g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastAttempt;
+ stats->int_stats[i].dsTimeOfLastSuccess = g_get_global_snmp_vars()->int_tbl[i].dsTimeOfLastSuccess;
+ stats->int_stats[i].dsFailuresSinceLastSuccess = g_get_global_snmp_vars()->int_tbl[i].dsFailuresSinceLastSuccess;
+ stats->int_stats[i].dsFailures = g_get_global_snmp_vars()->int_tbl[i].dsFailures;
+ stats->int_stats[i].dsSuccesses = g_get_global_snmp_vars()->int_tbl[i].dsSuccesses;
+ strncpy(stats->int_stats[i].dsURL, g_get_global_snmp_vars()->int_tbl[i].dsURL,
+ sizeof(stats->int_stats[i].dsURL));
+ }
+}
+
+/*
+ * snmp_update_cache_stats()
+ *
+ * Reads the backend cache stats from the backend monitor entry and
+ * updates the global counter used by the SNMP sub-agent as well as
+ * the SNMP monitor entry.
+ */
+static void
+snmp_update_cache_stats()
+{
+ Slapi_Backend *be, *be_next;
+ char *cookie = NULL;
+ Slapi_PBlock *search_result_pb = NULL;
+ Slapi_Entry **search_entries;
+ int search_result;
+
/* set the cache hits/cache entries info */
- be = slapi_get_first_backend(&cookie);
- if (!be)
- return;
+ be = slapi_get_first_backend(&cookie);
+ if (!be)
+ return;
- be_next = slapi_get_next_backend(cookie);
+ be_next = slapi_get_next_backend(cookie);
- slapi_ch_free ((void **) &cookie);
+ slapi_ch_free ((void **) &cookie);
- /* for now, only do it if there is only 1 backend, otherwise don't know
- which backend to pick */
+ /* for now, only do it if there is only 1 backend, otherwise don't know
+ * which backend to pick */
if(be_next == NULL)
{
- Slapi_DN monitordn;
- slapi_sdn_init(&monitordn);
- be_getmonitordn(be,&monitordn);
+ Slapi_DN monitordn;
+ slapi_sdn_init(&monitordn);
+ be_getmonitordn(be,&monitordn);
- /* do a search on the monitor dn to get info */
+ /* do a search on the monitor dn to get info */
search_result_pb = slapi_search_internal( slapi_sdn_get_dn(&monitordn),
- LDAP_SCOPE_BASE,
- "objectclass=*",
- NULL,
- NULL,
- 0);
- slapi_sdn_done(&monitordn);
-
- slapi_pblock_get( search_result_pb, SLAPI_PLUGIN_INTOP_RESULT, &search_result);
-
- if(search_result == 0)
- {
- const struct berval *val = NULL;
- /* get the entrycachehits */
- slapi_pblock_get( search_result_pb,SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES,
- &search_entries);
- if(slapi_entry_attr_find( search_entries[0], "entrycachehits", &attr) == 0 )
- {
- /* get the values out of the attribute */
- val = NULL;
- slapi_attr_first_value( attr, &sval );
- if(NULL != sval)
- {
- val= slapi_value_get_berval( sval );
- }
- }
-
- /* if we got a value for entrycachehits, then set it */
- if(val != NULL)
- {
- snmp_set_counter(g_get_global_snmp_vars()->entries_tbl.dsCacheHits, atoi(val->bv_val));
-
- }
+ LDAP_SCOPE_BASE,
+ "objectclass=*",
+ NULL,
+ NULL,
+ 0);
+ slapi_sdn_done(&monitordn);
+
+ slapi_pblock_get( search_result_pb, SLAPI_PLUGIN_INTOP_RESULT, &search_result);
+
+ if(search_result == 0)
+ {
+ slapi_pblock_get( search_result_pb,SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES,
+ &search_entries);
+
+ /* set the entrycachehits */
+ slapi_counter_set_value(g_get_global_snmp_vars()->entries_tbl.dsCacheHits,
+ slapi_entry_attr_get_ulonglong(search_entries[0], "entrycachehits"));
- /* get the currententrycachesize */
- attr = NULL;
- val = NULL;
- sval = NULL;
- if(slapi_entry_attr_find( search_entries[0], "currententrycachesize", &attr) == 0 )
- {
- /* get the values out of the attribute */
- slapi_attr_first_value( attr,&sval );
- if(NULL != sval) {
- val= slapi_value_get_berval( sval );
- }
- }
-
- /* if we got a value for currententrycachesize, then set it */
- if(val != NULL)
- {
- snmp_set_counter(g_get_global_snmp_vars()->entries_tbl.dsCacheEntries, atoi(val->bv_val));
-
- }
-
- }
-
- slapi_free_search_results_internal(search_result_pb);
- slapi_pblock_destroy(search_result_pb);
+ /* set the currententrycachesize */
+ slapi_counter_set_value(g_get_global_snmp_vars()->entries_tbl.dsCacheEntries,
+ slapi_entry_attr_get_ulonglong(search_entries[0], "currententrycachesize"));
+ }
+
+ slapi_free_search_results_internal(search_result_pb);
+ slapi_pblock_destroy(search_result_pb);
}
}
-/* NGK - We should not be using a plain int here. All of these counters
- * are PRUint32 types for now, but they will be PRUint64 once converted
- * to use Slapi_Counter. */
static void
-add_counter_to_value(Slapi_Entry *e, const char *type, int countervalue)
+add_counter_to_value(Slapi_Entry *e, const char *type, PRUint64 countervalue)
{
char value[40];
- sprintf(value,"%d",countervalue);
+ sprintf(value,"%" PRIu64, countervalue);
slapi_entry_attr_set_charptr( e, type, value);
}
void
snmp_as_entry(Slapi_Entry *e)
{
- add_counter_to_value(e,"AnonymousBinds",stats->ops_stats.dsAnonymousBinds);
- add_counter_to_value(e,"UnAuthBinds",stats->ops_stats.dsUnAuthBinds);
- add_counter_to_value(e,"SimpleAuthBinds",stats->ops_stats.dsSimpleAuthBinds);
- add_counter_to_value(e,"StrongAuthBinds",stats->ops_stats.dsStrongAuthBinds);
- add_counter_to_value(e,"BindSecurityErrors",stats->ops_stats.dsBindSecurityErrors);
- add_counter_to_value(e,"InOps",stats->ops_stats.dsInOps);
- add_counter_to_value(e,"ReadOps",stats->ops_stats.dsReadOps);
- add_counter_to_value(e,"CompareOps",stats->ops_stats.dsCompareOps);
- add_counter_to_value(e,"AddEntryOps",stats->ops_stats.dsAddEntryOps);
- add_counter_to_value(e,"RemoveEntryOps",stats->ops_stats.dsRemoveEntryOps);
- add_counter_to_value(e,"ModifyEntryOps",stats->ops_stats.dsModifyEntryOps);
- add_counter_to_value(e,"ModifyRDNOps",stats->ops_stats.dsModifyRDNOps);
- add_counter_to_value(e,"ListOps",stats->ops_stats.dsListOps);
- add_counter_to_value(e,"SearchOps",stats->ops_stats.dsSearchOps);
- add_counter_to_value(e,"OneLevelSearchOps",stats->ops_stats.dsOneLevelSearchOps);
- add_counter_to_value(e,"WholeSubtreeSearchOps",stats->ops_stats.dsWholeSubtreeSearchOps);
- add_counter_to_value(e,"Referrals",stats->ops_stats.dsReferrals);
- add_counter_to_value(e,"Chainings",stats->ops_stats.dsChainings);
- add_counter_to_value(e,"SecurityErrors",stats->ops_stats.dsSecurityErrors);
- add_counter_to_value(e,"Errors",stats->ops_stats.dsErrors);
- add_counter_to_value(e,"Connections",stats->ops_stats.dsConnections);
- add_counter_to_value(e,"ConnectionSeq",stats->ops_stats.dsConnectionSeq);
- add_counter_to_value(e,"BytesRecv",stats->ops_stats.dsBytesRecv);
- add_counter_to_value(e,"BytesSent",stats->ops_stats.dsBytesSent);
- add_counter_to_value(e,"EntriesReturned",stats->ops_stats.dsEntriesReturned);
- add_counter_to_value(e,"ReferralsReturned",stats->ops_stats.dsReferralsReturned);
- add_counter_to_value(e,"MasterEntries",stats->entries_stats.dsMasterEntries);
- add_counter_to_value(e,"CopyEntries",stats->entries_stats.dsCopyEntries);
- add_counter_to_value(e,"CacheEntries",stats->entries_stats.dsCacheEntries);
- add_counter_to_value(e,"CacheHits",stats->entries_stats.dsCacheHits);
- add_counter_to_value(e,"SlaveHits",stats->entries_stats.dsSlaveHits);
+ add_counter_to_value(e,"AnonymousBinds", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds));
+ add_counter_to_value(e,"UnAuthBinds", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds));
+ add_counter_to_value(e,"SimpleAuthBinds", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsSimpleAuthBinds));
+ add_counter_to_value(e,"StrongAuthBinds", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsStrongAuthBinds));
+ add_counter_to_value(e,"BindSecurityErrors", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors));
+ add_counter_to_value(e,"InOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsInOps));
+ add_counter_to_value(e,"ReadOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsReadOps));
+ add_counter_to_value(e,"CompareOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsCompareOps));
+ add_counter_to_value(e,"AddEntryOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsAddEntryOps));
+ add_counter_to_value(e,"RemoveEntryOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsRemoveEntryOps));
+ add_counter_to_value(e,"ModifyEntryOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsModifyEntryOps));
+ add_counter_to_value(e,"ModifyRDNOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsModifyRDNOps));
+ add_counter_to_value(e,"ListOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsListOps));
+ add_counter_to_value(e,"SearchOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsSearchOps));
+ add_counter_to_value(e,"OneLevelSearchOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsOneLevelSearchOps));
+ add_counter_to_value(e,"WholeSubtreeSearchOps", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsWholeSubtreeSearchOps));
+ add_counter_to_value(e,"Referrals", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsReferrals));
+ add_counter_to_value(e,"Chainings", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsChainings));
+ add_counter_to_value(e,"SecurityErrors", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsSecurityErrors));
+ add_counter_to_value(e,"Errors", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsErrors));
+ add_counter_to_value(e,"Connections", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnections));
+ add_counter_to_value(e,"ConnectionSeq", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq));
+ add_counter_to_value(e,"BytesRecv", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBytesRecv));
+ add_counter_to_value(e,"BytesSent", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBytesSent));
+ add_counter_to_value(e,"EntriesReturned", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned));
+ add_counter_to_value(e,"ReferralsReturned", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsReferralsReturned));
+ add_counter_to_value(e,"MasterEntries", slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsMasterEntries));
+ add_counter_to_value(e,"CopyEntries", slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsCopyEntries));
+ add_counter_to_value(e,"CacheEntries", slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsCacheEntries));
+ add_counter_to_value(e,"CacheHits", slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsCacheHits));
+ add_counter_to_value(e,"SlaveHits", slapi_counter_get_value(g_get_global_snmp_vars()->entries_tbl.dsSlaveHits));
}
+/*
+ * loadConfigStats()
+ *
+ * Reads the header table SNMP settings and sets them in the mmap'd stats
+ * file. This should be done only when the semaphore is held.
+ */
static void
loadConfigStats() {
Slapi_Entry *entry = NULL;
@@ -726,20 +879,3 @@
}
}
-/*
- * wrapper functions to ease the cast burdon between net=snmp APIs which expect
- * unsigned int and PR_AtomicIncrement/PR_AtomicSet which expect signed int.
- * NSPR_API(PRInt32) PR_AtomicSet(PRInt32 *val, PRInt32 newval);
- * NSPR_API(PRInt32) PR_AtomicIncrement(PRInt32 *val);
- */
-void
-snmp_increment_counter(PRUint32 *counter)
-{
- PR_AtomicIncrement((PRInt32 *)counter);
-}
-
-void snmp_set_counter(PRUint32 *counter, PRInt32 newval)
-{
- PR_AtomicSet((PRInt32 *)counter, newval);
-}
-
15 years, 6 months
[Fedora-directory-commits] ldapserver/ldap/servers/snmp ldap-agent.c, 1.12, 1.13 ldap-agent.h, 1.10, 1.11 main.c, 1.15, 1.16 redhat-directory.mib, 1.3, 1.4
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/snmp
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9308/ldap/servers/snmp
Modified Files:
ldap-agent.c ldap-agent.h main.c redhat-directory.mib
Log Message:
Resolves: 207457
Summary: Convert counters to 64-bit capable Slapi_Counter type.
Index: ldap-agent.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/snmp/ldap-agent.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ldap-agent.c 18 Oct 2007 00:08:35 -0000 1.12
+++ ldap-agent.c 24 Oct 2008 22:36:59 -0000 1.13
@@ -277,6 +277,7 @@
time_t previous_start;
int previous_state;
int stats_hdl = -1;
+ sem_t *stats_sem = NULL;
snmp_log(LOG_INFO, "Reloading stats.\n");
@@ -291,8 +292,39 @@
snmp_log(LOG_INFO, "Opening stats file (%s) for server: %d\n",
serv_p->stats_file, serv_p->port);
+ /* Open and acquire semaphore */
+ if ((stats_sem = sem_open(serv_p->stats_sem_name, 0)) == SEM_FAILED) {
+ stats_sem = NULL;
+ snmp_log(LOG_INFO, "Unable to open semaphore for server: %d\n", serv_p->port);
+ } else {
+ int i = 0;
+ int got_sem = 0;
+
+ for (i=0; i < SNMP_NUM_SEM_WAITS; i++) {
+ if (sem_trywait(stats_sem) == 0) {
+ got_sem = 1;
+ break;
+ }
+ PR_Sleep(PR_SecondsToInterval(1));
+ }
+
+ if (!got_sem) {
+ /* We're unable to get the semaphore. Assume
+ * that the server is down. */
+ snmp_log(LOG_INFO, "Unable to acquire semaphore for server: %d\n", serv_p->port);
+ sem_close(stats_sem);
+ stats_sem = NULL;
+ }
+ }
+
/* Open the stats file */
- if ( agt_mopen_stats(serv_p->stats_file, O_RDONLY, &stats_hdl) != 0 ) {
+ if ((stats_sem == NULL) || (agt_mopen_stats(serv_p->stats_file, O_RDONLY, &stats_hdl) != 0)) {
+ if (stats_sem) {
+ /* Release and close semaphore */
+ sem_post(stats_sem);
+ sem_close(stats_sem);
+ }
+
/* Server must be down */
serv_p->server_state = SERVER_DOWN;
/* Zero out the ops and entries tables */
@@ -313,6 +345,10 @@
snmp_log(LOG_ERR, "Error closing stats file: %s\n",
serv_p->stats_file);
+ /* Release and close semaphore */
+ sem_post(stats_sem);
+ sem_close(stats_sem);
+
/* Server must be down if the stats file hasn't been
* updated in a while */
if (difftime(time(NULL), ctx->hdr_tbl.updateTime) >= UPDATE_THRESHOLD) {
@@ -382,135 +418,108 @@
netsnmp_index * item,
netsnmp_table_request_info *table_info)
{
+ PRUint64 *the_stat = NULL;
+ integer64 new_val;
netsnmp_variable_list *var = request->requestvb;
stats_table_context *context = (stats_table_context *) item;
switch (table_info->colnum) {
case COLUMN_DSANONYMOUSBINDS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsAnonymousBinds,
- sizeof(context->ops_tbl.dsAnonymousBinds));
+ the_stat = &context->ops_tbl.dsAnonymousBinds;
break;
case COLUMN_DSUNAUTHBINDS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsUnAuthBinds,
- sizeof(context->ops_tbl.dsUnAuthBinds));
+ the_stat = &context->ops_tbl.dsUnAuthBinds;
break;
case COLUMN_DSSIMPLEAUTHBINDS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsSimpleAuthBinds,
- sizeof(context->ops_tbl.dsSimpleAuthBinds));
+ the_stat = &context->ops_tbl.dsSimpleAuthBinds;
break;
case COLUMN_DSSTRONGAUTHBINDS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsStrongAuthBinds,
- sizeof(context->ops_tbl.dsStrongAuthBinds));
+ the_stat = &context->ops_tbl.dsStrongAuthBinds;
break;
case COLUMN_DSBINDSECURITYERRORS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsBindSecurityErrors,
- sizeof(context->ops_tbl.dsBindSecurityErrors));
+ the_stat = &context->ops_tbl.dsBindSecurityErrors;
break;
case COLUMN_DSINOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsInOps,
- sizeof(context->ops_tbl.dsInOps));
+ the_stat = &context->ops_tbl.dsInOps;
break;
case COLUMN_DSREADOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsReadOps,
- sizeof(context->ops_tbl.dsReadOps));
+ the_stat = &context->ops_tbl.dsReadOps;
break;
case COLUMN_DSCOMPAREOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsCompareOps,
- sizeof(context->ops_tbl.dsCompareOps));
+ the_stat = &context->ops_tbl.dsCompareOps;
break;
case COLUMN_DSADDENTRYOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsAddEntryOps,
- sizeof(context->ops_tbl.dsAddEntryOps));
+ the_stat = &context->ops_tbl.dsAddEntryOps;
break;
case COLUMN_DSREMOVEENTRYOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsRemoveEntryOps,
- sizeof(context->ops_tbl.dsRemoveEntryOps));
+ the_stat = &context->ops_tbl.dsRemoveEntryOps;
break;
case COLUMN_DSMODIFYENTRYOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsModifyEntryOps,
- sizeof(context->ops_tbl.dsModifyEntryOps));
+ the_stat = &context->ops_tbl.dsModifyEntryOps;
break;
case COLUMN_DSMODIFYRDNOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsModifyRDNOps,
- sizeof(context->ops_tbl.dsModifyRDNOps));
+ the_stat = &context->ops_tbl.dsModifyRDNOps;
break;
case COLUMN_DSLISTOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsListOps,
- sizeof(context->ops_tbl.dsListOps));
+ the_stat = &context->ops_tbl.dsListOps;
break;
case COLUMN_DSSEARCHOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsSearchOps,
- sizeof(context->ops_tbl.dsSearchOps));
+ the_stat = &context->ops_tbl.dsSearchOps;
break;
case COLUMN_DSONELEVELSEARCHOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsOneLevelSearchOps,
- sizeof(context->ops_tbl.dsOneLevelSearchOps));
+ the_stat = &context->ops_tbl.dsOneLevelSearchOps;
break;
case COLUMN_DSWHOLESUBTREESEARCHOPS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsWholeSubtreeSearchOps,
- sizeof(context->ops_tbl.dsWholeSubtreeSearchOps));
+ the_stat = &context->ops_tbl.dsWholeSubtreeSearchOps;
break;
case COLUMN_DSREFERRALS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsReferrals,
- sizeof(context->ops_tbl.dsReferrals));
+ the_stat = &context->ops_tbl.dsReferrals;
break;
case COLUMN_DSCHAININGS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsChainings,
- sizeof(context->ops_tbl.dsChainings));
+ the_stat = &context->ops_tbl.dsChainings;
break;
case COLUMN_DSSECURITYERRORS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsSecurityErrors,
- sizeof(context->ops_tbl.dsSecurityErrors));
+ the_stat = &context->ops_tbl.dsSecurityErrors;
break;
case COLUMN_DSERRORS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->ops_tbl.dsErrors,
- sizeof(context->ops_tbl.dsErrors));
+ the_stat = &context->ops_tbl.dsErrors;
break;
default:/* We shouldn't get here */
snmp_log(LOG_ERR, "Unknown column in dsOpsTable_get_value\n");
return SNMP_ERR_GENERR;
}
+
+ /* The Net-SNMP integer64 type isn't a true 64-bit value, but instead
+ * a structure containing the high and low bits separately. We need
+ * to split our value appropriately. */
+ new_val.low = *the_stat & 0x00000000ffffffff;
+ new_val.high = (*the_stat >> 32) & 0x00000000ffffffff;
+
+ snmp_set_var_typed_value(var, ASN_COUNTER64,
+ (u_char *) &new_val,
+ sizeof(new_val));
+
return SNMP_ERR_NOERROR;
}
@@ -527,45 +536,48 @@
netsnmp_index * item,
netsnmp_table_request_info *table_info)
{
+ PRUint64 *the_stat = NULL;
+ integer64 new_val;
netsnmp_variable_list *var = request->requestvb;
stats_table_context *context = (stats_table_context *) item;
switch (table_info->colnum) {
case COLUMN_DSMASTERENTRIES:
- snmp_set_var_typed_value(var, ASN_GAUGE,
- (u_char *) &context->entries_tbl.dsMasterEntries,
- sizeof(context->entries_tbl.dsMasterEntries));
+ the_stat = &context->entries_tbl.dsMasterEntries;
break;
case COLUMN_DSCOPYENTRIES:
- snmp_set_var_typed_value(var, ASN_GAUGE,
- (u_char *) &context->entries_tbl.dsCopyEntries,
- sizeof(context->entries_tbl.dsCopyEntries));
+ the_stat = &context->entries_tbl.dsCopyEntries;
break;
case COLUMN_DSCACHEENTRIES:
- snmp_set_var_typed_value(var, ASN_GAUGE,
- (u_char *) &context->entries_tbl.dsCacheEntries,
- sizeof(context->entries_tbl.dsCacheEntries));
+ the_stat = &context->entries_tbl.dsCacheEntries;
break;
case COLUMN_DSCACHEHITS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->entries_tbl.dsCacheHits,
- sizeof(context->entries_tbl.dsCacheHits));
+ the_stat = &context->entries_tbl.dsCacheHits;
break;
case COLUMN_DSSLAVEHITS:
- snmp_set_var_typed_value(var, ASN_COUNTER,
- (u_char *) &context->entries_tbl.dsSlaveHits,
- sizeof(context->entries_tbl.dsSlaveHits));
+ the_stat = &context->entries_tbl.dsSlaveHits;
break;
default:/* We shouldn't get here */
snmp_log(LOG_ERR, "Unknown column in dsEntriesTable_get_value\n");
return SNMP_ERR_GENERR;
}
+
+ /* The Net-SNMP integer64 type isn't a true 64-bit value, but instead
+ * a structure containing the high and low bits separately. We need
+ * to split our value appropriately. */
+ new_val.low = *the_stat & 0x00000000ffffffff;
+ new_val.high = (*the_stat >> 32) & 0x00000000ffffffff;
+
+ snmp_set_var_typed_value(var, ASN_COUNTER64,
+ (u_char *) &new_val,
+ sizeof(new_val));
+
return SNMP_ERR_NOERROR;
}
Index: ldap-agent.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/snmp/ldap-agent.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ldap-agent.h 8 Oct 2008 17:29:04 -0000 1.10
+++ ldap-agent.h 24 Oct 2008 22:36:59 -0000 1.11
@@ -74,10 +74,19 @@
#include <net-snmp/library/container.h>
#include <net-snmp/agent/table_array.h>
#include "../slapd/agtmmap.h"
+#include <semaphore.h>
+#include <fcntl.h>
+
+#ifdef HPUX
+/* HP-UX doesn't define SEM_FAILED like other platforms, so
+ * * we define it ourselves. */
+#define SEM_FAILED ((sem_t *)(-1))
+#endif
#define MAXLINE 4096
#define CACHE_REFRESH_INTERVAL 15
#define UPDATE_THRESHOLD 20
+#define SNMP_NUM_SEM_WAITS 10
#define LDAP_AGENT_PIDFILE ".ldap-agent.pid"
#define LDAP_AGENT_LOGFILE "ldap-agent.log"
@@ -95,6 +104,7 @@
PRUint32 port;
int server_state;
char *stats_file;
+ char *stats_sem_name;
char *dse_ldif;
struct server_instance_s *next;
} server_instance;
Index: main.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/snmp/main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- main.c 22 Oct 2007 18:29:55 -0000 1.15
+++ main.c 24 Oct 2008 22:36:59 -0000 1.16
@@ -355,6 +355,19 @@
instancename = NULL;
goto close_and_exit;
}
+
+ /* set the semaphore name */
+ /* ".stats" + \0 = 7 */
+ serv_p->stats_sem_name = malloc(strlen(p) + 7);
+ if (serv_p->stats_sem_name != NULL) {
+ snprintf(serv_p->stats_sem_name, strlen(p) + 7, "%s.stats", p);
+ } else {
+ printf("ldap-agent: malloc error processing config file\n");
+ error = 1;
+ free(instancename);
+ instancename = NULL;
+ goto close_and_exit;
+ }
}
/* Open dse.ldif */
Index: redhat-directory.mib
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/snmp/redhat-directory.mib,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- redhat-directory.mib 19 Apr 2005 22:07:42 -0000 1.3
+++ redhat-directory.mib 24 Oct 2008 22:36:59 -0000 1.4
@@ -46,7 +46,7 @@
RHDS-MIB DEFINITIONS ::= BEGIN
IMPORTS
- MODULE-IDENTITY, Counter32, Gauge32, OBJECT-TYPE
+ MODULE-IDENTITY, Counter64, Counter32, Gauge32, OBJECT-TYPE
FROM SNMPv2-SMI
DisplayString, TimeStamp, TEXTUAL-CONVENTION
FROM SNMPv2-TC
@@ -68,7 +68,7 @@
SYNTAX DisplayString
rhds MODULE-IDENTITY
- LAST-UPDATED "200503020000Z"
+ LAST-UPDATED "200810230000Z"
ORGANIZATION "Red Hat, Inc."
CONTACT-INFO
"Red Hat, Inc.
@@ -103,54 +103,54 @@
-- Bindings
dsAnonymousBinds
- Counter32,
+ Counter64,
dsUnAuthBinds
- Counter32,
+ Counter64,
dsSimpleAuthBinds
- Counter32,
+ Counter64,
dsStrongAuthBinds
- Counter32,
+ Counter64
dsBindSecurityErrors
- Counter32,
+ Counter64,
-- In-coming operations
dsInOps
- Counter32,
+ Counter64,
dsReadOps
- Counter32,
+ Counter64,
dsCompareOps
- Counter32,
+ Counter64,
dsAddEntryOps
- Counter32,
+ Counter64,
dsRemoveEntryOps
- Counter32,
+ Counter64,
dsModifyEntryOps
- Counter32,
+ Counter64,
dsModifyRDNOps
- Counter32,
+ Counter64,
dsListOps
- Counter32,
+ Counter64,
dsSearchOps
- Counter32,
+ Counter64,
dsOneLevelSearchOps
- Counter32,
+ Counter64,
dsWholeSubtreeSearchOps
- Counter32,
+ Counter64,
-- Out going operations
dsReferrals
- Counter32,
+ Counter64,
dsChainings
- Counter32,
+ Counter64,
-- Errors
dsSecurityErrors
- Counter32,
+ Counter64,
dsErrors
- Counter32
+ Counter64
}
-- CLDAP does not use binds; for A CLDAP DS the bind
@@ -172,7 +172,7 @@
-- CLDAP and LDAP DSs: dsReferrals.
dsAnonymousBinds OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -181,7 +181,7 @@
::= {dsOpsEntry 1}
dsUnAuthBinds OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -190,7 +190,7 @@
::= {dsOpsEntry 2}
dsSimpleAuthBinds OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -203,7 +203,7 @@
::= {dsOpsEntry 3}
dsStrongAuthBinds OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -217,7 +217,7 @@
::= {dsOpsEntry 4}
dsBindSecurityErrors OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -230,7 +230,7 @@
::= {dsOpsEntry 5}
dsInOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -240,7 +240,7 @@
::= {dsOpsEntry 6}
dsReadOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -252,7 +252,7 @@
::= {dsOpsEntry 7}
dsCompareOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -264,7 +264,7 @@
::= {dsOpsEntry 8}
dsAddEntryOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -276,7 +276,7 @@
::= {dsOpsEntry 9}
dsRemoveEntryOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -288,7 +288,7 @@
::= {dsOpsEntry 10}
dsModifyEntryOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -300,7 +300,7 @@
::= {dsOpsEntry 11}
dsModifyRDNOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -312,7 +312,7 @@
::= {dsOpsEntry 12}
dsListOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -324,7 +324,7 @@
::= {dsOpsEntry 13}
dsSearchOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -337,7 +337,7 @@
::= {dsOpsEntry 14}
dsOneLevelSearchOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -349,7 +349,7 @@
::= {dsOpsEntry 15}
dsWholeSubtreeSearchOps OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -361,7 +361,7 @@
::= {dsOpsEntry 16}
dsReferrals OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -373,7 +373,7 @@
::= {dsOpsEntry 17}
dsChainings OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -385,7 +385,7 @@
::= {dsOpsEntry 18}
dsSecurityErrors OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -397,7 +397,7 @@
::= {dsOpsEntry 19}
dsErrors OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -437,15 +437,15 @@
DsEntriesEntry ::= SEQUENCE {
dsMasterEntries
- Gauge32,
+ Counter64,
dsCopyEntries
- Gauge32,
+ Counter64,
dsCacheEntries
- Gauge32,
+ Counter64,
dsCacheHits
- Counter32,
+ Counter64,
dsSlaveHits
- Counter32
+ Counter64
}
-- A (C)LDAP frontend to the X.500 Directory will not have
@@ -454,7 +454,7 @@
-- directory: dsMasterEntries, dsCopyEntries, dsSlaveHits.
dsMasterEntries OBJECT-TYPE
- SYNTAX Gauge32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -462,7 +462,7 @@
::= {dsEntriesEntry 1}
dsCopyEntries OBJECT-TYPE
- SYNTAX Gauge32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -471,7 +471,7 @@
::= {dsEntriesEntry 2}
dsCacheEntries OBJECT-TYPE
- SYNTAX Gauge32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -480,8 +480,8 @@
cached partially. The negative cache is not counted."
::= {dsEntriesEntry 3}
- dsCacheHits OBJECT-TYPE
- SYNTAX Counter32
+ dsCacheHits OBJECT-TYPE
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
@@ -491,7 +491,7 @@
::= {dsEntriesEntry 4}
dsSlaveHits OBJECT-TYPE
- SYNTAX Counter32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
15 years, 6 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm back-ldbm.h, 1.18, 1.19 cache.c, 1.6, 1.7
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9308/ldap/servers/slapd/back-ldbm
Modified Files:
back-ldbm.h cache.c
Log Message:
Resolves: 207457
Summary: Convert counters to 64-bit capable Slapi_Counter type.
Index: back-ldbm.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/back-ldbm.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- back-ldbm.h 17 Oct 2008 22:12:48 -0000 1.18
+++ back-ldbm.h 24 Oct 2008 22:36:59 -0000 1.19
@@ -339,7 +339,7 @@
/* for the in-core cache of entries */
struct cache {
size_t c_maxsize; /* max size in bytes */
- size_t c_cursize; /* size in bytes */
+ Slapi_Counter *c_cursize; /* size in bytes */
long c_maxentries; /* max entries allowed (-1: no limit) */
long c_curentries; /* current # entries in cache */
Hashtable *c_dntable;
@@ -347,8 +347,8 @@
#ifdef UUIDCACHE_ON
Hashtable *c_uuidtable;
#endif
- u_long c_hits; /* for analysis of hits/misses */
- u_long c_tries;
+ Slapi_Counter *c_hits; /* for analysis of hits/misses */
+ Slapi_Counter *c_tries;
struct backentry *c_lruhead; /* add entries here */
struct backentry *c_lrutail; /* remove entries here */
PRLock *c_mutex; /* lock for cache operations */
Index: cache.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/cache.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- cache.c 15 Oct 2008 06:30:06 -0000 1.6
+++ cache.c 24 Oct 2008 22:36:59 -0000 1.7
@@ -405,8 +405,15 @@
LDAPDebug(LDAP_DEBUG_TRACE, "=> cache_init\n", 0, 0, 0);
cache->c_maxsize = maxsize;
cache->c_maxentries = maxentries;
- cache->c_cursize = cache->c_curentries = 0;
- cache->c_hits = cache->c_tries = 0;
+ cache->c_cursize = slapi_counter_new();
+ cache->c_curentries = 0;
+ if (config_get_slapi_counters()) {
+ cache->c_hits = slapi_counter_new();
+ cache->c_tries = slapi_counter_new();
+ } else {
+ cache->c_hits = NULL;
+ cache->c_tries = NULL;
+ }
cache->c_lruhead = cache->c_lrutail = NULL;
cache_make_hashes(cache);
@@ -421,7 +428,7 @@
}
#define CACHE_FULL(cache) \
- (((cache)->c_cursize > (cache)->c_maxsize) || \
+ ((slapi_counter_get_value((cache)->c_cursize) > (cache)->c_maxsize) || \
(((cache)->c_maxentries > 0) && \
((cache)->c_curentries > (cache)->c_maxentries)))
@@ -466,7 +473,7 @@
if (e)
lru_detach(cache, e);
LOG("<= cache_flush (down to %lu entries, %lu bytes)\n", cache->c_curentries,
- cache->c_cursize, 0);
+ slapi_counter_get_value(cache->c_cursize), 0);
return e;
}
@@ -623,16 +630,16 @@
* if it ever wants to pull out more info, we might want to change all
* these u_long *'s to a struct
*/
-void cache_get_stats(struct cache *cache, u_long *hits, u_long *tries,
+void cache_get_stats(struct cache *cache, PRUint64 *hits, PRUint64 *tries,
long *nentries, long *maxentries,
size_t *size, size_t *maxsize)
{
PR_Lock(cache->c_mutex);
- if (hits) *hits = cache->c_hits;
- if (tries) *tries = cache->c_tries;
+ if (hits) *hits = slapi_counter_get_value(cache->c_hits);
+ if (tries) *tries = slapi_counter_get_value(cache->c_tries);
if (nentries) *nentries = cache->c_curentries;
if (maxentries) *maxentries = cache->c_maxentries;
- if (size) *size = cache->c_cursize;
+ if (size) *size = slapi_counter_get_value(cache->c_cursize);
if (maxsize) *maxsize = cache->c_maxsize;
PR_Unlock(cache->c_mutex);
}
@@ -735,10 +742,11 @@
if (ret == 0) {
/* won't be on the LRU list since it has a refcount on it */
/* adjust cache size */
- cache->c_cursize -= e->size;
+ slapi_counter_subtract(cache->c_cursize, e->size);
cache->c_curentries--;
LOG("<= cache_remove (size %lu): cache now %lu entries, %lu bytes\n",
- e->size, cache->c_curentries, cache->c_cursize);
+ e->size, cache->c_curentries,
+ slapi_counter_get_value(cache->c_cursize));
}
/* mark for deletion (will be erased when refcount drops to zero) */
@@ -775,7 +783,7 @@
int cache_replace(struct cache *cache, struct backentry *olde,
struct backentry *newe)
{
- int found;
+ int found;
const char *oldndn;
const char *newndn;
#ifdef UUIDCACHE_ON
@@ -799,31 +807,31 @@
PR_Lock(cache->c_mutex);
/*
- * First, remove the old entry from all the hashtables.
- * If the old entry is in cache but not in at least one of the
- * cache tables, operation error
- */
- if ( (olde->ep_state & ENTRY_STATE_NOTINCACHE) == 0 ) {
+ * First, remove the old entry from all the hashtables.
+ * If the old entry is in cache but not in at least one of the
+ * cache tables, operation error
+ */
+ if ( (olde->ep_state & ENTRY_STATE_NOTINCACHE) == 0 ) {
- found = remove_hash(cache->c_dntable, (void *)oldndn, strlen(oldndn));
- found &= remove_hash(cache->c_idtable, &(olde->ep_id), sizeof(ID));
+ found = remove_hash(cache->c_dntable, (void *)oldndn, strlen(oldndn));
+ found &= remove_hash(cache->c_idtable, &(olde->ep_id), sizeof(ID));
#ifdef UUIDCACHE_ON
- found &= remove_hash(cache->c_uuidtable, (void *)olduuid, strlen(olduuid));
+ found &= remove_hash(cache->c_uuidtable, (void *)olduuid, strlen(olduuid));
#endif
- if (!found) {
- LOG("cache replace: cache index tables out of sync\n", 0, 0, 0);
- PR_Unlock(cache->c_mutex);
- return 1;
- }
- }
+ if (!found) {
+ LOG("cache replace: cache index tables out of sync\n", 0, 0, 0);
+ PR_Unlock(cache->c_mutex);
+ return 1;
+ }
+ }
if (! entry_same_dn(newe, (void *)oldndn) &&
- (newe->ep_state & ENTRY_STATE_NOTINCACHE) == 0) {
+ (newe->ep_state & ENTRY_STATE_NOTINCACHE) == 0) {
/* if we're doing a modrdn, the new entry can be in the dn table
* already, so we need to remove that too.
*/
if (remove_hash(cache->c_dntable, (void *)newndn, strlen(newndn)))
{
- cache->c_cursize -= newe->size;
+ slapi_counter_subtract(cache->c_cursize, newe->size);
cache->c_curentries--;
LOG("cache replace remove entry size %lu\n", newe->size, 0, 0);
}
@@ -857,12 +865,12 @@
/* adjust cache meta info */
newe->ep_refcnt = 1;
newe->size = cache_entry_size(newe);
- cache->c_cursize += (newe->size - olde->size);
+ slapi_counter_add(cache->c_cursize, newe->size - olde->size);
olde->ep_state = ENTRY_STATE_DELETED;
newe->ep_state = 0;
PR_Unlock(cache->c_mutex);
LOG("<= cache_replace OK, cache size now %lu cache count now %ld\n",
- cache->c_cursize, cache->c_curentries, 0);
+ slapi_counter_get_value(cache->c_cursize), cache->c_curentries, 0);
return 0;
}
@@ -930,11 +938,13 @@
}
if (e->ep_refcnt == 0)
lru_delete(cache, e);
+ PR_Unlock(cache->c_mutex);
e->ep_refcnt++;
- cache->c_hits++;
+ slapi_counter_increment(cache->c_hits);
+ } else {
+ PR_Unlock(cache->c_mutex);
}
- cache->c_tries++;
- PR_Unlock(cache->c_mutex);
+ slapi_counter_increment(cache->c_tries);
LOG("<= cache_find_dn (%sFOUND)\n", e ? "" : "NOT ", 0, 0);
return e;
@@ -959,11 +969,13 @@
}
if (e->ep_refcnt == 0)
lru_delete(cache, e);
+ PR_Unlock(cache->c_mutex);
e->ep_refcnt++;
- cache->c_hits++;
+ slapi_counter_increment(cache->c_hits);
+ } else {
+ PR_Unlock(cache->c_mutex);
}
- cache->c_tries++;
- PR_Unlock(cache->c_mutex);
+ slapi_counter_increment(cache->c_tries);
LOG("<= cache_find_id (%sFOUND)\n", e ? "" : "NOT ", 0, 0);
return e;
@@ -988,11 +1000,13 @@
}
if (e->ep_refcnt == 0)
lru_delete(cache, e);
+ PR_Unlock(cache->c_mutex);
e->ep_refcnt++;
- cache->c_hits++;
+ slapi_counter_increment(cache->c_hits);
+ } else {
+ PR_Unlock(cache->c_mutex);
}
- cache->c_tries++;
- PR_Unlock(cache->c_mutex);
+ slapi_counter_increment(cache->c_tries);
LOG("<= cache_find_uuid (%sFOUND)\n", e ? "" : "NOT ", 0, 0);
return e;
@@ -1126,7 +1140,7 @@
0, 0);
remove_hash(cache->c_dntable, (void *)ndn, strlen(ndn));
remove_hash(cache->c_idtable, &(e->ep_id), sizeof(ID));
- e->ep_state |= ENTRY_STATE_NOTINCACHE;
+ e->ep_state |= ENTRY_STATE_NOTINCACHE;
PR_Unlock(cache->c_mutex);
return -1;
}
@@ -1140,11 +1154,11 @@
e->ep_refcnt = 1;
e->size = cache_entry_size(e);
- cache->c_cursize += e->size;
+ slapi_counter_add(cache->c_cursize, e->size);
cache->c_curentries++;
/* don't add to lru since refcnt = 1 */
LOG("added entry of size %lu -> total now %lu out of max %lu\n",
- e->size, cache->c_cursize, cache->c_maxsize);
+ e->size, slapi_counter_get_value(cache->c_cursize), cache->c_maxsize);
if (cache->c_maxentries >= 0) {
LOG(" total entries %ld out of %ld\n",
cache->c_curentries, cache->c_maxentries, 0);
15 years, 6 months
[Fedora-directory-commits] ldapserver config.h.in, 1.23, 1.24 configure, 1.95, 1.96 configure.ac, 1.54, 1.55
by Nathan Kinder
Author: nkinder
Update of /cvs/dirsec/ldapserver
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9308
Modified Files:
config.h.in configure configure.ac
Log Message:
Resolves: 207457
Summary: Convert counters to 64-bit capable Slapi_Counter type.
Index: config.h.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/config.h.in,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- config.h.in 23 Oct 2008 22:48:02 -0000 1.23
+++ config.h.in 24 Oct 2008 22:36:57 -0000 1.24
@@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* enabling atomic counter */
+#undef ATOMIC_64BIT_OPERATIONS
+
/* Define to 1 if the `closedir' function returns void instead of `int'. */
#undef CLOSEDIR_VOID
Index: configure
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- configure 23 Oct 2008 22:48:02 -0000 1.95
+++ configure 24 Oct 2008 22:36:57 -0000 1.96
@@ -23394,6 +23394,11 @@
#define _GNU_SOURCE 1
_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define ATOMIC_64BIT_OPERATIONS 1
+_ACEOF
+
platform="linux"
# relative to sysconfdir
initdir=/rc.d/init.d
@@ -23449,6 +23454,11 @@
#define _INCLUDE_STDC__SOURCE_199901 1
_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define ATOMIC_64BIT_OPERATIONS 1
+_ACEOF
+
# assume 64 bit
perlexec='/opt/perl_64/bin/perl'
platform="hpux"
@@ -23505,6 +23515,11 @@
#define _INCLUDE_STDC__SOURCE_199901 1
_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define ATOMIC_64BIT_OPERATIONS 1
+_ACEOF
+
# assume 64 bit
initconfigdir="/$PACKAGE_NAME/config"
perlexec='/opt/perl_64/bin/perl'
@@ -23571,6 +23586,11 @@
#define NO_DOMAINNAME 1
_ACEOF
+
+cat >>confdefs.h <<\_ACEOF
+#define ATOMIC_64BIT_OPERATIONS 1
+_ACEOF
+
LIBSOCKET=-lsocket
LIBSOCKET=$LIBSOCKET
Index: configure.ac
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure.ac,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- configure.ac 23 Oct 2008 22:42:54 -0000 1.54
+++ configure.ac 24 Oct 2008 22:36:58 -0000 1.55
@@ -302,6 +302,7 @@
AC_DEFINE([LINUX2_2], [1], [Linux 2.2])
AC_DEFINE([LINUX2_4], [1], [Linux 2.4])
AC_DEFINE([_GNU_SOURCE], [1], [GNU Source])
+ AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
platform="linux"
# relative to sysconfdir
initdir=/rc.d/init.d
@@ -317,6 +318,7 @@
AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
AC_DEFINE([_INCLUDE_STDC__SOURCE_199901], [1], [to pick up all of the printf format macros in inttypes.h])
+ AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
# assume 64 bit
perlexec='/opt/perl_64/bin/perl'
platform="hpux"
@@ -333,6 +335,7 @@
AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
AC_DEFINE([_INCLUDE_STDC__SOURCE_199901], [1], [to pick up all of the printf format macros in inttypes.h])
+ AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
# assume 64 bit
initconfigdir="/$PACKAGE_NAME/config"
perlexec='/opt/perl_64/bin/perl'
@@ -351,6 +354,7 @@
AC_DEFINE([OSVERSION], [509], [OS version])
AC_DEFINE([_REENTRANT], [1], [_REENTRANT])
AC_DEFINE([NO_DOMAINNAME], [1], [no getdomainname])
+ AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
dnl socket nsl and dl are required to link several programs and libdb
LIBSOCKET=-lsocket
AC_SUBST([LIBSOCKET], [$LIBSOCKET])
15 years, 6 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd proto-slap.h, 1.38, 1.39
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17945
Modified Files:
proto-slap.h
Log Message:
Resolves: #468248
Summary: LDAPI: when nsslapd-ldapiautodnsuffix doesn't exist - Bind is incorrect
Description:
- introducing --enable-auto-dn-suffix option to configure (disabled by default)
- building the auto-dn-suffix code only when the option is set
Index: proto-slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/proto-slap.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- proto-slap.h 17 Oct 2008 22:12:47 -0000 1.38
+++ proto-slap.h 24 Oct 2008 00:21:18 -0000 1.39
@@ -252,7 +252,9 @@
int config_set_ldapi_uidnumber_type( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_ldapi_gidnumber_type( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_ldapi_search_base_dn( const char *attrname, char *value, char *errorbuf, int apply );
+#if defined(ENABLE_AUTO_DN_SUFFIX)
int config_set_ldapi_auto_dn_suffix( const char *attrname, char *value, char *errorbuf, int apply );
+#endif
int config_set_srvtab( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_sizelimit( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_lastmod( const char *attrname, char *value, char *errorbuf, int apply );
@@ -365,7 +367,9 @@
char *config_get_ldapi_uidnumber_type();
char *config_get_ldapi_gidnumber_type();
char *config_get_ldapi_search_base_dn();
+#if defined(ENABLE_AUTO_DN_SUFFIX)
char *config_get_ldapi_auto_dn_suffix();
+#endif
char *config_get_srvtab();
int config_get_sizelimit();
char *config_get_pw_storagescheme();
15 years, 6 months
[Fedora-directory-commits] ldapserver Makefile.in, 1.99, 1.100 config.h.in, 1.22, 1.23 configure, 1.94, 1.95
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv11174
Modified Files:
Makefile.in config.h.in configure
Log Message:
Resolves: #468248
Summary: LDAPI: when nsslapd-ldapiautodnsuffix doesn't exist - Bind is incorrect
Description:
- introducing --enable-auto-dn-suffix option to configure (disabled by default)
- building the auto-dn-suffix code only when the option is set
======================
autoconf version 2.59
automake version 1.9.6
Index: Makefile.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/Makefile.in,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- Makefile.in 22 Oct 2008 20:31:50 -0000 1.99
+++ Makefile.in 23 Oct 2008 22:48:01 -0000 1.100
@@ -977,6 +977,8 @@
debug_defs = @debug_defs@
defaultgroup = @defaultgroup@
defaultuser = @defaultuser@
+enable_auto_dn_suffix_FALSE = @enable_auto_dn_suffix_FALSE@
+enable_auto_dn_suffix_TRUE = @enable_auto_dn_suffix_TRUE@
enable_autobind_FALSE = @enable_autobind_FALSE@
enable_autobind_TRUE = @enable_autobind_TRUE@
enable_bitwise_FALSE = @enable_bitwise_FALSE@
@@ -1952,6 +1954,7 @@
@enable_ldapi_TRUE@GETSOCKETPEER = ldap/servers/slapd/getsocketpeer.c
@enable_ldapi_TRUE@enable_ldapi = 1
@enable_autobind_TRUE@enable_autobind = 1
+@enable_auto_dn_suffix_TRUE@enable_auto_dn_suffix = 1
ns_slapd_SOURCES = ldap/servers/slapd/abandon.c \
ldap/servers/slapd/auth.c \
ldap/servers/slapd/bind.c \
@@ -2047,6 +2050,7 @@
@BUNDLE_FALSE@ -e 's,@enable_bitwise\@,$(enable_bitwise),g' \
@BUNDLE_FALSE@ -e 's,@enable_dna\@,$(enable_dna),g' \
@BUNDLE_FALSE@ -e 's,@enable_autobind\@,$(enable_autobind),g' \
+@BUNDLE_FALSE@ -e 's,@enable_auto_dn_suffix\@,$(enable_auto_dn_suffix),g' \
@BUNDLE_FALSE@ -e 's,@ECHO_N\@,$(ECHO_N),g' \
@BUNDLE_FALSE@ -e 's,@ECHO_C\@,$(ECHO_C),g' \
@BUNDLE_FALSE@ -e 's,@brand\@,$(brand),g' \
@@ -2106,6 +2110,7 @@
@BUNDLE_TRUE@ -e 's,@enable_bitwise\@,$(enable_bitwise),g' \
@BUNDLE_TRUE@ -e 's,@enable_dna\@,$(enable_dna),g' \
@BUNDLE_TRUE@ -e 's,@enable_autobind\@,$(enable_autobind),g' \
+@BUNDLE_TRUE@ -e 's,@enable_auto_dn_suffix\@,$(enable_auto_dn_suffix),g' \
@BUNDLE_TRUE@ -e 's,@ECHO_N\@,$(ECHO_N),g' \
@BUNDLE_TRUE@ -e 's,@ECHO_C\@,$(ECHO_C),g' \
@BUNDLE_TRUE@ -e 's,@brand\@,$(brand),g' \
Index: config.h.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/config.h.in,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- config.h.in 19 Oct 2008 17:12:55 -0000 1.22
+++ config.h.in 23 Oct 2008 22:48:02 -0000 1.23
@@ -15,6 +15,9 @@
/* enable ldapi auto bind support in the server */
#undef ENABLE_AUTOBIND
+/* enable ldapi auto bind with auto dn suffix support in the server */
+#undef ENABLE_AUTO_DN_SUFFIX
+
/* enable the bitwise plugin */
#undef ENABLE_BITWISE
Index: configure
===================================================================
RCS file: /cvs/dirsec/ldapserver/configure,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- configure 22 Oct 2008 20:31:51 -0000 1.94
+++ configure 23 Oct 2008 22:48:02 -0000 1.95
@@ -465,7 +465,7 @@
#endif"
ac_default_prefix=/opt/$PACKAGE_NAME
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS CCASFLAGS SED EGREP LN_S ECHO AR ac_ct_AR RANLIB a
c_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_autobind_TRUE enable_autobind_FALSE enable_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir mibdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir perlexec initconfigdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG PACKAGE_BASE_VERSION nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir sasl_path svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link brand capbrand vendo
r LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS CCASFLAGS SED EGREP LN_S ECHO AR ac_ct_AR RANLIB a
c_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_autobind_TRUE enable_autobind_FALSE enable_auto_dn_suffix_TRUE enable_auto_dn_suffix_FALSE enable_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir mibdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir perlexec initconfigdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG PACKAGE_BASE_VERSION nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir sasl_path svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsn
mp_lib netsnmp_libdir netsnmp_link brand capbrand vendor LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -1056,6 +1056,8 @@
(default: yes)
--enable-autobind enable auto bind over unix domain socket (LDAPI)
support (default: no)
+ --enable-auto-dn-suffix enable auto bind with auto dn suffix over unix
+ domain socket (LDAPI) support (default: no)
--enable-bitwise enable the bitwise matching rule plugin (default:
yes)
@@ -4331,7 +4333,7 @@
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4334 "configure"' > conftest.$ac_ext
+ echo '#line 4336 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -5466,7 +5468,7 @@
# Provide some information about the compiler.
-echo "$as_me:5469:" \
+echo "$as_me:5471:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -6529,11 +6531,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6532: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6534: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6536: \$? = $ac_status" >&5
+ echo "$as_me:6538: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -6797,11 +6799,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6800: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6802: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6804: \$? = $ac_status" >&5
+ echo "$as_me:6806: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -6901,11 +6903,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6904: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6906: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6908: \$? = $ac_status" >&5
+ echo "$as_me:6910: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8370,7 +8372,7 @@
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 8373 "configure"' > conftest.$ac_ext
+ echo '#line 8375 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -9267,7 +9269,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9270 "configure"
+#line 9272 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9367,7 +9369,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9370 "configure"
+#line 9372 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11710,11 +11712,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11713: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11715: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11717: \$? = $ac_status" >&5
+ echo "$as_me:11719: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -11814,11 +11816,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11817: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11819: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11821: \$? = $ac_status" >&5
+ echo "$as_me:11823: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12350,7 +12352,7 @@
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 12353 "configure"' > conftest.$ac_ext
+ echo '#line 12355 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -13408,11 +13410,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13411: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13413: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13415: \$? = $ac_status" >&5
+ echo "$as_me:13417: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -13512,11 +13514,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13515: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13517: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13519: \$? = $ac_status" >&5
+ echo "$as_me:13521: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14961,7 +14963,7 @@
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 14964 "configure"' > conftest.$ac_ext
+ echo '#line 14966 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -15739,11 +15741,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15742: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15744: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15746: \$? = $ac_status" >&5
+ echo "$as_me:15748: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16007,11 +16009,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16010: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16012: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16014: \$? = $ac_status" >&5
+ echo "$as_me:16016: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16111,11 +16113,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16114: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16116: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16118: \$? = $ac_status" >&5
+ echo "$as_me:16120: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -17580,7 +17582,7 @@
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 17583 "configure"' > conftest.$ac_ext
+ echo '#line 17585 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -23072,6 +23074,39 @@
fi
+if test -z "$enable_auto_dn_suffix" ; then
+ enable_auto_dn_suffix=no # if not set on cmdline, set default
+fi
+echo "$as_me:$LINENO: checking for --enable-auto-dn-suffix" >&5
+echo $ECHO_N "checking for --enable-auto-dn-suffix... $ECHO_C" >&6
+# Check whether --enable-autobind or --disable-autobind was given.
+if test "${enable_autobind+set}" = set; then
+ enableval="$enable_autobind"
+
+fi;
+if test "$enable_ldapi" = yes -a "$enable_autobind" = yes -a "$enable_auto_dn_suffix" = "yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define ENABLE_AUTO_DN_SUFFIX 1
+_ACEOF
+
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+if test "$enable_auto_dn_suffix" = "yes"; then
+ enable_auto_dn_suffix_TRUE=
+ enable_auto_dn_suffix_FALSE='#'
+else
+ enable_auto_dn_suffix_TRUE='#'
+ enable_auto_dn_suffix_FALSE=
+fi
+
+
if test -z "$enable_bitwise" ; then
enable_bitwise=yes # if not set on cmdline, set default
fi
@@ -25524,6 +25559,13 @@
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${enable_auto_dn_suffix_TRUE}" && test -z "${enable_auto_dn_suffix_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"enable_auto_dn_suffix\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"enable_auto_dn_suffix\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${enable_bitwise_TRUE}" && test -z "${enable_bitwise_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"enable_bitwise\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -26167,6 +26209,8 @@
s,@enable_ldapi_FALSE@,$enable_ldapi_FALSE,;t t
s,@enable_autobind_TRUE@,$enable_autobind_TRUE,;t t
s,@enable_autobind_FALSE@,$enable_autobind_FALSE,;t t
+s,@enable_auto_dn_suffix_TRUE@,$enable_auto_dn_suffix_TRUE,;t t
+s,@enable_auto_dn_suffix_FALSE@,$enable_auto_dn_suffix_FALSE,;t t
s,@enable_bitwise_TRUE@,$enable_bitwise_TRUE,;t t
s,@enable_bitwise_FALSE@,$enable_bitwise_FALSE,;t t
s,@with_fhs_opt@,$with_fhs_opt,;t t
15 years, 6 months