浏览代码

Bug 730387 - Add slapi_rwlock API and use POSIX rwlocks

This adds a new slapi_rwlock API and uses it throughout the server.
Internally, this API can allow either NSPR or POSIX rwlocks to be
used for different platforms.  This patch makes it use the POSIX
implementation on Linux platforms since the NSPR implementation
does not safely allow re-entrant reader locks to be used.
Nathan Kinder 14 年之前
父节点
当前提交
f9b199ec05
共有 59 个文件被更改,包括 1596 次插入1413 次删除
  1. 1 1
      Makefile.in
  2. 2 2
      aclocal.m4
  3. 9 0
      config.h.in
  4. 449 630
      configure
  5. 1 0
      configure.ac
  6. 1 1
      ldap/servers/plugins/acl/acl.h
  7. 6 6
      ldap/servers/plugins/acl/aclanom.c
  8. 5 5
      ldap/servers/plugins/acl/aclgroup.c
  9. 6 6
      ldap/servers/plugins/acl/acllist.c
  10. 5 5
      ldap/servers/plugins/automember/automember.c
  11. 3 3
      ldap/servers/plugins/chainingdb/cb.h
  12. 4 4
      ldap/servers/plugins/chainingdb/cb_bind.c
  13. 12 12
      ldap/servers/plugins/chainingdb/cb_config.c
  14. 4 4
      ldap/servers/plugins/chainingdb/cb_conn_stateless.c
  15. 9 9
      ldap/servers/plugins/chainingdb/cb_controls.c
  16. 1 1
      ldap/servers/plugins/chainingdb/cb_init.c
  17. 114 114
      ldap/servers/plugins/chainingdb/cb_instance.c
  18. 2 2
      ldap/servers/plugins/chainingdb/cb_modify.c
  19. 3 3
      ldap/servers/plugins/chainingdb/cb_monitor.c
  20. 2 2
      ldap/servers/plugins/chainingdb/cb_schema.c
  21. 2 2
      ldap/servers/plugins/chainingdb/cb_search.c
  22. 5 5
      ldap/servers/plugins/chainingdb/cb_utils.c
  23. 5 5
      ldap/servers/plugins/dna/dna.c
  24. 5 5
      ldap/servers/plugins/linkedattrs/linked_attrs.c
  25. 5 5
      ldap/servers/plugins/memberof/memberof_config.c
  26. 5 5
      ldap/servers/plugins/mep/mep.c
  27. 18 18
      ldap/servers/plugins/replication/cl5_api.c
  28. 11 11
      ldap/servers/plugins/replication/cl5_clcache.c
  29. 9 9
      ldap/servers/plugins/replication/cl5_config.c
  30. 18 18
      ldap/servers/plugins/replication/csnpl.c
  31. 8 8
      ldap/servers/plugins/replication/legacy_consumer.c
  32. 13 13
      ldap/servers/plugins/replication/repl5_replica_dnhash.c
  33. 15 15
      ldap/servers/plugins/replication/repl5_replica_hash.c
  34. 67 67
      ldap/servers/plugins/replication/repl5_ruv.c
  35. 27 27
      ldap/servers/plugins/roles/roles_cache.c
  36. 5 5
      ldap/servers/plugins/views/views.c
  37. 10 12
      ldap/servers/slapd/attrsyntax.c
  38. 11 12
      ldap/servers/slapd/back-ldbm/dblayer.c
  39. 1 1
      ldap/servers/slapd/back-ldbm/dblayer.h
  40. 9 9
      ldap/servers/slapd/back-ldbm/idl.c
  41. 43 43
      ldap/servers/slapd/back-ldbm/vlv.c
  42. 1 1
      ldap/servers/slapd/backend.c
  43. 5 5
      ldap/servers/slapd/backend_manager.c
  44. 18 18
      ldap/servers/slapd/computed.c
  45. 9 10
      ldap/servers/slapd/control.c
  46. 24 24
      ldap/servers/slapd/csngen.c
  47. 17 17
      ldap/servers/slapd/dse.c
  48. 2 2
      ldap/servers/slapd/entry.c
  49. 5 5
      ldap/servers/slapd/index_subsystem.c
  50. 5 5
      ldap/servers/slapd/mapping_tree.c
  51. 14 16
      ldap/servers/slapd/plugin.c
  52. 19 21
      ldap/servers/slapd/resourcelimit.c
  53. 6 7
      ldap/servers/slapd/schema.c
  54. 6 7
      ldap/servers/slapd/schemaparse.c
  55. 3 3
      ldap/servers/slapd/slap.h
  56. 59 0
      ldap/servers/slapd/slapi-plugin.h
  57. 79 0
      ldap/servers/slapd/slapi2nspr.c
  58. 15 15
      ldap/servers/slapd/vattr.c
  59. 378 152
      ltmain.sh

+ 1 - 1
Makefile.in

@@ -1122,6 +1122,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
@@ -1202,7 +1203,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mibdir = $(datadir)@mibdir@
 mkdir_p = @mkdir_p@

+ 2 - 2
aclocal.m4

@@ -13,8 +13,8 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
-[m4_warning([this file was generated for autoconf 2.63.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.66],,
+[m4_warning([this file was generated for autoconf 2.66.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])

+ 9 - 0
config.h.in

@@ -247,6 +247,9 @@
    */
 #undef HAVE_SYS_NDIR_H
 
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
 /* Define to 1 if you have the <sys/socket.h> header file. */
 #undef HAVE_SYS_SOCKET_H
 
@@ -363,6 +366,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
@@ -396,6 +402,9 @@
 /* If defined, using OpenLDAP for LDAP SDK */
 #undef USE_OPENLDAP
 
+/* POSIX rwlocks */
+#undef USE_POSIX_RWLOCKS
+
 /* package version */
 #undef VERSION
 

文件差异内容过多而无法显示
+ 449 - 630
configure


+ 1 - 0
configure.ac

@@ -422,6 +422,7 @@ case $host in
     AC_SUBST([THREADLIB], [$THREADLIB])
     LIBCRYPT=-lcrypt
     AC_SUBST([LIBCRYPT], [$LIBCRYPT])
+    AC_DEFINE([USE_POSIX_RWLOCKS], [1], [POSIX rwlocks])
     ;;
   ia64-hp-hpux*)
     AC_DEFINE([XP_UNIX], [1], [UNIX])

+ 1 - 1
ldap/servers/plugins/acl/acl.h

@@ -632,7 +632,7 @@ struct acl_groupcache {
 	int				aclg_num_userGroups;
 	aclUserGroup	*aclg_first;
 	aclUserGroup	*aclg_last;
-	PRRWLock		*aclg_rwlock;		/* lock to monitor the group cache */	
+	Slapi_RWLock		*aclg_rwlock;		/* lock to monitor the group cache */	
 };
 typedef struct acl_groupcache	aclGroupCache;
 

+ 6 - 6
ldap/servers/plugins/acl/aclanom.c

@@ -63,11 +63,11 @@ struct anom_profile {
 
 static struct anom_profile *acl_anom_profile = NULL;
 
-static PRRWLock *anom_rwlock = NULL;
-#define ANOM_LOCK_READ()     PR_RWLock_Rlock  (anom_rwlock )
-#define ANOM_UNLOCK_READ()   PR_RWLock_Unlock (anom_rwlock )
-#define ANOM_LOCK_WRITE()    PR_RWLock_Wlock  (anom_rwlock )
-#define ANOM_UNLOCK_WRITE()  PR_RWLock_Unlock (anom_rwlock )
+static Slapi_RWLock *anom_rwlock = NULL;
+#define ANOM_LOCK_READ()     slapi_rwlock_rdlock  (anom_rwlock )
+#define ANOM_UNLOCK_READ()   slapi_rwlock_unlock (anom_rwlock )
+#define ANOM_LOCK_WRITE()    slapi_rwlock_wrlock  (anom_rwlock )
+#define ANOM_UNLOCK_WRITE()  slapi_rwlock_unlock (anom_rwlock )
 
 
 static void 	__aclanom__del_profile ();
@@ -92,7 +92,7 @@ aclanom_init ()
 	acl_anom_profile = (struct anom_profile * )
                 slapi_ch_calloc (1, sizeof ( struct anom_profile ) );
 
-	if (( anom_rwlock = PR_NewRWLock( PR_RWLOCK_RANK_NONE,"ANOM LOCK") ) == NULL ) {
+	if (( anom_rwlock = slapi_new_rwlock()) == NULL ) {
 		slapi_log_error( SLAPI_LOG_FATAL, plugin_name,
 				"Failed in getting the ANOM rwlock\n" );
 		return 1;

+ 5 - 5
ldap/servers/plugins/acl/aclgroup.c

@@ -55,10 +55,10 @@
 static aclGroupCache   *aclUserGroups;
 #define ACL_MAXCACHE_USERGROUPS 200
 
-#define ACLG_LOCK_GROUPCACHE_READ()      PR_RWLock_Rlock ( aclUserGroups->aclg_rwlock )
-#define ACLG_LOCK_GROUPCACHE_WRITE()     PR_RWLock_Wlock ( aclUserGroups->aclg_rwlock )
-#define ACLG_ULOCK_GROUPCACHE_WRITE()    PR_RWLock_Unlock ( aclUserGroups->aclg_rwlock )
-#define ACLG_ULOCK_GROUPCACHE_READ()     PR_RWLock_Unlock ( aclUserGroups->aclg_rwlock )
+#define ACLG_LOCK_GROUPCACHE_READ()      slapi_rwlock_rdlock ( aclUserGroups->aclg_rwlock )
+#define ACLG_LOCK_GROUPCACHE_WRITE()     slapi_rwlock_wrlock ( aclUserGroups->aclg_rwlock )
+#define ACLG_ULOCK_GROUPCACHE_WRITE()    slapi_rwlock_unlock ( aclUserGroups->aclg_rwlock )
+#define ACLG_ULOCK_GROUPCACHE_READ()     slapi_rwlock_unlock ( aclUserGroups->aclg_rwlock )
 
 
 static void		__aclg__delete_userGroup ( aclUserGroup *u_group );
@@ -69,7 +69,7 @@ aclgroup_init ()
 {
 
 	aclUserGroups = ( aclGroupCache * ) slapi_ch_calloc (1, sizeof ( aclGroupCache ) );
-	if ( NULL ==  (aclUserGroups->aclg_rwlock = PR_NewRWLock( PR_RWLOCK_RANK_NONE,"Group LOCK"))) {
+	if ( NULL ==  (aclUserGroups->aclg_rwlock = slapi_new_rwlock())) {
 		slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Unable to allocate RWLOCK for group cache\n");
 		return 1;
 	}

+ 6 - 6
ldap/servers/plugins/acl/acllist.c

@@ -71,11 +71,11 @@
  */
 #include "acl.h"
 
-static PRRWLock *aci_rwlock = NULL;
-#define ACILIST_LOCK_READ()     PR_RWLock_Rlock  (aci_rwlock )
-#define ACILIST_UNLOCK_READ()   PR_RWLock_Unlock (aci_rwlock )
-#define ACILIST_LOCK_WRITE()    PR_RWLock_Wlock  (aci_rwlock )
-#define ACILIST_UNLOCK_WRITE()  PR_RWLock_Unlock (aci_rwlock )
+static Slapi_RWLock *aci_rwlock = NULL;
+#define ACILIST_LOCK_READ()     slapi_rwlock_rdlock  (aci_rwlock )
+#define ACILIST_UNLOCK_READ()   slapi_rwlock_unlock (aci_rwlock )
+#define ACILIST_LOCK_WRITE()    slapi_rwlock_wrlock  (aci_rwlock )
+#define ACILIST_UNLOCK_WRITE()  slapi_rwlock_unlock (aci_rwlock )
 
 
 /* Root of the TREE */
@@ -103,7 +103,7 @@ int
 acllist_init ()
 {
 
-	if (( aci_rwlock = PR_NewRWLock( PR_RWLOCK_RANK_NONE,"ACLLIST LOCK") ) == NULL ) {
+	if (( aci_rwlock = slapi_new_rwlock() ) == NULL ) {
 		slapi_log_error( SLAPI_LOG_FATAL, plugin_name, 
 							"acllist_init:failed in getting the rwlock\n" );
 		return 1;

+ 5 - 5
ldap/servers/plugins/automember/automember.c

@@ -49,7 +49,7 @@
  * Plug-in globals
  */
 static PRCList *g_automember_config = NULL;
-static PRRWLock *g_automember_config_lock;
+static Slapi_RWLock *g_automember_config_lock;
 
 static void *_PluginID = NULL;
 static Slapi_DN *_PluginDN = NULL;
@@ -113,19 +113,19 @@ static void automember_add_member_value(Slapi_Entry *member_e, const char *group
 void
 automember_config_read_lock()
 {
-    PR_RWLock_Rlock(g_automember_config_lock);
+    slapi_rwlock_rdlock(g_automember_config_lock);
 }
 
 void
 automember_config_write_lock()
 {
-    PR_RWLock_Wlock(g_automember_config_lock);
+    slapi_rwlock_wrlock(g_automember_config_lock);
 }
 
 void
 automember_config_unlock()
 {
-    PR_RWLock_Unlock(g_automember_config_lock);
+    slapi_rwlock_unlock(g_automember_config_lock);
 }
 
 
@@ -286,7 +286,7 @@ automember_start(Slapi_PBlock * pb)
         goto done;
     }
 
-    g_automember_config_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "automember_config");
+    g_automember_config_lock = slapi_new_rwlock();
 
     if (!g_automember_config_lock) {
         slapi_log_error(SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,

+ 3 - 3
ldap/servers/plugins/chainingdb/cb.h

@@ -235,7 +235,7 @@ typedef struct _cb_backend {
 		char ** chaining_components;	/* List of plugins that chains	   */
 		char ** chainable_components;	/* List of plugins allowed to chain*/
 						/* internal operations.            */
-		PRRWLock *rwl_config_lock;	/* Protect the global config	   */
+		Slapi_RWLock *rwl_config_lock;	/* Protect the global config	   */
 	} config;
 
 	int started;				/* TRUE when started		   */
@@ -293,7 +293,7 @@ typedef struct  {
 	cb_outgoing_conn  *connarray[MAX_CONN_ARRAY]; /* array of secure connections */
 
 	/* To protect the config set by LDAP */
-	PRRWLock	* rwl_config_lock;
+	Slapi_RWLock	* rwl_config_lock;
 	int		starttls; /* use starttls with connection */
 	char		*mech; /* plain, external, or a sasl mech */
 } cb_conn_pool;
@@ -310,7 +310,7 @@ typedef struct _cb_backend_instance {
 
 	/* configuration */
 
-	PRRWLock		*rwl_config_lock;	/* protect the config */
+	Slapi_RWLock		*rwl_config_lock;	/* protect the config */
 	char 			*configDn;		/* config entry dn */
 	char 			*monitorDn;		/* monitor entry dn */
 	int 		  	local_acl;		/* True if local acl evaluation */

+ 4 - 4
ldap/servers/plugins/chainingdb/cb_bind.c

@@ -107,10 +107,10 @@ cb_sasl_bind_once_s( cb_conn_pool *pool, char *dn, int method, char * mechanism,
 	
     /* Grab an LDAP connection to use for this bind. */
 
-    PR_RWLock_Rlock(pool->rwl_config_lock);
+    slapi_rwlock_rdlock(pool->rwl_config_lock);
     timeout_copy.tv_sec = pool->conn.bind_timeout.tv_sec;
     timeout_copy.tv_usec = pool->conn.bind_timeout.tv_usec;
-    PR_RWLock_Unlock(pool->rwl_config_lock);
+    slapi_rwlock_unlock(pool->rwl_config_lock);
 
 	rc = cb_get_connection(pool, &ld, &cnx, NULL, &cnxerrbuf);
 	if (LDAP_SUCCESS != rc) {
@@ -286,9 +286,9 @@ chainingdb_bind( Slapi_PBlock *pb ) {
 	  return -1;
         }
 
-        PR_RWLock_Rlock(cb->rwl_config_lock);
+        slapi_rwlock_rdlock(cb->rwl_config_lock);
 	bind_retry=cb->bind_retry;
-        PR_RWLock_Unlock(cb->rwl_config_lock);
+        slapi_rwlock_unlock(cb->rwl_config_lock);
 
 	rc = cb_sasl_bind_s(pb, cb->bind_pool, bind_retry, dn, method, 
 	                    mechanism, creds, reqctrls, &matcheddn, &errmsg, 

+ 12 - 12
ldap/servers/plugins/chainingdb/cb_config.c

@@ -330,7 +330,7 @@ cb_config_search_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* e2, int
  
 	/* other attributes */
 
-        PR_RWLock_Rlock(cb->config.rwl_config_lock);
+        slapi_rwlock_rdlock(cb->config.rwl_config_lock);
 
 	for (i=0; cb->config.forward_ctrls && cb->config.forward_ctrls[i] ; i++) {
 		val.bv_val=cb->config.forward_ctrls[i];
@@ -364,7 +364,7 @@ cb_config_search_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* e2, int
         }
 
 
-        PR_RWLock_Unlock(cb->config.rwl_config_lock);
+        slapi_rwlock_unlock(cb->config.rwl_config_lock);
 
         *returncode = LDAP_SUCCESS;
         return SLAPI_DSE_CALLBACK_OK;
@@ -461,7 +461,7 @@ cb_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
                         char * config_attr_value;
                         int done=0;
 
-                        PR_RWLock_Wlock(cb->config.rwl_config_lock);
+                        slapi_rwlock_wrlock(cb->config.rwl_config_lock);
 
                         for (j = 0; mods[i]->mod_bvalues && mods[i]->mod_bvalues[j]; j++) {
                                 config_attr_value = (char *) mods[i]->mod_bvalues[j]->bv_val;
@@ -490,13 +490,13 @@ cb_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
 				cb->config.chaining_components=NULL;
 			}
 
-                        PR_RWLock_Unlock(cb->config.rwl_config_lock);
+                        slapi_rwlock_unlock(cb->config.rwl_config_lock);
 		} else
 		if ( !strcasecmp ( attr_name, CB_CONFIG_GLOBAL_CHAINABLE_COMPONENTS )) {
                         char * config_attr_value;
                         int done=0;
 
-                        PR_RWLock_Wlock(cb->config.rwl_config_lock);
+                        slapi_rwlock_wrlock(cb->config.rwl_config_lock);
 
                         for (j = 0; mods[i]->mod_bvalues && mods[i]->mod_bvalues[j]; j++) {
                                 config_attr_value = (char *) mods[i]->mod_bvalues[j]->bv_val;
@@ -527,7 +527,7 @@ cb_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
                                 cb->config.chainable_components=NULL;
                         }
 
-                        PR_RWLock_Unlock(cb->config.rwl_config_lock);
+                        slapi_rwlock_unlock(cb->config.rwl_config_lock);
                 }
 
 
@@ -582,12 +582,12 @@ static int cb_parse_config_entry(cb_backend * cb, Slapi_Entry *e)
                 if ( !strcasecmp ( attr_name, CB_CONFIG_GLOBAL_FORWARD_CTRLS )) {
                 	i = slapi_attr_first_value(attr, &sval);
 
-		        PR_RWLock_Wlock(cb->config.rwl_config_lock);
+		        slapi_rwlock_wrlock(cb->config.rwl_config_lock);
 			if (cb->config.forward_ctrls) {
 				charray_free(cb->config.forward_ctrls);
 				cb->config.forward_ctrls=NULL;
 			}
-		        PR_RWLock_Unlock(cb->config.rwl_config_lock);
+		        slapi_rwlock_unlock(cb->config.rwl_config_lock);
 
                         while (i != -1 ) {
                         	bval = (struct berval *) slapi_value_get_berval(sval);
@@ -601,7 +601,7 @@ static int cb_parse_config_entry(cb_backend * cb, Slapi_Entry *e)
 		} else 
                 if ( !strcasecmp ( attr_name, CB_CONFIG_GLOBAL_CHAINING_COMPONENTS )) {
                 	i = slapi_attr_first_value(attr, &sval);
-		        PR_RWLock_Wlock(cb->config.rwl_config_lock);
+		        slapi_rwlock_wrlock(cb->config.rwl_config_lock);
 			if (cb->config.chaining_components) {
 				charray_free(cb->config.chaining_components);
 				cb->config.chaining_components=NULL;
@@ -613,11 +613,11 @@ static int cb_parse_config_entry(cb_backend * cb, Slapi_Entry *e)
 					slapi_dn_normalize(slapi_ch_strdup(bval->bv_val)));
                                 i = slapi_attr_next_value(attr, i, &sval);
                         }
-		        PR_RWLock_Unlock(cb->config.rwl_config_lock);
+		        slapi_rwlock_unlock(cb->config.rwl_config_lock);
 		} else
 		if ( !strcasecmp ( attr_name, CB_CONFIG_GLOBAL_CHAINABLE_COMPONENTS )) {
                         i = slapi_attr_first_value(attr, &sval);
-                        PR_RWLock_Wlock(cb->config.rwl_config_lock);
+                        slapi_rwlock_wrlock(cb->config.rwl_config_lock);
                         if (cb->config.chainable_components) {
                                 charray_free(cb->config.chainable_components);
                                 cb->config.chainable_components=NULL;
@@ -628,7 +628,7 @@ static int cb_parse_config_entry(cb_backend * cb, Slapi_Entry *e)
                                         slapi_dn_normalize(slapi_ch_strdup(bval->bv_val)));
                                 i = slapi_attr_next_value(attr, i, &sval);
                         }
-                        PR_RWLock_Unlock(cb->config.rwl_config_lock);
+                        slapi_rwlock_unlock(cb->config.rwl_config_lock);
                 } else
                 if ( !strcasecmp ( attr_name, CB_CONFIG_GLOBAL_DEBUG )) {
                         i = slapi_attr_first_value(attr, &sval);

+ 4 - 4
ldap/servers/plugins/chainingdb/cb_conn_stateless.c

@@ -183,7 +183,7 @@ cb_get_connection(cb_conn_pool * pool,
 	*/
 	*cc=NULL;
 
-	PR_RWLock_Rlock(pool->rwl_config_lock);
+	slapi_rwlock_rdlock(pool->rwl_config_lock);
 	maxconcurrency=pool->conn.maxconcurrency;
 	maxconnections=pool->conn.maxconnections;
 	bind_to.tv_sec = pool->conn.bind_timeout.tv_sec;
@@ -209,7 +209,7 @@ cb_get_connection(cb_conn_pool * pool,
 	}
 	mech=pool->mech;
 
-	PR_RWLock_Unlock(pool->rwl_config_lock);
+	slapi_rwlock_unlock(pool->rwl_config_lock);
 
 	if (secure) {
 		isMultiThread = DISABLE_MULTITHREAD_PER_CONN ;
@@ -637,9 +637,9 @@ static void cb_check_for_stale_connections(cb_conn_pool * pool) {
 	int 			connlifetime;
 	int 			myself;
 
-       	PR_RWLock_Rlock(pool->rwl_config_lock);
+       	slapi_rwlock_rdlock(pool->rwl_config_lock);
 	connlifetime=pool->conn.connlifetime;
-       	PR_RWLock_Unlock(pool->rwl_config_lock);
+       	slapi_rwlock_unlock(pool->rwl_config_lock);
 	
        	connprev = NULL;
 	conn_next = NULL;

+ 9 - 9
ldap/servers/plugins/chainingdb/cb_controls.c

@@ -57,9 +57,9 @@ cb_register_supported_control( cb_backend * cb, char *controloid, unsigned long
 {
     /* For now, ignore controlops */
     if ( controloid != NULL ) {
-        PR_RWLock_Wlock(cb->config.rwl_config_lock);
+        slapi_rwlock_wrlock(cb->config.rwl_config_lock);
                    charray_add( &cb->config.forward_ctrls,slapi_ch_strdup( controloid ));
-        PR_RWLock_Unlock(cb->config.rwl_config_lock);
+        slapi_rwlock_unlock(cb->config.rwl_config_lock);
         }
 }
 
@@ -67,10 +67,10 @@ cb_register_supported_control( cb_backend * cb, char *controloid, unsigned long
 void
 cb_unregister_all_supported_control( cb_backend * cb ) {
 
-    PR_RWLock_Wlock(cb->config.rwl_config_lock);
+    slapi_rwlock_wrlock(cb->config.rwl_config_lock);
     charray_free(cb->config.forward_ctrls);
     cb->config.forward_ctrls=NULL;
-    PR_RWLock_Unlock(cb->config.rwl_config_lock);
+    slapi_rwlock_unlock(cb->config.rwl_config_lock);
 }
 
 void
@@ -80,20 +80,20 @@ cb_unregister_supported_control( cb_backend * cb, char *controloid, unsigned lon
     /* For now, ignore controlops */
     if ( controloid != NULL ) {
         int i;
-        PR_RWLock_Wlock(cb->config.rwl_config_lock);
+        slapi_rwlock_wrlock(cb->config.rwl_config_lock);
         for ( i = 0; cb->config.forward_ctrls != NULL && cb->config.forward_ctrls[i] != NULL; ++i ) {
             if ( strcmp( cb->config.forward_ctrls[i], controloid ) == 0 ) {
                 break;
             }
         }
         if ( cb->config.forward_ctrls == NULL || cb->config.forward_ctrls[i] == NULL) {
-            PR_RWLock_Unlock(cb->config.rwl_config_lock);
+            slapi_rwlock_unlock(cb->config.rwl_config_lock);
             return;
         }
         if ( controlops == 0 ) {
             charray_remove(cb->config.forward_ctrls,controloid,0/* free it */);
         }
-        PR_RWLock_Unlock(cb->config.rwl_config_lock);
+        slapi_rwlock_unlock(cb->config.rwl_config_lock);
     }
 }
 
@@ -174,7 +174,7 @@ int cb_update_controls( Slapi_PBlock * pb,
     for ( cCount=0; reqControls && reqControls[cCount]; cCount++ );
     ctrls = (LDAPControl **)slapi_ch_calloc(1,sizeof(LDAPControl *) * (cCount +3));
 
-    PR_RWLock_Rlock(cbb->config.rwl_config_lock);
+    slapi_rwlock_rdlock(cbb->config.rwl_config_lock);
 
     for ( cCount=0; reqControls && reqControls[cCount]; cCount++ ) {
 
@@ -262,7 +262,7 @@ int cb_update_controls( Slapi_PBlock * pb,
         }
     }
 
-    PR_RWLock_Unlock(cbb->config.rwl_config_lock);
+    slapi_rwlock_unlock(cbb->config.rwl_config_lock);
 
     if (LDAP_SUCCESS != rc) {
         ldap_controls_free(ctrls);

+ 1 - 1
ldap/servers/plugins/chainingdb/cb_init.c

@@ -81,7 +81,7 @@ chaining_back_init( Slapi_PBlock *pb )
         cb->plugin = p;
 
 	/* Initialize misc. fields */
-	cb->config.rwl_config_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "chaining_db");
+	cb->config.rwl_config_lock = slapi_new_rwlock();
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_PRIVATE, (void *) cb );
 
 	/* These DNs are already normalized */

+ 114 - 114
ldap/servers/plugins/chainingdb/cb_instance.c

@@ -214,7 +214,7 @@ static cb_backend_instance * cb_instance_alloc(cb_backend * cb, char * name, cha
 	inst->monitor_availability.cpt              = 0 ;					 /* set up the failed conn counter to 0 */
 
 	/* create RW lock to protect the config */
-	inst->rwl_config_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, name);
+	inst->rwl_config_lock = slapi_new_rwlock();
 
 	/* quick hack 				    */
 	/* put a ref to the config lock in the pool */
@@ -242,7 +242,7 @@ static cb_backend_instance * cb_instance_alloc(cb_backend * cb, char * name, cha
 void cb_instance_free(cb_backend_instance * inst) {
 
 	if (inst) {
-		PR_RWLock_Wlock(inst->rwl_config_lock);
+		slapi_rwlock_wrlock(inst->rwl_config_lock);
 
 		if ( inst->eq_ctx != NULL )
 		{
@@ -278,8 +278,8 @@ void cb_instance_free(cb_backend_instance * inst) {
 		slapi_ch_free_string(&inst->inst_name);
 		charray_free(inst->every_attribute);
 
-		PR_RWLock_Unlock(inst->rwl_config_lock);
-		PR_DestroyRWLock(inst->rwl_config_lock);
+		slapi_rwlock_unlock(inst->rwl_config_lock);
+		slapi_destroy_rwlock(inst->rwl_config_lock);
 
 		slapi_ch_free((void **) &inst);
 	}
@@ -387,7 +387,7 @@ int cb_instance_modify_config_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
                        	int done=0;
 			int j;
 
-       			PR_RWLock_Wlock(inst->rwl_config_lock);
+       			slapi_rwlock_wrlock(inst->rwl_config_lock);
                         for (j = 0; mods[i]->mod_bvalues && mods[i]->mod_bvalues[j]; j++) {
                                	config_attr_value = (char *) mods[i]->mod_bvalues[j]->bv_val;
                                	if (SLAPI_IS_MOD_REPLACE(mods[i]->mod_op)) {
@@ -413,7 +413,7 @@ int cb_instance_modify_config_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
                                	charray_free(inst->illegal_attributes);
                                	inst->illegal_attributes=NULL;
                         }
-        		PR_RWLock_Unlock(inst->rwl_config_lock);
+        		slapi_rwlock_unlock(inst->rwl_config_lock);
                         continue;
 		} 
 		if ( !strcasecmp ( attr_name, CB_CONFIG_CHAINING_COMPONENTS )) {
@@ -421,7 +421,7 @@ int cb_instance_modify_config_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
                        	int done=0;
 			int j;
 
-        		PR_RWLock_Wlock(inst->rwl_config_lock);
+        		slapi_rwlock_wrlock(inst->rwl_config_lock);
                        	for (j = 0; mods[i]->mod_bvalues && mods[i]->mod_bvalues[j]; j++) {
                                	config_attr_value = (char *) mods[i]->mod_bvalues[j]->bv_val;
                                	if (SLAPI_IS_MOD_REPLACE(mods[i]->mod_op)) {
@@ -448,7 +448,7 @@ int cb_instance_modify_config_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
                                	charray_free(inst->chaining_components);
                                	inst->chaining_components=NULL;
                        	}
-        		PR_RWLock_Unlock(inst->rwl_config_lock);
+        		slapi_rwlock_unlock(inst->rwl_config_lock);
                         continue;
 		} 
 
@@ -594,7 +594,7 @@ cb_instance_config_initialize(cb_backend_instance * inst, Slapi_Entry * e , int
 		if ( !strcasecmp ( attr_name, CB_CONFIG_CHAINING_COMPONENTS )) {
 
        			if (apply) {
-	                	PR_RWLock_Wlock(inst->rwl_config_lock);
+	                	slapi_rwlock_wrlock(inst->rwl_config_lock);
                                 i = slapi_attr_first_value(attr, &sval);
 				charray_free(inst->chaining_components);
 				inst->chaining_components=NULL;
@@ -604,14 +604,14 @@ cb_instance_config_initialize(cb_backend_instance * inst, Slapi_Entry * e , int
 						slapi_dn_normalize(slapi_ch_strdup(bval->bv_val)));
                                         i = slapi_attr_next_value(attr, i, &sval);
                                 }
-	                	PR_RWLock_Unlock(inst->rwl_config_lock);
+	                	slapi_rwlock_unlock(inst->rwl_config_lock);
                         }
                         continue;
 		} else
 		if ( !strcasecmp ( attr_name, CB_CONFIG_ILLEGAL_ATTRS )) {
 
        			if (apply) {
-	                	PR_RWLock_Wlock(inst->rwl_config_lock);
+	                	slapi_rwlock_wrlock(inst->rwl_config_lock);
                                 i = slapi_attr_first_value(attr, &sval);
 				charray_free(inst->illegal_attributes);
 				inst->illegal_attributes=NULL;
@@ -621,7 +621,7 @@ cb_instance_config_initialize(cb_backend_instance * inst, Slapi_Entry * e , int
 						slapi_ch_strdup(bval->bv_val));
                                         i = slapi_attr_next_value(attr, i, &sval);
                                 }
-	                	PR_RWLock_Unlock(inst->rwl_config_lock);
+	                	slapi_rwlock_unlock(inst->rwl_config_lock);
                         }
                         continue;
 		}
@@ -708,9 +708,9 @@ static void *cb_instance_hosturl_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	char * data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = slapi_ch_strdup(inst->pool->url);
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return data;
 }
 
@@ -738,9 +738,9 @@ static int cb_instance_hosturl_set(void *arg, void *value, char *errorbuf, int p
  
 	if (secure && inst->rwl_config_lock) {
 		int isgss = 0;
-		PR_RWLock_Rlock(inst->rwl_config_lock);
+		slapi_rwlock_rdlock(inst->rwl_config_lock);
 		isgss = inst->pool->mech && !PL_strcasecmp(inst->pool->mech, "GSSAPI");
-		PR_RWLock_Unlock(inst->rwl_config_lock);
+		slapi_rwlock_unlock(inst->rwl_config_lock);
 		if (isgss) {
 			PR_snprintf (errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Cannot use LDAPS if using GSSAPI - please change the %s to use something other than GSSAPI before changing connection to use LDAPS", CB_CONFIG_BINDMECH);
 			rc = LDAP_UNWILLING_TO_PERFORM;
@@ -749,7 +749,7 @@ static int cb_instance_hosturl_set(void *arg, void *value, char *errorbuf, int p
 
 	if ((LDAP_SUCCESS == rc) && apply) {
 
-               	PR_RWLock_Wlock(inst->rwl_config_lock);
+               	slapi_rwlock_wrlock(inst->rwl_config_lock);
 
 	        if (( phase != CB_CONFIG_PHASE_INITIALIZATION ) &&
        			( phase != CB_CONFIG_PHASE_STARTUP )) {
@@ -823,7 +823,7 @@ static int cb_instance_hosturl_set(void *arg, void *value, char *errorbuf, int p
 		inst->bind_pool->secure=inst->pool->secure;
 		inst->bind_pool->hostname=slapi_ch_strdup(inst->pool->hostname);
 
-	        PR_RWLock_Unlock(inst->rwl_config_lock);
+	        slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 done:
     	if ( ludp != NULL ) {
@@ -837,9 +837,9 @@ static void *cb_instance_binduser_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	char * data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = slapi_ch_strdup(inst->pool->binddn2);	/* not normalized */	
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return data;
 }
 
@@ -850,7 +850,7 @@ static int cb_instance_binduser_set(void *arg, void *value, char *errorbuf, int
 
 	if (apply) {
 
-	        PR_RWLock_Wlock(inst->rwl_config_lock);
+	        slapi_rwlock_wrlock(inst->rwl_config_lock);
 		if (( phase != CB_CONFIG_PHASE_INITIALIZATION ) &&
 	    		( phase != CB_CONFIG_PHASE_STARTUP )) {
 
@@ -865,7 +865,7 @@ static int cb_instance_binduser_set(void *arg, void *value, char *errorbuf, int
 		inst->pool->binddn=slapi_ch_strdup((char *) value);
 		inst->pool->binddn2=slapi_ch_strdup((char *) value);
 		slapi_dn_normalize_case(inst->pool->binddn);
-	        PR_RWLock_Unlock(inst->rwl_config_lock);
+	        slapi_rwlock_unlock(inst->rwl_config_lock);
 	} else {
 
 		/* Security check */
@@ -881,7 +881,7 @@ static int cb_instance_binduser_set(void *arg, void *value, char *errorbuf, int
 			slapi_dn_normalize_case(theValueCopy);
 		}
 
-		PR_RWLock_Rlock(inst->rwl_config_lock);
+		slapi_rwlock_rdlock(inst->rwl_config_lock);
                 if (inst->impersonate && theValueCopy && 
                         !strcmp(theValueCopy,rootdn)) {	/* UTF8-aware. See cb_get_dn() */
                         rc=LDAP_UNWILLING_TO_PERFORM; 
@@ -889,7 +889,7 @@ static int cb_instance_binduser_set(void *arg, void *value, char *errorbuf, int
 				PR_snprintf(errorbuf,SLAPI_DSE_RETURNTEXT_SIZE, "value %s not allowed",rootdn);
 			}
                 }
-                PR_RWLock_Unlock(inst->rwl_config_lock);
+                slapi_rwlock_unlock(inst->rwl_config_lock);
 
 		slapi_ch_free((void **)&theValueCopy);
 		slapi_ch_free((void **)&rootdn);
@@ -904,9 +904,9 @@ static void *cb_instance_userpassword_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	char * data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = slapi_ch_strdup(inst->pool->password);
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return data;
 }
 
@@ -916,7 +916,7 @@ static int cb_instance_userpassword_set(void *arg, void *value, char *errorbuf,
 	int rc=LDAP_SUCCESS;
 
 	if (apply) {
-               	PR_RWLock_Wlock(inst->rwl_config_lock);
+               	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		if (( phase != CB_CONFIG_PHASE_INITIALIZATION ) &&
     			( phase != CB_CONFIG_PHASE_STARTUP )) {
 
@@ -926,7 +926,7 @@ static int cb_instance_userpassword_set(void *arg, void *value, char *errorbuf,
 		}
 
 		inst->pool->password=slapi_ch_strdup((char *) value);
-               	PR_RWLock_Unlock(inst->rwl_config_lock);
+               	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return rc;
 }
@@ -936,9 +936,9 @@ static void *cb_instance_sizelimit_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->sizelimit;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -946,9 +946,9 @@ static int cb_instance_sizelimit_set(void *arg, void *value, char *errorbuf, int
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-        	PR_RWLock_Wlock(inst->rwl_config_lock);
+        	slapi_rwlock_wrlock(inst->rwl_config_lock);
             inst->sizelimit=(int) ((uintptr_t)value);
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 		if (inst->inst_be) 
 			be_set_sizelimit(inst->inst_be, (int) ((uintptr_t)value));
 	}
@@ -960,9 +960,9 @@ static void *cb_instance_timelimit_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->timelimit;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -970,9 +970,9 @@ static int cb_instance_timelimit_set(void *arg, void *value, char *errorbuf, int
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-        	PR_RWLock_Wlock(inst->rwl_config_lock);
+        	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->timelimit=(int) ((uintptr_t)value);
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 		if (inst->inst_be) 
 			be_set_timelimit(inst->inst_be, (int) ((uintptr_t)value));
 	}
@@ -984,9 +984,9 @@ static void *cb_instance_max_test_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->max_test_time;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -994,9 +994,9 @@ static int cb_instance_max_test_set(void *arg, void *value, char *errorbuf, int
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-        	PR_RWLock_Wlock(inst->rwl_config_lock);
+        	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->max_test_time=(int) ((uintptr_t)value);
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return LDAP_SUCCESS;
 }
@@ -1006,9 +1006,9 @@ static void *cb_instance_max_idle_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->max_idle_time;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -1016,9 +1016,9 @@ static int cb_instance_max_idle_set(void *arg, void *value, char *errorbuf, int
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-        	PR_RWLock_Wlock(inst->rwl_config_lock);
+        	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->max_idle_time=(int) ((uintptr_t)value);
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return LDAP_SUCCESS;
 }
@@ -1029,9 +1029,9 @@ static void *cb_instance_hoplimit_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->hoplimit;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -1039,9 +1039,9 @@ static int cb_instance_hoplimit_set(void *arg, void *value, char *errorbuf, int
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-        	PR_RWLock_Wlock(inst->rwl_config_lock);
+        	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->hoplimit=(int) ((uintptr_t)value);
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return LDAP_SUCCESS;
 }
@@ -1051,9 +1051,9 @@ static void *cb_instance_maxbconn_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->bind_pool->conn.maxconnections;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -1061,9 +1061,9 @@ static int cb_instance_maxbconn_set(void *arg, void *value, char *errorbuf, int
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-        	PR_RWLock_Wlock(inst->rwl_config_lock);
+        	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->bind_pool->conn.maxconnections=(int) ((uintptr_t)value);
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return LDAP_SUCCESS;
 }
@@ -1073,9 +1073,9 @@ static void *cb_instance_maxconn_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->pool->conn.maxconnections;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -1083,9 +1083,9 @@ static int cb_instance_maxconn_set(void *arg, void *value, char *errorbuf, int p
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-        	PR_RWLock_Wlock(inst->rwl_config_lock);
+        	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->pool->conn.maxconnections=(int) ((uintptr_t)value);
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return LDAP_SUCCESS;
 }
@@ -1095,9 +1095,9 @@ static void *cb_instance_abandonto_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->abandon_timeout.tv_sec;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -1114,10 +1114,10 @@ static int cb_instance_abandonto_set(void *arg, void *value, char *errorbuf, int
 			return LDAP_SUCCESS;
 		}
 
-               	PR_RWLock_Wlock(inst->rwl_config_lock);
+               	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->abandon_timeout.tv_sec=(int) ((uintptr_t)value);
 		inst->abandon_timeout.tv_usec=0;
-               	PR_RWLock_Unlock(inst->rwl_config_lock);
+               	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return LDAP_SUCCESS;
 }
@@ -1127,9 +1127,9 @@ static void *cb_instance_maxbconc_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->bind_pool->conn.maxconcurrency;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -1137,9 +1137,9 @@ static int cb_instance_maxbconc_set(void *arg, void *value, char *errorbuf, int
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-        	PR_RWLock_Wlock(inst->rwl_config_lock);
+        	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->bind_pool->conn.maxconcurrency=(int) ((uintptr_t)value);
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return LDAP_SUCCESS;
 }
@@ -1149,9 +1149,9 @@ static void *cb_instance_maxconc_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = inst->pool->conn.maxconcurrency;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return (void *) data;
 }
 
@@ -1159,9 +1159,9 @@ static int cb_instance_maxconc_set(void *arg, void *value, char *errorbuf, int p
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-                PR_RWLock_Wlock(inst->rwl_config_lock);
+                slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->pool->conn.maxconcurrency=(int) ((uintptr_t)value);
-                PR_RWLock_Unlock(inst->rwl_config_lock);
+                slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
         return LDAP_SUCCESS;   
 }
@@ -1171,9 +1171,9 @@ static void *cb_instance_imperson_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
         uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
         data = inst->impersonate;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
         return (void *) data;
 }
 
@@ -1183,16 +1183,16 @@ static int cb_instance_imperson_set(void *arg, void *value, char *errorbuf, int
 	int rc=LDAP_SUCCESS;
 
 	if (apply) {
-                PR_RWLock_Wlock(inst->rwl_config_lock); 
+                slapi_rwlock_wrlock(inst->rwl_config_lock); 
 		inst->impersonate=(int) ((uintptr_t)value);
-                PR_RWLock_Unlock(inst->rwl_config_lock); 
+                slapi_rwlock_unlock(inst->rwl_config_lock); 
 	} else {
 		/* Security check: Make sure the proxing user is */
 		/* not the directory manager.			 */
 
 		char * rootdn=cb_get_rootdn();
 
-                PR_RWLock_Rlock(inst->rwl_config_lock); 
+                slapi_rwlock_rdlock(inst->rwl_config_lock); 
 		if (((int) ((uintptr_t)value)) && inst->pool && inst->pool->binddn &&
 	                !strcmp(inst->pool->binddn,rootdn)) {	/* UTF-8 aware */
 		  	rc=LDAP_UNWILLING_TO_PERFORM;
@@ -1200,7 +1200,7 @@ static int cb_instance_imperson_set(void *arg, void *value, char *errorbuf, int
 				PR_snprintf(errorbuf,SLAPI_DSE_RETURNTEXT_SIZE, "Proxy mode incompatible with %s value (%s not allowed)",
 					CB_CONFIG_BINDUSER,rootdn);
 		}
-                PR_RWLock_Unlock(inst->rwl_config_lock); 
+                slapi_rwlock_unlock(inst->rwl_config_lock); 
 		slapi_ch_free((void **)&rootdn);
 	}
 
@@ -1212,9 +1212,9 @@ static void *cb_instance_connlife_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
         uintptr_t data; 
  
-        PR_RWLock_Rlock(inst->rwl_config_lock); 
+        slapi_rwlock_rdlock(inst->rwl_config_lock); 
         data=inst->pool->conn.connlifetime;
-        PR_RWLock_Unlock(inst->rwl_config_lock); 
+        slapi_rwlock_unlock(inst->rwl_config_lock); 
         return (void *) data; 
 }
 
@@ -1222,9 +1222,9 @@ static int cb_instance_connlife_set(void *arg, void *value, char *errorbuf, int
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-                PR_RWLock_Wlock(inst->rwl_config_lock);  
+                slapi_rwlock_wrlock(inst->rwl_config_lock);  
 		inst->pool->conn.connlifetime=(int) ((uintptr_t)value);
-                PR_RWLock_Unlock(inst->rwl_config_lock);  
+                slapi_rwlock_unlock(inst->rwl_config_lock);  
 	}
         return LDAP_SUCCESS;     
 }
@@ -1234,9 +1234,9 @@ static void *cb_instance_bindto_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
         uintptr_t data;  
  
-        PR_RWLock_Rlock(inst->rwl_config_lock);  
+        slapi_rwlock_rdlock(inst->rwl_config_lock);  
         data=inst->bind_pool->conn.op_timeout.tv_sec;
-        PR_RWLock_Unlock(inst->rwl_config_lock);  
+        slapi_rwlock_unlock(inst->rwl_config_lock);  
         return (void *) data;   
 }
 
@@ -1244,7 +1244,7 @@ static int cb_instance_bindto_set(void *arg, void *value, char *errorbuf, int ph
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-                PR_RWLock_Wlock(inst->rwl_config_lock);   
+                slapi_rwlock_wrlock(inst->rwl_config_lock);   
 		inst->bind_pool->conn.op_timeout.tv_sec=(int) ((uintptr_t)value);
 		inst->bind_pool->conn.op_timeout.tv_usec=0;
 		inst->bind_pool->conn.bind_timeout.tv_sec=(int) ((uintptr_t)value);
@@ -1252,7 +1252,7 @@ static int cb_instance_bindto_set(void *arg, void *value, char *errorbuf, int ph
 		/* Used to bind to the farm server */
 		inst->pool->conn.bind_timeout.tv_sec=(int) ((uintptr_t)value);
 		inst->pool->conn.bind_timeout.tv_usec=0;
-                PR_RWLock_Unlock(inst->rwl_config_lock);   
+                slapi_rwlock_unlock(inst->rwl_config_lock);   
 	}
 	return LDAP_SUCCESS;
 }
@@ -1262,9 +1262,9 @@ static void *cb_instance_opto_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
         uintptr_t data;  
  
-        PR_RWLock_Rlock(inst->rwl_config_lock);  
+        slapi_rwlock_rdlock(inst->rwl_config_lock);  
         data=inst->pool->conn.op_timeout.tv_sec;
-        PR_RWLock_Unlock(inst->rwl_config_lock);  
+        slapi_rwlock_unlock(inst->rwl_config_lock);  
         return (void *) data;   
 }
 
@@ -1272,10 +1272,10 @@ static int cb_instance_opto_set(void *arg, void *value, char *errorbuf, int phas
 {
         cb_backend_instance * inst=(cb_backend_instance *) arg;
         if (apply) {
-                PR_RWLock_Wlock(inst->rwl_config_lock);
+                slapi_rwlock_wrlock(inst->rwl_config_lock);
                 inst->pool->conn.op_timeout.tv_sec=(int) ((uintptr_t)value);
                 inst->pool->conn.op_timeout.tv_usec=0;
-                PR_RWLock_Unlock(inst->rwl_config_lock);
+                slapi_rwlock_unlock(inst->rwl_config_lock);
         }
         return LDAP_SUCCESS;
 }
@@ -1285,9 +1285,9 @@ static void *cb_instance_ref_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
         uintptr_t data;   
   
-        PR_RWLock_Rlock(inst->rwl_config_lock);   
+        slapi_rwlock_rdlock(inst->rwl_config_lock);   
         data=inst->searchreferral;
-        PR_RWLock_Unlock(inst->rwl_config_lock);   
+        slapi_rwlock_unlock(inst->rwl_config_lock);   
         return (void *) data;    
 }
 
@@ -1295,9 +1295,9 @@ static int cb_instance_ref_set(void *arg, void *value, char *errorbuf, int phase
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-                PR_RWLock_Wlock(inst->rwl_config_lock);    
+                slapi_rwlock_wrlock(inst->rwl_config_lock);    
 		inst->searchreferral=(int) ((uintptr_t)value);
-                PR_RWLock_Unlock(inst->rwl_config_lock);    
+                slapi_rwlock_unlock(inst->rwl_config_lock);    
 	}
 	return LDAP_SUCCESS;
 }
@@ -1307,9 +1307,9 @@ static void *cb_instance_acl_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
         uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
         data=inst->local_acl;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
         return (void *) data;
 }
 
@@ -1325,9 +1325,9 @@ static int cb_instance_acl_set(void *arg, void *value, char *errorbuf, int phase
                         /* Stored in ldif only             */
                         return LDAP_SUCCESS;
                 }
-	        PR_RWLock_Wlock(inst->rwl_config_lock);
+	        slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->local_acl=(int) ((uintptr_t)value);
-	        PR_RWLock_Unlock(inst->rwl_config_lock);
+	        slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return LDAP_SUCCESS;
 }
@@ -1337,9 +1337,9 @@ static void *cb_instance_bindretry_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock); 
+        slapi_rwlock_rdlock(inst->rwl_config_lock); 
         data=inst->bind_retry;
-        PR_RWLock_Unlock(inst->rwl_config_lock); 
+        slapi_rwlock_unlock(inst->rwl_config_lock); 
         return (void *) data; 
 }
 
@@ -1347,9 +1347,9 @@ static int cb_instance_bindretry_set(void *arg, void *value, char *errorbuf, int
 {
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	if (apply) {
-                PR_RWLock_Wlock(inst->rwl_config_lock);
+                slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->bind_retry=(int) ((uintptr_t)value);
-                PR_RWLock_Unlock(inst->rwl_config_lock);
+                slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 	return LDAP_SUCCESS;
 }
@@ -1360,9 +1360,9 @@ static void *cb_instance_starttls_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
         uintptr_t data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
         data=inst->pool->starttls;
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
         return (void *) data;
 }
 
@@ -1379,9 +1379,9 @@ static int cb_instance_starttls_set(void *arg, void *value, char *errorbuf, int
 
 	if (value && inst->rwl_config_lock) {
 		int isgss = 0;
-		PR_RWLock_Rlock(inst->rwl_config_lock);
+		slapi_rwlock_rdlock(inst->rwl_config_lock);
 		isgss = inst->pool->mech && !PL_strcasecmp(inst->pool->mech, "GSSAPI");
-		PR_RWLock_Unlock(inst->rwl_config_lock);
+		slapi_rwlock_unlock(inst->rwl_config_lock);
 		if (isgss) {
 			PR_snprintf (errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Cannot use startTLS if using GSSAPI - please change the %s to use something other than GSSAPI before changing connection to use startTLS", CB_CONFIG_BINDMECH);
 			rc = LDAP_UNWILLING_TO_PERFORM;
@@ -1389,9 +1389,9 @@ static int cb_instance_starttls_set(void *arg, void *value, char *errorbuf, int
 	}
 
 	if ((LDAP_SUCCESS == rc) && apply) {
-	        PR_RWLock_Wlock(inst->rwl_config_lock);
+	        slapi_rwlock_wrlock(inst->rwl_config_lock);
 		inst->pool->starttls=(int) ((uintptr_t)value);
-	        PR_RWLock_Unlock(inst->rwl_config_lock);
+	        slapi_rwlock_unlock(inst->rwl_config_lock);
 		if (( phase != CB_CONFIG_PHASE_INITIALIZATION ) &&
     			( phase != CB_CONFIG_PHASE_STARTUP )) {
 		    rc=CB_REOPEN_CONN; /* reconnect with the new starttls setting */
@@ -1406,9 +1406,9 @@ static void *cb_instance_bindmech_get(void *arg)
 	cb_backend_instance * inst=(cb_backend_instance *) arg;
 	char * data;
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	data = slapi_ch_strdup(inst->pool->mech);
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 	return data;
 }
 
@@ -1425,9 +1425,9 @@ static int cb_instance_bindmech_set(void *arg, void *value, char *errorbuf, int
 
 	if (value && !PL_strcasecmp((char *) value, "GSSAPI") && inst->rwl_config_lock) {
 		int secure = 0;
-		PR_RWLock_Rlock(inst->rwl_config_lock);
+		slapi_rwlock_rdlock(inst->rwl_config_lock);
 		secure = inst->pool->secure || inst->pool->starttls;
-		PR_RWLock_Unlock(inst->rwl_config_lock);
+		slapi_rwlock_unlock(inst->rwl_config_lock);
 		if (secure) {
 			PR_snprintf (errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Cannot use SASL/GSSAPI if using SSL or TLS - please change the connection to use no security before changing %s to use GSSAPI", CB_CONFIG_BINDMECH);
 			rc = LDAP_UNWILLING_TO_PERFORM;
@@ -1435,7 +1435,7 @@ static int cb_instance_bindmech_set(void *arg, void *value, char *errorbuf, int
 	}
 
 	if ((LDAP_SUCCESS == rc) && apply) {
-               	PR_RWLock_Wlock(inst->rwl_config_lock);
+               	slapi_rwlock_wrlock(inst->rwl_config_lock);
 		if (( phase != CB_CONFIG_PHASE_INITIALIZATION ) &&
     			( phase != CB_CONFIG_PHASE_STARTUP )) {
 
@@ -1451,7 +1451,7 @@ static int cb_instance_bindmech_set(void *arg, void *value, char *errorbuf, int
 		} else {
 		    inst->pool->mech=slapi_ch_strdup((char *) value);
 		}
-               	PR_RWLock_Unlock(inst->rwl_config_lock);
+               	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 done:
 	return rc;
@@ -1623,7 +1623,7 @@ int cb_instance_search_config_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_E
 
         /* suffixes */
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 
         {
                 const Slapi_DN *aSuffix;
@@ -1665,7 +1665,7 @@ int cb_instance_search_config_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_E
 		}
 	}
 
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 
 	/* standard attributes */
         for(config = cb_the_instance_config; config->config_name != NULL; config++) {
@@ -1749,7 +1749,7 @@ static void cb_instance_add_monitor_later(time_t when, void *arg) {
 
 	if ( inst != NULL )
 	{
-		PR_RWLock_Rlock(inst->rwl_config_lock);
+		slapi_rwlock_rdlock(inst->rwl_config_lock);
 
 		/* create the monitor entry if it is not there yet */
 		if (LDAP_SUCCESS == cb_config_add_dse_entries(inst->backend_type, cb_skeleton_entries,
@@ -1766,7 +1766,7 @@ static void cb_instance_add_monitor_later(time_t when, void *arg) {
 			slapi_config_register_callback(SLAPI_OPERATION_DELETE, DSE_FLAG_PREOP , inst->monitorDn, LDAP_SCOPE_BASE,
 					"(objectclass=*)", cb_delete_monitor_callback, (void *) inst);
 		}
-		PR_RWLock_Unlock(inst->rwl_config_lock);
+		slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 }
 

+ 2 - 2
ldap/servers/plugins/chainingdb/cb_modify.c

@@ -285,7 +285,7 @@ cb_remove_illegal_mods(cb_backend_instance *inst, LDAPMod **mods)
 
 	if ( inst->illegal_attributes != NULL ) {	/* Unlikely to happen */
 
-        	PR_RWLock_Wlock(inst->rwl_config_lock);
+        	slapi_rwlock_wrlock(inst->rwl_config_lock);
 
 		for (j=0; inst->illegal_attributes[j]; j++) {
         		for ( i = 0; mods[i] != NULL; i++ ) {
@@ -304,6 +304,6 @@ cb_remove_illegal_mods(cb_backend_instance *inst, LDAPMod **mods)
 			}
 		}
 
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 	}
 }

+ 3 - 3
ldap/servers/plugins/chainingdb/cb_monitor.c

@@ -89,13 +89,13 @@ cb_search_monitor_callback(Slapi_PBlock * pb, Slapi_Entry * e, Slapi_Entry * ent
 	/* First make sure the backend instance is configured */
 	/* If not, don't return anything		      */
 
-        PR_RWLock_Rlock(inst->rwl_config_lock);
+        slapi_rwlock_rdlock(inst->rwl_config_lock);
 	if (!inst->isconfigured) {
 	        *returnCode= LDAP_NO_SUCH_OBJECT;
-        	PR_RWLock_Unlock(inst->rwl_config_lock);
+        	slapi_rwlock_unlock(inst->rwl_config_lock);
 		return SLAPI_DSE_CALLBACK_ERROR;
 	}
-        PR_RWLock_Unlock(inst->rwl_config_lock);
+        slapi_rwlock_unlock(inst->rwl_config_lock);
 
   	vals[0] = &val;
   	vals[1] = NULL;

+ 2 - 2
ldap/servers/plugins/chainingdb/cb_schema.c

@@ -53,7 +53,7 @@ void cb_eliminate_illegal_attributes(cb_backend_instance * inst, Slapi_Entry * e
 
 	if (inst->illegal_attributes != NULL ) {       /* Unlikely to happen */
 
-		PR_RWLock_Wlock(inst->rwl_config_lock); 
+		slapi_rwlock_wrlock(inst->rwl_config_lock); 
  
                 for (j=0; inst->illegal_attributes[j]; j++) { 
 			char * aType=NULL;
@@ -77,6 +77,6 @@ void cb_eliminate_illegal_attributes(cb_backend_instance * inst, Slapi_Entry * e
 			}
 		}
 
-		PR_RWLock_Unlock(inst->rwl_config_lock); 
+		slapi_rwlock_unlock(inst->rwl_config_lock); 
 	}
 }

+ 2 - 2
ldap/servers/plugins/chainingdb/cb_search.c

@@ -148,7 +148,7 @@ chainingdb_build_candidate_list ( Slapi_PBlock *pb )
 		bv.bv_len=strlen(bv.bv_val);
                 slapi_entry_add_values( anEntry, "objectclass", bvals);
 
-        	PR_RWLock_Rlock(cb->rwl_config_lock);
+        	slapi_rwlock_rdlock(cb->rwl_config_lock);
 		for (i=0; cb->url_array && cb->url_array[i]; i++) {
 			char * anUrl = slapi_ch_smprintf("%s%s",cb->url_array[i],target);
                 	bv.bv_val=anUrl;
@@ -156,7 +156,7 @@ chainingdb_build_candidate_list ( Slapi_PBlock *pb )
                 	slapi_entry_attr_merge( anEntry, "ref", bvals);
 			slapi_ch_free((void **)&anUrl);
 		}
-        	PR_RWLock_Unlock(cb->rwl_config_lock);
+        	slapi_rwlock_unlock(cb->rwl_config_lock);
 		
 		aciArray[0]=anEntry;
 		aciArray[1]=NULL;

+ 5 - 5
ldap/servers/plugins/chainingdb/cb_utils.c

@@ -209,22 +209,22 @@ int cb_forward_operation(Slapi_PBlock * pb ) {
         cb = cb_get_instance(be);
 
 	/* Local policy */
-        PR_RWLock_Rlock(cb->rwl_config_lock);
+        slapi_rwlock_rdlock(cb->rwl_config_lock);
 	if ( cb->chaining_components != NULL ) {
 		retcode=charray_inlist(cb->chaining_components,pname);
-        	PR_RWLock_Unlock(cb->rwl_config_lock);
+        	slapi_rwlock_unlock(cb->rwl_config_lock);
 		if ( retcode )
 			retcode=LDAP_SUCCESS;
 		else
 			retcode=LDAP_UNWILLING_TO_PERFORM;
 		return retcode;
 	}
-       	PR_RWLock_Unlock(cb->rwl_config_lock);
+       	slapi_rwlock_unlock(cb->rwl_config_lock);
 
 	/* Global policy */
-        PR_RWLock_Rlock(cb->backend_type->config.rwl_config_lock);
+        slapi_rwlock_rdlock(cb->backend_type->config.rwl_config_lock);
 	retcode=charray_inlist(cb->backend_type->config.chaining_components,pname);
-       	PR_RWLock_Unlock(cb->backend_type->config.rwl_config_lock);
+       	slapi_rwlock_unlock(cb->backend_type->config.rwl_config_lock);
 
 	if ( retcode )
 		retcode=LDAP_SUCCESS;

+ 5 - 5
ldap/servers/plugins/dna/dna.c

@@ -169,7 +169,7 @@ struct configEntry {
 };
 
 static PRCList *dna_global_config = NULL;
-static PRRWLock *g_dna_cache_lock;
+static Slapi_RWLock *g_dna_cache_lock;
 
 static void *_PluginID = NULL;
 static char *_PluginDN = NULL;
@@ -294,17 +294,17 @@ void plugin_init_debug_level(int *level_ptr)
  */
 void dna_read_lock()
 {
-    PR_RWLock_Rlock(g_dna_cache_lock);
+    slapi_rwlock_rdlock(g_dna_cache_lock);
 }
 
 void dna_write_lock()
 {
-    PR_RWLock_Wlock(g_dna_cache_lock);
+    slapi_rwlock_wrlock(g_dna_cache_lock);
 }
 
 void dna_unlock()
 {
-    PR_RWLock_Unlock(g_dna_cache_lock);
+    slapi_rwlock_unlock(g_dna_cache_lock);
 }
 
 /**
@@ -499,7 +499,7 @@ dna_start(Slapi_PBlock * pb)
         goto done;
     }
 
-    g_dna_cache_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "dna");
+    g_dna_cache_lock = slapi_new_rwlock();
 
     if (!g_dna_cache_lock) {
         slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,

+ 5 - 5
ldap/servers/plugins/linkedattrs/linked_attrs.c

@@ -50,7 +50,7 @@
  */
 static PRCList *g_link_config = NULL;
 static PRCList *g_managed_config_index = NULL;
-static PRRWLock *g_config_lock;
+static Slapi_RWLock *g_config_lock;
 
 static void *_PluginID = NULL;
 static char *_PluginDN = NULL;
@@ -120,19 +120,19 @@ static void linked_attrs_mod_backpointers(char *linkdn, char *type, char *scope,
 void
 linked_attrs_read_lock()
 {
-    PR_RWLock_Rlock(g_config_lock);
+    slapi_rwlock_rdlock(g_config_lock);
 }
 
 void
 linked_attrs_write_lock()
 {
-    PR_RWLock_Wlock(g_config_lock);
+    slapi_rwlock_wrlock(g_config_lock);
 }
 
 void
 linked_attrs_unlock()
 {
-    PR_RWLock_Unlock(g_config_lock);
+    slapi_rwlock_unlock(g_config_lock);
 }
 
 
@@ -291,7 +291,7 @@ linked_attrs_start(Slapi_PBlock * pb)
         goto done;
     }
 
-    g_config_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "linkedattrs");
+    g_config_lock = slapi_new_rwlock();
 
     if (!g_config_lock) {
         slapi_log_error(SLAPI_LOG_FATAL, LINK_PLUGIN_SUBSYSTEM,

+ 5 - 5
ldap/servers/plugins/memberof/memberof_config.c

@@ -80,7 +80,7 @@ static int memberof_search (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_En
  * config will be copied when it is used by the plug-in to prevent it
  * being changed out from under a running memberOf operation. */
 static MemberOfConfig theConfig;
-static PRRWLock *memberof_config_lock = 0;
+static Slapi_RWLock *memberof_config_lock = 0;
 static int inited = 0;
 
 
@@ -113,7 +113,7 @@ memberof_config(Slapi_Entry *config_e)
 	}
 
 	/* initialize the RW lock to protect the main config */
-	memberof_config_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "memberof_config_lock");
+	memberof_config_lock = slapi_new_rwlock();
 
 	/* initialize fields */
 	if (SLAPI_DSE_CALLBACK_OK == memberof_validate_config(NULL, NULL, config_e,
@@ -501,7 +501,7 @@ memberof_get_config()
 void
 memberof_rlock_config()
 {
-	PR_RWLock_Rlock(memberof_config_lock);
+	slapi_rwlock_rdlock(memberof_config_lock);
 }
 
 /*
@@ -513,7 +513,7 @@ memberof_rlock_config()
 void
 memberof_wlock_config()
 {
-	PR_RWLock_Wlock(memberof_config_lock);
+	slapi_rwlock_wrlock(memberof_config_lock);
 }
 
 /*
@@ -524,5 +524,5 @@ memberof_wlock_config()
 void
 memberof_unlock_config()
 {
-	PR_RWLock_Unlock(memberof_config_lock);
+	slapi_rwlock_unlock(memberof_config_lock);
 }

+ 5 - 5
ldap/servers/plugins/mep/mep.c

@@ -49,7 +49,7 @@
  * Plug-in globals
  */
 static PRCList *g_mep_config = NULL;
-static PRRWLock *g_mep_config_lock;
+static Slapi_RWLock *g_mep_config_lock;
 
 static void *_PluginID = NULL;
 static Slapi_DN *_PluginDN = NULL;
@@ -124,19 +124,19 @@ static int mep_has_tombstone_value(Slapi_Entry * e);
 void
 mep_config_read_lock()
 {
-    PR_RWLock_Rlock(g_mep_config_lock);
+    slapi_rwlock_rdlock(g_mep_config_lock);
 }
 
 void
 mep_config_write_lock()
 {
-    PR_RWLock_Wlock(g_mep_config_lock);
+    slapi_rwlock_wrlock(g_mep_config_lock);
 }
 
 void
 mep_config_unlock()
 {
-    PR_RWLock_Unlock(g_mep_config_lock);
+    slapi_rwlock_unlock(g_mep_config_lock);
 }
 
 
@@ -300,7 +300,7 @@ mep_start(Slapi_PBlock * pb)
         goto done;
     }
 
-    g_mep_config_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "mep_config");
+    g_mep_config_lock = slapi_new_rwlock();
 
     if (!g_mep_config_lock) {
         slapi_log_error(SLAPI_LOG_FATAL, MEP_PLUGIN_SUBSYSTEM,

+ 18 - 18
ldap/servers/plugins/replication/cl5_api.c

@@ -241,7 +241,7 @@ typedef struct cl5desc
 	CL5DBConfig	dbConfig;	/* database configuration params					*/
 	CL5Trim     dbTrim;		/* trimming parameters								*/
 	CL5State	dbState;	/* changelog current state							*/
-	PRRWLock	*stLock;	/* lock that controls access to the changelog state	*/	
+	Slapi_RWLock	*stLock;	/* lock that controls access to the changelog state	*/	
 	PRBool      dbRmOnClose;/* indicates whether changelog should be removed when
 							   it is closed	*/
 	PRBool		fatalError; /* bad stuff happened like out of disk space; don't 
@@ -376,7 +376,7 @@ static void cl5_set_no_diskfull();
  */
 int cl5Init ()
 {
-	s_cl5Desc.stLock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "state_lock");
+	s_cl5Desc.stLock = slapi_new_rwlock();
 	if (s_cl5Desc.stLock == NULL)
 	{
 		slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
@@ -432,7 +432,7 @@ void cl5Cleanup ()
 	}
 
 	if (s_cl5Desc.stLock)
-		PR_DestroyRWLock (s_cl5Desc.stLock);
+		slapi_destroy_rwlock (s_cl5Desc.stLock);
 	s_cl5Desc.stLock = NULL;
 
 	if (cl5_diskfull_lock)
@@ -476,7 +476,7 @@ int cl5Open (const char *dir, const CL5DBConfig *config)
 	}
 
 	/* prevent state from changing */
-	PR_RWLock_Wlock (s_cl5Desc.stLock);
+	slapi_rwlock_wrlock (s_cl5Desc.stLock);
 
 	/* already open - ignore */
 	if (s_cl5Desc.dbState == CL5_STATE_OPEN)
@@ -521,7 +521,7 @@ int cl5Open (const char *dir, const CL5DBConfig *config)
 	}
 
 done:
-	PR_RWLock_Unlock (s_cl5Desc.stLock);
+	slapi_rwlock_unlock (s_cl5Desc.stLock);
 
 	return rc;
 }
@@ -546,21 +546,21 @@ int cl5Close ()
 		return CL5_BAD_STATE;	
 	}
 
-	PR_RWLock_Wlock (s_cl5Desc.stLock);
+	slapi_rwlock_wrlock (s_cl5Desc.stLock);
 
 	/* already closed - ignore */
 	if (s_cl5Desc.dbState == CL5_STATE_CLOSED)
 	{
 		slapi_log_error(SLAPI_LOG_PLUGIN, repl_plugin_name_cl, 
 					"cl5Close: changelog closed; request ignored\n");
-		PR_RWLock_Unlock (s_cl5Desc.stLock);
+		slapi_rwlock_unlock (s_cl5Desc.stLock);
 		return CL5_SUCCESS;
 	}
 	else if (s_cl5Desc.dbState != CL5_STATE_OPEN)
 	{
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
 						"cl5Close: invalid state - %d\n", s_cl5Desc.dbState);
-		PR_RWLock_Unlock (s_cl5Desc.stLock);
+		slapi_rwlock_unlock (s_cl5Desc.stLock);
 		return CL5_BAD_STATE;
 	}
 
@@ -575,7 +575,7 @@ int cl5Close ()
 
 	s_cl5Desc.dbState = CL5_STATE_CLOSED;
 
-	PR_RWLock_Unlock (s_cl5Desc.stLock);
+	slapi_rwlock_unlock (s_cl5Desc.stLock);
 
 	return rc;
 }
@@ -605,13 +605,13 @@ int cl5Delete (const char *dir)
 		return CL5_BAD_STATE;	
 	}
 
-	PR_RWLock_Wlock (s_cl5Desc.stLock);
+	slapi_rwlock_wrlock (s_cl5Desc.stLock);
 
 	if (s_cl5Desc.dbState != CL5_STATE_CLOSED)
 	{
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
 						"cl5Delete: invalid state - %d\n", s_cl5Desc.dbState);
-		PR_RWLock_Unlock (s_cl5Desc.stLock);
+		slapi_rwlock_unlock (s_cl5Desc.stLock);
 		return CL5_BAD_STATE;
 	}
 
@@ -622,7 +622,7 @@ int cl5Delete (const char *dir)
 						"cl5Delete: failed to remove changelog\n");
 	}
 	 
-	PR_RWLock_Unlock (s_cl5Desc.stLock);
+	slapi_rwlock_unlock (s_cl5Desc.stLock);
 	return rc;
 } 
 
@@ -920,7 +920,7 @@ cl5ImportLDIF (const char *clDir, const char *ldifFile, Object **replicas)
 	prim_replica = (Replica*)object_get_data(prim_replica_obj);
 
 	/* make sure that nobody change changelog state while import is in progress */
-	PR_RWLock_Wlock (s_cl5Desc.stLock);
+	slapi_rwlock_wrlock (s_cl5Desc.stLock);
 
 	/* make sure changelog is closed */
 	if (s_cl5Desc.dbState != CL5_STATE_CLOSED)
@@ -928,7 +928,7 @@ cl5ImportLDIF (const char *clDir, const char *ldifFile, Object **replicas)
 		slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl, 
 						"cl5ImportLDIF: invalid state - %d \n", s_cl5Desc.dbState);
 
-		PR_RWLock_Unlock (s_cl5Desc.stLock);
+		slapi_rwlock_unlock (s_cl5Desc.stLock);
 		return CL5_BAD_STATE;
 	}
 	
@@ -1141,7 +1141,7 @@ done:
 		_cl5Close ();
 		s_cl5Desc.dbState = CL5_STATE_CLOSED; /* force to change the state */
 	}
-	PR_RWLock_Unlock (s_cl5Desc.stLock);
+	slapi_rwlock_unlock (s_cl5Desc.stLock);
     return rc;
 }
 
@@ -2351,18 +2351,18 @@ static int _cl5AddThread ()
 	/* lock the state lock so that nobody can change the state
 	   while backup is in progress 
 	 */
-	PR_RWLock_Rlock (s_cl5Desc.stLock);
+	slapi_rwlock_rdlock (s_cl5Desc.stLock);
 
 	/* open changelog if it is not already open */
 	if (s_cl5Desc.dbState != CL5_STATE_OPEN)
 	{
 		slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl, 
 				"_cl5AddThread: invalid changelog state - %d\n", s_cl5Desc.dbState);
-		PR_RWLock_Unlock (s_cl5Desc.stLock);
+		slapi_rwlock_unlock (s_cl5Desc.stLock);
 		return CL5_BAD_STATE;			
 	}
 
-	PR_RWLock_Unlock (s_cl5Desc.stLock);
+	slapi_rwlock_unlock (s_cl5Desc.stLock);
 
 	/* increment global thread count to make sure that changelog does not close while
 	   backup is in progress */

+ 11 - 11
ldap/servers/plugins/replication/cl5_clcache.c

@@ -142,7 +142,7 @@ struct clc_busy_list {
  * Each process has a buffer pool
  */ 
 struct clc_pool {
-	PRRWLock		*pl_lock;				/* cl writer and agreements */
+	Slapi_RWLock		*pl_lock;				/* cl writer and agreements */
 	DB_ENV			**pl_dbenv;				/* pointer to DB_ENV for all the changelog files */
 	CLC_Busy_List	*pl_busy_lists;			/* busy buffer lists, one list per changelog file */
 	int				 pl_buffer_cnt_now;		/* total number of buffers */
@@ -189,7 +189,7 @@ clcache_init ( DB_ENV **dbenv )
 	_pool->pl_buffer_cnt_min = DEFAULT_CLC_BUFFER_COUNT_MIN;
 	_pool->pl_buffer_cnt_max = DEFAULT_CLC_BUFFER_COUNT_MAX;
 	_pool->pl_buffer_default_pages = DEFAULT_CLC_BUFFER_COUNT_MAX;
-	_pool->pl_lock = PR_NewRWLock (PR_RWLOCK_RANK_NONE, "clcache_pl_lock");
+	_pool->pl_lock = slapi_new_rwlock ();
 	return 0;
 }
 
@@ -200,7 +200,7 @@ clcache_init ( DB_ENV **dbenv )
 void
 clcache_set_config ()
 {
-	PR_RWLock_Wlock ( _pool->pl_lock );
+	slapi_rwlock_wrlock ( _pool->pl_lock );
 
 	_pool->pl_buffer_cnt_max = CL5_DEFAULT_CONFIG_CACHESIZE;
 
@@ -215,7 +215,7 @@ clcache_set_config ()
 		_pool->pl_buffer_default_pages = DEFAULT_CLC_BUFFER_PAGE_COUNT;
 	}
 
-	PR_RWLock_Unlock ( _pool->pl_lock );
+	slapi_rwlock_unlock ( _pool->pl_lock );
 }
 
 /*
@@ -899,20 +899,20 @@ clcache_enqueue_busy_list ( DB *db, CLC_Buffer *buf )
 	CLC_Busy_List *bl;
 	int rc = 0;
 
-	PR_RWLock_Rlock ( _pool->pl_lock );
+	slapi_rwlock_rdlock ( _pool->pl_lock );
 	for ( bl = _pool->pl_busy_lists; bl && bl->bl_db != db; bl = bl->bl_next );
-	PR_RWLock_Unlock ( _pool->pl_lock );
+	slapi_rwlock_unlock ( _pool->pl_lock );
 
 	if ( NULL == bl ) {
 		if ( NULL == ( bl = clcache_new_busy_list ()) ) {
 			rc = CL5_MEMORY_ERROR;
 		}
 		else {
-			PR_RWLock_Wlock ( _pool->pl_lock );
+			slapi_rwlock_wrlock ( _pool->pl_lock );
 			bl->bl_db = db;
 			bl->bl_next = _pool->pl_busy_lists;
 			_pool->pl_busy_lists = bl;
-			PR_RWLock_Unlock ( _pool->pl_lock );
+			slapi_rwlock_unlock ( _pool->pl_lock );
 		}
 	}
 
@@ -1002,7 +1002,7 @@ clcache_destroy()
 	if (_pool) {
 		CLC_Busy_List *bl = NULL;
 		if (_pool->pl_lock) {
-			PR_RWLock_Wlock (_pool->pl_lock);
+			slapi_rwlock_wrlock (_pool->pl_lock);
 		}
 
 		bl = _pool->pl_busy_lists;
@@ -1014,8 +1014,8 @@ clcache_destroy()
 		_pool->pl_busy_lists = NULL;
 		_pool->pl_dbenv = NULL;
 		if (_pool->pl_lock) {
-			PR_RWLock_Unlock(_pool->pl_lock);
-			PR_DestroyRWLock(_pool->pl_lock);
+			slapi_rwlock_unlock(_pool->pl_lock);
+			slapi_destroy_rwlock(_pool->pl_lock);
 			_pool->pl_lock = NULL;
 		}
 		slapi_ch_free ( (void **) &_pool );

+ 9 - 9
ldap/servers/plugins/replication/cl5_config.c

@@ -58,7 +58,7 @@
 #define CONFIG_BASE		"cn=changelog5,cn=config" /*"cn=changelog,cn=supplier,cn=replication5.0,cn=replication,cn=config"*/
 #define CONFIG_FILTER	"(objectclass=*)"
 
-static PRRWLock *s_configLock; /* guarantees that only on thread at a time
+static Slapi_RWLock *s_configLock; /* guarantees that only on thread at a time
 								modifies changelog configuration */
 
 /* Forward Declartions */
@@ -80,7 +80,7 @@ int changelog5_config_init()
 	/* create the configuration lock, if not yet created. */
 	if (!s_configLock)
 	{
-		s_configLock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "config_lock");
+		s_configLock = slapi_new_rwlock();
 	}
 	if (s_configLock == NULL)
 	{
@@ -115,7 +115,7 @@ void changelog5_config_cleanup()
 
 	if (s_configLock)
 	{
-		PR_DestroyRWLock (s_configLock);
+		slapi_destroy_rwlock (s_configLock);
 		s_configLock = NULL;
 	}	
 }
@@ -176,7 +176,7 @@ changelog5_config_add (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter
 
 	*returncode = LDAP_SUCCESS;
 
-	PR_RWLock_Wlock (s_configLock);
+	slapi_rwlock_wrlock (s_configLock);
 
 	/* we already have a configured changelog - don't need to do anything
 	   since add operation will fail */
@@ -260,7 +260,7 @@ changelog5_config_add (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter
 #endif
 
 done:;
-	PR_RWLock_Unlock (s_configLock);
+	slapi_rwlock_unlock (s_configLock);
     changelog5_config_done (&config);
 	if (*returncode == LDAP_SUCCESS)
 	{
@@ -301,7 +301,7 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
 		return SLAPI_DSE_CALLBACK_ERROR;
 	}
 
-	PR_RWLock_Wlock (s_configLock);
+	slapi_rwlock_wrlock (s_configLock);
 
 	/* changelog must be open before its parameters can be modified */
 	if (cl5GetState() != CL5_STATE_OPEN)
@@ -558,7 +558,7 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
 	}
 
 done:;						   
-	PR_RWLock_Unlock (s_configLock);
+	slapi_rwlock_unlock (s_configLock);
 
     changelog5_config_done (&config);
     changelog5_config_free (&originalConfig);
@@ -602,7 +602,7 @@ changelog5_config_delete (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAf
 		return SLAPI_DSE_CALLBACK_ERROR;
 	}
 
-	PR_RWLock_Wlock (s_configLock);	
+	slapi_rwlock_wrlock (s_configLock);	
 
 	/* changelog must be open before it can be deleted */
 	if (cl5GetState () != CL5_STATE_OPEN)
@@ -665,7 +665,7 @@ changelog5_config_delete (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAf
 	}
 
 done:;
-	PR_RWLock_Unlock (s_configLock);
+	slapi_rwlock_unlock (s_configLock);
 
 	/* slapi_ch_free accepts NULL pointer */
 	slapi_ch_free ((void**)&currentDir);

+ 18 - 18
ldap/servers/plugins/replication/csnpl.c

@@ -48,7 +48,7 @@
 struct csnpl 
 {
 	LList*		csnList;	/* pending list */
-	PRRWLock*	csnLock;	/* lock to serialize access to PL */
+	Slapi_RWLock*	csnLock;	/* lock to serialize access to PL */
 };	
 
 typedef struct _csnpldata
@@ -84,7 +84,7 @@ CSNPL* csnplNew ()
 	}
 
 	/* ONREPL: do locks need different names */
-	csnpl->csnLock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "pl_lock");
+	csnpl->csnLock = slapi_new_rwlock();
 
 	if (csnpl->csnLock == NULL)
 	{
@@ -123,7 +123,7 @@ void csnplFree (CSNPL **csnpl)
 	llistDestroy (&((*csnpl)->csnList), (FNFree)csnpldata_free);
 
 	if ((*csnpl)->csnLock)
-		PR_DestroyRWLock ((*csnpl)->csnLock);
+		slapi_destroy_rwlock ((*csnpl)->csnLock);
 
 	slapi_ch_free ((void**)csnpl);	
 }
@@ -146,7 +146,7 @@ int csnplInsert (CSNPL *csnpl, const CSN *csn)
 		return -1;
 	}
 	
-	PR_RWLock_Wlock (csnpl->csnLock);
+	slapi_rwlock_wrlock (csnpl->csnLock);
 
     /* check to see if this csn is larger than the last csn in the
        pending list. It has to be if we have not seen it since
@@ -154,7 +154,7 @@ int csnplInsert (CSNPL *csnpl, const CSN *csn)
     csnplnode = llistGetTail (csnpl->csnList);
     if (csnplnode && csn_compare (csnplnode->csn, csn) >= 0)
     {
-        PR_RWLock_Unlock (csnpl->csnLock);
+        slapi_rwlock_unlock (csnpl->csnLock);
         return 1;
     }
 
@@ -168,7 +168,7 @@ int csnplInsert (CSNPL *csnpl, const CSN *csn)
     _csnplDumpContentNoLock(csnpl, "csnplInsert");
 #endif
 
-	PR_RWLock_Unlock (csnpl->csnLock);
+	slapi_rwlock_unlock (csnpl->csnLock);
 	if (rc != 0)
 	{
 		char s[CSN_STRSIZE];		
@@ -193,12 +193,12 @@ int csnplRemove (CSNPL *csnpl, const CSN *csn)
 	}
 
 	csn_as_string(csn, PR_FALSE, csn_str);
-	PR_RWLock_Wlock (csnpl->csnLock);
+	slapi_rwlock_wrlock (csnpl->csnLock);
 
 	data = (csnpldata *)llistRemove (csnpl->csnList, csn_str);
 	if (data == NULL)
 	{
-		PR_RWLock_Unlock (csnpl->csnLock);
+		slapi_rwlock_unlock (csnpl->csnLock);
 		return -1;		
 	}
 
@@ -209,7 +209,7 @@ int csnplRemove (CSNPL *csnpl, const CSN *csn)
 	csn_free(&data->csn);
 	slapi_ch_free((void **)&data);
 
-	PR_RWLock_Unlock (csnpl->csnLock);
+	slapi_rwlock_unlock (csnpl->csnLock);
 
 	return 0;
 }
@@ -227,7 +227,7 @@ int csnplCommit (CSNPL *csnpl, const CSN *csn)
 	}
 	csn_as_string(csn, PR_FALSE, csn_str);
 
-	PR_RWLock_Wlock (csnpl->csnLock);
+	slapi_rwlock_wrlock (csnpl->csnLock);
 
 #ifdef DEBUG
     _csnplDumpContentNoLock(csnpl, "csnplCommit");
@@ -249,7 +249,7 @@ int csnplCommit (CSNPL *csnpl, const CSN *csn)
 	        slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, 
 			            "csnplCommit: can't find csn %s\n", csn_str);
 		}
-		PR_RWLock_Unlock (csnpl->csnLock);
+		slapi_rwlock_unlock (csnpl->csnLock);
 		return -1;		
 	}
 	else
@@ -257,7 +257,7 @@ int csnplCommit (CSNPL *csnpl, const CSN *csn)
 		data->committed = PR_TRUE;
 	}
 
-	PR_RWLock_Unlock (csnpl->csnLock);
+	slapi_rwlock_unlock (csnpl->csnLock);
 
 	return 0;
 }
@@ -268,7 +268,7 @@ CSN* csnplGetMinCSN (CSNPL *csnpl, PRBool *committed)
 {
 	csnpldata *data;
 	CSN *csn = NULL;
-	PR_RWLock_Rlock (csnpl->csnLock);
+	slapi_rwlock_rdlock (csnpl->csnLock);
 	if ((data = (csnpldata*)llistGetHead (csnpl->csnList)) != NULL)
 	{
 		csn = csn_dup(data->csn);
@@ -277,7 +277,7 @@ CSN* csnplGetMinCSN (CSNPL *csnpl, PRBool *committed)
 			*committed = data->committed;
 		}
 	}
-	PR_RWLock_Unlock (csnpl->csnLock);
+	slapi_rwlock_unlock (csnpl->csnLock);
 
 	return csn;
 }
@@ -297,7 +297,7 @@ csnplRollUp(CSNPL *csnpl, CSN **first_commited)
 	csnpldata *data;
 	PRBool freeit = PR_TRUE;
 
-	PR_RWLock_Wlock (csnpl->csnLock);
+	slapi_rwlock_wrlock (csnpl->csnLock);
 	if (first_commited) {
 	   /* Avoid non-initialization issues due to careless callers */
 	  *first_commited = NULL;
@@ -324,7 +324,7 @@ csnplRollUp(CSNPL *csnpl, CSN **first_commited)
     _csnplDumpContentNoLock(csnpl, "csnplRollUp");
 #endif
 
-	PR_RWLock_Unlock (csnpl->csnLock);
+	slapi_rwlock_unlock (csnpl->csnLock);
 	return largest_committed_csn;
 }
 
@@ -335,9 +335,9 @@ csnplDumpContent(CSNPL *csnpl, const char *caller)
 {
     if (csnpl)
     {
-        PR_RWLock_Rlock (csnpl->csnLock);
+        slapi_rwlock_rdlock (csnpl->csnLock);
         _csnplDumpContentNoLock (csnpl, caller);
-        PR_RWLock_Unlock (csnpl->csnLock);
+        slapi_rwlock_unlock (csnpl->csnLock);
     }   
 }
 

+ 8 - 8
ldap/servers/plugins/replication/legacy_consumer.c

@@ -91,7 +91,7 @@ static int get_legacy_referral (Slapi_Entry *e, char **referral, char **state);
 static Slapi_DN *legacy_consumer_replicationdn = NULL;
 static char *legacy_consumer_replicationpw = NULL;
 /* Lock which protects the above config parameters */
-PRRWLock *legacy_consumer_config_lock = NULL;
+Slapi_RWLock *legacy_consumer_config_lock = NULL;
 
 static PRBool
 target_is_a_replica_root(Slapi_PBlock *pb, const Slapi_DN **root)
@@ -258,7 +258,7 @@ legacy_consumer_config_init()
     /* The FE DSE *must* be initialised before we get here */
 	int rc;
 
-	if ((legacy_consumer_config_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "legacy_consumer_config_lock")) == NULL) {
+	if ((legacy_consumer_config_lock = slapi_new_rwlock()) == NULL) {
 		slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
 				"Failed to create legacy_consumer config read-write lock\n");
 		exit(1);
@@ -319,7 +319,7 @@ legacy_consumer_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi
 
 
 	slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
-	PR_RWLock_Wlock (legacy_consumer_config_lock);
+	slapi_rwlock_wrlock (legacy_consumer_config_lock);
 		
 	for (i = 0; (mods[i] && (!not_allowed)); i++)
 	{
@@ -395,7 +395,7 @@ legacy_consumer_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi
 		}
 	}
 
-	PR_RWLock_Unlock (legacy_consumer_config_lock);
+	slapi_rwlock_unlock (legacy_consumer_config_lock);
 
 
 	if (not_allowed)
@@ -416,7 +416,7 @@ static int
 legacy_consumer_config_delete (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg)
 {
 	
-	PR_RWLock_Wlock (legacy_consumer_config_lock);
+	slapi_rwlock_wrlock (legacy_consumer_config_lock);
     if (legacy_consumer_replicationdn)
         slapi_sdn_free (&legacy_consumer_replicationdn);
     if (legacy_consumer_replicationpw)
@@ -424,7 +424,7 @@ legacy_consumer_config_delete (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* en
 
 	legacy_consumer_replicationdn = NULL;
     legacy_consumer_replicationpw = NULL;
-	PR_RWLock_Unlock (legacy_consumer_config_lock);
+	slapi_rwlock_unlock (legacy_consumer_config_lock);
 
 	*returncode = LDAP_SUCCESS;
 	return SLAPI_DSE_CALLBACK_OK;
@@ -439,7 +439,7 @@ legacy_consumer_extract_config(Slapi_Entry* entry, char *returntext)
 	int rc = LDAP_SUCCESS; /* OK */
 	char *arg;
 
-  	PR_RWLock_Wlock (legacy_consumer_config_lock);
+  	slapi_rwlock_wrlock (legacy_consumer_config_lock);
 
     arg= slapi_entry_attr_get_charptr(entry,CONFIG_LEGACY_REPLICATIONDN_ATTRIBUTE);
     if (arg)
@@ -448,7 +448,7 @@ legacy_consumer_extract_config(Slapi_Entry* entry, char *returntext)
     arg= slapi_entry_attr_get_charptr(entry,CONFIG_LEGACY_REPLICATIONPW_ATTRIBUTE);
     legacy_consumer_replicationpw = arg;
 
-	PR_RWLock_Unlock (legacy_consumer_config_lock);
+	slapi_rwlock_unlock (legacy_consumer_config_lock);
 
 	return rc;
 }

+ 13 - 13
ldap/servers/plugins/replication/repl5_replica_dnhash.c

@@ -47,7 +47,7 @@
 
 /* global data */
 static PLHashTable *s_hash;
-static PRRWLock *s_lock;
+static Slapi_RWLock *s_lock;
 
 /* Forward declarations */
 static PRIntn replica_destroy_hash_entry (PLHashEntry *he, PRIntn index, void *arg); 
@@ -66,7 +66,7 @@ int replica_init_dn_hash ()
     }
 
     /* create lock */
-    s_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "replica_dnhash_lock");
+    s_lock = slapi_new_rwlock();
     if (s_lock == NULL)
     {
         slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_init_dn_hash: "
@@ -88,7 +88,7 @@ void replica_destroy_dn_hash ()
         PL_HashTableDestroy(s_hash); 
 
     if (s_lock)
-        PR_DestroyRWLock (s_lock);
+        slapi_destroy_rwlock (s_lock);
 }
 
 int replica_add_by_dn (const char *dn)
@@ -108,14 +108,14 @@ int replica_add_by_dn (const char *dn)
         return -1;
     }
 
-    PR_RWLock_Wlock (s_lock);
+    slapi_rwlock_wrlock (s_lock);
    
     /* make sure that the dn is unique */
     if (PL_HashTableLookup(s_hash, dn) != NULL)
     {
         slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_add_by_dn: "
                         "replica with dn (%s) already in the hash\n", dn);
-        PR_RWLock_Unlock (s_lock);
+        slapi_rwlock_unlock (s_lock);
         return -1 ;    
     }
 
@@ -127,14 +127,14 @@ int replica_add_by_dn (const char *dn)
                         "failed to add dn (%s); NSPR error - %d\n",
                         dn_copy, PR_GetError ());
 		slapi_ch_free((void **)&dn_copy);
-        PR_RWLock_Unlock (s_lock);
+        slapi_rwlock_unlock (s_lock);
         return -1;
     }
 
 	slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "replica_add_by_dn: "
 					"added dn (%s)\n",
 					dn_copy);
-    PR_RWLock_Unlock (s_lock);
+    slapi_rwlock_unlock (s_lock);
     return 0;
 }
 
@@ -156,14 +156,14 @@ int replica_delete_by_dn (const char *dn)
         return -1;
     }
 
-    PR_RWLock_Wlock (s_lock);
+    slapi_rwlock_wrlock (s_lock);
 
     /* locate object */
     if (NULL == (dn_copy = (char *)PL_HashTableLookup(s_hash, dn)))
     {
         slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_delete_by_dn: "
                         "dn (%s) is not in the hash.\n", dn);
-        PR_RWLock_Unlock (s_lock);
+        slapi_rwlock_unlock (s_lock);
         return -1;
     }
 
@@ -174,7 +174,7 @@ int replica_delete_by_dn (const char *dn)
 	slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "replica_delete_by_dn: "
 					"removed dn (%s)\n",
 					dn);
-    PR_RWLock_Unlock (s_lock);
+    slapi_rwlock_unlock (s_lock);
 
     return 0;
 }
@@ -195,16 +195,16 @@ int replica_is_being_configured (const char *dn)
         return 0;
     }
 
-    PR_RWLock_Wlock (s_lock);
+    slapi_rwlock_wrlock (s_lock);
 
     /* locate object */
     if (NULL == PL_HashTableLookup(s_hash, dn))
     {
-        PR_RWLock_Unlock (s_lock);
+        slapi_rwlock_unlock (s_lock);
         return 0;
     }
 
-    PR_RWLock_Unlock (s_lock);
+    slapi_rwlock_unlock (s_lock);
 
     return 1;
 }

+ 15 - 15
ldap/servers/plugins/replication/repl5_replica_hash.c

@@ -48,7 +48,7 @@
 
 /* global data */
 static PLHashTable *s_hash;
-static PRRWLock *s_lock;
+static Slapi_RWLock *s_lock;
 
 struct repl_enum_data
 {
@@ -75,7 +75,7 @@ int replica_init_name_hash ()
     }
 
     /* create lock */
-    s_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "replica_hash_lock");
+    s_lock = slapi_new_rwlock();
     if (s_lock == NULL)
     {
         slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_init_name_hash: "
@@ -97,7 +97,7 @@ void replica_destroy_name_hash ()
         PL_HashTableDestroy(s_hash); 
 
     if (s_lock)
-        PR_DestroyRWLock (s_lock);
+        slapi_destroy_rwlock (s_lock);
 }
 
 int replica_add_by_name (const char *name, Object *replica)
@@ -115,14 +115,14 @@ int replica_add_by_name (const char *name, Object *replica)
         return -1;
     }
 
-    PR_RWLock_Wlock (s_lock);
+    slapi_rwlock_wrlock (s_lock);
    
     /* make sure that the name is unique */
     if (PL_HashTableLookup(s_hash, name) != NULL)
     {
         slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_add_by_name: "
                         "replica with name (%s) already in the hash\n", name);
-        PR_RWLock_Unlock (s_lock);
+        slapi_rwlock_unlock (s_lock);
         return -1 ;    
     }
 
@@ -136,11 +136,11 @@ int replica_add_by_name (const char *name, Object *replica)
                         "failed to add replica with name (%s); NSPR error - %d\n",
                         name, PR_GetError ());
         object_release (replica);
-        PR_RWLock_Unlock (s_lock);
+        slapi_rwlock_unlock (s_lock);
         return -1;
     }
 
-    PR_RWLock_Unlock (s_lock);
+    slapi_rwlock_unlock (s_lock);
     return 0;
 }
 
@@ -162,7 +162,7 @@ int replica_delete_by_name (const char *name)
         return -1;
     }
 
-    PR_RWLock_Wlock (s_lock);
+    slapi_rwlock_wrlock (s_lock);
 
     /* locate object */
     replica = (Object*)PL_HashTableLookup(s_hash, name);     
@@ -170,7 +170,7 @@ int replica_delete_by_name (const char *name)
     {
         slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_delete_by_name: "
                         "replica with name (%s) is not in the hash.\n", name);
-        PR_RWLock_Unlock (s_lock);
+        slapi_rwlock_unlock (s_lock);
         return -1;
     }
 
@@ -180,7 +180,7 @@ int replica_delete_by_name (const char *name)
     /* release replica */
     object_release (replica);
 
-    PR_RWLock_Unlock (s_lock);
+    slapi_rwlock_unlock (s_lock);
 
     return 0;
 }
@@ -203,19 +203,19 @@ Object* replica_get_by_name (const char *name)
         return NULL;
     }
 
-    PR_RWLock_Rlock (s_lock);
+    slapi_rwlock_rdlock (s_lock);
 
     /* locate object */
     replica = (Object*)PL_HashTableLookup(s_hash, name);     
     if (replica == NULL)
     {
-        PR_RWLock_Unlock (s_lock);
+        slapi_rwlock_unlock (s_lock);
         return NULL;
     }
 
     object_acquire (replica);
 
-    PR_RWLock_Unlock (s_lock);
+    slapi_rwlock_unlock (s_lock);
 
     return replica;   
 }
@@ -229,9 +229,9 @@ void replica_enumerate_replicas (FNEnumReplica fn, void *arg)
     data.fn = fn;
     data.arg = arg;
 
-    PR_RWLock_Wlock (s_lock);
+    slapi_rwlock_wrlock (s_lock);
     PL_HashTableEnumerateEntries(s_hash, replica_enumerate, &data);
-    PR_RWLock_Unlock (s_lock);
+    slapi_rwlock_unlock (s_lock);
 }
 
 /* Helper functions */

+ 67 - 67
ldap/servers/plugins/replication/repl5_ruv.c

@@ -89,7 +89,7 @@ struct _ruv
 	char	  *replGen;	    /* replicated area generation: identifies replica
 						       in space and in time */ 
 	DataList  *elements;    /* replicas */	
-	PRRWLock  *lock;	    /* concurrency control */
+	Slapi_RWLock  *lock;	    /* concurrency control */
 };
 
 /* forward declarations */
@@ -329,7 +329,7 @@ ruv_dup (const RUV *ruv)
 	if (ruv == NULL)
 		return NULL;
 
-	PR_RWLock_Rlock (ruv->lock);
+	slapi_rwlock_rdlock (ruv->lock);
 
 	rc = ruvInit (&dupRUV, dl_get_count (ruv->elements));
 	if (rc != RUV_SUCCESS || dupRUV == NULL)
@@ -357,7 +357,7 @@ ruv_dup (const RUV *ruv)
 	} 
 
 done:
-	PR_RWLock_Unlock (ruv->lock);
+	slapi_rwlock_unlock (ruv->lock);
 	
 	return dupRUV;
 }
@@ -377,7 +377,7 @@ ruv_destroy (RUV **ruv)
 
 		if ((*ruv)->lock)
 		{
-			PR_DestroyRWLock ((*ruv)->lock);
+			slapi_destroy_rwlock ((*ruv)->lock);
 		}
         
 		slapi_ch_free ((void**)ruv);
@@ -408,7 +408,7 @@ ruv_copy_and_destroy (RUV **srcruv, RUV **destruv)
 	}
 	else
 	{
-		PR_RWLock_Wlock((*destruv)->lock);
+		slapi_rwlock_wrlock((*destruv)->lock);
 		elemp = (*destruv)->elements;
 		(*destruv)->elements = (*srcruv)->elements;
 		if (elemp)
@@ -424,11 +424,11 @@ ruv_copy_and_destroy (RUV **srcruv, RUV **destruv)
 
 		if ((*srcruv)->lock)
 		{
-			PR_DestroyRWLock ((*srcruv)->lock);
+			slapi_destroy_rwlock ((*srcruv)->lock);
 		}
 		slapi_ch_free ((void**)srcruv);
 
-		PR_RWLock_Unlock((*destruv)->lock);
+		slapi_rwlock_unlock((*destruv)->lock);
 	}
     PR_ASSERT (*destruv != NULL && *srcruv == NULL);
 }
@@ -445,9 +445,9 @@ ruv_delete_replica (RUV *ruv, ReplicaId rid)
 	else
 	{
 		/* check for duplicates */
-		PR_RWLock_Wlock (ruv->lock);
+		slapi_rwlock_wrlock (ruv->lock);
 		dl_delete (ruv->elements, (const void*)&rid, ruvReplicaCompare, ruvFreeReplica); 
-		PR_RWLock_Unlock (ruv->lock);
+		slapi_rwlock_unlock (ruv->lock);
 		return_value = RUV_SUCCESS;
 	}
 	return return_value;
@@ -460,14 +460,14 @@ ruv_add_replica (RUV *ruv, ReplicaId rid, const char *replica_purl)
 
     PR_ASSERT (ruv && replica_purl);
 
-    PR_RWLock_Wlock (ruv->lock);
+    slapi_rwlock_wrlock (ruv->lock);
     replica = ruvGetReplica (ruv, rid);
     if (replica == NULL)
     {
         replica = ruvAddReplicaNoCSN (ruv, rid, replica_purl);
     }
     
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 
     if (replica)
         return RUV_SUCCESS;
@@ -483,7 +483,7 @@ ruv_replace_replica_purl (RUV *ruv, ReplicaId rid, const char *replica_purl)
 	
     PR_ASSERT (ruv && replica_purl);
 
-    PR_RWLock_Wlock (ruv->lock);
+    slapi_rwlock_wrlock (ruv->lock);
     replica = ruvGetReplica (ruv, rid);
     if (replica != NULL)
     {
@@ -492,7 +492,7 @@ ruv_replace_replica_purl (RUV *ruv, ReplicaId rid, const char *replica_purl)
         rc = RUV_SUCCESS;
 	}
 
-	PR_RWLock_Unlock (ruv->lock);
+	slapi_rwlock_unlock (ruv->lock);
 	return rc;
 }
 
@@ -503,14 +503,14 @@ ruv_add_index_replica (RUV *ruv, ReplicaId rid, const char *replica_purl, int in
 
     PR_ASSERT (ruv && replica_purl);
 
-    PR_RWLock_Wlock (ruv->lock);
+    slapi_rwlock_wrlock (ruv->lock);
     replica = ruvGetReplica (ruv, rid);
     if (replica == NULL)
     {
         replica = ruvAddIndexReplicaNoCSN (ruv, rid, replica_purl, index);
     }
     
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 
     if (replica)
         return RUV_SUCCESS;
@@ -527,9 +527,9 @@ ruv_contains_replica (const RUV *ruv, ReplicaId rid)
     if (ruv == NULL)
         return PR_FALSE;
 
-    PR_RWLock_Rlock (ruv->lock);
+    slapi_rwlock_rdlock (ruv->lock);
 	replica = ruvGetReplica (ruv, rid);
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 
     return replica != NULL;
 }
@@ -554,7 +554,7 @@ get_csn_internal(const RUV *ruv, ReplicaId rid, CSN **csn, int whichone)
 	{
 		*csn = NULL;
 		/* prevent element from being destroyed while we get its data */
-		PR_RWLock_Rlock (ruv->lock);
+		slapi_rwlock_rdlock (ruv->lock);
 
 		replica = ruvGetReplica (ruv, rid);
         /* replica without min csn is treated as a non-existent replica */
@@ -576,7 +576,7 @@ get_csn_internal(const RUV *ruv, ReplicaId rid, CSN **csn, int whichone)
 				*csn = NULL;
 			}
 		}
-		PR_RWLock_Unlock (ruv->lock);	
+		slapi_rwlock_unlock (ruv->lock);	
 	}
 	return return_value;
 }
@@ -600,7 +600,7 @@ ruv_get_purl_for_replica(const RUV *ruv, ReplicaId rid)
 	RUVElement *replica;
 	const char *return_value = NULL;
 
-    PR_RWLock_Rlock (ruv->lock);
+    slapi_rwlock_rdlock (ruv->lock);
 
 	replica = ruvGetReplica (ruv, rid);
 	if (replica != NULL)
@@ -608,7 +608,7 @@ ruv_get_purl_for_replica(const RUV *ruv, ReplicaId rid)
 		return_value = replica->replica_purl;
 	}
 
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 
 	return return_value;
 }
@@ -672,9 +672,9 @@ int
 ruv_set_min_csn(RUV *ruv, const CSN *min_csn, const char *replica_purl)
 {
 	int return_value;
-	PR_RWLock_Wlock (ruv->lock);
+	slapi_rwlock_wrlock (ruv->lock);
 	return_value = set_min_csn_nolock(ruv, min_csn, replica_purl);
-	PR_RWLock_Unlock (ruv->lock);
+	slapi_rwlock_unlock (ruv->lock);
 	return return_value;
 }
 
@@ -683,9 +683,9 @@ int
 ruv_set_max_csn(RUV *ruv, const CSN *max_csn, const char *replica_purl)
 {
 	int return_value;
-	PR_RWLock_Wlock (ruv->lock);
+	slapi_rwlock_wrlock (ruv->lock);
 	return_value = set_max_csn_nolock(ruv, max_csn, replica_purl);
-	PR_RWLock_Unlock (ruv->lock);
+	slapi_rwlock_unlock (ruv->lock);
 	return return_value;
 }
 
@@ -706,7 +706,7 @@ ruv_set_csns(RUV *ruv, const CSN *csn, const char *replica_purl)
 		rid = csn_get_replicaid (csn);
 
 		/* prevent element from being destroyed while we get its data */
-		PR_RWLock_Wlock (ruv->lock);
+		slapi_rwlock_wrlock (ruv->lock);
 
 		replica = ruvGetReplica (ruv, rid);
 		if (replica == NULL) /* add new replica */
@@ -748,7 +748,7 @@ ruv_set_csns(RUV *ruv, const CSN *csn, const char *replica_purl)
 			return_value = RUV_SUCCESS;
 		}
 
-		PR_RWLock_Unlock (ruv->lock);
+		slapi_rwlock_unlock (ruv->lock);
 	}
 	return return_value;
 }
@@ -774,7 +774,7 @@ ruv_set_csns_keep_smallest(RUV *ruv, const CSN *csn)
 		rid = csn_get_replicaid (csn);
 
 		/* prevent element from being destroyed while we get its data */
-		PR_RWLock_Wlock (ruv->lock);
+		slapi_rwlock_wrlock (ruv->lock);
 
 		replica = ruvGetReplica (ruv, rid);
 		if (replica == NULL) /* add new replica */
@@ -797,7 +797,7 @@ ruv_set_csns_keep_smallest(RUV *ruv, const CSN *csn)
 			return_value = RUV_SUCCESS;
 		}
 
-		PR_RWLock_Unlock (ruv->lock);
+		slapi_rwlock_unlock (ruv->lock);
 	}
 	return return_value;
 }
@@ -808,7 +808,7 @@ ruv_set_replica_generation(RUV *ruv, const char *csnstr)
 {
 	if (NULL != csnstr && NULL != ruv)
 	{
-        PR_RWLock_Wlock (ruv->lock);
+        slapi_rwlock_wrlock (ruv->lock);
 
 		if (NULL != ruv->replGen)
 		{
@@ -816,7 +816,7 @@ ruv_set_replica_generation(RUV *ruv, const char *csnstr)
 		}
 		ruv->replGen = slapi_ch_strdup(csnstr);
     
-        PR_RWLock_Unlock (ruv->lock);
+        slapi_rwlock_unlock (ruv->lock);
 	}
 }
 
@@ -830,14 +830,14 @@ ruv_get_replica_generation(const RUV *ruv)
 		return return_str;
 	}
 
-	PR_RWLock_Rlock (ruv->lock);
+	slapi_rwlock_rdlock (ruv->lock);
 
 	if (ruv != NULL && ruv->replGen != NULL)
 	{
 		return_str = slapi_ch_strdup(ruv->replGen);
 	}
 
-	PR_RWLock_Unlock (ruv->lock);
+	slapi_rwlock_unlock (ruv->lock);
 
 	return return_str;
 }
@@ -883,9 +883,9 @@ ruv_covers_csn(const RUV *ruv, const CSN *csn)
 {
     PRBool rc;
 
-    PR_RWLock_Rlock (ruv->lock);
+    slapi_rwlock_rdlock (ruv->lock);
 	rc = ruv_covers_csn_internal(ruv, csn, PR_FALSE);
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 
     return rc;
 }
@@ -895,9 +895,9 @@ ruv_covers_csn_strict(const RUV *ruv, const CSN *csn)
 {
     PRBool rc;
 
-    PR_RWLock_Rlock (ruv->lock);
+    slapi_rwlock_rdlock (ruv->lock);
 	rc = ruv_covers_csn_internal(ruv, csn, PR_TRUE);
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 
     return rc;
 }
@@ -922,7 +922,7 @@ ruv_get_min_or_max_csn(const RUV *ruv, CSN **csn, int get_the_max)
 		CSN *found = NULL;
 		RUVElement *replica;
 		int cookie;
-		PR_RWLock_Rlock (ruv->lock);
+		slapi_rwlock_rdlock (ruv->lock);
 		for (replica = dl_get_first (ruv->elements, &cookie); replica;
 			 replica = dl_get_next (ruv->elements, &cookie))
 		{
@@ -954,7 +954,7 @@ ruv_get_min_or_max_csn(const RUV *ruv, CSN **csn, int get_the_max)
 		{
 			*csn = csn_dup (found);
 		}
-		PR_RWLock_Unlock (ruv->lock);
+		slapi_rwlock_unlock (ruv->lock);
 		return_value = RUV_SUCCESS;	
 	}
 	return return_value;
@@ -986,7 +986,7 @@ ruv_enumerate_elements (const RUV *ruv, FNEnumRUV fn, void *arg)
         return -1;
     }
 
-    PR_RWLock_Rlock (ruv->lock);
+    slapi_rwlock_rdlock (ruv->lock);
     for (elem = (RUVElement*)dl_get_first (ruv->elements, &cookie); elem;
          elem = (RUVElement*)dl_get_next (ruv->elements, &cookie))
     {
@@ -1001,7 +1001,7 @@ ruv_enumerate_elements (const RUV *ruv, FNEnumRUV fn, void *arg)
         }
     }
     
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 
     return rc;
 }
@@ -1028,7 +1028,7 @@ ruv_to_bervals(const RUV *ruv, struct berval ***bvals)
 		char csnStr1 [CSN_STRSIZE];
 		char csnStr2 [CSN_STRSIZE];
 		int cookie;
-		PR_RWLock_Rlock (ruv->lock);
+		slapi_rwlock_rdlock (ruv->lock);
 		count = dl_get_count (ruv->elements) + 2;
 		returned_bervals = (struct berval **)slapi_ch_malloc(sizeof(struct berval *) * count);
 		returned_bervals[count - 1] = NULL;
@@ -1050,7 +1050,7 @@ ruv_to_bervals(const RUV *ruv, struct berval ***bvals)
 				replica->csn == NULL ? "" : csn_as_string (replica->csn, PR_FALSE, csnStr2));
 			returned_bervals[i]->bv_len = strlen(returned_bervals[i]->bv_val);
 		}
-		PR_RWLock_Unlock (ruv->lock);
+		slapi_rwlock_unlock (ruv->lock);
 		return_value = RUV_SUCCESS;
 		*bvals = returned_bervals;
 	}
@@ -1076,7 +1076,7 @@ ruv_to_smod(const RUV *ruv, Slapi_Mod *smod)
 		char csnStr2 [CSN_STRSIZE];
 #define B_SIZ 1024
 		char buf[B_SIZ];
-		PR_RWLock_Rlock (ruv->lock);
+		slapi_rwlock_rdlock (ruv->lock);
 		slapi_mod_init (smod, dl_get_count (ruv->elements) + 1);
 		slapi_mod_set_type (smod, type_ruvElement);
 		slapi_mod_set_operation (smod, LDAP_MOD_REPLACE | LDAP_MOD_BVALUES);
@@ -1098,7 +1098,7 @@ ruv_to_smod(const RUV *ruv, Slapi_Mod *smod)
 			val.bv_len = strlen(buf);
 			slapi_mod_add_value(smod, &val);
 		}
-		PR_RWLock_Unlock (ruv->lock);
+		slapi_rwlock_unlock (ruv->lock);
 		return_value = RUV_SUCCESS;
 	}
 	return return_value;
@@ -1120,7 +1120,7 @@ ruv_last_modified_to_smod(const RUV *ruv, Slapi_Mod *smod)
 		RUVElement *replica;
 		int cookie;
 		char buf[B_SIZ];
-		PR_RWLock_Rlock (ruv->lock);
+		slapi_rwlock_rdlock (ruv->lock);
 		slapi_mod_init (smod, dl_get_count (ruv->elements));
 		slapi_mod_set_type (smod, type_ruvElementUpdatetime);
 		slapi_mod_set_operation (smod, LDAP_MOD_REPLACE | LDAP_MOD_BVALUES);
@@ -1135,7 +1135,7 @@ ruv_last_modified_to_smod(const RUV *ruv, Slapi_Mod *smod)
 			val.bv_len = strlen(buf);
 			slapi_mod_add_value(smod, &val);
 		}
-		PR_RWLock_Unlock (ruv->lock);
+		slapi_rwlock_unlock (ruv->lock);
 		return_value = RUV_SUCCESS;
 	}
 	return return_value;
@@ -1181,9 +1181,9 @@ ruv_replica_count (const RUV *ruv)
     {
         int count;
 
-        PR_RWLock_Rlock (ruv->lock);
+        slapi_rwlock_rdlock (ruv->lock);
         count = dl_get_count (ruv->elements);
-        PR_RWLock_Unlock (ruv->lock);
+        slapi_rwlock_unlock (ruv->lock);
         
         return count;
     }
@@ -1201,7 +1201,7 @@ ruv_get_referrals(const RUV *ruv)
     int n;
 	const char *mypurl = multimaster_get_local_purl();
 	
-    PR_RWLock_Rlock (ruv->lock);
+    slapi_rwlock_rdlock (ruv->lock);
 
 	n = ruv_replica_count(ruv);
 	if(n>0)
@@ -1224,7 +1224,7 @@ ruv_get_referrals(const RUV *ruv)
 		}
 	}
 
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 
 	return r; /* Caller must free this */
 }
@@ -1241,7 +1241,7 @@ ruv_dump(const RUV *ruv, char *ruv_name, PRFileDesc *prFile)
 
 	PR_ASSERT(NULL != ruv);
 
-    PR_RWLock_Rlock (ruv->lock);
+    slapi_rwlock_rdlock (ruv->lock);
 
 	PR_snprintf (buff, len, "%s: {replicageneration} %s\n",
 				ruv_name ? ruv_name : type_ruvElement,
@@ -1282,7 +1282,7 @@ ruv_dump(const RUV *ruv, char *ruv_name, PRFileDesc *prFile)
 		}
 	}
 
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 }
 
 /* this function notifies the ruv that there are operations in progress so that
@@ -1296,7 +1296,7 @@ int ruv_add_csn_inprogress (RUV *ruv, const CSN *csn)
     PR_ASSERT (ruv && csn);
 
     /* locate ruvElement */
-    PR_RWLock_Wlock (ruv->lock);
+    slapi_rwlock_wrlock (ruv->lock);
     replica = ruvGetReplica (ruv, csn_get_replicaid (csn));
     if (replica == NULL)
     {
@@ -1342,7 +1342,7 @@ int ruv_add_csn_inprogress (RUV *ruv, const CSN *csn)
     }
       
 done:
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
     return rc;
 }
 
@@ -1354,7 +1354,7 @@ int ruv_cancel_csn_inprogress (RUV *ruv, const CSN *csn)
     PR_ASSERT (ruv && csn);
 
     /* locate ruvElement */
-    PR_RWLock_Wlock (ruv->lock);
+    slapi_rwlock_wrlock (ruv->lock);
     replica = ruvGetReplica (ruv, csn_get_replicaid (csn));
     if (replica == NULL)
     {
@@ -1370,7 +1370,7 @@ int ruv_cancel_csn_inprogress (RUV *ruv, const CSN *csn)
         rc = RUV_SUCCESS;
       
 done:
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
     return rc;
 }
 
@@ -1384,7 +1384,7 @@ int ruv_update_ruv (RUV *ruv, const CSN *csn, const char *replica_purl, PRBool i
     
     PR_ASSERT (ruv && csn);
 
-    PR_RWLock_Wlock (ruv->lock);
+    slapi_rwlock_wrlock (ruv->lock);
 
     replica = ruvGetReplica (ruv, csn_get_replicaid (csn));
     if (replica == NULL)
@@ -1434,7 +1434,7 @@ int ruv_update_ruv (RUV *ruv, const CSN *csn, const char *replica_purl, PRBool i
 	}
 
 done:
-    PR_RWLock_Unlock (ruv->lock);
+    slapi_rwlock_unlock (ruv->lock);
 
     return rc;
 }
@@ -1459,7 +1459,7 @@ ruvInit (RUV **ruv, int initCount)
 	dl_init ((*ruv)->elements, initCount);
 
 	/* create lock */
-	(*ruv)->lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "ruv_lock");
+	(*ruv)->lock = slapi_new_rwlock();
 	if ((*ruv)->lock == NULL)
 	{
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, 
@@ -1784,7 +1784,7 @@ ruv_move_local_supplier_to_first(RUV *ruv, ReplicaId aRid)
 	
 	PR_ASSERT(ruv);
 
-    PR_RWLock_Wlock (ruv->lock);
+    slapi_rwlock_wrlock (ruv->lock);
 	
 	elem = (RUVElement *)dl_delete(ruv->elements,(const void*)&aRid, ruvReplicaCompare, 0);
 	if (elem) {
@@ -1792,7 +1792,7 @@ ruv_move_local_supplier_to_first(RUV *ruv, ReplicaId aRid)
 		rc = RUV_SUCCESS;
 	}
 	
-	PR_RWLock_Unlock (ruv->lock);
+	slapi_rwlock_unlock (ruv->lock);
 	
 	return rc;
 }
@@ -1807,7 +1807,7 @@ ruv_get_first_id_and_purl(RUV *ruv, ReplicaId *rid, char **replica_purl )
 	
 	PR_ASSERT(ruv);
 
-    PR_RWLock_Rlock (ruv->lock);
+    slapi_rwlock_rdlock (ruv->lock);
 	first = dl_get_first(ruv->elements, &cookie);
 	if ( first == NULL )
 	{
@@ -1819,7 +1819,7 @@ ruv_get_first_id_and_purl(RUV *ruv, ReplicaId *rid, char **replica_purl )
 		*replica_purl = first->replica_purl;
 		rc = RUV_SUCCESS;
 	}
-	PR_RWLock_Unlock (ruv->lock);
+	slapi_rwlock_unlock (ruv->lock);
 	return rc;
 }
 
@@ -1830,17 +1830,17 @@ int ruv_local_contains_supplier(RUV *ruv, ReplicaId rid)
 
 	PR_ASSERT(ruv);
 
-    PR_RWLock_Rlock (ruv->lock);
+	slapi_rwlock_rdlock (ruv->lock);
 	for (elem = dl_get_first (ruv->elements, &cookie);
 		 elem;
 		 elem = dl_get_next (ruv->elements, &cookie))
 	{
 		if (elem->rid == rid){
-			PR_RWLock_Unlock (ruv->lock);
+			slapi_rwlock_unlock (ruv->lock);
 			return 1;
 		}
 	}
-	PR_RWLock_Unlock (ruv->lock);
+	slapi_rwlock_unlock (ruv->lock);
 	return 0;
 }
 

+ 27 - 27
ldap/servers/plugins/roles/roles_cache.c

@@ -103,7 +103,7 @@ typedef struct _roles_cache_def {
 	PRThread     *roles_tid;
 	int keeprunning;
 
-	PRRWLock *cache_lock;
+	Slapi_RWLock *cache_lock;
 	Slapi_Mutex *stop_lock;
 
 	Slapi_Mutex *change_lock;
@@ -132,7 +132,7 @@ typedef struct _roles_cache_def {
 /* Global list containing all the roles definitions per suffix */
 static roles_cache_def *roles_list = NULL;
 
-static PRRWLock *global_lock = NULL;
+static Slapi_RWLock *global_lock = NULL;
 
 /* Structure holding the nsrole values */
 typedef struct _roles_cache_build_result
@@ -215,7 +215,7 @@ int roles_cache_init()
 
 	if ( global_lock == NULL )
 	{
-		global_lock = PR_NewRWLock(0,"roles_cache");
+		global_lock = slapi_new_rwlock();
 	}
 
 	/* grab the views interface */
@@ -226,7 +226,7 @@ int roles_cache_init()
 	}
 
 	/* For each top suffix, get the roles definitions defined below it */
-	PR_RWLock_Wlock(global_lock);
+	slapi_rwlock_wrlock(global_lock);
 
 	sdn = slapi_get_first_suffix(&node, 0);
 	while (sdn)
@@ -234,7 +234,7 @@ int roles_cache_init()
 
 		if ( (new_suffix = roles_cache_create_suffix(sdn)) == NULL )
 		{
-			PR_DestroyRWLock(global_lock);
+			slapi_destroy_rwlock(global_lock);
 			global_lock = NULL;
 			return(-1);
 		}
@@ -245,7 +245,7 @@ int roles_cache_init()
 		}
 		sdn = slapi_get_next_suffix(&node, 0);
 	}
-	PR_RWLock_Unlock(global_lock);
+	slapi_rwlock_unlock(global_lock);
 
 	/* to expose roles_check to ACL plugin */
 	slapi_register_role_check(roles_check); 
@@ -262,7 +262,7 @@ int roles_cache_init()
         slapi_log_error( SLAPI_LOG_FATAL, ROLES_PLUGIN_SUBSYSTEM,
                "roles_cache_init: slapi_vattrspi_register failed\n");
 
-		PR_DestroyRWLock(global_lock);
+		slapi_destroy_rwlock(global_lock);
 		global_lock = NULL;
         return(-1);
 	}
@@ -271,7 +271,7 @@ int roles_cache_init()
         slapi_log_error( SLAPI_LOG_FATAL, ROLES_PLUGIN_SUBSYSTEM,
                "roles_cache_init: slapi_vattrspi_regattr failed\n");
 		slapi_ch_free((void **)&vattr_handle);
-		PR_DestroyRWLock(global_lock);
+		slapi_destroy_rwlock(global_lock);
 		global_lock = NULL;
 		return(-1);
 	}
@@ -303,7 +303,7 @@ static roles_cache_def *roles_cache_create_suffix(Slapi_DN *sdn)
 		return(NULL);
 	}
 
-	new_suffix->cache_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "roles_def_lock");
+	new_suffix->cache_lock = slapi_new_rwlock();
 	new_suffix->change_lock = slapi_new_mutex();
 	new_suffix->stop_lock = slapi_new_mutex();
 	new_suffix->create_lock = slapi_new_mutex();
@@ -461,7 +461,7 @@ static void roles_cache_trigger_update_suffix(void *handle, char *be_name, int o
 	Slapi_Backend *backend = NULL;
 	int found = 0;
 
-	PR_RWLock_Wlock(global_lock);
+	slapi_rwlock_wrlock(global_lock);
 
 	if ( (new_be_state == SLAPI_BE_STATE_DELETE) || (new_be_state == SLAPI_BE_STATE_OFFLINE) )
 	{
@@ -494,14 +494,14 @@ static void roles_cache_trigger_update_suffix(void *handle, char *be_name, int o
 
 			if ( (new_suffix = roles_cache_create_suffix(sdn)) == NULL )
 			{
-				PR_RWLock_Unlock(global_lock);
+				slapi_rwlock_unlock(global_lock);
 				return;
 			}
 
 			roles_cache_add_roles_from_suffix(sdn, new_suffix);
 			sdn = slapi_get_next_suffix(&node, 0);
 		}
-		PR_RWLock_Unlock(global_lock);
+		slapi_rwlock_unlock(global_lock);
 		return;
 	}
  
@@ -539,7 +539,7 @@ static void roles_cache_trigger_update_suffix(void *handle, char *be_name, int o
         slapi_sdn_free(&top_suffix_dn);
     }
 
-	PR_RWLock_Unlock(global_lock);
+	slapi_rwlock_unlock(global_lock);
 }
 
 /* roles_cache_trigger_update_role
@@ -552,7 +552,7 @@ static void roles_cache_trigger_update_role(char *dn, Slapi_Entry *roles_entry,
 	int found = 0;
 	roles_cache_def *current_role = NULL;
 
-	PR_RWLock_Wlock(global_lock);
+	slapi_rwlock_wrlock(global_lock);
  
 	current_role = roles_list;
 
@@ -589,7 +589,7 @@ static void roles_cache_trigger_update_role(char *dn, Slapi_Entry *roles_entry,
 		slapi_unlock_mutex(current_role->change_lock);
 	}
 
-	PR_RWLock_Unlock(global_lock);
+	slapi_rwlock_unlock(global_lock);
 
 	slapi_log_error( SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "<-- roles_cache_trigger_update_role: %p \n", roles_list);
 }
@@ -610,7 +610,7 @@ static int roles_cache_update(roles_cache_def *suffix_to_update)
 
 	slapi_log_error( SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "--> roles_cache_update \n");
 
-	PR_RWLock_Wlock(suffix_to_update->cache_lock);
+	slapi_rwlock_wrlock(suffix_to_update->cache_lock);
 
 	operation = suffix_to_update->notified_operation;
 	entry = suffix_to_update->notified_entry;
@@ -654,7 +654,7 @@ static int roles_cache_update(roles_cache_def *suffix_to_update)
 
 	}
 done:
-	PR_RWLock_Unlock(suffix_to_update->cache_lock);
+	slapi_rwlock_unlock(suffix_to_update->cache_lock);
 	if ( dn != NULL )
 	{
 		slapi_sdn_free(&dn);
@@ -679,7 +679,7 @@ void roles_cache_stop()
     slapi_log_error( SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "--> roles_cache_stop\n");
 
 	/* Go through all the roles list and trigger the associated structure */
-	PR_RWLock_Wlock(global_lock);
+	slapi_rwlock_wrlock(global_lock);
 	current_role = roles_list;
 	while ( current_role )
 	{
@@ -691,7 +691,7 @@ void roles_cache_stop()
 
 		current_role = next_role;
 	}
-	PR_RWLock_Unlock(global_lock);
+	slapi_rwlock_unlock(global_lock);
 
     slapi_log_error( SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "<-- roles_cache_stop\n");
 }
@@ -1504,11 +1504,11 @@ int roles_cache_listroles_ext(vattr_context *c, Slapi_Entry *entry, int return_v
  
     /* First get a list of all the in-scope roles */
 	/* XXX really need a mutex for this read operation ? */
-	PR_RWLock_Rlock(global_lock);
+	slapi_rwlock_rdlock(global_lock);
 
     rc = roles_cache_find_roles_in_suffix( slapi_entry_get_sdn(entry),&roles_cache);
 
-	PR_RWLock_Unlock(global_lock);
+	slapi_rwlock_unlock(global_lock);
 
     /* Traverse the tree checking if the entry has any of the roles */
 	if ( roles_cache != NULL )
@@ -1522,11 +1522,11 @@ int roles_cache_listroles_ext(vattr_context *c, Slapi_Entry *entry, int return_v
 			arg.context = c;
 
 			/* XXX really need a mutex for this read operation ? */
-			PR_RWLock_Rlock(roles_cache->cache_lock);
+			slapi_rwlock_rdlock(roles_cache->cache_lock);
 
 			avl_apply(roles_cache->avl_tree, (IFP)roles_cache_build_nsrole, &arg, -1, AVL_INORDER);
 
-			PR_RWLock_Unlock(roles_cache->cache_lock);
+			slapi_rwlock_unlock(roles_cache->cache_lock);
 	 
 			if( !arg.has_value )
 			{
@@ -1642,15 +1642,15 @@ int roles_check(Slapi_Entry *entry_to_check, Slapi_DN *role_dn, int *present)
 
     *present = 0;
 
-    PR_RWLock_Rlock(global_lock);
+    slapi_rwlock_rdlock(global_lock);
 
     if ( roles_cache_find_roles_in_suffix(slapi_entry_get_sdn(entry_to_check),
                                     &roles_cache) != 0 )
     {
-        PR_RWLock_Unlock(global_lock);
+        slapi_rwlock_unlock(global_lock);
         return -1;
     }
-    PR_RWLock_Unlock(global_lock);
+    slapi_rwlock_unlock(global_lock);
 
     this_role = (role_object *)avl_find(roles_cache->avl_tree, role_dn, (IFP)roles_cache_find_node);
 
@@ -2065,7 +2065,7 @@ static void roles_cache_role_def_free(roles_cache_def *role_def)
 
 	avl_free(role_def->avl_tree, (IFP)roles_cache_role_object_free);
 	slapi_sdn_free(&(role_def->suffix_dn));
-	PR_DestroyRWLock(role_def->cache_lock);
+	slapi_destroy_rwlock(role_def->cache_lock);
 	role_def->cache_lock = NULL;
 	slapi_destroy_mutex(role_def->change_lock);
 	role_def->change_lock = NULL;

+ 5 - 5
ldap/servers/plugins/views/views.c

@@ -153,7 +153,7 @@ static Slapi_PluginDesc pdesc = { "views", VENDOR, DS_PACKAGE_VERSION,
 
 static void * view_plugin_identity = NULL;
 
-static PRRWLock *g_views_cache_lock;
+static Slapi_RWLock *g_views_cache_lock;
 
 #ifdef _WIN32
 int *module_ldap_debug = 0;
@@ -218,17 +218,17 @@ int views_init( Slapi_PBlock *pb )
 
 void views_read_lock()
 {
-	PR_RWLock_Rlock(g_views_cache_lock);
+	slapi_rwlock_rdlock(g_views_cache_lock);
 }
 
 void views_write_lock()
 {
-	PR_RWLock_Wlock(g_views_cache_lock);
+	slapi_rwlock_wrlock(g_views_cache_lock);
 }
 
 void views_unlock()
 {
-	PR_RWLock_Unlock(g_views_cache_lock);
+	slapi_rwlock_unlock(g_views_cache_lock);
 }
 
 /*
@@ -244,7 +244,7 @@ static int views_start( Slapi_PBlock *pb )
 	slapi_log_error( SLAPI_LOG_TRACE, VIEWS_PLUGIN_SUBSYSTEM, "--> views_start\n");
 
 	theCache.cache_built = 0;
-	g_views_cache_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "views");
+	g_views_cache_lock = slapi_new_rwlock();
 
 	/* first register our backend state change func (we'll use func pointer as handle) */
 	slapi_register_backend_state_change((void *)views_cache_backend_state_change, views_cache_backend_state_change); 

+ 10 - 12
ldap/servers/slapd/attrsyntax.c

@@ -55,7 +55,7 @@
  */
 static PLHashTable *oid2asi = NULL;
 /* read/write lock to protect table */
-static PRRWLock *oid2asi_lock = NULL;
+static Slapi_RWLock *oid2asi_lock = NULL;
 
 /*
  * This hashtable maps the name or alias of the attribute to the
@@ -65,12 +65,12 @@ static PRRWLock *oid2asi_lock = NULL;
  */
 static PLHashTable *name2asi = NULL;
 /* read/write lock to protect table */
-static PRRWLock *name2asi_lock = NULL;
+static Slapi_RWLock *name2asi_lock = NULL;
 
-#define AS_LOCK_READ(l)		PR_RWLock_Rlock(l)
-#define AS_LOCK_WRITE(l)	PR_RWLock_Wlock(l)
-#define AS_UNLOCK_READ(l)	PR_RWLock_Unlock(l)
-#define AS_UNLOCK_WRITE(l)	PR_RWLock_Unlock(l)
+#define AS_LOCK_READ(l)		slapi_rwlock_rdlock(l)
+#define AS_LOCK_WRITE(l)	slapi_rwlock_wrlock(l)
+#define AS_UNLOCK_READ(l)	slapi_rwlock_unlock(l)
+#define AS_UNLOCK_WRITE(l)	slapi_rwlock_unlock(l)
 
 
 
@@ -1042,13 +1042,12 @@ attr_syntax_init(void)
 		oid2asi = PL_NewHashTable(2047, hashNocaseString,
 								  hashNocaseCompare,
 								  PL_CompareValues, 0, 0);
-		if ( NULL == ( oid2asi_lock = PR_NewRWLock( PR_RWLOCK_RANK_NONE,
-				"attrsyntax oid rwlock" ))) {
+		if ( NULL == ( oid2asi_lock = slapi_new_rwlock())) {
 			if(oid2asi) PL_HashTableDestroy(oid2asi);
 			oid2asi = NULL;
 
 			slapi_log_error( SLAPI_LOG_FATAL, "attr_syntax_init",
-					"PR_NewRWLock() for oid2asi lock failed\n" );
+					"slapi_new_rwlock() for oid2asi lock failed\n" );
 			return 1;
 		}
 	}
@@ -1058,13 +1057,12 @@ attr_syntax_init(void)
 		name2asi = PL_NewHashTable(2047, hashNocaseString,
 								   hashNocaseCompare,
 								   PL_CompareValues, 0, 0);
-		if ( NULL == ( name2asi_lock = PR_NewRWLock( PR_RWLOCK_RANK_NONE,
-				"attrsyntax name2asi rwlock"))) {
+		if ( NULL == ( name2asi_lock = slapi_new_rwlock())) {
 			if(name2asi) PL_HashTableDestroy(name2asi);
 			name2asi = NULL;
 
 			slapi_log_error( SLAPI_LOG_FATAL, "attr_syntax_init",
-					"PR_NewRWLock() for oid2asi lock failed\n" );
+					"slapi_new_rwlock() for oid2asi lock failed\n" );
 			return 1;
 		}
 	}

+ 11 - 12
ldap/servers/slapd/back-ldbm/dblayer.c

@@ -95,7 +95,6 @@
 
 #include "back-ldbm.h"
 #include "dblayer.h"
-#include <prrwlock.h>
 
 #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4100
 #define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval)    \
@@ -116,8 +115,8 @@
 #else /* older then db 41 */
 #define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval)    \
     (rval) = (db)->open((db), (file), (database), (type), (flags), (mode))
-#define DB_CHECKPOINT_LOCK(use_lock, lock) if(use_lock) PR_RWLock_Wlock(lock);
-#define DB_CHECKPOINT_UNLOCK(use_lock, lock) if(use_lock) PR_RWLock_Unlock(lock);
+#define DB_CHECKPOINT_LOCK(use_lock, lock) if(use_lock) slapi_rwlock_wrlock(lock);
+#define DB_CHECKPOINT_UNLOCK(use_lock, lock) if(use_lock) slapi_rwlock_unlock(lock);
 #endif
 
 #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4000
@@ -1187,7 +1186,7 @@ dblayer_free_env(struct dblayer_private_env **env)
         return;
     }
     if ((*env)->dblayer_env_lock) {
-        PR_DestroyRWLock((*env)->dblayer_env_lock);
+        slapi_destroy_rwlock((*env)->dblayer_env_lock);
         (*env)->dblayer_env_lock = NULL;
     }
     slapi_ch_free((void **)env);
@@ -1263,7 +1262,7 @@ dblayer_make_env(struct dblayer_private_env **env, struct ldbminfo *li)
     /* set up cache sizes */
     dblayer_init_dbenv(pEnv->dblayer_DB_ENV, priv);
 
-    pEnv->dblayer_env_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "checkpointer");
+    pEnv->dblayer_env_lock = slapi_new_rwlock();
 
     if (pEnv->dblayer_env_lock) {
         *env = pEnv;
@@ -2640,7 +2639,7 @@ int dblayer_instance_close(backend *be)
          if (inst_dirp != inst_dir)
            slapi_ch_free_string(&inst_dirp);
        }
-       PR_DestroyRWLock(inst->import_env->dblayer_env_lock);
+       slapi_destroy_rwlock(inst->import_env->dblayer_env_lock);
        slapi_ch_free((void **)&inst->import_env);
     } else {
        be->be_state = BE_STATE_STOPPED;
@@ -3213,7 +3212,7 @@ dblayer_db_remove_ex(dblayer_private_env *env, char const path[], char const dbN
   DB *db;
   
   if (env) {
-    if(use_lock) PR_RWLock_Wlock(env->dblayer_env_lock); /* We will be causing logging activity */
+    if(use_lock) slapi_rwlock_wrlock(env->dblayer_env_lock); /* We will be causing logging activity */
     db_env = env->dblayer_DB_ENV;
   }
   
@@ -3227,7 +3226,7 @@ dblayer_db_remove_ex(dblayer_private_env *env, char const path[], char const dbN
 
 done:
   if (env) {
-    if(use_lock) PR_RWLock_Unlock(env->dblayer_env_lock);
+    if(use_lock) slapi_rwlock_unlock(env->dblayer_env_lock);
   }
   
   return rc;
@@ -3393,14 +3392,14 @@ int dblayer_txn_begin_ext(struct ldbminfo *li, back_txnid parent_txn, back_txn *
     if (priv->dblayer_enable_transactions)
     {
         dblayer_private_env *pEnv = priv->dblayer_env;
-        if(use_lock) PR_RWLock_Rlock(pEnv->dblayer_env_lock);
+        if(use_lock) slapi_rwlock_rdlock(pEnv->dblayer_env_lock);
         return_value = TXN_BEGIN(pEnv->dblayer_DB_ENV,
                                  (DB_TXN*)parent_txn,
                                  &txn->back_txn_txn,
                                  0);
         if (0 != return_value) 
         {
-            if(use_lock) PR_RWLock_Unlock(priv->dblayer_env->dblayer_env_lock);
+            if(use_lock) slapi_rwlock_unlock(priv->dblayer_env->dblayer_env_lock);
             txn->back_txn_txn = NULL;
         }
     } else
@@ -3456,7 +3455,7 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
                 LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
             }
         }
-        if(use_lock) PR_RWLock_Unlock(priv->dblayer_env->dblayer_env_lock);
+        if(use_lock) slapi_rwlock_unlock(priv->dblayer_env->dblayer_env_lock);
     } else
     {
         return_value = 0;
@@ -3500,7 +3499,7 @@ int dblayer_txn_abort_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
         priv->dblayer_enable_transactions)
     {
         return_value = TXN_ABORT(db_txn);
-        if(use_lock) PR_RWLock_Unlock(priv->dblayer_env->dblayer_env_lock);
+        if(use_lock) slapi_rwlock_unlock(priv->dblayer_env->dblayer_env_lock);
     } else
     {
         return_value = 0;

+ 1 - 1
ldap/servers/slapd/back-ldbm/dblayer.h

@@ -107,7 +107,7 @@
 
 struct dblayer_private_env {
 	DB_ENV	*dblayer_DB_ENV;
-	PRRWLock * dblayer_env_lock;
+	Slapi_RWLock * dblayer_env_lock;
 	int dblayer_openflags;
 	int dblayer_priv_flags;
 };

+ 9 - 9
ldap/servers/slapd/back-ldbm/idl.c

@@ -58,7 +58,7 @@ struct idl_private {
 	int			idl_maxindirect; /* Number of blocks allowed */
 	size_t		idl_allidslimit; /* Max number of IDs before it turns to allids */
 #ifdef IDL_LOCKING_ENABLE
-	PRRWLock	*idl_rwlock;
+	Slapi_RWLock	*idl_rwlock;
 #endif
 };
 
@@ -119,7 +119,7 @@ int idl_old_init_private(backend *be,struct attrinfo *a)
 	    priv->idl_maxindirect = 0;
 	}
 #ifdef IDL_LOCKING_ENABLE
-	priv->idl_rwlock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "idl lock");
+	priv->idl_rwlock = slapi_new_rwlock();
 
 	if (NULL == priv->idl_rwlock) {
 		slapi_ch_free((void**)&priv);
@@ -139,7 +139,7 @@ int idl_old_release_private(struct attrinfo *a)
 #ifdef IDL_LOCKING_ENABLE
 		idl_private *priv = a->ai_idl;
 		PR_ASSERT(NULL != priv->idl_rwlock);
-		PR_DestroyRWLock(priv->idl_rwlock);
+		slapi_destroy_rwlock(priv->idl_rwlock);
 #endif
 		slapi_ch_free( (void **)&(a->ai_idl) );
 	}
@@ -160,35 +160,35 @@ int idl_old_release_private(struct attrinfo *a)
 #ifdef IDL_LOCKING_ENABLE
 static void idl_Wlock_list(idl_private *priv, DBT *key)
 {
-	PRRWLock *lock = NULL;
+	Slapi_RWLock *lock = NULL;
 
 	PR_ASSERT(NULL != priv);
 	lock = priv->idl_rwlock;
 	PR_ASSERT(NULL != lock);
 
-	PR_RWLock_Wlock(lock);
+	slapi_rwlock_wrlock(lock);
 }
 
 static void idl_Rlock_list(idl_private *priv, DBT *key)
 {
-	PRRWLock *lock = NULL;
+	Slapi_RWLock *lock = NULL;
 
 	PR_ASSERT(NULL != priv);
 	lock = priv->idl_rwlock;
 	PR_ASSERT(NULL != lock);
 
-	PR_RWLock_Rlock(lock);
+	slapi_rwlock_rdlock(lock);
 }
 
 static void idl_unlock_list(idl_private *priv, DBT *key)
 {
-	PRRWLock *lock = NULL;
+	Slapi_RWLock *lock = NULL;
 
 	PR_ASSERT(NULL != priv);
 	lock = priv->idl_rwlock;
 	PR_ASSERT(NULL != lock);
 
-	PR_RWLock_Unlock(lock);
+	slapi_rwlock_unlock(lock);
 }
 #endif
 

+ 43 - 43
ldap/servers/slapd/back-ldbm/vlv.c

@@ -62,7 +62,7 @@ static PRUint32 vlv_trim_candidates_byvalue(backend *be, const IDList *candidate
 static int vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_request *vlv_request_control, IDList** candidates, struct vlv_response *vlv_response_control, int is_srchlist_locked);
 
 /* New mutex for vlv locking
-PRRWLock * vlvSearchList_lock=NULL;
+Slapi_RWLock * vlvSearchList_lock=NULL;
 static struct vlvSearch *vlvSearchList= NULL; 
 */
 
@@ -82,9 +82,9 @@ int vlv_AddSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry*
     }
     vlvSearch_init(newVlvSearch, pb, entryBefore, inst);
     /* vlvSearchList is modified; need Wlock */
-    PR_RWLock_Wlock(be->vlvSearchList_lock);
+    slapi_rwlock_wrlock(be->vlvSearchList_lock);
     vlvSearch_addtolist(newVlvSearch, (struct vlvSearch **)&be->vlvSearchList);
-    PR_RWLock_Unlock(be->vlvSearchList_lock);
+    slapi_rwlock_unlock(be->vlvSearchList_lock);
     return SLAPI_DSE_CALLBACK_OK;
 }
 
@@ -100,7 +100,7 @@ int vlv_AddIndexEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e
     slapi_sdn_get_parent(slapi_entry_get_sdn(entryBefore),&parentdn);
 
     /* vlvIndex list is modified; need Wlock */
-    PR_RWLock_Wlock(be->vlvSearchList_lock);
+    slapi_rwlock_wrlock(be->vlvSearchList_lock);
     parent= vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, &parentdn);
     if(parent!=NULL)
     {
@@ -118,7 +118,7 @@ int vlv_AddIndexEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e
         }
         slapi_ch_free_string(&name);
     }
-    PR_RWLock_Unlock(be->vlvSearchList_lock);
+    slapi_rwlock_unlock(be->vlvSearchList_lock);
     slapi_sdn_done(&parentdn);
     return SLAPI_DSE_CALLBACK_OK;
 }
@@ -140,7 +140,7 @@ int vlv_DeleteSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
         return SLAPI_DSE_CALLBACK_ERROR;
     }
     /* vlvSearchList is modified; need Wlock */
-    PR_RWLock_Wlock(be->vlvSearchList_lock);
+    slapi_rwlock_wrlock(be->vlvSearchList_lock);
     p = vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, slapi_entry_get_sdn(entryBefore));
     if(p!=NULL)
     {
@@ -148,7 +148,7 @@ int vlv_DeleteSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
         vlvSearch_removefromlist((struct vlvSearch **)&be->vlvSearchList,p->vlv_dn);
         vlvSearch_delete(&p);
     }
-    PR_RWLock_Unlock(be->vlvSearchList_lock);
+    slapi_rwlock_unlock(be->vlvSearchList_lock);
     instance_set_not_busy(inst);
     return SLAPI_DSE_CALLBACK_OK;
 }
@@ -180,13 +180,13 @@ int vlv_ModifySearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
 	struct vlvSearch* p=NULL;
 	backend *be= ((ldbm_instance*)arg)->inst_be;
 	
-	PR_RWLock_Rlock(be->vlvSearchList_lock); 
+	slapi_rwlock_rdlock(be->vlvSearchList_lock); 
     p= vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, slapi_entry_get_sdn(entryBefore));
     if(p!=NULL)
     {
        	LDAPDebug( LDAP_DEBUG_ANY, "Modified Virtual List View Search (%s), which will be enabled when the database is rebuilt.\n", p->vlv_name, 0, 0);
     }
-	PR_RWLock_Unlock(be->vlvSearchList_lock);
+	slapi_rwlock_unlock(be->vlvSearchList_lock);
     return SLAPI_DSE_CALLBACK_DO_NOT_APPLY;
 }
 
@@ -207,13 +207,13 @@ int vlv_ModifyRDNSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_E
 	struct vlvSearch* p=NULL;
 	backend *be= ((ldbm_instance*)arg)->inst_be;
 	
-	PR_RWLock_Rlock(be->vlvSearchList_lock); 
+	slapi_rwlock_rdlock(be->vlvSearchList_lock); 
     p= vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, slapi_entry_get_sdn(entryBefore));
     if(p!=NULL)
     {
        	LDAPDebug( LDAP_DEBUG_ANY, "Modified Virtual List View Search (%s), which will be enabled when the database is rebuilt.\n", p->vlv_name, 0, 0);
     }
-	PR_RWLock_Unlock(be->vlvSearchList_lock);
+	slapi_rwlock_unlock(be->vlvSearchList_lock);
     return SLAPI_DSE_CALLBACK_DO_NOT_APPLY;
 }
 
@@ -314,9 +314,9 @@ void vlv_grok_new_import_entry(const struct backentry *e, backend *be)
     int any_not_done = 0;
 
 
-    PR_RWLock_Wlock(be->vlvSearchList_lock); 
+    slapi_rwlock_wrlock(be->vlvSearchList_lock); 
     if (seen_them_all) {
-		PR_RWLock_Unlock(be->vlvSearchList_lock);
+		slapi_rwlock_unlock(be->vlvSearchList_lock);
         return;
     }
 	p=(struct vlvSearch *)be->vlvSearchList;
@@ -335,7 +335,7 @@ void vlv_grok_new_import_entry(const struct backentry *e, backend *be)
     if (!any_not_done) {
         seen_them_all = 1;
     }
-	PR_RWLock_Unlock(be->vlvSearchList_lock);
+	slapi_rwlock_unlock(be->vlvSearchList_lock);
 }
 
 /*
@@ -366,7 +366,7 @@ vlv_init(ldbm_instance *inst)
     /* Initialize lock first time through */
     if(be->vlvSearchList_lock == NULL) {
         char *rwlockname = slapi_ch_smprintf("vlvSearchList_%s", inst->inst_name);
-        be->vlvSearchList_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, rwlockname);
+        be->vlvSearchList_lock = slapi_new_rwlock();
         slapi_ch_free((void**)&rwlockname);
     }
     if (NULL != (struct vlvSearch *)be->vlvSearchList)
@@ -374,7 +374,7 @@ vlv_init(ldbm_instance *inst)
         struct vlvSearch *t = NULL;
         struct vlvSearch *nt = NULL;
         /* vlvSearchList is modified; need Wlock */
-        PR_RWLock_Wlock(be->vlvSearchList_lock);
+        slapi_rwlock_wrlock(be->vlvSearchList_lock);
         for (t = (struct vlvSearch *)be->vlvSearchList; NULL != t; )
         {
             nt = t->vlv_next;
@@ -382,7 +382,7 @@ vlv_init(ldbm_instance *inst)
             t = nt;
         }
         be->vlvSearchList = NULL;
-        PR_RWLock_Unlock(be->vlvSearchList_lock);
+        slapi_rwlock_unlock(be->vlvSearchList_lock);
     }
 
     {
@@ -492,9 +492,9 @@ vlv_find_searchname(const char * name, backend *be)
 {
 	struct vlvIndex *p=NULL;
 
-	PR_RWLock_Rlock(be->vlvSearchList_lock);
+	slapi_rwlock_rdlock(be->vlvSearchList_lock);
 	p=vlvSearch_findname((struct vlvSearch *)be->vlvSearchList,name);
-	PR_RWLock_Unlock(be->vlvSearchList_lock);
+	slapi_rwlock_unlock(be->vlvSearchList_lock);
 	return p;
 }
 
@@ -506,9 +506,9 @@ vlv_find_indexname(const char * name, backend *be)
     
 	struct vlvIndex *p=NULL;
 
-	PR_RWLock_Rlock(be->vlvSearchList_lock);
+	slapi_rwlock_rdlock(be->vlvSearchList_lock);
 	p=vlvSearch_findindexname((struct vlvSearch *)be->vlvSearchList,name);
-	PR_RWLock_Unlock(be->vlvSearchList_lock);
+	slapi_rwlock_unlock(be->vlvSearchList_lock);
 	return p;
 }
 
@@ -520,9 +520,9 @@ vlv_getindexnames(backend *be)
 {
     char *n=NULL;
 
-	PR_RWLock_Rlock(be->vlvSearchList_lock);
+	slapi_rwlock_rdlock(be->vlvSearchList_lock);
 	n=vlvSearch_getnames((struct vlvSearch *)be->vlvSearchList);
-	PR_RWLock_Unlock(be->vlvSearchList_lock);
+	slapi_rwlock_unlock(be->vlvSearchList_lock);
 	return n;
 }
 
@@ -534,7 +534,7 @@ vlv_getindices(IFP callback_fn,void *param, backend *be)
     /* Traverse the list, calling the import code's callback function */
     struct vlvSearch* ps = NULL;
 	
-	PR_RWLock_Rlock(be->vlvSearchList_lock);
+	slapi_rwlock_rdlock(be->vlvSearchList_lock);
 	ps = (struct vlvSearch *)be->vlvSearchList;
     for(;ps!=NULL;ps= ps->vlv_next)
     {
@@ -544,7 +544,7 @@ vlv_getindices(IFP callback_fn,void *param, backend *be)
             callback_fn(pi->vlv_attrinfo,param);
         }
     }
-	PR_RWLock_Unlock(be->vlvSearchList_lock);
+	slapi_rwlock_unlock(be->vlvSearchList_lock);
 }
 
 /*
@@ -855,7 +855,7 @@ vlv_update_all_indexes(back_txn *txn, backend *be, Slapi_PBlock *pb, struct back
     struct vlvSearch* ps=NULL;
 	struct ldbminfo *li = ((ldbm_instance *)be->be_instance_info)->inst_li;
 	
-	PR_RWLock_Rlock(be->vlvSearchList_lock);
+	slapi_rwlock_rdlock(be->vlvSearchList_lock);
 	ps = (struct vlvSearch *)be->vlvSearchList;
     for(;ps!=NULL;ps= ps->vlv_next)
     {
@@ -863,7 +863,7 @@ vlv_update_all_indexes(back_txn *txn, backend *be, Slapi_PBlock *pb, struct back
 		for (return_value = LDAP_SUCCESS; return_value == LDAP_SUCCESS && pi!=NULL; pi=pi->vlv_next) 
 			return_value=vlv_update_index(pi, txn, li, pb, oldEntry, newEntry);
     }
-	PR_RWLock_Unlock(be->vlvSearchList_lock);
+	slapi_rwlock_unlock(be->vlvSearchList_lock);
     return return_value;
 }
 
@@ -1154,15 +1154,15 @@ vlv_search_build_candidate_list(Slapi_PBlock *pb, const Slapi_DN *base, int *vlv
 	slapi_pblock_get( pb, SLAPI_BACKEND, &be );
     slapi_pblock_get( pb, SLAPI_SEARCH_SCOPE, &scope );
     slapi_pblock_get( pb, SLAPI_SEARCH_STRFILTER, &fstr );
-	PR_RWLock_Rlock(be->vlvSearchList_lock);
+	slapi_rwlock_rdlock(be->vlvSearchList_lock);
 	if((pi=vlv_find_search(be, base, scope, fstr, sort_control)) == NULL) {
 	    unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
-	    PR_RWLock_Unlock(be->vlvSearchList_lock);
+	    slapi_rwlock_unlock(be->vlvSearchList_lock);
 	    slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, &opnote );
 	    pagedresults_set_unindexed( pb->pb_conn );
 	    rc = VLV_FIND_SEARCH_FAILED;
 	} else if((*vlv_rc=vlvIndex_accessallowed(pi, pb)) != LDAP_SUCCESS) {
-	    PR_RWLock_Unlock(be->vlvSearchList_lock);
+	    slapi_rwlock_unlock(be->vlvSearchList_lock);
 		rc = VLV_ACCESS_DENIED;
 	} else if ((*vlv_rc=vlv_build_candidate_list(be,pi,vlv_request_control,candidates,vlv_response_control, 1)) != LDAP_SUCCESS) {
 		rc = VLV_BLD_LIST_FAILED;
@@ -1203,7 +1203,7 @@ vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_requ
               vlvIndex_getName(p));
     if (!vlvIndex_online(p)) {
         if (is_srchlist_locked) {
-            PR_RWLock_Unlock(be->vlvSearchList_lock);
+            slapi_rwlock_unlock(be->vlvSearchList_lock);
         }
         return -1;
     }
@@ -1213,7 +1213,7 @@ vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_requ
         LDAPDebug(LDAP_DEBUG_ANY, "VLV: can't get index file '%s' (err %d)\n",
                   p->vlv_attrinfo->ai_type, rc, 0);
         if (is_srchlist_locked) {
-            PR_RWLock_Unlock(be->vlvSearchList_lock);
+            slapi_rwlock_unlock(be->vlvSearchList_lock);
         }
         return -1;
     }
@@ -1224,7 +1224,7 @@ vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_requ
     vlvIndex_incrementUsage(p);
 
     if (is_srchlist_locked) {
-        PR_RWLock_Unlock(be->vlvSearchList_lock);
+        slapi_rwlock_unlock(be->vlvSearchList_lock);
     }
     err = db->cursor(db, 0 /* txn */, &dbc, 0);
     if (err != 0) {
@@ -1956,7 +1956,7 @@ IDList *vlv_find_index_by_filter(struct backend *be, const char *base,
     Slapi_Filter *vlv_f;
 
 	slapi_sdn_init_dn_byref(&base_sdn, base);
-	PR_RWLock_Rlock(be->vlvSearchList_lock);
+	slapi_rwlock_rdlock(be->vlvSearchList_lock);
 	for (t = (struct vlvSearch *)be->vlvSearchList; t; t = t->vlv_next) {
 		/* all vlv "filters" start with (|(xxx)(objectclass=referral)).
 		 * we only care about the (xxx) part.
@@ -1977,13 +1977,13 @@ IDList *vlv_find_index_by_filter(struct backend *be, const char *base,
 				/* no match */
 				LDAPDebug(LDAP_DEBUG_TRACE, "vlv: no index online for %s\n",
 					t->vlv_filter, 0, 0);
-				PR_RWLock_Unlock(be->vlvSearchList_lock);
+				slapi_rwlock_unlock(be->vlvSearchList_lock);
 				return NULL;
 			}
 			
 			if (dblayer_get_index_file(be, vi->vlv_attrinfo, &db, 0) == 0) {
 				length = vlvIndex_get_indexlength(vi, db, 0 /* txn */);
-				PR_RWLock_Unlock(be->vlvSearchList_lock);
+				slapi_rwlock_unlock(be->vlvSearchList_lock);
 				err = db->cursor(db, 0 /* txn */, &dbc, 0);
 				if (err == 0) {
 					if (length == 0) /* 609377: index size could be 0 */
@@ -2009,7 +2009,7 @@ IDList *vlv_find_index_by_filter(struct backend *be, const char *base,
 			}
 		}
     }
-    PR_RWLock_Unlock(be->vlvSearchList_lock);
+    slapi_rwlock_unlock(be->vlvSearchList_lock);
     /* no match */
     slapi_sdn_done(&base_sdn);
     return NULL;
@@ -2080,7 +2080,7 @@ int vlv_delete_search_entry(Slapi_PBlock *pb, Slapi_Entry* e, ldbm_instance *ins
 	}
 	newdn = slapi_sdn_new_dn_byval(base1);
 	/* vlvSearchList is modified; need Wlock */
-	PR_RWLock_Wlock(be->vlvSearchList_lock);
+	slapi_rwlock_wrlock(be->vlvSearchList_lock);
 	p = vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, newdn);
 	if(p!=NULL)
 	{
@@ -2095,12 +2095,12 @@ int vlv_delete_search_entry(Slapi_PBlock *pb, Slapi_Entry* e, ldbm_instance *ins
 					  tag2, inst->inst_li->li_plugin->plg_name, inst->inst_name); 
 			rc = LDAP_PARAM_ERROR;
 			slapi_ch_free((void **)&tag2);
-			PR_RWLock_Unlock(be->vlvSearchList_lock);
+			slapi_rwlock_unlock(be->vlvSearchList_lock);
 			goto bail;
 		}
 		vlvSearch_removefromlist((struct vlvSearch **)&be->vlvSearchList,p->vlv_dn);
 		/* This line release lock to prevent recursive deadlock caused by slapi_internal_delete calling vlvDeleteSearchEntry */
-		PR_RWLock_Unlock(be->vlvSearchList_lock); 
+		slapi_rwlock_unlock(be->vlvSearchList_lock); 
 		vlvSearch_delete(&p);	
 		tmppb = slapi_pblock_new();
 		slapi_delete_internal_set_pb(tmppb, base2, NULL, NULL,
@@ -2123,7 +2123,7 @@ int vlv_delete_search_entry(Slapi_PBlock *pb, Slapi_Entry* e, ldbm_instance *ins
 		slapi_ch_free((void **)&tag2);
 		slapi_ch_free((void **)&base2);
     } else {
-		PR_RWLock_Unlock(be->vlvSearchList_lock);
+		slapi_rwlock_unlock(be->vlvSearchList_lock);
 	}
 bail:
 	instance_set_not_busy(inst);
@@ -2137,12 +2137,12 @@ void
 vlv_acquire_lock(backend *be)
 {
 	LDAPDebug(LDAP_DEBUG_TRACE, "vlv_acquire_lock => trying to acquire the lock\n", 0, 0, 0);
-	PR_RWLock_Wlock(be->vlvSearchList_lock);
+	slapi_rwlock_wrlock(be->vlvSearchList_lock);
 }
 
 void
 vlv_release_lock(backend *be)
 {
 	LDAPDebug(LDAP_DEBUG_TRACE, "vlv_release_lock => trying to release the lock\n", 0, 0, 0);
-	PR_RWLock_Unlock(be->vlvSearchList_lock);
+	slapi_rwlock_unlock(be->vlvSearchList_lock);
 }

+ 1 - 1
ldap/servers/slapd/backend.c

@@ -135,7 +135,7 @@ be_done(Slapi_Backend *be)
     PR_DestroyLock(be->be_state_lock);
     if (be->be_lock != NULL)
     {
-        PR_DestroyRWLock(be->be_lock);
+        slapi_destroy_rwlock(be->be_lock);
         be->be_lock = NULL;
     }
 }

+ 5 - 5
ldap/servers/slapd/backend_manager.c

@@ -75,7 +75,7 @@ slapi_be_new( const char *type, const char *name, int isprivate, int logchanges
 	PR_ASSERT(i<maxbackends);
 
 	be = (Slapi_Backend *) slapi_ch_calloc(1, sizeof(Slapi_Backend));
-	be->be_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, name );
+	be->be_lock = slapi_new_rwlock();
 	be_init( be, type, name, isprivate, logchanges, defsize, deftime );
 
 	backends[i] = be;
@@ -102,7 +102,7 @@ slapi_be_stopping (Slapi_Backend *be)
 	be->be_state = BE_STATE_DELETED;
 	if (be->be_lock != NULL)
 	{
-		PR_DestroyRWLock(be->be_lock);
+		slapi_destroy_rwlock(be->be_lock);
 		be->be_lock = NULL;
 	}
 
@@ -427,19 +427,19 @@ be_nbackends_public()
 void 
 slapi_be_Rlock(Slapi_Backend * be)
 {
-	PR_RWLock_Rlock(be->be_lock);
+	slapi_rwlock_rdlock(be->be_lock);
 }
 
 void
 slapi_be_Wlock(Slapi_Backend * be)
 {
-	PR_RWLock_Wlock(be->be_lock);
+	slapi_rwlock_wrlock(be->be_lock);
 }
 
 void
 slapi_be_Unlock(Slapi_Backend * be)
 {
-	PR_RWLock_Unlock(be->be_lock);
+	slapi_rwlock_unlock(be->be_lock);
 }
 
 /*

+ 18 - 18
ldap/servers/slapd/computed.c

@@ -62,7 +62,7 @@ struct _compute_evaluator {
 typedef struct _compute_evaluator compute_evaluator;
 
 static compute_evaluator *compute_evaluators = NULL;
-static PRRWLock *compute_evaluators_lock = NULL;
+static Slapi_RWLock *compute_evaluators_lock = NULL;
 
 static int
 compute_stock_evaluator(computed_attr_context *c,char* type,Slapi_Entry *e,slapi_compute_output_t outputfn);
@@ -74,7 +74,7 @@ struct _compute_rewriter {
 typedef struct _compute_rewriter compute_rewriter;
 
 static compute_rewriter *compute_rewriters = NULL;
-static PRRWLock *compute_rewriters_lock = NULL;
+static Slapi_RWLock *compute_rewriters_lock = NULL;
 
 /* Function called by evaluators to have the value output */
 static int
@@ -89,11 +89,11 @@ compute_call_evaluators(computed_attr_context *c,slapi_compute_output_t outfn,ch
 	int rc = -1;
 	compute_evaluator *current = NULL;
 	/* Walk along the list (locked) calling the evaluator functions util one says yes, an error happens, or we finish */
-	PR_RWLock_Rlock(compute_evaluators_lock);
+	slapi_rwlock_rdlock(compute_evaluators_lock);
 	for (current = compute_evaluators; (current != NULL) && (-1 == rc); current = current->next) {
 		rc = (*(current->function))(c,type,e,outfn);
 	}
-	PR_RWLock_Unlock(compute_evaluators_lock);
+	slapi_rwlock_unlock(compute_evaluators_lock);
 	return rc;
 }
 
@@ -138,7 +138,7 @@ int slapi_compute_add_evaluator(slapi_compute_callback_t function)
 	compute_evaluator *new_eval = NULL;
 	PR_ASSERT(NULL != function);
 	PR_ASSERT(NULL != compute_evaluators_lock);
-	PR_RWLock_Wlock(compute_evaluators_lock);
+	slapi_rwlock_wrlock(compute_evaluators_lock);
 	new_eval = (compute_evaluator *)slapi_ch_calloc(1,sizeof (compute_evaluator));
 	if (NULL == new_eval) {
 		rc = ENOMEM;
@@ -147,7 +147,7 @@ int slapi_compute_add_evaluator(slapi_compute_callback_t function)
 		new_eval->function = function;
 		compute_evaluators = new_eval;
 	}
-	PR_RWLock_Unlock(compute_evaluators_lock);
+	slapi_rwlock_unlock(compute_evaluators_lock);
 	return rc;
 }
 
@@ -155,12 +155,12 @@ int slapi_compute_add_evaluator(slapi_compute_callback_t function)
 int compute_init()
 {
 	/* Initialize the lock */
-	compute_evaluators_lock = PR_NewRWLock( PR_RWLOCK_RANK_NONE, "compute_attr_lock" );
+	compute_evaluators_lock = slapi_new_rwlock();
 	if (NULL == compute_evaluators_lock) {
 		/* Out of resources */
 		return ENOMEM;
 	}
-	compute_rewriters_lock = PR_NewRWLock( PR_RWLOCK_RANK_NONE, "compute_rewriters_lock" );
+	compute_rewriters_lock = slapi_new_rwlock();
 	if (NULL == compute_rewriters_lock) {
 		/* Out of resources */
 		return ENOMEM;
@@ -176,26 +176,26 @@ int compute_terminate()
 	/* Free the list */
 	if (NULL != compute_evaluators_lock) {
 		compute_evaluator *current = compute_evaluators;
-		PR_RWLock_Wlock(compute_evaluators_lock);
+		slapi_rwlock_wrlock(compute_evaluators_lock);
 		while (current != NULL) {
 			compute_evaluator *asabird = current;
 			current = current->next;
 			slapi_ch_free((void **)&asabird);
 		}
-		PR_RWLock_Unlock(compute_evaluators_lock);
+		slapi_rwlock_unlock(compute_evaluators_lock);
 		/* Free the lock */
-		PR_DestroyRWLock(compute_evaluators_lock);
+		slapi_destroy_rwlock(compute_evaluators_lock);
 	}
 	if (NULL != compute_rewriters_lock) {
 		compute_rewriter *current = compute_rewriters;
-		PR_RWLock_Wlock(compute_rewriters_lock);
+		slapi_rwlock_wrlock(compute_rewriters_lock);
 		while (current != NULL) {
 			compute_rewriter *asabird = current;
 			current = current->next;
 			slapi_ch_free((void **)&asabird);
 		}
-		PR_RWLock_Unlock(compute_rewriters_lock);
-		PR_DestroyRWLock(compute_rewriters_lock);
+		slapi_rwlock_unlock(compute_rewriters_lock);
+		slapi_destroy_rwlock(compute_rewriters_lock);
 	}	
 	return 0;
 }
@@ -212,11 +212,11 @@ int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function)
 	if (NULL == new_rewriter) {
 		rc = ENOMEM;
 	} else {
-		PR_RWLock_Wlock(compute_rewriters_lock);
+		slapi_rwlock_wrlock(compute_rewriters_lock);
 		new_rewriter->next = compute_rewriters;
 		new_rewriter->function = function;
 		compute_rewriters = new_rewriter;
-		PR_RWLock_Unlock(compute_rewriters_lock);
+		slapi_rwlock_unlock(compute_rewriters_lock);
 	}
 	return rc;
 }
@@ -227,7 +227,7 @@ int	compute_rewrite_search_filter(Slapi_PBlock *pb)
 	int rc = -1;
 	compute_rewriter *current = NULL;
 	/* Walk along the list (locked) calling the evaluator functions util one says yes, an error happens, or we finish */
-	PR_RWLock_Rlock(compute_rewriters_lock);
+	slapi_rwlock_rdlock(compute_rewriters_lock);
 	for (current = compute_rewriters; (current != NULL) && (-1 == rc); current = current->next) {
 		rc = (*(current->function))(pb);
 		/* Meaning of the return code :
@@ -237,7 +237,7 @@ int	compute_rewrite_search_filter(Slapi_PBlock *pb)
 		  2 : operations error
 		 */
 	}
-	PR_RWLock_Unlock(compute_rewriters_lock);
+	slapi_rwlock_unlock(compute_rewriters_lock);
 	return rc;
 
 }

+ 9 - 10
ldap/servers/slapd/control.c

@@ -57,7 +57,7 @@
 static char **supported_controls = NULL;
 static unsigned long *supported_controls_ops = NULL;
 static int supported_controls_count = 0;
-static PRRWLock *supported_controls_lock = NULL;
+static Slapi_RWLock *supported_controls_lock = NULL;
 
 /*
  * Register all of the LDAPv3 controls we know about "out of the box."
@@ -65,8 +65,7 @@ static PRRWLock *supported_controls_lock = NULL;
 void
 init_controls( void )
 {
-	supported_controls_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE,
-		"supported controls rwlock");
+	supported_controls_lock = slapi_new_rwlock();
 	if (NULL == supported_controls_lock) {
 		/* Out of resources */
 		slapi_log_error(SLAPI_LOG_FATAL, "startup", 
@@ -126,7 +125,7 @@ void
 slapi_register_supported_control( char *controloid, unsigned long controlops )
 {
 	if ( controloid != NULL ) {
-		PR_RWLock_Wlock(supported_controls_lock);
+		slapi_rwlock_wrlock(supported_controls_lock);
 		++supported_controls_count;
 		charray_add( &supported_controls, slapi_ch_strdup( controloid ));
 		supported_controls_ops = (unsigned long *)slapi_ch_realloc(
@@ -134,7 +133,7 @@ slapi_register_supported_control( char *controloid, unsigned long controlops )
 		    supported_controls_count * sizeof( unsigned long ));
 		supported_controls_ops[ supported_controls_count - 1 ] = 
 		    controlops;
-		PR_RWLock_Unlock(supported_controls_lock);
+		slapi_rwlock_unlock(supported_controls_lock);
 	}
 }
 
@@ -175,14 +174,14 @@ unsigned long *supported_controls_ops_dup(unsigned long *ctrlops)
 
 int slapi_get_supported_controls_copy( char ***ctrloidsp, unsigned long **ctrlopsp )
 {
-	PR_RWLock_Rlock(supported_controls_lock);
+	slapi_rwlock_rdlock(supported_controls_lock);
 	if ( ctrloidsp != NULL ) {
 		*ctrloidsp = charray_dup(supported_controls);
 	}
 	if ( ctrlopsp != NULL ) {
 		*ctrlopsp = supported_controls_ops_dup(supported_controls_ops);
 	}
-	PR_RWLock_Unlock(supported_controls_lock);
+	slapi_rwlock_unlock(supported_controls_lock);
 	return (0);
 }
 
@@ -322,7 +321,7 @@ get_ldapmessage_controls_ext(
 		if ( new->ldctl_iscritical ) {
 		    int		i;
 
-		    PR_RWLock_Rlock(supported_controls_lock);
+		    slapi_rwlock_rdlock(supported_controls_lock);
 		    for ( i = 0; supported_controls != NULL
 			&& supported_controls[i] != NULL; ++i ) {
 			    if ( strcmp( supported_controls[i],
@@ -336,10 +335,10 @@ get_ldapmessage_controls_ext(
 			( 0 == ( supported_controls_ops[i] &
 			operation_get_type(pb->pb_op) ))) {
 			    rc = LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
-			    PR_RWLock_Unlock(supported_controls_lock);
+			    slapi_rwlock_unlock(supported_controls_lock);
 			    goto free_and_return;
 		    }
-		    PR_RWLock_Unlock(supported_controls_lock);
+		    slapi_rwlock_unlock(supported_controls_lock);
 		}
 
 		/* the control value is optional */

+ 24 - 24
ldap/servers/slapd/csngen.c

@@ -81,7 +81,7 @@ typedef struct callback_node
 
 typedef struct callback_list 
 {
-	PRRWLock *lock;
+	Slapi_RWLock *lock;
 	DataList *list;	/* list of callback_node structures */
 } callback_list;
 
@@ -100,7 +100,7 @@ struct csngen
 {
 	csngen_state  state;        /* persistent state of the generator */
 	callback_list callbacks;	/* list of callbacks registered with the generator */
-	PRRWLock	  *lock;		/* concurrency control */
+	Slapi_RWLock	  *lock;		/* concurrency control */
 };
 
 /*
@@ -155,7 +155,7 @@ csngen_new (ReplicaId rid, Slapi_Attr *state)
 	}
 
 	/* create lock to control the access to the state information */
-	gen->lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "state_lock");	
+	gen->lock = slapi_new_rwlock();	
 	if (gen->lock == NULL)
 	{
 		slapi_log_error (SLAPI_LOG_FATAL, NULL, "csngen_new: failed to create lock\n");
@@ -208,7 +208,7 @@ csngen_free (CSNGen **gen)
 	_csngen_free_callbacks (*gen);	
 	
 	if ((*gen)->lock)
-		PR_DestroyRWLock ((*gen)->lock);
+		slapi_destroy_rwlock ((*gen)->lock);
 
 	slapi_ch_free((void**)gen);
 }
@@ -233,7 +233,7 @@ csngen_new_csn (CSNGen *gen, CSN **csn, PRBool notify)
 		return CSN_MEMORY_ERROR;
 	}
 
-    PR_RWLock_Wlock (gen->lock);
+    slapi_rwlock_wrlock (gen->lock);
 
     if (g_sampled_time == 0)
         csngen_update_time ();
@@ -247,7 +247,7 @@ csngen_new_csn (CSNGen *gen, CSN **csn, PRBool notify)
         rc = _csngen_adjust_local_time (gen, cur_time);
         if (rc != CSN_SUCCESS)
         {
-            PR_RWLock_Unlock (gen->lock);
+            slapi_rwlock_unlock (gen->lock);
             return rc;
         }
     }
@@ -264,7 +264,7 @@ csngen_new_csn (CSNGen *gen, CSN **csn, PRBool notify)
         rc = _csngen_adjust_local_time (gen, gen->state.sampled_time+1);
         if (rc != CSN_SUCCESS)
         {
-            PR_RWLock_Unlock (gen->lock);
+            slapi_rwlock_unlock (gen->lock);
             return rc;
         }
 		
@@ -286,7 +286,7 @@ csngen_new_csn (CSNGen *gen, CSN **csn, PRBool notify)
     /* The lock is intentionally unlocked before callbacks are called.
        This is to prevent deadlocks. The callback management code has
        its own lock */
-    PR_RWLock_Unlock (gen->lock);
+    slapi_rwlock_unlock (gen->lock);
 
     /* notify modules that registered interest in csn generation */
     if (notify)
@@ -322,7 +322,7 @@ int csngen_adjust_time (CSNGen *gen, const CSN* csn)
     remote_time = csn_get_time (csn);
 	remote_seqnum = csn_get_seqnum (csn);
 
-    PR_RWLock_Wlock (gen->lock);
+    slapi_rwlock_wrlock (gen->lock);
 
     if (slapi_is_loglevel_set(SLAPI_LOG_REPL)) {
         cur_time = CSN_CALC_TSTAMP(gen);
@@ -344,7 +344,7 @@ int csngen_adjust_time (CSNGen *gen, const CSN* csn)
         (CSN_SUCCESS != (rc = _csngen_adjust_local_time(gen, cur_time))))
     {
         /* _csngen_adjust_local_time will log error */
-        PR_RWLock_Unlock (gen->lock);
+        slapi_rwlock_unlock (gen->lock);
         csngen_dump_state(gen);
         return rc;
     }
@@ -378,7 +378,7 @@ int csngen_adjust_time (CSNGen *gen, const CSN* csn)
 				slapi_log_error (SLAPI_LOG_FATAL, NULL, "csngen_adjust_time: "
                             "adjustment limit exceeded; value - %ld, limit - %ld\n",
                              remote_offset, (long)CSN_MAX_TIME_ADJUST);
-				PR_RWLock_Unlock (gen->lock);
+				slapi_rwlock_unlock (gen->lock);
 				csngen_dump_state(gen);
 				return CSN_LIMIT_EXCEEDED;
 			}
@@ -417,7 +417,7 @@ int csngen_adjust_time (CSNGen *gen, const CSN* csn)
 		   generated? */
 	}
 
-    PR_RWLock_Unlock (gen->lock);
+    slapi_rwlock_unlock (gen->lock);
 
     return CSN_SUCCESS;
 }
@@ -437,7 +437,7 @@ int csngen_get_state (const CSNGen *gen, Slapi_Mod *state)
     if (gen == NULL || state == NULL)
         return CSN_INVALID_PARAMETER;
 
-    PR_RWLock_Rlock (gen->lock);
+    slapi_rwlock_rdlock (gen->lock);
 
     slapi_mod_init (state, 1);
     slapi_mod_set_type (state, ATTR_CSN_GENERATOR_STATE);
@@ -446,7 +446,7 @@ int csngen_get_state (const CSNGen *gen, Slapi_Mod *state)
     bval.bv_len = sizeof (gen->state);
     slapi_mod_add_value(state, &bval);
 
-    PR_RWLock_Unlock (gen->lock);
+    slapi_rwlock_unlock (gen->lock);
 
     return CSN_SUCCESS;
 }
@@ -465,9 +465,9 @@ void* csngen_register_callbacks(CSNGen *gen, GenCSNFn genFn, void *genArg,
     node->abort_fn = abortFn;
     node->abort_arg = abortArg;
 
-    PR_RWLock_Wlock (gen->callbacks.lock);
+    slapi_rwlock_wrlock (gen->callbacks.lock);
     dl_add (gen->callbacks.list, node);
-    PR_RWLock_Unlock (gen->callbacks.lock);
+    slapi_rwlock_unlock (gen->callbacks.lock);
 
     return node;
 }
@@ -477,9 +477,9 @@ void csngen_unregister_callbacks(CSNGen *gen, void *cookie)
 {
     if (gen && cookie)
     {
-        PR_RWLock_Wlock (gen->callbacks.lock);
+        slapi_rwlock_wrlock (gen->callbacks.lock);
         dl_delete (gen->callbacks.list, cookie, _csngen_cmp_callbacks, slapi_ch_free);
-        PR_RWLock_Unlock (gen->callbacks.lock);
+        slapi_rwlock_unlock (gen->callbacks.lock);
     }
 }
 
@@ -495,14 +495,14 @@ void csngen_dump_state (const CSNGen *gen)
 {
     if (gen)
     {
-        PR_RWLock_Rlock (gen->lock);
+        slapi_rwlock_rdlock (gen->lock);
         slapi_log_error(SLAPI_LOG_FATAL, NULL, "CSN generator's state:\n");
         slapi_log_error(SLAPI_LOG_FATAL, NULL, "\treplica id: %d\n", gen->state.rid);
         slapi_log_error(SLAPI_LOG_FATAL, NULL, "\tsampled time: %ld\n", gen->state.sampled_time);
         slapi_log_error(SLAPI_LOG_FATAL, NULL, "\tlocal offset: %ld\n", gen->state.local_offset);
         slapi_log_error(SLAPI_LOG_FATAL, NULL, "\tremote offset: %ld\n", gen->state.remote_offset);
         slapi_log_error(SLAPI_LOG_FATAL, NULL, "\tsequence number: %d\n", gen->state.seq_num);
-        PR_RWLock_Unlock (gen->lock);
+        slapi_rwlock_unlock (gen->lock);
     }
 }
 
@@ -569,7 +569,7 @@ static int
 _csngen_init_callbacks (CSNGen *gen)
 {
 	/* create a lock to control access to the callback list */
-	gen->callbacks.lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "callback_lock");	
+	gen->callbacks.lock = slapi_new_rwlock();	
 	if (gen->callbacks.lock == NULL)
 	{
 		return CSN_NSPR_ERROR;
@@ -593,7 +593,7 @@ _csngen_free_callbacks (CSNGen *gen)
 	}
 
 	if (gen->callbacks.lock)
-		PR_DestroyRWLock (gen->callbacks.lock);
+		slapi_destroy_rwlock (gen->callbacks.lock);
 }
 
 static void 
@@ -604,7 +604,7 @@ _csngen_call_callbacks (const CSNGen *gen, const CSN *csn, PRBool abort)
 
 	PR_ASSERT (gen && csn);
 	
-	PR_RWLock_Rlock (gen->callbacks.lock);
+	slapi_rwlock_rdlock (gen->callbacks.lock);
 	node = (callback_node*)dl_get_first (gen->callbacks.list, &cookie);
 	while (node)
 	{
@@ -621,7 +621,7 @@ _csngen_call_callbacks (const CSNGen *gen, const CSN *csn, PRBool abort)
 		node = (callback_node*)dl_get_next (gen->callbacks.list, &cookie);
 	}
 
-	PR_RWLock_Unlock (gen->callbacks.lock);
+	slapi_rwlock_unlock (gen->callbacks.lock);
 }
 
 /* el1 is just a pointer to the callback_node */

+ 17 - 17
ldap/servers/slapd/dse.c

@@ -121,7 +121,7 @@ struct dse
     char *dse_filestartOK; /* contain the latest info with which the server has successfully started */
     Avlnode *dse_tree;
     struct dse_callback *dse_callback;
-    PRRWLock *dse_rwlock; /* a read-write lock to protect the whole dse backend */
+    Slapi_RWLock *dse_rwlock; /* a read-write lock to protect the whole dse backend */
 	char **dse_filelist; /* these are additional read only files used to */
 						 /* initialize the dse */
 	int  dse_is_updateable; /* if non-zero, this DSE can be written to */
@@ -211,7 +211,7 @@ dse_get_entry_copy( struct dse* pdse, const Slapi_DN *dn, int use_lock )
     struct dse_node *n;
 
 	if (use_lock == DSE_USE_LOCK && pdse->dse_rwlock)
-		PR_RWLock_Rlock(pdse->dse_rwlock);
+		slapi_rwlock_rdlock(pdse->dse_rwlock);
 
     n = dse_find_node( pdse, dn );
     if(n!=NULL)
@@ -220,7 +220,7 @@ dse_get_entry_copy( struct dse* pdse, const Slapi_DN *dn, int use_lock )
     }
 
 	if (use_lock == DSE_USE_LOCK && pdse->dse_rwlock)
-		PR_RWLock_Unlock(pdse->dse_rwlock);
+		slapi_rwlock_unlock(pdse->dse_rwlock);
 
     return e;
 }
@@ -373,7 +373,7 @@ dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfil
         pdse= (struct dse *)slapi_ch_calloc(1, sizeof(struct dse));
         if(pdse!=NULL)
         {
-			pdse->dse_rwlock = PR_NewRWLock(PR_RWLOCK_RANK_NONE,"dse lock");
+			pdse->dse_rwlock = slapi_new_rwlock();
             /* Set the full path name for the config DSE entry */
 			if (!strstr(filename, realconfigdir))
 			{
@@ -452,7 +452,7 @@ dse_destroy(struct dse *pdse)
         return 0; /* no one checks this return value */
     }
     if (pdse->dse_rwlock)
-        PR_RWLock_Wlock(pdse->dse_rwlock);
+        slapi_rwlock_wrlock(pdse->dse_rwlock);
     slapi_ch_free((void **)&(pdse->dse_filename));
     slapi_ch_free((void **)&(pdse->dse_tmpfile));
     slapi_ch_free((void **)&(pdse->dse_fileback));
@@ -461,8 +461,8 @@ dse_destroy(struct dse *pdse)
     charray_free(pdse->dse_filelist);
     nentries = avl_free(pdse->dse_tree, dse_internal_delete_entry);
     if (pdse->dse_rwlock) {
-        PR_RWLock_Unlock(pdse->dse_rwlock);
-        PR_DestroyRWLock(pdse->dse_rwlock);
+        slapi_rwlock_unlock(pdse->dse_rwlock);
+        slapi_destroy_rwlock(pdse->dse_rwlock);
     }
     slapi_ch_free((void **)&pdse);
     LDAPDebug( SLAPI_DSE_TRACELEVEL, "Removed [%d] entries from the dse tree.\n",
@@ -917,7 +917,7 @@ dse_check_for_readonly_error(Slapi_PBlock *pb, struct dse* pdse)
 	int		rc = 0;	/* default: no error */
 
 	if (pdse->dse_rwlock)
-		PR_RWLock_Rlock(pdse->dse_rwlock);
+		slapi_rwlock_rdlock(pdse->dse_rwlock);
 
 	if ( !pdse->dse_is_updateable ) {
 		if ( !pdse->dse_readonly_error_reported ) {
@@ -934,7 +934,7 @@ dse_check_for_readonly_error(Slapi_PBlock *pb, struct dse* pdse)
     }
 
 	if (pdse->dse_rwlock)
-		PR_RWLock_Unlock(pdse->dse_rwlock);
+		slapi_rwlock_unlock(pdse->dse_rwlock);
 
 	if ( rc != 0 ) {
         slapi_send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL,
@@ -1086,7 +1086,7 @@ dse_add_entry_pb(struct dse* pdse, Slapi_Entry *e, Slapi_PBlock *pb)
 
 	/* keep write lock during both tree update and file write operations */
 	if (pdse->dse_rwlock)
-		PR_RWLock_Wlock(pdse->dse_rwlock);
+		slapi_rwlock_wrlock(pdse->dse_rwlock);
 	if (merge) 
 	{
 		rc= avl_insert( &(pdse->dse_tree), n, entry_dn_cmp, dupentry_merge );
@@ -1110,7 +1110,7 @@ dse_add_entry_pb(struct dse* pdse, Slapi_Entry *e, Slapi_PBlock *pb)
 		dse_node_delete(&n); /* This also deletes the contained entry */
 	}
 	if (pdse->dse_rwlock)
-		PR_RWLock_Unlock(pdse->dse_rwlock);
+		slapi_rwlock_unlock(pdse->dse_rwlock);
 
 	if (rc == -1) 
 	{
@@ -1288,7 +1288,7 @@ dse_replace_entry( struct dse* pdse, Slapi_Entry *e, int write_file, int use_loc
     {
         struct dse_node *n= dse_node_new(e);
 		if (use_lock && pdse->dse_rwlock)
-			PR_RWLock_Wlock(pdse->dse_rwlock);
+			slapi_rwlock_wrlock(pdse->dse_rwlock);
         rc = avl_insert( &(pdse->dse_tree), n, entry_dn_cmp, dupentry_replace );
 		if (write_file)
 			dse_write_file_nolock(pdse);
@@ -1299,7 +1299,7 @@ dse_replace_entry( struct dse* pdse, Slapi_Entry *e, int write_file, int use_loc
 			rc = 0; /* for return to caller */
 		}
 		if (use_lock && pdse->dse_rwlock)
-			PR_RWLock_Unlock(pdse->dse_rwlock);
+			slapi_rwlock_unlock(pdse->dse_rwlock);
     }
     return rc;
 }
@@ -1400,7 +1400,7 @@ dse_delete_entry(struct dse* pdse, Slapi_PBlock *pb, const Slapi_Entry *e)
 
 	/* keep write lock for both tree deleting and file writing */
 	if (pdse->dse_rwlock)
-		PR_RWLock_Wlock(pdse->dse_rwlock);
+		slapi_rwlock_wrlock(pdse->dse_rwlock);
     if ((deleted_node = (struct dse_node *)avl_delete(&pdse->dse_tree,
 													  n, entry_dn_cmp)))
 		dse_node_delete(&deleted_node);
@@ -1414,7 +1414,7 @@ dse_delete_entry(struct dse* pdse, Slapi_PBlock *pb, const Slapi_Entry *e)
         dse_write_file_nolock(pdse);
     }
 	if (pdse->dse_rwlock)
-		PR_RWLock_Unlock(pdse->dse_rwlock);
+		slapi_rwlock_unlock(pdse->dse_rwlock);
 
     return 1;
 }
@@ -1591,10 +1591,10 @@ do_dse_search(struct dse* pdse, Slapi_PBlock *pb, int scope, const Slapi_DN *bas
 	if ( pb->pb_op == NULL
 			|| !operation_is_flag_set( pb->pb_op, OP_FLAG_PS_CHANGESONLY )) {
 		if (pdse->dse_rwlock)
-			PR_RWLock_Rlock(pdse->dse_rwlock);
+			slapi_rwlock_rdlock(pdse->dse_rwlock);
 		dse_apply_nolock(pdse,dse_search_filter_entry,(caddr_t)&stuff);
 		if (pdse->dse_rwlock)
-			PR_RWLock_Unlock(pdse->dse_rwlock);
+			slapi_rwlock_unlock(pdse->dse_rwlock);
 	}
 
 	if (stuff.ss) /* something was found which matched our criteria */

+ 2 - 2
ldap/servers/slapd/entry.c

@@ -1921,7 +1921,7 @@ slapi_entry_init(Slapi_Entry *e, char *dn, Slapi_Attr *a)
 	e->e_deleted_attrs= NULL;
 	e->e_virtual_attrs= NULL;
 	e->e_virtual_watermark= 0;
-	e->e_virtual_lock= PR_NewRWLock(PR_RWLOCK_RANK_NONE, "vattrValueCache");
+	e->e_virtual_lock= slapi_new_rwlock();
 	e->e_flags= 0;
 }
 
@@ -1942,7 +1942,7 @@ slapi_entry_free( Slapi_Entry *e ) /* JCM - Should be ** so that we can NULL the
 		attrlist_free(e->e_deleted_attrs);
 		attrlist_free(e->e_virtual_attrs);
 		if(e->e_virtual_lock)
-            PR_DestroyRWLock(e->e_virtual_lock);
+            slapi_destroy_rwlock(e->e_virtual_lock);
 		slapi_ch_free((void**)&e);
 	    PR_INCREMENT_COUNTER(slapi_entry_counter_deleted);
 	    PR_DECREMENT_COUNTER(slapi_entry_counter_exist);

+ 5 - 5
ldap/servers/slapd/index_subsystem.c

@@ -99,7 +99,7 @@ struct _globalIndexCache
 	indexPlugin *pPlugins;
 	indexEntry **ppIndexIndex; /* sorted list with key: indexEntry.indexedAttribute */
 	int index_count;
-	PRRWLock *cache_lock;
+	Slapi_RWLock *cache_lock;
 };
 typedef struct _globalIndexCache globalIndexCache;
 
@@ -123,17 +123,17 @@ static int index_subsys_index_matches_filter(indexEntry *index, Slapi_Filter *f)
 
 static void index_subsys_read_lock()
 {
-	PR_RWLock_Rlock(theCache->cache_lock);
+	slapi_rwlock_rdlock(theCache->cache_lock);
 }
 
 static void index_subsys_write_lock()
 {
-	PR_RWLock_Wlock(theCache->cache_lock);
+	slapi_rwlock_wrlock(theCache->cache_lock);
 }
 
 static void index_subsys_unlock()
 {
-	PR_RWLock_Unlock(theCache->cache_lock);
+	slapi_rwlock_unlock(theCache->cache_lock);
 }
 
 int slapi_index_entry_list_create(IndexEntryList **list)
@@ -962,7 +962,7 @@ int slapi_index_register_decoder(char *plugin_id, index_validate_callback valida
 			theCache->pPlugins = 0;
 			theCache->ppIndexIndex = 0;
 			theCache->index_count = 0;
-			theCache->cache_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "Index Plugins");;
+			theCache->cache_lock = slapi_new_rwlock();
 			firstTime = 0;
 
 			if(!gotIDLapi)

+ 5 - 5
ldap/servers/slapd/mapping_tree.c

@@ -116,7 +116,7 @@ struct mt_node
  *      release backend lock 
  *
  */
-static PRRWLock    *myLock;    /* global lock on the mapping tree structures */
+static Slapi_RWLock    *myLock;    /* global lock on the mapping tree structures */
 
 
 static mapping_tree_node *mapping_tree_root = NULL;
@@ -1619,7 +1619,7 @@ mapping_tree_init()
     slapi_register_supported_control(MTN_CONTROL_USE_ONE_BACKEND_EXT_OID,
                      SLAPI_OPERATION_SEARCH);
 
-    myLock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "mapping tree");
+    myLock = slapi_new_rwlock();
 
     be= slapi_be_select_by_instance_name(DSE_BACKEND);
     mapping_tree_root= add_internal_mapping_tree_node("", be, NULL);
@@ -3563,7 +3563,7 @@ static int lock_count = 0;
 
 void mtn_wlock()
 {
-    PR_RWLock_Wlock(myLock);
+    slapi_rwlock_wrlock(myLock);
 #ifdef DEBUG
     lock_count--;
     LDAPDebug(LDAP_DEBUG_ARGS, "mtn_wlock : lock count : %d\n", lock_count, 0, 0);
@@ -3572,7 +3572,7 @@ void mtn_wlock()
 
 void mtn_lock()
 {
-    PR_RWLock_Rlock(myLock);
+    slapi_rwlock_rdlock(myLock);
 #ifdef DEBUG
     lock_count++;
     LDAPDebug(LDAP_DEBUG_ARGS, "mtn_lock : lock count : %d\n", lock_count, 0, 0);
@@ -3591,7 +3591,7 @@ void mtn_unlock()
         lock_count = (int) 11111111;   /* this happening means problems */
     LDAPDebug(LDAP_DEBUG_ARGS, "mtn_unlock : lock count : %d\n", lock_count, 0, 0);
 #endif
-    PR_RWLock_Unlock(myLock);
+    slapi_rwlock_unlock(myLock);
 }
 
 #ifdef TEST_FOR_REGISTER_CHANGE

+ 14 - 16
ldap/servers/slapd/plugin.c

@@ -1486,7 +1486,7 @@ slapi_berval_cmp (const struct berval* L, const struct berval* R) /* JCM - This
 
 
 static char **supported_saslmechanisms = NULL;
-static PRRWLock *supported_saslmechanisms_lock = NULL;
+static Slapi_RWLock *supported_saslmechanisms_lock = NULL;
 
 /*
  * register a supported SASL mechanism so it will be returned as part of the
@@ -1499,8 +1499,7 @@ slapi_register_supported_saslmechanism( char *mechanism )
 		if (NULL == supported_saslmechanisms_lock) {
 			/* This is thread safe, as it gets executed by
 			 * a single thread at init time (main->init_saslmechanisms) */
-			supported_saslmechanisms_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE,
-				"supported saslmechanisms rwlock");
+			supported_saslmechanisms_lock = slapi_new_rwlock();
 			if (NULL == supported_saslmechanisms_lock) {
 				/* Out of resources */
 				slapi_log_error(SLAPI_LOG_FATAL, "startup",
@@ -1508,9 +1507,9 @@ slapi_register_supported_saslmechanism( char *mechanism )
 				exit (1);
 			}
 		}
-		PR_RWLock_Wlock(supported_saslmechanisms_lock);
+		slapi_rwlock_wrlock(supported_saslmechanisms_lock);
 		charray_add( &supported_saslmechanisms, slapi_ch_strdup( mechanism ));
-		PR_RWLock_Unlock(supported_saslmechanisms_lock);
+		slapi_rwlock_unlock(supported_saslmechanisms_lock);
 	}
 }
 
@@ -1534,15 +1533,15 @@ char **
 slapi_get_supported_saslmechanisms_copy( void )
 {
     char ** ret = NULL;
-    PR_RWLock_Rlock(supported_saslmechanisms_lock);
+    slapi_rwlock_rdlock(supported_saslmechanisms_lock);
     ret = charray_dup(supported_saslmechanisms);
-    PR_RWLock_Unlock(supported_saslmechanisms_lock);
+    slapi_rwlock_unlock(supported_saslmechanisms_lock);
     return( ret );
 }
 
 
 static char **supported_extended_ops = NULL;
-static PRRWLock *extended_ops_lock = NULL;
+static Slapi_RWLock *extended_ops_lock = NULL;
 
 /*
  * register all of the LDAPv3 extended operations we know about.
@@ -1550,8 +1549,7 @@ static PRRWLock *extended_ops_lock = NULL;
 void
 ldapi_init_extended_ops( void )
 {
-	extended_ops_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE,
-		"supported extended ops rwlock");
+	extended_ops_lock = slapi_new_rwlock();
 	if (NULL == extended_ops_lock) {
 		/* Out of resources */
 		slapi_log_error(SLAPI_LOG_FATAL, "startup",
@@ -1559,13 +1557,13 @@ ldapi_init_extended_ops( void )
 		exit (1);
 	}
 
-	PR_RWLock_Wlock(extended_ops_lock);
+	slapi_rwlock_wrlock(extended_ops_lock);
 	charray_add(&supported_extended_ops,
 	slapi_ch_strdup(EXTOP_BULK_IMPORT_START_OID));
 	charray_add(&supported_extended_ops,
 	slapi_ch_strdup(EXTOP_BULK_IMPORT_DONE_OID));
 	/* add future supported extops here... */
-	PR_RWLock_Unlock(extended_ops_lock);
+	slapi_rwlock_unlock(extended_ops_lock);
 }
 
 
@@ -1577,13 +1575,13 @@ ldapi_register_extended_op( char **opoids )
 {
     int	i;
 
-    PR_RWLock_Wlock(extended_ops_lock);
+    slapi_rwlock_wrlock(extended_ops_lock);
     for ( i = 0; opoids != NULL && opoids[i] != NULL; ++i ) {
 	if ( !charray_inlist( supported_extended_ops, opoids[i] )) {
 	    charray_add( &supported_extended_ops, slapi_ch_strdup( opoids[i] ));
 	}
     }
-    PR_RWLock_Unlock(extended_ops_lock);
+    slapi_rwlock_unlock(extended_ops_lock);
 }
 
 
@@ -1608,9 +1606,9 @@ char **
 slapi_get_supported_extended_ops_copy( void )
 {
     char ** ret = NULL;
-    PR_RWLock_Rlock(extended_ops_lock);
+    slapi_rwlock_rdlock(extended_ops_lock);
     ret = charray_dup(supported_extended_ops);
-    PR_RWLock_Unlock(extended_ops_lock);
+    slapi_rwlock_unlock(extended_ops_lock);
     return( ret );
 }
 

+ 19 - 21
ldap/servers/slapd/resourcelimit.c

@@ -142,7 +142,7 @@
  */
 /* Per-connection resource limits data */
 typedef struct slapi_reslimit_conndata {
-	PRRWLock	*rlcd_rwlock;			 /* to serialize access to the rest */
+	Slapi_RWLock	*rlcd_rwlock;			 /* to serialize access to the rest */
 	int			rlcd_integer_count;		 /* size of rlcd_integer_limit array */
 	PRBool		*rlcd_integer_available; /* array that says whether each */
 										 /*           value is available */
@@ -170,7 +170,7 @@ static struct slapi_componentid 				*reslimit_componentid=NULL;
  * reslimit_map_rwlock is used to serialize access to
  * reslimit_map and reslimit_map_count
  */
-static PRRWLock   					*reslimit_map_rwlock = NULL;
+static Slapi_RWLock   					*reslimit_map_rwlock = NULL;
 
 /*
  * Static functions.
@@ -206,10 +206,9 @@ reslimit_init( void )
 			return( -1 );
 		}
 
-		if (( reslimit_map_rwlock = PR_NewRWLock( PR_RWLOCK_RANK_NONE,
-					"resourcelimit map rwlock" )) == NULL ) {
+		if (( reslimit_map_rwlock = slapi_new_rwlock()) == NULL ) {
 			slapi_log_error( SLAPI_LOG_FATAL, SLAPI_RESLIMIT_MODULE,
-					"reslimit_init: PR_NewRWLock() failed\n" );
+					"reslimit_init: slapi_new_rwlock() failed\n" );
 			return( -1 );
 		}
 
@@ -243,7 +242,7 @@ reslimit_cleanup( void )
 	}
 
 	if ( reslimit_map_rwlock != NULL ) {
-		PR_DestroyRWLock( reslimit_map_rwlock );
+		slapi_destroy_rwlock( reslimit_map_rwlock );
 	}
 
 	if ( reslimit_componentid != NULL ) {
@@ -259,12 +258,11 @@ static void *
 reslimit_connext_constructor( void *object, void *parent )
 {
 	SLAPIResLimitConnData	*rlcdp;
-	PRRWLock				*rwlock;
+	Slapi_RWLock				*rwlock;
 
-	if (( rwlock = PR_NewRWLock( PR_RWLOCK_RANK_NONE,
-			"resource limit connection data rwlock" )) == NULL ) {
+	if (( rwlock = slapi_new_rwlock()) == NULL ) {
 		slapi_log_error( SLAPI_LOG_FATAL, SLAPI_RESLIMIT_MODULE,
-				"reslimit_connext_constructor: PR_NewRWLock() failed\n" );
+				"reslimit_connext_constructor: slapi_new_rwlock() failed\n" );
 		return( NULL );
 	}
 
@@ -290,7 +288,7 @@ reslimit_connext_destructor( void *extension, void *object, void *parent )
 	if ( rlcdp->rlcd_integer_value != NULL ) {
 			slapi_ch_free( (void **)&rlcdp->rlcd_integer_value );
 	}
-	PR_DestroyRWLock( rlcdp->rlcd_rwlock );
+	slapi_destroy_rwlock( rlcdp->rlcd_rwlock );
 	slapi_ch_free( (void **)&rlcdp );
 }
 
@@ -401,9 +399,9 @@ reslimit_update_from_entry( Slapi_Connection *conn, Slapi_Entry *e )
 	}
 
 	/* LOCK FOR READ -- map lock */
-	PR_RWLock_Rlock( reslimit_map_rwlock );
+	slapi_rwlock_rdlock( reslimit_map_rwlock );
 	/* LOCK FOR WRITE -- conn. data lock */
-	PR_RWLock_Wlock( rlcdp->rlcd_rwlock );
+	slapi_rwlock_wrlock( rlcdp->rlcd_rwlock );
 
 	if ( rlcdp->rlcd_integer_value == NULL ) {
 		rlcdp->rlcd_integer_count = reslimit_map_count;
@@ -456,9 +454,9 @@ reslimit_update_from_entry( Slapi_Connection *conn, Slapi_Entry *e )
 		}
 	}
 
-	PR_RWLock_Unlock( rlcdp->rlcd_rwlock );
+	slapi_rwlock_unlock( rlcdp->rlcd_rwlock );
 	/* UNLOCKED -- conn. data lock */
-	PR_RWLock_Unlock( reslimit_map_rwlock );
+	slapi_rwlock_unlock( reslimit_map_rwlock );
 	/* UNLOCKED -- map lock */
 
 log_and_return:
@@ -477,7 +475,7 @@ static char ** reslimit_get_registered_attributes()
 	char 		**attrs=NULL;
 
     	/* LOCK FOR READ -- map lock */
-        PR_RWLock_Rlock( reslimit_map_rwlock );
+        slapi_rwlock_rdlock( reslimit_map_rwlock );
 
         for ( i = 0; i < reslimit_map_count; ++i ) {
                 if ( reslimit_map[ i ].rlmap_at != NULL ) {
@@ -485,7 +483,7 @@ static char ** reslimit_get_registered_attributes()
                 }
         }
  
-        PR_RWLock_Unlock( reslimit_map_rwlock );
+        slapi_rwlock_unlock( reslimit_map_rwlock );
 
 	return attrs;
 }
@@ -535,7 +533,7 @@ slapi_reslimit_register( int type, const char *attrname, int *handlep )
 	}
 
 	/* LOCK FOR WRITE -- map lock */
-	PR_RWLock_Wlock( reslimit_map_rwlock );
+	slapi_rwlock_wrlock( reslimit_map_rwlock );
 
 	/*
 	 * check that attrname is not already registered
@@ -564,7 +562,7 @@ slapi_reslimit_register( int type, const char *attrname, int *handlep )
 	++reslimit_map_count;
 
 unlock_and_return:
-	PR_RWLock_Unlock( reslimit_map_rwlock );
+	slapi_rwlock_unlock( reslimit_map_rwlock );
 	/* UNLOCKED -- map lock */
 
 log_and_return:
@@ -621,7 +619,7 @@ slapi_reslimit_get_integer_limit( Slapi_Connection *conn, int handle,
 	if(rlcdp->rlcd_integer_count==0) { /* peek at it to avoid lock */
 		rc = SLAPI_RESLIMIT_STATUS_NOVALUE;
 	} else {
-		PR_RWLock_Rlock( rlcdp->rlcd_rwlock );
+		slapi_rwlock_rdlock( rlcdp->rlcd_rwlock );
 		if(rlcdp->rlcd_integer_count==0) {
 			rc = SLAPI_RESLIMIT_STATUS_NOVALUE;
 		} else if ( handle < 0 || handle >= rlcdp->rlcd_integer_count ) {
@@ -633,7 +631,7 @@ slapi_reslimit_get_integer_limit( Slapi_Connection *conn, int handle,
 		} else {
 			rc = SLAPI_RESLIMIT_STATUS_NOVALUE;
 		}
-		PR_RWLock_Unlock( rlcdp->rlcd_rwlock );
+		slapi_rwlock_unlock( rlcdp->rlcd_rwlock );
 	}
 
 

+ 6 - 7
ldap/servers/slapd/schema.c

@@ -188,7 +188,7 @@ static int schema_ignore_trailing_spaces =
 			SLAPD_DEFAULT_SCHEMA_IGNORE_TRAILING_SPACES;
 
 /* R/W lock used to serialize access to the schema DSE */
-static PRRWLock	*schema_dse_lock = NULL;
+static Slapi_RWLock	*schema_dse_lock = NULL;
 
 /*
  * The schema_dse_mandatory_init_callonce structure is used by NSPR to ensure
@@ -201,10 +201,9 @@ static PRCallOnceType schema_dse_mandatory_init_callonce = { 0, 0, 0 };
 static PRStatus
 schema_dse_mandatory_init( void )
 {
-	if ( NULL == ( schema_dse_lock = PR_NewRWLock( PR_RWLOCK_RANK_NONE,
-				"schema DSE rwlock" ))) {
+	if ( NULL == ( schema_dse_lock = slapi_new_rwlock())) {
 		slapi_log_error( SLAPI_LOG_FATAL, "schema_dse_mandatory_init",
-				"PR_NewRWLock() for schema DSE lock failed\n" );
+				"slapi_new_rwlock() for schema DSE lock failed\n" );
 		return PR_FAILURE;
 	}
 
@@ -219,7 +218,7 @@ schema_dse_lock_read( void )
 	if ( NULL != schema_dse_lock ||
 			PR_SUCCESS == PR_CallOnce( &schema_dse_mandatory_init_callonce,
 					schema_dse_mandatory_init )) {
-		PR_RWLock_Rlock( schema_dse_lock );
+		slapi_rwlock_rdlock( schema_dse_lock );
 	}
 }
 
@@ -230,7 +229,7 @@ schema_dse_lock_write( void )
 	if ( NULL != schema_dse_lock ||
 			PR_SUCCESS == PR_CallOnce( &schema_dse_mandatory_init_callonce,
 					schema_dse_mandatory_init )) {
-		PR_RWLock_Wlock( schema_dse_lock );
+		slapi_rwlock_wrlock( schema_dse_lock );
 	}
 }
 
@@ -239,7 +238,7 @@ static void
 schema_dse_unlock( void )
 {
 	if ( schema_dse_lock != NULL ) {
-		PR_RWLock_Unlock( schema_dse_lock );
+		slapi_rwlock_unlock( schema_dse_lock );
 	}
 }
 

+ 6 - 7
ldap/servers/slapd/schemaparse.c

@@ -58,7 +58,7 @@ static void     normalize_list( char **list );
 
 
 /* R/W lock used to protect the global objclass linked list. */
-static PRRWLock	*oc_lock = NULL;
+static Slapi_RWLock	*oc_lock = NULL;
 
 /*
  * The oc_init_lock_callonce structure is used by NSPR to ensure
@@ -71,10 +71,9 @@ static PRCallOnceType oc_init_lock_callonce = { 0, 0, 0 };
 static PRStatus
 oc_init_lock( void )
 {
-	if ( NULL == ( oc_lock = PR_NewRWLock( PR_RWLOCK_RANK_NONE,
-				"objectclass rwlock" ))) {
+	if ( NULL == ( oc_lock = slapi_new_rwlock())) {
 		slapi_log_error( SLAPI_LOG_FATAL, "oc_init_lock",
-				"PR_NewRWLock() for objectclass lock failed\n" );
+				"slapi_new_rwlock() for objectclass lock failed\n" );
 		return PR_FAILURE;
 	}
 
@@ -87,7 +86,7 @@ oc_lock_read( void )
 {
 	if ( NULL != oc_lock ||
 			PR_SUCCESS == PR_CallOnce( &oc_init_lock_callonce, oc_init_lock )) {
-		PR_RWLock_Rlock( oc_lock );
+		slapi_rwlock_rdlock( oc_lock );
 	}
 }
 
@@ -97,7 +96,7 @@ oc_lock_write( void )
 {
 	if ( NULL != oc_lock ||
 			PR_SUCCESS == PR_CallOnce( &oc_init_lock_callonce, oc_init_lock )) {
-		PR_RWLock_Wlock( oc_lock );
+		slapi_rwlock_wrlock( oc_lock );
 	}
 }
 
@@ -106,7 +105,7 @@ void
 oc_unlock( void )
 {
 	if ( oc_lock != NULL ) {
-		PR_RWLock_Unlock( oc_lock );
+		slapi_rwlock_unlock( oc_lock );
 	}
 }
 

+ 3 - 3
ldap/servers/slapd/slap.h

@@ -631,7 +631,7 @@ struct slapi_entry {
     Slapi_Attr *e_virtual_attrs; /* list of virtual attributes */
     time_t e_virtual_watermark;  /* indicates cache consistency when compared
                                     to global watermark */ 
-    PRRWLock *e_virtual_lock;    /* for access to cached vattrs */
+    Slapi_RWLock *e_virtual_lock;    /* for access to cached vattrs */
     void *e_extension;           /* A list of entry object extensions */
     unsigned char e_flags;
     Slapi_Attr *e_aux_attrs;     /* Attr list used for upgrade */
@@ -1189,8 +1189,8 @@ typedef struct backend {
 	PRLock *be_state_lock;		/* lock under which to modify the state */
 
     int     be_flags;		/* misc properties. See BE_FLAG_xxx defined in slapi-private.h */
-	PRRWLock    *be_lock;	
-	PRRWLock    *vlvSearchList_lock;
+	Slapi_RWLock    *be_lock;	
+	Slapi_RWLock    *vlvSearchList_lock;
 	void        *vlvSearchList;
 	Slapi_Counter *be_usn_counter; /* USN counter; one counter per backend */
 } backend;

+ 59 - 0
ldap/servers/slapd/slapi-plugin.h

@@ -5124,6 +5124,7 @@ int slapi_is_loglevel_set( const int loglevel );
  */
 typedef struct slapi_mutex	Slapi_Mutex;
 typedef struct slapi_condvar	Slapi_CondVar;
+typedef struct slapi_rwlock	Slapi_RWLock;
 Slapi_Mutex *slapi_new_mutex( void );
 void slapi_destroy_mutex( Slapi_Mutex *mutex );
 void slapi_lock_mutex( Slapi_Mutex *mutex );
@@ -5133,6 +5134,64 @@ void slapi_destroy_condvar( Slapi_CondVar *cvar );
 int slapi_wait_condvar( Slapi_CondVar *cvar, struct timeval *timeout );
 int slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all );
 
+/**
+ * Creates a new read/write lock.
+ *
+ * \return A pointer to a \c Slapi_RWLock
+ *
+ * \note Free the returned lock by calling slapi_destroy_rwlock() when finished
+ *
+ * \see slapi_destroy_rwlock()
+ * \see slapi_rwlock_rdlock()
+ * \see slapi_rwlock_wrlock()
+ * \see slapi_rwlock_unlock()
+ */
+Slapi_RWLock *slapi_new_rwlock( void );
+
+/**
+ * Free a read/write lock
+ *
+ * \see slapi_new_rwlock()
+ */
+void slapi_destroy_rwlock( Slapi_RWLock *rwlock );
+
+/**
+ * Acquires a reader lock
+ *
+ * \return 0 if successful
+ * \return Non-zero if an error occurred
+ *
+ * \note Release the acquired lock by calling slapi_rwlock_unlock()
+ * \note It is safe for a thread to hold multiple reader locks, but
+ *       you must call slapi_rwlock_unlock() for each aquired lock.
+ *
+ * \see slapi_rwlock_unlock()
+ */
+int slapi_rwlock_rdlock( Slapi_RWLock *rwlock );
+
+/**
+ * Acquires a writer lock
+ *
+ * \return 0 if successful
+ * \return Non-zero if an error occurred
+ *
+ * \note Release the acquired lock by calling slapi_rwlock_unlock()
+ *
+ * \see slapi_rwlock_unlock()
+ */
+int slapi_rwlock_wrlock( Slapi_RWLock *rwlock );
+
+/**
+ * Releases a reader or writer lock
+ *
+ * \return 0 if successful
+ * \return Non-zero if an error occurred
+ *
+ * \see slapi_rwlock_rdlock()
+ * \see slapi_rwlock_wrlock()
+ */
+int slapi_rwlock_unlock( Slapi_RWLock *rwlock );
+
 
 /*
  * thread-safe LDAP connections

+ 79 - 0
ldap/servers/slapd/slapi2nspr.c

@@ -210,3 +210,82 @@ slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all )
 
     return( prrc == PR_SUCCESS ? 1 : 0 );
 }
+
+Slapi_RWLock *
+slapi_new_rwlock(void)
+{
+#ifdef USE_POSIX_RWLOCKS
+    pthread_rwlock_t *rwlock = NULL;
+
+    rwlock = (pthread_rwlock_t *)slapi_ch_malloc(sizeof(pthread_rwlock_t));
+    if (rwlock) {
+        pthread_rwlock_init(rwlock, NULL);
+    }
+
+    return((Slapi_RWLock *)rwlock);
+#else
+    return((Slapi_RWLock *)PR_NewRWLock(PR_RWLOCK_RANK_NONE, "slapi_rwlock"));
+#endif
+}
+
+void
+slapi_destroy_rwlock(Slapi_RWLock *rwlock)
+{
+    if (rwlock != NULL) {
+#ifdef USE_POSIX_RWLOCKS
+        pthread_rwlock_destroy((pthread_rwlock_t *)rwlock);
+        slapi_ch_free((void **)&rwlock);
+#else
+        PR_DestroyLock((PRRWLock *)rwlock);
+#endif
+    }
+}
+
+int
+slapi_rwlock_rdlock( Slapi_RWLock *rwlock )
+{
+    int ret = 0;
+
+    if (rwlock != NULL) {
+#ifdef USE_POSIX_RWLOCKS
+        ret = pthread_rwlock_rdlock((pthread_rwlock_t *)rwlock);
+#else
+        PR_RWLock_Rlock((PRRWLock *)rwlock);
+#endif
+    }
+
+    return ret;
+}
+
+int
+slapi_rwlock_wrlock( Slapi_RWLock *rwlock )
+{
+    int ret = 0;
+
+    if (rwlock != NULL) {
+#ifdef USE_POSIX_RWLOCKS
+        ret = pthread_rwlock_wrlock((pthread_rwlock_t *)rwlock);
+#else
+        PR_RWLock_Wlock((PRRWLock *)rwlock);
+#endif
+    }
+
+    return ret;
+}
+
+int
+slapi_rwlock_unlock( Slapi_RWLock *rwlock )
+{
+    int ret = 0;
+
+    if (rwlock != NULL) {
+#ifdef USE_POSIX_RWLOCKS
+        ret = pthread_rwlock_unlock((pthread_rwlock_t *)rwlock);
+#else
+        PR_RWLock_Unlock((PRRWLock *)rwlock);
+#endif
+    }
+
+    return ret;
+}
+

+ 15 - 15
ldap/servers/slapd/vattr.c

@@ -1799,7 +1799,7 @@ typedef struct _vattr_map_entry vattr_map_entry;
 vattr_map_entry test_entry = {NULL};
 
 struct _vattr_map {
-	PRRWLock  *lock;
+	Slapi_RWLock  *lock;
 	PLHashTable *hashtable; /* Hash table */  
 };
 typedef struct _vattr_map vattr_map;
@@ -1848,7 +1848,7 @@ static int vattr_map_create()
 		return ENOMEM;
 	}
 
-	the_map->lock = PR_NewRWLock(0,SOURCEFILE "1");
+	the_map->lock = slapi_new_rwlock();
 	if (NULL == the_map) {
 		slapd_nasty(sourcefile,3,0);
 		return ENOMEM;
@@ -1863,7 +1863,7 @@ static void vattr_map_destroy()
 			PL_HashTableDestroy(the_map->hashtable);
 		}
 		if (the_map->lock) {
-			PR_DestroyRWLock(the_map->lock);
+			slapi_destroy_rwlock(the_map->lock);
 		}
 	}
 	slapi_ch_free ((void**)&the_map);
@@ -1897,11 +1897,11 @@ static int vattr_map_lookup(const char *type_to_find, vattr_map_entry **result)
 	}
 
 	/* Get the reader lock */
-	PR_RWLock_Rlock(the_map->lock);
+	slapi_rwlock_rdlock(the_map->lock);
     *result = (vattr_map_entry*)PL_HashTableLookupConst(the_map->hashtable,
 					      (void*)basetype);
 	/* Release ze lock */
-	PR_RWLock_Unlock(the_map->lock);
+	slapi_rwlock_unlock(the_map->lock);
 
 	if(tmp)
 	{
@@ -1926,13 +1926,13 @@ int vattr_map_insert(vattr_map_entry *vae)
 		return ENOMEM;
 	}
 	/* Get the writer lock */
-	PR_RWLock_Wlock(the_map->lock);
+	slapi_rwlock_wrlock(the_map->lock);
 	/* Insert the thing */
 	/* It's illegal to call this function if the entry is already there */
 	PR_ASSERT(NULL == PL_HashTableLookupConst(the_map->hashtable,(void*)copy_of_type_name));
     PL_HashTableAdd(the_map->hashtable,(void*)copy_of_type_name,(void*)vae);
 	/* Unlock and we're done */
-	PR_RWLock_Unlock(the_map->lock);
+	slapi_rwlock_unlock(the_map->lock);
 	return 0;
 }
 
@@ -2075,13 +2075,13 @@ static PRIntn vattr_map_entry_rebuild_schema(PLHashEntry *he, PRIntn i, void *ar
 void schema_changed_callback(Slapi_Entry *e, char *dn, int modtype, Slapi_PBlock *pb, void *caller_data)
 {
 	/* Get the writer lock */
-	PR_RWLock_Wlock(the_map->lock);
+	slapi_rwlock_wrlock(the_map->lock);
 
 	/* go through the list */
 	PL_HashTableEnumerateEntries(the_map->hashtable, vattr_map_entry_rebuild_schema, 0);
 
 	/* Unlock and we're done */
-	PR_RWLock_Unlock(the_map->lock);
+	slapi_rwlock_unlock(the_map->lock);
 }
 
 
@@ -2104,7 +2104,7 @@ int slapi_vattr_schema_check_type(Slapi_Entry *e, char *type)
 
 				if(0 == vattr_map_lookup(type, &map_entry))
 				{
-					PR_RWLock_Rlock(the_map->lock);
+					slapi_rwlock_rdlock(the_map->lock);
 
 					obj = map_entry->objectclasses;
 
@@ -2123,7 +2123,7 @@ int slapi_vattr_schema_check_type(Slapi_Entry *e, char *type)
 						obj = obj->pNext;
 					}
 
-					PR_RWLock_Unlock(the_map->lock);
+					slapi_rwlock_unlock(the_map->lock);
 				}
 
 				slapi_valueset_free(vs);
@@ -2333,19 +2333,19 @@ void slapi_vattrcache_cache_none()
 }
 
 void vattrcache_entry_READ_LOCK(const Slapi_Entry *e){
-	PR_RWLock_Rlock(e->e_virtual_lock);
+	slapi_rwlock_rdlock(e->e_virtual_lock);
 }
 
 void vattrcache_entry_READ_UNLOCK(const Slapi_Entry *e) {
-	PR_RWLock_Unlock(e->e_virtual_lock);
+	slapi_rwlock_unlock(e->e_virtual_lock);
 
 }
 void vattrcache_entry_WRITE_LOCK(const Slapi_Entry *e){
-	PR_RWLock_Wlock(e->e_virtual_lock);
+	slapi_rwlock_wrlock(e->e_virtual_lock);
 
 }
 void vattrcache_entry_WRITE_UNLOCK(const Slapi_Entry *e){
-	PR_RWLock_Unlock(e->e_virtual_lock);
+	slapi_rwlock_unlock(e->e_virtual_lock);
 }
 
 Slapi_PBlock *

文件差异内容过多而无法显示
+ 378 - 152
ltmain.sh


部分文件因为文件数量过多而无法显示