Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv11144/ldap/servers/slapd
Modified Files:
abandon.c add.c auth.c bind.c compare.c connection.c
conntable.c daemon.c delete.c extendop.c fe.h globals.c init.c
modify.c modrdn.c opshared.c pblock.c plugin_internal_op.c
proto-slap.h psearch.c result.c sasl_io.c search.c slap.h
slapi-plugin.h snmp_collator.c stubrepl.c unbind.c value.c
Log Message:
Related: 207457
Summary: Add support for 64-bit counters (phase 1).
Index: abandon.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/abandon.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- abandon.c 10 Nov 2006 23:45:40 -0000 1.7
+++ abandon.c 17 Oct 2008 22:12:47 -0000 1.8
@@ -153,15 +153,15 @@
}
if ( NULL == o ) {
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d ABANDON"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
" targetop=NOTFOUND msgid=%d\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
} else if ( suppressed_by_plugin ) {
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d ABANDON"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64" op=%d ABANDON"
" targetop=SUPPRESSED-BY-PLUGIN msgid=%d\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
} else {
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d ABANDON"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
" targetop=%d msgid=%d nentries=%d etime=%ld\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, o->o_opid, id,
o->o_results.r.r_search.nentries, current_time() - o->o_time );
Index: add.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/add.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- add.c 15 Oct 2008 06:30:03 -0000 1.13
+++ add.c 17 Oct 2008 22:12:47 -0000 1.14
@@ -166,7 +166,7 @@
if (( rc = slapi_entry_add_values( e, normtype, vals ))
!= LDAP_SUCCESS ) {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d ADD dn=\"%s\", add values for type %s failed\n",
+ "conn=%" PRIu64 " op=%d ADD dn=\"%s\", add values for type %s failed\n",
pb->pb_conn->c_connid, operation->o_opid,
escape_string( slapi_entry_get_dn_const(e), ebuf ), normtype );
send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
@@ -432,7 +432,7 @@
{
if ( !internal_op )
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d ADD dn=\"%s\"\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ADD dn=\"%s\"\n",
pb->pb_conn->c_connid,
operation->o_opid,
escape_string(slapi_entry_get_dn_const(e), ebuf));
Index: auth.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/auth.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- auth.c 8 Oct 2008 17:29:03 -0000 1.11
+++ auth.c 17 Oct 2008 22:12:47 -0000 1.12
@@ -391,7 +391,7 @@
char* subject = subject_of (clientCert);
char* issuer = issuer_of (clientCert);
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
+ "conn=%" PRIu64 " " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
conn->c_connid, errorCode, slapd_pr_strerror(errorCode),
subject ? escape_string( subject, sbuf ) : "NULL",
issuer ? escape_string( issuer, ibuf ) : "NULL" );
@@ -425,7 +425,7 @@
if ( (slapd_ssl_getChannelInfo (prfd, &channelInfo, sizeof(channelInfo))) != SECSuccess ) {
PRErrorCode errorCode = PR_GetError();
slapi_log_access (LDAP_DEBUG_STATS,
- "conn=%d SSL failed to obtain channel info; "
+ "conn=%" PRIu64 " SSL failed to obtain channel info; "
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
return;
@@ -434,7 +434,7 @@
!= SECSuccess) {
PRErrorCode errorCode = PR_GetError();
slapi_log_access (LDAP_DEBUG_STATS,
- "conn=%d SSL failed to obtain cipher info; "
+ "conn=%" PRIu64 " SSL failed to obtain cipher info; "
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
return;
@@ -455,13 +455,13 @@
}
if (config_get_SSLclientAuth() == SLAPD_SSLCLIENTAUTH_OFF ) {
- slapi_log_access (LDAP_DEBUG_STATS, "conn=%d SSL %i-bit %s\n",
+ slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL %i-bit %s\n",
conn->c_connid, keySize, cipher ? cipher : "NULL" );
slapi_ch_free_string(&cipher);
return;
}
if (clientCert == NULL) {
- slapi_log_access (LDAP_DEBUG_STATS, "conn=%d SSL %i-bit %s\n",
+ slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL %i-bit %s\n",
conn->c_connid, keySize, cipher ? cipher : "NULL" );
} else {
char* subject = subject_of (clientCert);
@@ -469,7 +469,7 @@
char* issuer = issuer_of (clientCert);
char sbuf[ BUFSIZ ], ibuf[ BUFSIZ ];
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d SSL %i-bit %s; client %s; issuer %s\n",
+ "conn=%" PRIu64 " SSL %i-bit %s; client %s; issuer %s\n",
conn->c_connid, keySize, cipher ? cipher : "NULL",
subject ? escape_string( subject, sbuf ) : "NULL",
issuer ? escape_string( issuer, ibuf ) : "NULL");
@@ -507,11 +507,11 @@
if (clientDN != NULL) {
char ebuf[ BUFSIZ ];
- slapi_log_access (LDAP_DEBUG_STATS, "conn=%d SSL client bound as %s\n",
+ slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " SSL client bound as %s\n",
conn->c_connid, escape_string( clientDN, ebuf ));
} else if (clientCert != NULL) {
slapi_log_access (LDAP_DEBUG_STATS,
- "conn=%d SSL failed to map client certificate to LDAP DN (%s)\n",
+ "conn=%" PRIu64 " SSL failed to map client certificate to LDAP DN (%s)\n",
conn->c_connid, extraErrorMsg );
}
Index: bind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/bind.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- bind.c 15 Oct 2008 06:30:03 -0000 1.15
+++ bind.c 17 Oct 2008 22:12:47 -0000 1.16
@@ -686,25 +686,25 @@
if (method == LDAP_AUTH_SASL && saslmech && msg) {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d BIND dn=\"%s\" "
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
"method=sasl version=%d mech=%s, %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, edn,
version, saslmech, msg );
} else if (method == LDAP_AUTH_SASL && saslmech) {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d BIND dn=\"%s\" "
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
"method=sasl version=%d mech=%s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, edn,
version, saslmech );
} else if (msg) {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d BIND dn=\"%s\" "
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
"method=%d version=%d, %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, edn,
method, version, msg );
} else {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d BIND dn=\"%s\" "
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
"method=%d version=%d\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, edn,
method, version );
Index: compare.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/compare.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- compare.c 18 Oct 2007 00:08:34 -0000 1.7
+++ compare.c 17 Oct 2008 22:12:47 -0000 1.8
@@ -122,7 +122,7 @@
dn, ava.ava_type, 0 );
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d CMP dn=\"%s\" attr=\"%s\"\n",
+ "conn=%" PRIu64 " op=%d CMP dn=\"%s\" attr=\"%s\"\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid,
escape_string( dn, ebuf ), ava.ava_type );
Index: connection.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/connection.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- connection.c 15 Oct 2008 06:30:03 -0000 1.20
+++ connection.c 17 Oct 2008 22:12:47 -0000 1.21
@@ -147,14 +147,14 @@
if (conn->c_prfd && (conn->c_flags & CONN_FLAG_SSL))
{
LDAPDebug( LDAP_DEBUG_CONNS,
- "conn=%d fd=%d closed now\n",
+ "conn=%" PRIu64 " fd=%d closed now\n",
conn->c_connid, conn->c_sd,0);
PR_Close(conn->c_prfd);
}
else if (conn->c_sd)
{
LDAPDebug( LDAP_DEBUG_CONNS,
- "conn=%d fd=%d closed now\n",
+ "conn=%" PRIu64 " fd=%d closed now\n",
conn->c_connid, conn->c_sd,0);
closesocket(conn->c_sd);
}
@@ -217,9 +217,7 @@
LDAPDebug( LDAP_DEBUG_CONNS, "new %sconnection on %d\n", pTmp, conn->c_sd, 0 );
/* bump our count of connections and update SNMP stats */
- PR_Lock( num_conns_mutex );
- conn->c_connid = num_conns++;
- PR_Unlock( num_conns_mutex );
+ conn->c_connid = slapi_counter_increment(num_conns);
if (! in_referral_mode) {
snmp_increment_counter(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq);
@@ -354,7 +352,7 @@
/* log useful stuff to our access log */
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d fd=%d slot=%d %sconnection from %s to %s\n",
+ "conn=%" PRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
/* initialize the remaining connection fields */
@@ -454,7 +452,7 @@
op->o_tag != LDAP_REQ_ABANDON )
{
slapi_add_pwd_control ( pb, LDAP_CONTROL_PWEXPIRED, 0);
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d %s\n",
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid,
"need new password" );
send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM,
@@ -524,7 +522,7 @@
{
ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
if (ret < 0) {
- LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %d\n",conn->c_connid, 0, 0);
+ LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %" PRIu64 "\n",conn->c_connid, 0, 0);
}
}
#endif
@@ -538,7 +536,7 @@
{
ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
if (ret < 0) {
- LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %d\n",conn->c_connid, 0, 0);
+ LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %" PRIu64 "\n",conn->c_connid, 0, 0);
}
}
}
@@ -564,7 +562,7 @@
default:
LDAPDebug( LDAP_DEBUG_ANY,
- "ignoring unknown LDAP request (conn=%d, tag=0x%lx)\n",
+ "ignoring unknown LDAP request (conn=%" PRIu64 ", tag=0x%lx)\n",
conn->c_connid, op->o_tag, 0 );
break;
}
@@ -576,7 +574,7 @@
if (conn->c_refcnt <= 0)
{
slapi_log_error(SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d Attempt to release connection that is not aquired\n",
+ "conn=%" PRIu64 " fd=%d Attempt to release connection that is not aquired\n",
conn->c_connid, conn->c_sd);
PR_ASSERT (PR_FALSE);
return -1;
@@ -597,7 +595,7 @@
{
/* This may happen while other threads are still working on this connection */
slapi_log_error(SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d Attempt to acquire connection in the closing state\n",
+ "conn=%" PRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
conn->c_connid, conn->c_sd);
return -1;
}
@@ -775,7 +773,7 @@
/* if connection is closing */
if (return_value != 0) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "handle_read_data returns as conn %d closing, fd=%d\n",
+ "handle_read_data returns as conn %" PRIu64 " closing, fd=%d\n",
conn->c_connid,conn->c_sd,0);
return return_value;
}
@@ -838,7 +836,7 @@
!= LDAP_TAG_MSGID ) {
/* log, close and send error */
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
+ "conn=%" PRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
return_value = -1;
goto done;
}
@@ -850,7 +848,7 @@
case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
/* log, close and send error */
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d ber_peek_tag returns 0x%lx\n", conn->c_connid, tag, 0 );
+ "conn=%" PRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, tag, 0 );
return_value = -1;
goto done;
default:
@@ -981,7 +979,7 @@
PR_Lock( conn->c_mutex );
if (connection_is_active_nolock(conn) == 0) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "not creating a new operation when conn %d closing\n",
+ "not creating a new operation when conn %" PRIu64 " closing\n",
conn->c_connid,0,0);
PR_Unlock( conn->c_mutex );
return -1;
@@ -1073,7 +1071,7 @@
So, we toss it away ! */
if (LBER_OVERFLOW == tag) {
slapi_log_error( SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d The length of BER Element was too long.\n",
+ "conn=%" PRIu64 " fd=%d The length of BER Element was too long.\n",
conn->c_connid, conn->c_sd );
}
PR_Lock( conn->c_mutex );
@@ -1110,7 +1108,7 @@
* We received a non-LDAP message. Log and close connection.
*/
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d received a non-LDAP message"
+ "conn=%" PRIu64 " received a non-LDAP message"
" (tag 0x%lx, expected 0x%lx)\n",
conn->c_connid, tag, LDAP_TAG_MESSAGE );
PR_Lock( conn->c_mutex );
@@ -1128,7 +1126,7 @@
if (Bytes_Scanned != Bytes_Read) {
if (connection_increment_reference(conn) == -1) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "could not acquire lock in issue_new_read as conn %d closing fd=%d\n",
+ "could not acquire lock in issue_new_read as conn %" PRIu64 " closing fd=%d\n",
conn->c_connid,conn->c_sd,0);
/* XXX how to handle this error? */
/* MAB: 25 Jan 01: let's try like this and pray this won't leak... */
@@ -1150,7 +1148,7 @@
*/
connection_decrement_reference(conn);
LDAPDebug(LDAP_DEBUG_CONNS,
- "push_back_data failed: closing conn %d fd=%d\n",
+ "push_back_data failed: closing conn %" PRIu64 " fd=%d\n",
conn->c_connid,conn->c_sd,0);
}
} else {
@@ -1248,7 +1246,7 @@
if (connection_increment_reference(conn) == -1) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "could not acquire lock in issue_new_read as conn %d closing fd=%d\n",
+ "could not acquire lock in issue_new_read as conn %" PRIu64 " closing fd=%d\n",
conn->c_connid,conn->c_sd,0);
/* This means that the connection is closing */
return -1;
@@ -1410,7 +1408,7 @@
be decremented in wait_for_new_work(). */
if (connection_acquire_nolock (conn) == -1) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "could not acquire lock in connection_activity as conn %d closing fd=%d\n",
+ "could not acquire lock in connection_activity as conn %" PRIu64 " closing fd=%d\n",
conn->c_connid,conn->c_sd,0);
/* XXX how to handle this error? */
/* MAB: 25 Jan 01: let's return on error and pray this won't leak */
@@ -1646,7 +1644,7 @@
syserr = errno;
/* Bad stuff happened, like the client sent us some junk */
LDAPDebug( LDAP_DEBUG_CONNS,
- "ber_get_next failed for connection %d\n", conn->c_connid, 0, 0 );
+ "ber_get_next failed for connection %" PRIu64 "\n", conn->c_connid, 0, 0 );
/* reset private buffer */
conn->c_private->c_buffer_bytes = conn->c_private->c_buffer_offset = 0;
@@ -1715,7 +1713,7 @@
ret = sasl_io_setup(conn);
if (ret) {
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d unable to enable SASL I/O\n", conn->c_connid, 0, 0 );
+ "conn=%" PRIu64 " unable to enable SASL I/O\n", conn->c_connid, 0, 0 );
disconnect_server( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
return CONN_DONE;
}
@@ -1776,7 +1774,7 @@
} else {
/* Otherwise we loop, unless we exceeded the ioblock timeout */
if (waits_done > ioblocktimeout_waits) {
- LDAPDebug( LDAP_DEBUG_CONNS,"ioblock timeout expired on connection %d\n", conn->c_connid, 0, 0 );
+ LDAPDebug( LDAP_DEBUG_CONNS,"ioblock timeout expired on connection %" PRIu64 "\n", conn->c_connid, 0, 0 );
disconnect_server( conn, conn->c_connid, -1,
SLAPD_DISCONNECT_IO_TIMEOUT, 0 );
return CONN_DONE;
@@ -1796,7 +1794,7 @@
err = PR_GetError();
syserr = PR_GetOSError();
LDAPDebug( LDAP_DEBUG_ANY,
- "PR_Poll for connection %d returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
+ "PR_Poll for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
/* If this happens we should close the connection */
disconnect_server( conn, conn->c_connid, -1, err, syserr );
return CONN_DONE;
@@ -1805,7 +1803,7 @@
/* Some other error, typically meaning bad stuff */
syserr = PR_GetOSError();
LDAPDebug( LDAP_DEBUG_CONNS,
- "PR_Recv for connection %d returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
+ "PR_Recv for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
/* If this happens we should close the connection */
disconnect_server( conn, conn->c_connid, -1, err, syserr );
return CONN_DONE;
@@ -1837,7 +1835,7 @@
* We received a non-LDAP message. Log and close connection.
*/
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
+ "conn=%" PRIu64 " received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
conn->c_connid, *tag, LDAP_TAG_MESSAGE );
disconnect_server( conn, conn->c_connid, -1,
SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
@@ -1848,7 +1846,7 @@
!= LDAP_TAG_MSGID ) {
/* log, close and send error */
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
+ "conn=%" PRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
disconnect_server( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
return CONN_DONE;
}
@@ -1865,7 +1863,7 @@
case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
/* log, close and send error */
LDAPDebug( LDAP_DEBUG_ANY,
- "conn=%d ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag, 0 );
+ "conn=%" PRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag, 0 );
disconnect_server( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BER_PEEK, EPROTO );
return CONN_DONE;
default:
@@ -1902,7 +1900,7 @@
/* update the last checked time */
conn->c_private->previous_count_check_time = current_time();
PR_Unlock( conn->c_mutex );
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d activity level = %d\n",conn->c_connid,delta_count,0);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " activity level = %d\n",conn->c_connid,delta_count,0);
}
typedef struct table_iterate_info_struct {
@@ -1957,7 +1955,7 @@
} else {
double activet = 0.0;
connection_find_our_rank(conn,&connection_count, &our_rank);
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count);
activet = (double)g_get_active_threadcnt();
threshold_rank = (int)(activet * ((double)CONN_TURBO_PERCENTILE / 100.0));
@@ -1999,9 +1997,9 @@
PR_Unlock(conn->c_mutex);
if (current_mode != new_mode) {
if (current_mode) {
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d leaving turbo mode\n",conn->c_connid,0,0);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " leaving turbo mode\n",conn->c_connid,0,0);
} else {
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d entering turbo mode\n",conn->c_connid,0,0);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " entering turbo mode\n",conn->c_connid,0,0);
}
}
*new_turbo_flag = new_mode;
@@ -2092,7 +2090,7 @@
/* turn off turbo mode immediately if any pb waiting in global queue */
if (thread_turbo_flag && (counter > 0)) {
thread_turbo_flag = 0;
- LDAPDebug(LDAP_DEBUG_CONNS,"conn %d leaving turbo mode\n",conn->c_connid,0,0);
+ LDAPDebug(LDAP_DEBUG_CONNS,"conn %" PRIu64 " leaving turbo mode\n",conn->c_connid,0,0);
}
#endif
@@ -2235,7 +2233,7 @@
if (connection_acquire_nolock (conn) == -1) {
LDAPDebug(LDAP_DEBUG_CONNS,
- "could not acquire lock in connection_activity as conn %d closing fd=%d\n",
+ "could not acquire lock in connection_activity as conn %" PRIu64 " closing fd=%d\n",
conn->c_connid,conn->c_sd,0);
/* XXX how to handle this error? */
/* MAB: 25 Jan 01: let's return on error and pray this won't leak */
@@ -2355,9 +2353,9 @@
static void
connection_add_operation(Connection* conn,Operation* op)
{
- Operation **olist= &conn->c_ops;
- int id= conn->c_opsinitiated++;
- int connid= conn->c_connid;
+ Operation **olist= &conn->c_ops;
+ int id= conn->c_opsinitiated++;
+ PRUint64 connid = conn->c_connid;
Operation **tmp;
/* slapi_ch_stop_recording(); */
@@ -2387,7 +2385,7 @@
if ( *tmp == NULL )
{
- LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %d\n",
+ LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %" PRIu64 "\n",
(int)op->o_msgid, conn->c_connid, 0 );
}
else
@@ -2498,13 +2496,13 @@
}
if (0 == ber_len) {
slapi_log_error( SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d Incoming BER Element was too long, max allowable"
+ "conn=%" PRIu64 " fd=%d Incoming BER Element was too long, max allowable"
" is %u bytes. Change the nsslapd-maxbersize attribute in"
" cn=config to increase.\n",
conn->c_connid, conn->c_sd, maxbersize );
} else {
slapi_log_error( SLAPI_LOG_FATAL, "connection",
- "conn=%d fd=%d Incoming BER Element was %u bytes, max allowable"
+ "conn=%" PRIu64 " fd=%d Incoming BER Element was %u bytes, max allowable"
" is %u bytes. Change the nsslapd-maxbersize attribute in"
" cn=config to increase.\n",
conn->c_connid, conn->c_sd, ber_len, maxbersize );
@@ -2513,7 +2511,7 @@
void
-disconnect_server( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error )
+disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
{
PR_Lock( conn->c_mutex );
disconnect_server_nomutex( conn, opconnid, opid, reason, error );
@@ -2530,7 +2528,7 @@
*/
void
-disconnect_server_nomutex( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error )
+disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
{
if ( ( conn->c_sd != SLAPD_INVALID_SOCKET &&
conn->c_connid == opconnid ) && !(conn->c_flags & CONN_FLAG_CLOSING) ) {
@@ -2557,13 +2555,13 @@
*/
if (error && (EPIPE != error) ) {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d fd=%d closed error %d (%s) - %s\n",
+ "conn=%" PRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
conn->c_connid, opid, conn->c_sd, error,
slapd_system_strerror(error),
slapd_pr_strerror(reason));
} else {
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d fd=%d closed - %s\n",
+ "conn=%" PRIu64 " op=%d fd=%d closed - %s\n",
conn->c_connid, opid, conn->c_sd,
slapd_pr_strerror(reason));
}
Index: conntable.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/conntable.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- conntable.c 8 Oct 2008 17:29:03 -0000 1.10
+++ conntable.c 17 Oct 2008 22:12:47 -0000 1.11
@@ -449,9 +449,7 @@
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "currentconnections", vals );
- PR_Lock( num_conns_mutex );
- sprintf( buf, "%d", num_conns );
- PR_Unlock( num_conns_mutex );
+ sprintf( buf, "%" PRIu64, slapi_counter_get_value(num_conns));
val.bv_val = buf;
val.bv_len = strlen( buf );
attrlist_replace( &e->e_attrs, "totalconnections", vals );
Index: daemon.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/daemon.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- daemon.c 16 May 2008 20:39:11 -0000 1.20
+++ daemon.c 17 Oct 2008 22:12:47 -0000 1.21
@@ -1496,7 +1496,7 @@
* trying to acquire a closing connection
*/
LDAPDebug (LDAP_DEBUG_ANY,
- "connection_activity: abandoning conn %d as fd=%d is already closing\n",
+ "connection_activity: abandoning conn %" PRIu64 " as fd=%d is already closing\n",
c->c_connid,c->c_sd,0);
/* The call disconnect_server should do nothing,
* as the connection c should be already set to CLOSING */
@@ -2216,7 +2216,7 @@
if(conn->c_dn)
{
/* log the auto bind */
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d AUTOBIND dn=\"%s\"\n", conn->c_connid, conn->c_dn);
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " AUTOBIND dn=\"%s\"\n", conn->c_connid, conn->c_dn);
}
return ret;
Index: delete.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/delete.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- delete.c 18 Oct 2007 00:08:34 -0000 1.8
+++ delete.c 17 Oct 2008 22:12:47 -0000 1.9
@@ -257,7 +257,7 @@
{
if (!internal_op )
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d DEL dn=\"%s\"\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d DEL dn=\"%s\"\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(dn, ebuf));
Index: extendop.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/extendop.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- extendop.c 10 Nov 2006 23:45:40 -0000 1.8
+++ extendop.c 17 Oct 2008 22:12:47 -0000 1.9
@@ -267,14 +267,14 @@
if ( NULL == ( name = extended_op_oid2string( extoid ))) {
LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s)\n", extoid, 0, 0 );
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d EXT oid=\"%s\"\n",
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d EXT oid=\"%s\"\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid );
} else {
LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s-%s)\n",
extoid, name, 0 );
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d EXT oid=\"%s\" name=\"%s\"\n",
+ "conn=%" PRIu64 " op=%d EXT oid=\"%s\" name=\"%s\"\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid, name );
}
Index: fe.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/fe.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- fe.h 20 Sep 2007 16:54:38 -0000 1.8
+++ fe.h 17 Oct 2008 22:12:47 -0000 1.9
@@ -61,8 +61,7 @@
extern PRLock *ops_mutex;
extern PRThread *listener_tid;
extern PRThread *listener_tid;
-extern int num_conns;
-extern PRLock *num_conns_mutex;
+extern Slapi_Counter *num_conns;
extern char *pid_file;
extern char *start_pid_file;
extern int should_detach;
Index: globals.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/globals.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- globals.c 20 Sep 2007 16:54:38 -0000 1.7
+++ globals.c 17 Oct 2008 22:12:47 -0000 1.8
@@ -91,8 +91,8 @@
PRInt32 ops_initiated;
PRInt32 ops_completed;
PRLock *ops_mutex;
-int num_conns;
-PRLock *num_conns_mutex;
+Slapi_Counter *num_conns;
+
/*
DEC/COMPAQ has released a patch for 4.0d (e?) which will speed up
Index: init.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/init.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- init.c 10 Nov 2006 23:45:40 -0000 1.6
+++ init.c 17 Oct 2008 22:12:47 -0000 1.7
@@ -70,14 +70,17 @@
}
#endif /* _WIN32 */
+ /* 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_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 ||
- num_conns_mutex == NULL ||
g_get_num_sent_mutex() == NULL ||
g_get_current_conn_count_mutex() == NULL )
{
Index: modify.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/modify.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- modify.c 18 Oct 2007 00:08:34 -0000 1.16
+++ modify.c 17 Oct 2008 22:12:47 -0000 1.17
@@ -575,7 +575,7 @@
{
if ( !internal_op )
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\"\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(slapi_sdn_get_dn(&sdn), ebuf));
@@ -956,7 +956,7 @@
if (operation_is_flag_set(operation,OP_FLAG_ACTION_LOG_ACCESS))
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\", %s\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid,
escape_string(slapi_sdn_get_dn(&sdn), ebuf),
"user is not allowed to change password");
@@ -976,7 +976,7 @@
{
if ( !internal_op )
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\", %s\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(slapi_sdn_get_dn(&sdn), ebuf),
@@ -1011,7 +1011,7 @@
{
if ( !internal_op )
{
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%d op=%d MOD dn=\"%s\", %s\n",
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\", %s\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(slapi_sdn_get_dn(&sdn), ebuf), "invalid password syntax");
Index: modrdn.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/modrdn.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- modrdn.c 18 Oct 2007 00:08:34 -0000 1.9
+++ modrdn.c 17 Oct 2008 22:12:47 -0000 1.10
@@ -351,7 +351,7 @@
if ( !internal_op )
{
slapi_log_access(LDAP_DEBUG_STATS,
- "conn=%d op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"\n",
+ "conn=%" PRIu64 " op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
escape_string(dn, dnbuf),
@@ -374,7 +374,7 @@
if ((rdns = ldap_explode_rdn(newrdn, 0)) == NULL)
{
slapi_log_error(SLAPI_LOG_FATAL, NULL,
- "conn=%d op=%d MODRDN invalid new RDN (\"%s\")\n",
+ "conn=%" PRIu64 " op=%d MODRDN invalid new RDN (\"%s\")\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
(NULL == newrdn) ? "(null)" : newrdn);
@@ -391,7 +391,7 @@
{
LDAPDebug(LDAP_DEBUG_ARGS, "ldap_explode_dn of newSuperior failed\n", 0, 0, 0);
slapi_log_error(SLAPI_LOG_FATAL, NULL,
- "conn=%d op=%d MODRDN invalid new superior (\"%s\")",
+ "conn=%" PRIu64 " op=%d MODRDN invalid new superior (\"%s\")",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
(NULL == newsuperior) ? "(null)" : newsuperiorbuf);
Index: opshared.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/opshared.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- opshared.c 27 Jun 2008 19:28:21 -0000 1.12
+++ opshared.c 17 Oct 2008 22:12:47 -0000 1.13
@@ -230,7 +230,7 @@
{
char *fmtstr;
-#define SLAPD_SEARCH_FMTSTR_BASE "conn=%d op=%d SRCH base=\"%s\" scope=%d "
+#define SLAPD_SEARCH_FMTSTR_BASE "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d "
#define SLAPD_SEARCH_FMTSTR_BASE_INT "conn=%s op=%d SRCH base=\"%s\" scope=%d "
#define SLAPD_SEARCH_FMTSTR_REMAINDER " attrs=%s%s\n"
@@ -1329,7 +1329,7 @@
void op_shared_log_error_access (Slapi_PBlock *pb, const char *type, const char *dn, const char *msg)
{
char ebuf[BUFSIZ];
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d %s dn=\"%s\", %s\n",
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s dn=\"%s\", %s\n",
( pb->pb_conn ? pb->pb_conn->c_connid : 0),
( pb->pb_op ? pb->pb_op->o_opid : 0),
type,
Index: pblock.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/pblock.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- pblock.c 8 Oct 2008 17:29:03 -0000 1.17
+++ pblock.c 17 Oct 2008 22:12:47 -0000 1.18
@@ -188,7 +188,7 @@
"Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
return (-1);
}
- (*(int *)value) = pblock->pb_conn->c_connid;
+ (*(PRUint64 *)value) = pblock->pb_conn->c_connid;
break;
case SLAPI_CONN_DN:
/*
@@ -1665,7 +1665,7 @@
"Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
return (-1);
}
- pblock->pb_conn->c_connid = *((int *) value);
+ pblock->pb_conn->c_connid = *((PRUint64 *) value);
break;
case SLAPI_CONN_DN:
/*
Index: plugin_internal_op.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/plugin_internal_op.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- plugin_internal_op.c 19 Oct 2007 15:36:01 -0000 1.10
+++ plugin_internal_op.c 17 Oct 2008 22:12:47 -0000 1.11
@@ -188,7 +188,7 @@
static get_disconnect_server_fn_ptr disconnect_server_fn = NULL;
void
-do_disconnect_server(Connection *conn, int opconnid, int opid)
+do_disconnect_server(Connection *conn, PRUint64 opconnid, int opid)
{
if (NULL == disconnect_server_fn) {
if (get_entry_point(ENTRY_POINT_DISCONNECT_SERVER, (caddr_t *)(&disconnect_server_fn)) < 0) {
Index: proto-slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/proto-slap.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- proto-slap.h 15 Oct 2008 06:30:05 -0000 1.37
+++ proto-slap.h 17 Oct 2008 22:12:47 -0000 1.38
@@ -825,7 +825,7 @@
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, int opconnid, int opid, PRErrorCode reason, PRInt32 error );
+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 );
void send_ldap_result( Slapi_PBlock *pb, int err, char *matched, char *text,
@@ -839,7 +839,7 @@
struct berval ***urls );
int send_ldapv3_referral( Slapi_PBlock *pb, struct berval **urls );
int set_db_default_result_handlers(Slapi_PBlock *pb);
-void disconnect_server_nomutex( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error );
+void disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error );
long g_get_current_conn_count();
void g_increment_current_conn_count();
void g_decrement_current_conn_count();
@@ -1075,7 +1075,7 @@
/*
* plugin_internal_op.c
*/
-void do_disconnect_server( Connection *conn, int opconnid, int opid );
+void do_disconnect_server( Connection *conn, PRUint64 opconnid, int opid );
/*
* regex.c
Index: psearch.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/psearch.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- psearch.c 20 Sep 2007 16:54:38 -0000 1.9
+++ psearch.c 17 Oct 2008 22:12:47 -0000 1.10
@@ -305,7 +305,7 @@
if (conn_acq_flag) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
- "conn=%d op=%d Could not acquire the connection - psearch aborted\n",
+ "conn=%" PRIu64 " op=%d Could not acquire the connection - psearch aborted\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
}
@@ -315,7 +315,7 @@
/* Check for an abandoned operation */
if ( ps->ps_pblock->pb_op == NULL || slapi_op_abandoned( ps->ps_pblock ) ) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
- "conn=%d op=%d The operation has been abandoned\n",
+ "conn=%" PRIu64 " op=%d The operation has been abandoned\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
break;
}
@@ -373,7 +373,7 @@
ectrls, attrs, attrsonly );
if (rc) {
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
- "conn=%d op=%d Error %d sending entry %s with op status %d\n",
+ "conn=%" PRIu64 " op=%d Error %d sending entry %s with op status %d\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
rc, slapi_entry_get_dn_const(ec), ps->ps_pblock->pb_op->o_status);
}
@@ -421,7 +421,7 @@
PR_Lock( ps->ps_pblock->pb_conn->c_mutex );
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
- "conn=%d op=%d Releasing the connection and operation\n",
+ "conn=%" PRIu64 " op=%d Releasing the connection and operation\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
/* Delete this op from the connection's list */
connection_remove_operation( ps->ps_pblock->pb_conn, ps->ps_pblock->pb_op );
@@ -557,7 +557,7 @@
}
slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
- "conn=%d op=%d entry %s with chgtype %d "
+ "conn=%" PRIu64 " op=%d entry %s with chgtype %d "
"matches the ps changetype %d\n",
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
edn, chgtype, ps->ps_changetypes);
Index: result.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/result.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- result.c 27 Jun 2008 19:28:21 -0000 1.13
+++ result.c 17 Oct 2008 22:12:47 -0000 1.14
@@ -1689,7 +1689,7 @@
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d RESULT err=%d"
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
" tag=%u nentries=%d etime=%s%s%s"
", SASL bind in progress\n",
op->o_connid,
@@ -1721,7 +1721,7 @@
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d RESULT err=%d"
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
" tag=%u nentries=%d etime=%s%s%s"
" dn=\"%s\"\n",
op->o_connid,
@@ -1747,7 +1747,7 @@
if ( !internal_op )
{
slapi_log_access( LDAP_DEBUG_STATS,
- "conn=%d op=%d RESULT err=%d"
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
" tag=%u nentries=%d etime=%s%s%s\n",
op->o_connid,
op->o_opid,
@@ -1780,7 +1780,7 @@
if ( !internal_op )
{
- slapi_log_access( LDAP_DEBUG_STATS2, "conn=%d op=%d ENTRY dn=\"%s\"\n",
+ slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d ENTRY dn=\"%s\"\n",
op->o_connid, op->o_opid,
escape_string( slapi_entry_get_dn_const(e), ebuf ));
}
@@ -1805,7 +1805,7 @@
if ( !internal_op )
{
- slapi_log_access( LDAP_DEBUG_STATS2, "conn=%d op=%d REFERRAL\n",
+ slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d REFERRAL\n",
op->o_connid, op->o_opid );
}
else
Index: sasl_io.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/sasl_io.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- sasl_io.c 5 Mar 2008 19:57:03 -0000 1.14
+++ sasl_io.c 17 Oct 2008 22:12:47 -0000 1.15
@@ -82,7 +82,7 @@
int ret = 0;
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_io_enable for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_io_enable for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Flag that we should enable SASL I/O for the next read operation on this connection */
c->c_enable_sasl_io = 1;
@@ -108,7 +108,7 @@
sasl_io_private *sp = (sasl_io_private*) slapi_ch_calloc(1, sizeof(sasl_io_private));
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_io_setup for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_io_setup for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Get the current functions and store them for later */
real_iofns->lbextiofn_size = LBER_X_EXTIO_FNS_SIZE;
ber_sockbuf_get_option( c->c_sb, LBER_SOCKBUF_OPT_EXT_IO_FNS, real_iofns );
@@ -142,7 +142,7 @@
sasl_io_private *sp = c->c_sasl_io_private;
if (sp) {
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_io_cleanup for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_io_cleanup for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Free the buffers */
slapi_ch_free((void**)&(sp->encrypted_buffer));
slapi_ch_free((void**)&(sp->decrypted_buffer));
@@ -203,7 +203,7 @@
}
if (ret != 0 && ret < sizeof(buffer)) {
LDAPDebug( LDAP_DEBUG_ANY,
- "failed to read sasl packet length on connection %d\n", c->c_connid, 0, 0 );
+ "failed to read sasl packet length on connection %" PRIu64 "\n", c->c_connid, 0, 0 );
return -1;
}
@@ -214,7 +214,7 @@
packet_length += 4;
LDAPDebug( LDAP_DEBUG_CONNS,
- "read sasl packet length %ld on connection %d\n", packet_length, c->c_connid, 0 );
+ "read sasl packet length %ld on connection %" PRIu64 "\n", packet_length, c->c_connid, 0 );
sasl_io_resize_encrypted_buffer(c->c_sasl_io_private, packet_length);
/* Cyrus SASL implementation expects to have the length at the first
4 bytes */
@@ -257,7 +257,7 @@
*err = 0;
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_recv_connection for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_recv_connection for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Do we have decrypted data buffered from 'before' ? */
bytes_in_buffer = sp->decrypted_buffer_count - sp->decrypted_buffer_offset;
if (0 == bytes_in_buffer) {
@@ -284,12 +284,12 @@
const char *output_buffer = NULL;
unsigned int output_length = 0;
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_recv_connection finished reading packet for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_recv_connection finished reading packet for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
/* Now decode it */
ret = sasl_decode(c->c_sasl_conn,sp->encrypted_buffer,sp->encrypted_buffer_count,&output_buffer,&output_length);
if (SASL_OK == ret) {
LDAPDebug( LDAP_DEBUG_CONNS,
- "sasl_recv_connection decoded packet length %d for connection %d\n", output_length, c->c_connid, 0 );
+ "sasl_recv_connection decoded packet length %d for connection %" PRIu64 "\n", output_length, c->c_connid, 0 );
if (output_length) {
sasl_io_resize_decrypted_buffer(sp,output_length);
memcpy(sp->decrypted_buffer,output_buffer,output_length);
@@ -300,7 +300,7 @@
}
} else {
LDAPDebug( LDAP_DEBUG_ANY,
- "sasl_recv_connection failed to decode packet for connection %d\n", c->c_connid, 0, 0 );
+ "sasl_recv_connection failed to decode packet for connection %" PRIu64 "\n", c->c_connid, 0, 0 );
}
}
}
Index: search.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/search.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- search.c 27 Jun 2008 19:28:21 -0000 1.9
+++ search.c 17 Oct 2008 22:12:47 -0000 1.10
@@ -384,7 +384,7 @@
{
char ebuf[BUFSIZ];
slapi_log_access(LDAP_DEBUG_STATS,
- "conn=%d op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
+ "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
pb->pb_conn->c_connid, pb->pb_op->o_opid,
escape_string(base, ebuf), scope, fstr, msg ? msg : "");
Index: slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slap.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- slap.h 15 Oct 2008 06:30:05 -0000 1.36
+++ slap.h 17 Oct 2008 22:12:47 -0000 1.37
@@ -97,6 +97,7 @@
#include <errno.h>
#if defined(SOLARIS)
#include <limits.h> /* for LONG_MAX */
+
#endif
/* there's a bug in the dbm code we import (from where?) -- FIXME */
@@ -116,6 +117,22 @@
#define LDAP_IOCP
#endif
+/* Required to get portable printf/scanf format macros */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+
+/* NSPR uses the print macros a bit differently than ANSI C. We
+ * need to use ll for a 64-bit integer, even when a long is 64-bit.
+ */
+#undef PRIu64
+#define PRIu64 "llu"
+#undef PRI64
+#define PRI64 "ll"
+
+#else
+#error Need to define portable format macros such as PRIu64
+#endif /* HAVE_INTTYPES_H */
+
#define LOG_INTERNAL_OP_CON_ID "Internal"
#define LOG_INTERNAL_OP_OP_ID -1
@@ -1164,7 +1181,7 @@
Slapi_DN o_sdn; /* dn bound when op was initiated */
char *o_authtype; /* auth method used to bind dn */
int o_opid; /* id of this operation */
- int o_connid; /* id of conn initiating this op; for logging only */
+ PRUint64 o_connid; /* id of conn initiating this op; for logging only */
void *o_handler_data;
result_handler o_result_handler;
search_entry_handler o_search_entry_handler;
@@ -1223,7 +1240,7 @@
int c_gettingber; /* in the middle of ber_get_next */
BerElement *c_currentber; /* ber we're getting */
time_t c_starttime; /* when the connection was opened */
- int c_connid; /* id of this connection for stats*/
+ PRUint64 c_connid; /* id of this connection for stats*/
int c_opsinitiated; /* # ops initiated/next op id */
PRInt32 c_opscompleted; /* # ops completed */
PRInt32 c_threadnumber; /* # threads used in this conn */
@@ -1582,7 +1599,7 @@
typedef void (*ps_wakeup_all_fn_ptr)( void );
typedef void (*ps_service_fn_ptr)(Slapi_Entry *, Slapi_Entry *, int, int );
typedef char *(*get_config_dn_fn_ptr)();
-typedef void (*get_disconnect_server_fn_ptr)(Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error );
+typedef void (*get_disconnect_server_fn_ptr)(Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error );
typedef int (*slapd_SSL_client_init_fn_ptr)( void );
typedef int (*modify_config_dse_fn_ptr)( Slapi_PBlock *pb );
typedef int (*slapd_ssl_init_fn_ptr)( void );
Index: slapi-plugin.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-plugin.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- slapi-plugin.h 3 Oct 2008 04:28:22 -0000 1.31
+++ slapi-plugin.h 17 Oct 2008 22:12:47 -0000 1.32
@@ -152,6 +152,7 @@
typedef struct slapi_mod Slapi_Mod;
typedef struct slapi_mods Slapi_Mods;
typedef struct slapi_componentid Slapi_ComponentId;
+typedef struct slapi_counter Slapi_Counter;
/* Online tasks interface (to support import, export, etc) */
#define SLAPI_TASK_PUBLIC 1 /* tell old plugins that the task api is now public */
@@ -1340,6 +1341,17 @@
void slapi_destroy_task(void *arg);
/* End of interface to support online tasks **********************************/
+/* Slapi_Counter Interface */
+Slapi_Counter *slapi_counter_new();
+void slapi_counter_init(Slapi_Counter *counter);
+void slapi_counter_destroy(Slapi_Counter **counter);
+PRUint64 slapi_counter_increment(Slapi_Counter *counter);
+PRUint64 slapi_counter_decrement(Slapi_Counter *counter);
+PRUint64 slapi_counter_add(Slapi_Counter *counter, PRUint64 addvalue);
+PRUint64 slapi_counter_subtract(Slapi_Counter *counter, PRUint64 subvalue);
+PRUint64 slapi_counter_set_value(Slapi_Counter *counter, PRUint64 newvalue);
+PRUint64 slapi_counter_get_value(Slapi_Counter *counter);
+
/* Binder-based (connection centric) resource limits */
/*
* Valid values for `type' parameter to slapi_reslimit_register().
Index: snmp_collator.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/snmp_collator.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- snmp_collator.c 8 Oct 2008 17:29:03 -0000 1.14
+++ snmp_collator.c 17 Oct 2008 22:12:47 -0000 1.15
@@ -611,6 +611,9 @@
}
}
+/* 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)
{
Index: stubrepl.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/stubrepl.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- stubrepl.c 10 Nov 2006 23:45:40 -0000 1.6
+++ stubrepl.c 17 Oct 2008 22:12:47 -0000 1.7
@@ -74,6 +74,6 @@
}
void
-disconnect_server( Connection *conn, int opconnid, int opid, PRErrorCode reason, PRInt32 error )
+disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
{
}
Index: unbind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/unbind.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- unbind.c 10 Nov 2006 23:45:40 -0000 1.5
+++ unbind.c 17 Oct 2008 22:12:47 -0000 1.6
@@ -79,7 +79,7 @@
* UnBindRequest ::= NULL
*/
if ( ber_get_null( ber ) == LBER_ERROR ) {
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d UNBIND,"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
" decoding error: UnBindRequest not null\n",
pb->pb_conn->c_connid, operation->o_opid );
/* LDAPv3 does not allow a response to an unbind... so just return. */
@@ -92,7 +92,7 @@
* pass them to the backend.
*/
if ( (err = get_ldapmessage_controls( pb, ber, NULL )) != 0 ) {
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d UNBIND,"
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
" error processing controls - error %d (%s)\n",
pb->pb_conn->c_connid, operation->o_opid,
err, ldap_err2string( err ));
@@ -107,7 +107,7 @@
/* ONREPL - plugins should be called and passed bind dn and, possibly, other data */
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%d op=%d UNBIND\n",
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND\n",
pb->pb_conn->c_connid, operation->o_opid );
/* pass the unbind to all backends */
Index: value.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/value.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- value.c 24 Sep 2008 21:21:52 -0000 1.7
+++ value.c 17 Oct 2008 22:12:47 -0000 1.8
@@ -487,7 +487,7 @@
p = slapi_ch_malloc(value->bv.bv_len + 1);
memcpy (p, value->bv.bv_val, value->bv.bv_len);
p [value->bv.bv_len] = '\0';
- r = atoll(p);
+ r = strtoll(p, (char **)NULL, 0);
slapi_ch_free((void **)&p);
}
return r;
@@ -503,7 +503,7 @@
p = slapi_ch_malloc(value->bv.bv_len + 1);
memcpy (p, value->bv.bv_val, value->bv.bv_len);
p [value->bv.bv_len] = '\0';
- r = (unsigned long long)atoll(p);
+ r = strtoull(p, (char **)NULL, 0);
slapi_ch_free((void **)&p);
}
return r;