*
*/
+#include "portable.h"
+
#include <stdio.h>
+#include <stdlib.h>
+#include <ac/unistd.h> /* 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.
*/
Rq *rq
)
{
- return( pthread_mutex_lock( &rq->rq_mutex ));
+ return( ldap_pvt_thread_mutex_lock( &rq->rq_mutex ));
}
-
-
-
/*
* Unlock the replication queue.
*/
Rq *rq
)
{
- return( pthread_mutex_unlock( &rq->rq_mutex ));
+ return( ldap_pvt_thread_mutex_unlock( &rq->rq_mutex ));
}
}
-
-
/*
* Return the next item in the queue. Callers should lock the queue before
* calling this routine.
}
-
-
/*
* Delete the item at the head of the list. The queue should be locked
* by the caller before calling this routine.
}
-
-
/*
* Add an entry to the tail of the replication queue. Locking is handled
* internally. When items are added to the queue, this routine wakes
/* 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 );
}
-
-
/*
* Garbage-collect the replication queue. Locking is handled internally.
*/
}
-
/*
* For debugging: dump the contents of the replication queue to a file.
* Locking is handled internally.
}
-
/*
* Write the contents of a replication queue to a file. Returns zero if
* successful, -1 if not. Handles queue locking internally. Callers should
}
-
-
/*
* Check to see if the private slurpd replication log needs trimming.
* The current criteria are:
}
-
-
/*
* Allocate and initialize an Rq object.
*/
(*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;
return 0;
}
-