* writing status information to disk.
*/
-#define DISABLE_BRIDGE
#include "portable.h"
#include <stdio.h>
+#include <stdlib.h>
#include <ac/string.h>
-#include <unistd.h>
+#include <ac/unistd.h>
#include "slurp.h"
#include "globals.h"
-#ifndef DECL_SYS_ERRLIST
-extern char *sys_errlist[];
-#endif /* DECL_SYS_ERRLIST */
-
/*
* Add information about replica host specified by Ri to list
* of hosts.
}
/* Serialize access to the St struct */
- pthread_mutex_lock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_lock( &(st->st_mutex ));
st->st_nreplicas++;
ind = st->st_nreplicas - 1;
st->st_data = ( Stel ** ) ch_realloc( st->st_data,
( st->st_nreplicas * sizeof( Stel * )));
if ( st->st_data == NULL ) {
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return NULL;
}
st->st_data[ ind ] = ( Stel * ) ch_malloc( sizeof( Stel ) );
if ( st->st_data[ ind ] == NULL ) {
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return NULL;
}
memset( st->st_data[ ind ]->last, 0, sizeof( st->st_data[ ind ]->last ));
st->st_data[ ind ]->seq = 0;
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return st->st_data[ ind ];
}
if ( st == NULL ) {
return -1;
}
- pthread_mutex_lock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_lock( &(st->st_mutex ));
if ( st->st_fp == NULL ) {
/* Open file */
if (( rc = acquire_lock( sglob->slurpd_status_file, &(st->st_fp),
"Error: cannot open status file \"%s\": %s\n",
sglob->slurpd_status_file, sys_errlist[ errno ], 0 );
st->st_err_logged = 1;
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return -1;
}
} else {
}
fflush( st->st_fp );
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return 0;
}
return -1;
}
- pthread_mutex_lock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_lock( &(st->st_mutex ));
strcpy( stel->last, re->re_timestamp );
stel->seq = re->re_seq;
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return 0;
}
if ( st == NULL ) {
return -1;
}
- pthread_mutex_lock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_lock( &(st->st_mutex ));
if ( access( sglob->slurpd_status_file, F_OK ) < 0 ) {
/*
* File doesn't exist, so create it and return.
if (( fp = fopen( sglob->slurpd_status_file, "w" )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "Error: cannot create status file \"%s\"\n",
sglob->slurpd_status_file, 0, 0 );
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return -1;
}
(void) fclose( fp );
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
Debug( LDAP_DEBUG_ARGS, "No status file found, defaulting values\n",
0, 0, 0 );
return 0;
}
if (( rc = acquire_lock( sglob->slurpd_status_file, &fp, &lfp)) < 0 ) {
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return 0;
}
while ( fgets( buf, sizeof( buf ), fp ) != NULL ) {
}
}
(void) relinquish_lock( sglob->slurpd_status_file, fp, lfp);
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return 0;
bad:
(void) relinquish_lock( sglob->slurpd_status_file, fp, lfp);
- pthread_mutex_unlock( &(st->st_mutex ));
+ ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return -1;
}
St *st
)
{
- return( pthread_mutex_lock( &st->st_mutex ));
+ return( ldap_pvt_thread_mutex_lock( &st->st_mutex ));
}
St *st
)
{
- return( pthread_mutex_unlock( &st->st_mutex ));
+ return( ldap_pvt_thread_mutex_unlock( &st->st_mutex ));
}
return -1;
}
- pthread_mutex_init( &((*st)->st_mutex), pthread_mutexattr_default );
+ ldap_pvt_thread_mutex_init( &((*st)->st_mutex) );
(*st)->st_data = NULL;
(*st)->st_fp = NULL;
(*st)->st_lfp = NULL;