/* nextid.c - keep track of the next id to be given out */
/* $OpenLDAP$ */
/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include <ac/string.h>
#include <ac/socket.h>
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
+#include <ac/param.h>
#include "slap.h"
#include "back-ldbm.h"
if ( (db = ldbm_cache_open( be, "nextid", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
- "next_id_read: could not open/create nextid%s\n", LDBM_SUFFIX ));
+ LDAP_LOG( BACK_LDBM, CRIT,
+ "next_id_read: could not open/create nextid%s\n", LDBM_SUFFIX, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "Could not open/create nextid" LDBM_SUFFIX "\n",
0, 0, 0 );
if ( (db = ldbm_cache_open( be, "nextid", LDBM_SUFFIX, LDBM_WRCREAT ))
== NULL ) {
#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
- "next_id_write: Could not open/create nextid%s\n", LDBM_SUFFIX ));
+ LDAP_LOG( BACK_LDBM, CRIT,
+ "next_id_write: Could not open/create nextid%s\n", LDBM_SUFFIX, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "Could not open/create nextid" LDBM_SUFFIX "\n",
0, 0, 0 );
*idp = NOID;
- ldap_pvt_thread_mutex_lock( &li->li_nextid_mutex );
-
if ( li->li_nextid == NOID ) {
if ( ( rc = next_id_read( be, idp ) ) ) {
- ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex );
return( rc );
}
li->li_nextid = *idp;
*idp = li->li_nextid;
- ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex );
return( rc );
}
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
int rc = 0;
- ldap_pvt_thread_mutex_lock( &li->li_nextid_mutex );
-
if ( li->li_nextid == NOID ) {
if ( ( rc = next_id_read( be, idp ) ) ) {
- ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex );
return( rc );
}
li->li_nextid = *idp;
rc = -1;
}
- ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex );
return( rc );
}