X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslurpd%2Frq.c;h=4ef66727bd51014f8e0e09adbecd6f86089a5944;hb=9568a013a8793ab5eddc2acb5c8027fb5a757a0c;hp=3fb842d48e99bef45be02c28dc2d144773efd584;hpb=fa2da63ca4d3f48793de5421f56c23c1c6d794ab;p=openldap diff --git a/servers/slurpd/rq.c b/servers/slurpd/rq.c index 3fb842d48e..4ef66727bd 100644 --- a/servers/slurpd/rq.c +++ b/servers/slurpd/rq.c @@ -31,23 +31,17 @@ * */ +#include "portable.h" + #include +#include +#include /* get ftruncate() */ + #include "slurp.h" #include "globals.h" -/* externs */ -#ifdef NEEDPROTOS -extern void Re_dump( Re *re ); -#else /* NEEDPROTOS */ -extern void Re_dump(); -#endif /* NEEDPROTOS */ - -#ifndef SYSERRLIST_IN_STDIO -extern char *sys_errlist[]; -#endif /* SYSERRLIST_IN_STDIO */ - /* * Lock the replication queue. */ @@ -56,13 +50,10 @@ Rq_lock( Rq *rq ) { - return( pthread_mutex_lock( &rq->rq_mutex )); + return( ldap_pvt_thread_mutex_lock( &rq->rq_mutex )); } - - - /* * Unlock the replication queue. */ @@ -71,7 +62,7 @@ Rq_unlock( Rq *rq ) { - return( pthread_mutex_unlock( &rq->rq_mutex )); + return( ldap_pvt_thread_mutex_unlock( &rq->rq_mutex )); } @@ -89,8 +80,6 @@ Rq_gethead( } - - /* * Return the next item in the queue. Callers should lock the queue before * calling this routine. @@ -108,8 +97,6 @@ Rq_getnext( } - - /* * Delete the item at the head of the list. The queue should be locked * by the caller before calling this routine. @@ -144,8 +131,6 @@ Rq_delhead( } - - /* * Add an entry to the tail of the replication queue. Locking is handled * internally. When items are added to the queue, this routine wakes @@ -200,7 +185,7 @@ Rq_add( /* Increment count of items in queue */ rq->rq_nre++; /* wake up any threads waiting for more work */ - pthread_cond_broadcast( &rq->rq_more ); + ldap_pvt_thread_cond_broadcast( &rq->rq_more ); /* ... and unlock the queue */ rq->rq_unlock( rq ); @@ -209,8 +194,6 @@ Rq_add( } - - /* * Garbage-collect the replication queue. Locking is handled internally. */ @@ -234,7 +217,6 @@ Rq_gc( } - /* * For debugging: dump the contents of the replication queue to a file. * Locking is handled internally. @@ -268,7 +250,6 @@ Rq_dump( } - /* * Write the contents of a replication queue to a file. Returns zero if * successful, -1 if not. Handles queue locking internally. Callers should @@ -317,8 +298,6 @@ Rq_write( } - - /* * Check to see if the private slurpd replication log needs trimming. * The current criteria are: @@ -391,8 +370,6 @@ Rq_getcount( } - - /* * Allocate and initialize an Rq object. */ @@ -421,8 +398,8 @@ Rq_init( (*rq)->rq_getcount = Rq_getcount; /* Initialize private data */ - pthread_mutex_init( &((*rq)->rq_mutex), pthread_mutexattr_default ); - pthread_cond_init( &((*rq)->rq_more), pthread_condattr_default ); + ldap_pvt_thread_mutex_init( &((*rq)->rq_mutex) ); + ldap_pvt_thread_cond_init( &((*rq)->rq_more) ); (*rq)->rq_head = NULL; (*rq)->rq_tail = NULL; (*rq)->rq_nre = 0; @@ -431,4 +408,3 @@ Rq_init( return 0; } -