Debug( LDAP_DEBUG_TRACE, "ldap_abandon_ext %d\n", msgid, 0, 0 );
/* check client controls */
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
rc = ldap_int_client_controls( ld, cctrls );
if ( rc == LDAP_SUCCESS ) {
rc = do_abandon( ld, msgid, msgid, sctrls, 1 );
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
return rc;
}
{
int rc;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
-
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
rc = do_abandon( ld, msgid, msgid, NULL, 0 );
-
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
-
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
return rc;
}
/* ldap_msgdelete locks the res_mutex. Give up the req_mutex
* while we're in there.
*/
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
err = ldap_msgdelete( ld, msgid );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
if ( err == 0 ) {
ld->ld_errno = LDAP_SUCCESS;
return LDAP_SUCCESS;
}
}
-#ifdef LDAP_R_COMPILE
/* ld_abandoned is actually protected by the ld_res_mutex;
* give up the ld_req_mutex and get the other */
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
+ LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
/* use bisection */
i = 0;
ld->ld_errno = LDAP_SUCCESS;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
return( ld->ld_errno );
}
}
rc = 0;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_GET_FD, &sd );
if ( sd == AC_SOCKET_INVALID ) {
}
}
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
if( rc != 0 ) return ld->ld_errno;
oldctx = ld->ld_defconn->lconn_sasl_authctx;
}
sprintf(request, "_ldap._tcp.%s", domain);
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock(&ldap_int_resolv_mutex);
-#endif
+ LDAP_MUTEX_LOCK(&ldap_int_resolv_mutex);
rc = LDAP_UNAVAILABLE;
#ifdef NS_HFIXEDSZ
*list = hostlist;
out:
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock(&ldap_int_resolv_mutex);
-#endif
+ LDAP_MUTEX_UNLOCK(&ldap_int_resolv_mutex);
if (request != NULL) {
LDAP_FREE(request);
if(referralsp != NULL) *referralsp = NULL;
if(serverctrls != NULL) *serverctrls = NULL;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
/* Find the result, last msg in chain... */
lm = r->lm_chain_tail;
/* FIXME: either this is not possible (assert?)
if( lm == NULL ) {
errcode = ld->ld_errno = LDAP_NO_RESULTS_RETURNED;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
goto done;
}
*referralsp = ldap_value_dup( ld->ld_referrals );
}
}
-
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
done:
if ( freeit ) {
#endif
#endif
+#ifdef LDAP_R_COMPILE
+#define LDAP_MUTEX_LOCK(mutex) ldap_pvt_thread_mutex_lock( mutex )
+#define LDAP_MUTEX_UNLOCK(mutex) ldap_pvt_thread_mutex_unlock( mutex )
+#define LDAP_ASSERT_MUTEX_OWNER(mutex) \
+ LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER(mutex)
+#else
+#define LDAP_MUTEX_LOCK(mutex)
+#define LDAP_MUTEX_UNLOCK(mutex)
+#define LDAP_ASSERT_MUTEX_OWNER(mutex)
+#endif
+
#ifdef LDAP_R_COMPILE
#define LDAP_NEXT_MSGID(ld, id) \
- ldap_pvt_thread_mutex_lock( &(ld)->ld_req_mutex ); \
+ LDAP_MUTEX_LOCK( &(ld)->ld_req_mutex ); \
id = ++(ld)->ld_msgid; \
- ldap_pvt_thread_mutex_unlock( &(ld)->ld_req_mutex )
+ LDAP_MUTEX_UNLOCK( &(ld)->ld_req_mutex )
#else
#define LDAP_NEXT_MSGID(ld, id) id = ++(ld)->ld_msgid
#endif
hints.ai_socktype = socktype;
snprintf(serv, sizeof serv, "%d", port );
-#ifdef LDAP_R_COMPILE
/* most getaddrinfo(3) use non-threadsafe resolver libraries */
- ldap_pvt_thread_mutex_lock(&ldap_int_resolv_mutex);
-#endif
+ LDAP_MUTEX_LOCK(&ldap_int_resolv_mutex);
err = getaddrinfo( host, serv, &hints, &res );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock(&ldap_int_resolv_mutex);
-#endif
+ LDAP_MUTEX_UNLOCK(&ldap_int_resolv_mutex);
if ( err != 0 ) {
osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n",
Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
if ( ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_GET_FD, NULL ) == -1 ) {
/* not connected yet */
rc = ldap_open_defconn( ld );
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
if( rc < 0 ) {
ber_free( ber, 1 );
return( -1 );
}
}
#endif
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
rc = ldap_send_server_request( ld, ber, msgid, NULL,
NULL, NULL, NULL );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
return(rc);
}
}
lc->lconn_status = async ? LDAP_CONNST_CONNECTING : LDAP_CONNST_CONNECTED;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
lc->lconn_next = ld->ld_conns;
ld->ld_conns = lc;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
if ( connect ) {
-#ifdef LDAP_R_COMPILE
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
-#endif
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
#ifdef HAVE_TLS
if ( lc->lconn_server->lud_exts ) {
++lc->lconn_refcnt; /* avoid premature free */
ld->ld_defconn = lc;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
+ LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
rc = ldap_start_tls_s( ld, NULL, NULL );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
ld->ld_defconn = savedefconn;
--lc->lconn_refcnt;
int err = 0;
LDAPConn *savedefconn;
-#ifdef LDAP_R_COMPILE
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
-#endif
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
/* Set flag to prevent additional referrals
* from being processed on this
ld->ld_defconn = lc;
Debug( LDAP_DEBUG_TRACE, "Call application rebind_proc\n", 0, 0, 0);
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
+ LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
err = (*ld->ld_rebind_proc)( ld,
bind->ri_url, bind->ri_request, bind->ri_msgid,
ld->ld_rebind_params );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
ld->ld_defconn = savedefconn;
--lc->lconn_refcnt;
"anonymous rebind via ldap_sasl_bind(\"\")\n",
0, 0, 0);
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
+ LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
rc = ldap_sasl_bind( ld, "", LDAP_SASL_SIMPLE, &passwd,
NULL, NULL, &msgid );
if ( rc != LDAP_SUCCESS ) {
}
}
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
ld->ld_defconn = savedefconn;
--lc->lconn_refcnt;
int lcu_port, lsu_port;
int found = 0;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {
lcu = lc->lconn_server;
lcu_port = ldap_pvt_url_scheme_port( lcu->lud_scheme,
if ( found )
break;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
return lc;
}
if ( force || --lc->lconn_refcnt <= 0 ) {
/* remove from connections list first */
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
for ( prevlc = NULL, tmplc = ld->ld_conns;
tmplc != NULL;
}
prevlc = tmplc;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
/* process connection callbacks */
{
void
ldap_free_request( LDAP *ld, LDAPRequest *lr )
{
-#ifdef LDAP_R_COMPILE
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
-#endif
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
Debug( LDAP_DEBUG_TRACE, "ldap_free_request (origid %d, msgid %d)\n",
lr->lr_origid, lr->lr_msgid, 0 );
/* Send the new request to the server - may require a bind */
rinfo.ri_msgid = origreq->lr_origid;
rinfo.ri_url = refarray[i];
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
rc = ldap_send_server_request( ld, ber, id,
origreq, &srv, NULL, &rinfo );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
if ( rc < 0 ) {
/* Failure, try next referral in the list */
Debug( LDAP_DEBUG_ANY, "Unable to chase referral \"%s\" (%d: %s)\n",
rinfo.ri_msgid = origreq->lr_origid;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
rc = ldap_send_server_request( ld, ber, id,
lr, &srv, NULL, &rinfo );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
LDAP_FREE( rinfo.ri_url );
{
LDAPRequest *lr;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
if ( lr->lr_status == LDAP_REQST_COMPLETED ) {
continue; /* Skip completed requests */
break;
}
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
return( lr );
}
{
LDAPRequest *lr;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
if ( lr == lrx ) {
if ( lr->lr_refcnt > 0 ) {
} else if ( freeit ) {
ldap_free_request( ld, lrx );
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
}
Debug( LDAP_DEBUG_TRACE, "ldap_result ld %p msgid %d\n", (void *)ld, msgid, 0 );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
-#endif
-
+ LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
rc = wait4msg( ld, msgid, all, timeout, result );
-
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
return rc;
}
* wait until it arrives or timeout occurs.
*/
-#ifdef LDAP_R_COMPILE
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
-#endif
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
Debug( LDAP_DEBUG_TRACE,
"ldap_chkResponseList ld %p msgid %d all %d\n",
assert( ld != NULL );
assert( result != NULL );
-#ifdef LDAP_R_COMPILE
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
-#endif
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
if ( timeout == NULL && ld->ld_options.ldo_tm_api.tv_sec >= 0 ) {
tv = ld->ld_options.ldo_tm_api;
if ( ldap_debug & LDAP_DEBUG_TRACE ) {
Debug( LDAP_DEBUG_TRACE, "wait4msg continue ld %p msgid %d all %d\n",
(void *)ld, msgid, all );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
ldap_dump_connection( ld, ld->ld_conns, 1 );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
ldap_dump_requests_and_responses( ld );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
}
#endif /* LDAP_DEBUG */
} else {
int lc_ready = 0;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {
if ( ber_sockbuf_ctrl( lc->lconn_sb,
LBER_SB_OPT_DATA_READY, NULL ) )
break;
}
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
if ( !lc_ready ) {
int err;
if ( lc_ready ) {
LDAPConn *lnext;
rc = LDAP_MSG_X_KEEP_LOOKING;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
if ( ld->ld_requests &&
ld->ld_requests->lr_status == LDAP_REQST_WRITING &&
ldap_is_write_ready( ld,
{
ldap_int_flush_request( ld, ld->ld_requests );
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
- ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
+ LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
for ( lc = ld->ld_conns;
rc == LDAP_MSG_X_KEEP_LOOKING && lc != NULL;
lc = lnext )
{
/* Don't let it get freed out from under us */
++lc->lconn_refcnt;
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
rc = try_read1msg( ld, msgid, all, lc, result );
lnext = lc->lconn_next;
/* Only take locks if we're really freeing */
if ( lc->lconn_refcnt <= 1 ) {
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
ldap_free_connection( ld, lc, 0, 1 );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
} else {
--lc->lconn_refcnt;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
} else {
lnext = lc->lconn_next;
}
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
}
}
assert( ld != NULL );
assert( lc != NULL );
-#ifdef LDAP_R_COMPILE
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
-#endif
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
Debug( LDAP_DEBUG_TRACE, "read1msg: ld %p msgid %d all %d\n",
(void *)ld, msgid, all );
Debug( LDAP_DEBUG_TRACE, "ldap_msgdelete ld=%p msgid=%d\n",
(void *)ld, msgid, 0 );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
prev = NULL;
for ( lm = ld->ld_responses; lm != NULL; lm = lm->lm_next ) {
if ( lm->lm_msgid == msgid ) {
prev->lm_next = lm->lm_next;
}
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
if ( lm ) {
switch ( ldap_msgfree( lm ) ) {
case LDAP_RES_SEARCH_ENTRY:
static int
ldap_abandoned( LDAP *ld, ber_int_t msgid, int *idxp )
{
-#ifdef LDAP_R_COMPILE
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
-#endif
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
assert( idxp != NULL );
assert( msgid >= 0 );
static int
ldap_mark_abandoned( LDAP *ld, ber_int_t msgid, int idx )
{
-#ifdef LDAP_R_COMPILE
- LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
-#endif
+ LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
/* NOTE: those assertions are repeated in ldap_int_bisect_delete() */
assert( idx >= 0 );
int rc;
char *smechs = NULL;
-#if defined( LDAP_R_COMPILE ) && defined( HAVE_CYRUS_SASL )
- ldap_pvt_thread_mutex_lock( &ldap_int_sasl_mutex );
+#if defined( HAVE_CYRUS_SASL )
+ LDAP_MUTEX_LOCK( &ldap_int_sasl_mutex );
#endif
#ifdef LDAP_CONNECTIONLESS
if( LDAP_IS_UDP(ld) ) {
flags, interact, defaults );
done:
-#if defined( LDAP_R_COMPILE ) && defined( HAVE_CYRUS_SASL )
- ldap_pvt_thread_mutex_unlock( &ldap_int_sasl_mutex );
+#if defined( HAVE_CYRUS_SASL )
+ LDAP_MUTEX_UNLOCK( &ldap_int_sasl_mutex );
#endif
if ( smechs ) LDAP_FREE( smechs );
int err = LDAP_SUCCESS;
/* free LDAP structure and outstanding requests/responses */
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
while ( ld->ld_requests != NULL ) {
ldap_free_request( ld, ld->ld_requests );
}
while ( ld->ld_conns != NULL ) {
ldap_free_connection( ld, ld->ld_conns, 1, close );
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
for ( lm = ld->ld_responses; lm != NULL; lm = next ) {
next = lm->lm_next;
ldap_msgfree( lm );
LDAP_FREE( ld->ld_abandoned );
ld->ld_abandoned = NULL;
}
-#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
/* final close callbacks */
{
#else
-# ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ldap_int_ctime_mutex );
-# endif
-
+ LDAP_MUTEX_LOCK( &ldap_int_ctime_mutex );
AC_MEMCPY( buf, ctime(tp), 26 );
-
-# ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ldap_int_ctime_mutex );
-# endif
+ LDAP_MUTEX_UNLOCK( &ldap_int_ctime_mutex );
return buf;
#endif
# ifndef LDAP_R_COMPILE
return 0;
# else /* LDAP_R_COMPILE */
- return ldap_pvt_thread_mutex_lock( &ldap_int_gmtime_mutex );
+ return LDAP_MUTEX_LOCK( &ldap_int_gmtime_mutex );
# endif /* LDAP_R_COMPILE */
}
# ifndef LDAP_R_COMPILE
return 0;
# else /* LDAP_R_COMPILE */
- return ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex );
+ return LDAP_MUTEX_UNLOCK( &ldap_int_gmtime_mutex );
# endif /* LDAP_R_COMPILE */
}
#endif /* !USE_GMTIME_R || !USE_LOCALTIME_R */
{
struct tm *tm_ptr;
-# ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ldap_int_gmtime_mutex );
-# endif /* LDAP_R_COMPILE */
-
+ LDAP_MUTEX_LOCK( &ldap_int_gmtime_mutex );
tm_ptr = gmtime( timep );
if ( tm_ptr == NULL ) {
result = NULL;
} else {
*result = *tm_ptr;
}
-
-# ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex );
-# endif /* LDAP_R_COMPILE */
+ LDAP_MUTEX_UNLOCK( &ldap_int_gmtime_mutex );
return result;
}
{
struct tm *tm_ptr;
-# ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ldap_int_gmtime_mutex );
-# endif /* LDAP_R_COMPILE */
-
+ LDAP_MUTEX_LOCK( &ldap_int_gmtime_mutex );
tm_ptr = localtime( timep );
if ( tm_ptr == NULL ) {
result = NULL;
} else {
*result = *tm_ptr;
}
-
-# ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex );
-# endif /* LDAP_R_COMPILE */
+ LDAP_MUTEX_UNLOCK( &ldap_int_gmtime_mutex );
return result;
}
int retval;
*buf = NULL;
- ldap_pvt_thread_mutex_lock( &ldap_int_resolv_mutex );
+ LDAP_MUTEX_LOCK( &ldap_int_resolv_mutex );
he = gethostbyname( name );
retval = 0;
}
- ldap_pvt_thread_mutex_unlock( &ldap_int_resolv_mutex );
+ LDAP_MUTEX_UNLOCK( &ldap_int_resolv_mutex );
return retval;
#else
int rc;
#if defined( HAVE_GETNAMEINFO )
-#if defined( LDAP_R_COMPILE )
- ldap_pvt_thread_mutex_lock( &ldap_int_resolv_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ldap_int_resolv_mutex );
rc = getnameinfo( sa, len, name, namelen, NULL, 0, 0 );
-#if defined( LDAP_R_COMPILE )
- ldap_pvt_thread_mutex_unlock( &ldap_int_resolv_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ldap_int_resolv_mutex );
if ( rc ) *err = (char *)AC_GAI_STRERROR( rc );
return rc;
LDAP_FREE(buf);
#else /* HAVE_GETHOSTBYADDR_R */
-#if defined( LDAP_R_COMPILE )
- ldap_pvt_thread_mutex_lock( &ldap_int_resolv_mutex );
-#endif
+ LDAP_MUTEX_LOCK( &ldap_int_resolv_mutex );
hp = gethostbyaddr( addr, alen, sa->sa_family );
if (hp) {
strncpy( name, hp->h_name, namelen );
rc = h_errno;
*err = (char *)HSTRERROR( h_errno );
}
-#if defined( LDAP_R_COMPILE )
- ldap_pvt_thread_mutex_unlock( &ldap_int_resolv_mutex );
-#endif
+ LDAP_MUTEX_UNLOCK( &ldap_int_resolv_mutex );
#endif /* !HAVE_GETHOSTBYADDR_R */
return rc;
int retval;
*buf = NULL;
- ldap_pvt_thread_mutex_lock( &ldap_int_resolv_mutex );
-
+ LDAP_MUTEX_LOCK( &ldap_int_resolv_mutex );
he = gethostbyaddr( addr, len, type );
if (he==NULL) {
*result = resbuf;
retval = 0;
}
-
- ldap_pvt_thread_mutex_unlock( &ldap_int_resolv_mutex );
+ LDAP_MUTEX_UNLOCK( &ldap_int_resolv_mutex );
return retval;