#endif
#ifdef AFS_PTHREAD_ENV
-#include <assert.h>
/*
* Use procedural initialization of mutexes/condition variables
MUTEX_INIT(&rxkad_random_mutex, "rxkad random", MUTEX_DEFAULT, 0);
MUTEX_INIT(&rx_debug_mutex, "debug", MUTEX_DEFAULT, 0);
- assert(pthread_cond_init
+ osi_Assert(pthread_cond_init
(&rx_event_handler_cond, (const pthread_condattr_t *)0) == 0);
- assert(pthread_cond_init(&rx_listener_cond, (const pthread_condattr_t *)0)
+ osi_Assert(pthread_cond_init(&rx_listener_cond, (const pthread_condattr_t *)0)
== 0);
- assert(pthread_key_create(&rx_thread_id_key, NULL) == 0);
- assert(pthread_key_create(&rx_ts_info_key, NULL) == 0);
+ osi_Assert(pthread_key_create(&rx_thread_id_key, NULL) == 0);
+ osi_Assert(pthread_key_create(&rx_ts_info_key, NULL) == 0);
rxkad_global_stats_init();
}
pthread_once_t rx_once_init = PTHREAD_ONCE_INIT;
-#define INIT_PTHREAD_LOCKS \
-assert(pthread_once(&rx_once_init, rxi_InitPthread)==0)
+#define INIT_PTHREAD_LOCKS osi_Assert(pthread_once(&rx_once_init, rxi_InitPthread)==0)
/*
* The rx_stats_mutex mutex protects the following global variables:
* rxi_lowConnRefCount
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
-#include <assert.h>
#include "rx.h"
#include "rx_clock.h"
#endif
signal(SIGALRM, SIG_IGN);
if (setitimer(ITIMER_REAL, &itimer, &otimer) != 0) {
- fprintf(stderr, "clock: could not set interval timer; \
- aborted(errno=%d)\n", errno);
- fflush(stderr);
- assert(0);
+ osi_Panic("clock: could not set interval timer; aborted(errno=%d)\n",
+ errno);
}
if (relclock_epoch.usec + startvalue.usec >= otimer.it_value.tv_usec) {
relclock_epoch.sec = relclock_epoch.sec +
#include <sys/types.h>
#include <errno.h>
-#include <assert.h>
#include "rx.h"
/*
* rxevent_initialized
*/
-#include <assert.h>
afs_kmutex_t rx_event_mutex;
#define LOCK_EV_INIT MUTEX_ENTER(&rx_event_mutex)
#define UNLOCK_EV_INIT MUTEX_EXIT(&rx_event_mutex)
do { \
ts_info_p = (struct rx_ts_info_t*)pthread_getspecific(rx_ts_info_key); \
if (ts_info_p == NULL) { \
- assert((ts_info_p = rx_ts_info_init()) != NULL); \
+ osi_Assert((ts_info_p = rx_ts_info_init()) != NULL); \
} \
} while(0)
#endif /* AFS_PTHREAD_ENV */
# include <sys/ioctl.h>
# include <sys/time.h>
#endif
-# include <assert.h>
# include "rx.h"
# include "rx_atomic.h"
# include "rx_globals.h"
nextPollTime = 0;
code = LWP_CurrentProcess(&pid);
if (code) {
- fprintf(stderr, "rxi_Listener: Can't get my pid.\n");
- assert(0);
+ osi_Panic("rxi_Listener: Can't get my pid.\n");
}
rx_listenerPid = pid;
if (swapNameProgram)
newcall = NULL;
threadID = -1;
rxi_ListenerProc(rfds, &threadID, &newcall);
- /* assert(threadID != -1); */
- /* assert(newcall != NULL); */
+ /* osi_Assert(threadID != -1); */
+ /* osi_Assert(newcall != NULL); */
sock = OSI_NULLSOCKET;
rxi_ServerProc(threadID, newcall, &sock);
- /* assert(sock != OSI_NULLSOCKET); */
+ /* osi_Assert(sock != OSI_NULLSOCKET); */
}
/* not reached */
return NULL;
while (1) {
sock = OSI_NULLSOCKET;
rxi_ServerProc(threadID, newcall, &sock);
- /* assert(sock != OSI_NULLSOCKET); */
+ /* osi_Assert(sock != OSI_NULLSOCKET); */
newcall = NULL;
rxi_ListenerProc(rfds, &threadID, &newcall);
- /* assert(threadID != -1); */
- /* assert(newcall != NULL); */
+ /* osi_Assert(threadID != -1); */
+ /* osi_Assert(newcall != NULL); */
}
/* not reached */
return NULL;
* osi_allocsize
*/
-#include <assert.h>
afs_kmutex_t osi_malloc_mutex;
#define LOCK_MALLOC_STATS MUTEX_ENTER(&osi_malloc_mutex);
#define UNLOCK_MALLOC_STATS MUTEX_EXIT(&osi_malloc_mutex);
#include "rx_internal.h"
#include "rx_stats.h"
#include <lwp.h>
-#include <assert.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#ifdef RXDEBUG
}
- assert(p != NULL);
+ osi_Assert(p != NULL);
dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %"AFS_PTR_FMT" resend %d.%.3d len %d\n",
deliveryType, p->header.serial, rx_packetTypes[p->header.type - 1], ntohl(peer->host),
# include <sys/ioctl.h>
# include <sys/time.h>
# include <unistd.h>
+# include <assert.h>
#endif
#include <sys/stat.h>
#include <rx/rx.h>
#include <rx/rx_globals.h>
-#include <assert.h>
#include <rx/rx_pthread.h>
#include <rx/rx_clock.h>
#include "rx_atomic.h"
AFS_SIGSET_DECL;
if (pthread_attr_init(&tattr) != 0) {
- dpf(("Unable to Create Rx server thread (pthread_attr_init)\n"));
- assert(0);
+ osi_Panic("Unable to Create Rx server thread (pthread_attr_init)\n");
}
if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) != 0) {
- dpf
- (("Unable to Create Rx server thread (pthread_attr_setdetachstate)\n"));
- assert(0);
+ osi_Panic("Unable to Create Rx server thread (pthread_attr_setdetachstate)\n");
}
/*
*/
AFS_SIGSET_CLEAR();
if (pthread_create(&thread, &tattr, server_entry, (void *)proc) != 0) {
- dpf(("Unable to Create Rx server thread\n"));
- assert(0);
+ osi_Panic("Unable to Create Rx server thread\n");
}
AFS_SIGSET_RESTORE();
}
} else {
if (!(p = rxi_AllocPacket(RX_PACKET_CLASS_RECEIVE))) {
/* Could this happen with multiple socket listeners? */
- dpf(("rxi_Listener: no packets!")); /* Shouldn't happen */
- assert(0);
+ osi_Panic("rxi_Listener: no packets!"); /* Shouldn't happen */
}
}
newcall = NULL;
threadID = -1;
rxi_ListenerProc(sock, &threadID, &newcall);
- /* assert(threadID != -1); */
- /* assert(newcall != NULL); */
+ /* osi_Assert(threadID != -1); */
+ /* osi_Assert(newcall != NULL); */
sock = OSI_NULLSOCKET;
- assert(pthread_setspecific(rx_thread_id_key, (void *)(intptr_t)threadID) == 0);
+ osi_Assert(pthread_setspecific(rx_thread_id_key, (void *)(intptr_t)threadID) == 0);
rxi_ServerProc(threadID, newcall, &sock);
- /* assert(sock != OSI_NULLSOCKET); */
+ /* osi_Assert(sock != OSI_NULLSOCKET); */
}
/* not reached */
return NULL;
while (1) {
sock = OSI_NULLSOCKET;
- assert(pthread_setspecific(rx_thread_id_key, (void *)(intptr_t)threadID) == 0);
+ osi_Assert(pthread_setspecific(rx_thread_id_key, (void *)(intptr_t)threadID) == 0);
rxi_ServerProc(threadID, newcall, &sock);
- /* assert(sock != OSI_NULLSOCKET); */
+ /* osi_Assert(sock != OSI_NULLSOCKET); */
newcall = NULL;
rxi_ListenerProc(sock, &threadID, &newcall);
- /* assert(threadID != -1); */
- /* assert(newcall != NULL); */
+ /* osi_Assert(threadID != -1); */
+ /* osi_Assert(newcall != NULL); */
}
/* not reached */
return NULL;
return;
if (pthread_attr_init(&tattr) != 0) {
- dpf
- (("Unable to create Rx event handling thread (pthread_attr_init)\n"));
- assert(0);
+ osi_Panic("Unable to create Rx event handling thread (pthread_attr_init)\n");
}
if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) != 0) {
- dpf
- (("Unable to create Rx event handling thread (pthread_attr_setdetachstate)\n"));
- assert(0);
+ osi_Panic("Unable to create Rx event handling thread (pthread_attr_setdetachstate)\n");
}
AFS_SIGSET_CLEAR();
if (pthread_create(&event_handler_thread, &tattr, event_handler, NULL) !=
0) {
- dpf(("Unable to create Rx event handling thread\n"));
- assert(0);
+ osi_Panic("Unable to create Rx event handling thread\n");
}
rx_NewThreadId();
AFS_SIGSET_RESTORE();
AFS_SIGSET_DECL;
if (pthread_attr_init(&tattr) != 0) {
- dpf
- (("Unable to create socket listener thread (pthread_attr_init)\n"));
- assert(0);
+ osi_Panic("Unable to create socket listener thread (pthread_attr_init)\n");
}
if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) != 0) {
- dpf
- (("Unable to create socket listener thread (pthread_attr_setdetachstate)\n"));
- assert(0);
+ osi_Panic("Unable to create socket listener thread (pthread_attr_setdetachstate)\n");
}
AFS_SIGSET_CLEAR();
if (pthread_create(&thread, &tattr, rx_ListenerProc, (void *)(intptr_t)sock) != 0) {
- dpf(("Unable to create socket listener thread\n"));
- assert(0);
+ osi_Panic("Unable to create socket listener thread\n");
}
rx_NewThreadId();
AFS_SIGSET_RESTORE();
struct rx_ts_info_t * rx_ts_info_init(void) {
struct rx_ts_info_t * rx_ts_info;
rx_ts_info = (rx_ts_info_t *) malloc(sizeof(rx_ts_info_t));
- assert(rx_ts_info != NULL && pthread_setspecific(rx_ts_info_key, rx_ts_info) == 0);
+ osi_Assert(rx_ts_info != NULL && pthread_setspecific(rx_ts_info_key, rx_ts_info) == 0);
memset(rx_ts_info, 0, sizeof(rx_ts_info_t));
#ifdef RX_ENABLE_TSFPQ
queue_Init(&rx_ts_info->_FPQ);
}
MUTEX_EXIT(&call->lock);
} else
- /* assert(cp); */
+ /* osi_Assert(cp); */
/* MTUXXX this should be replaced by some error-recovery code before shipping */
/* yes, the following block is allowed to be the ELSE clause (or not) */
/* It's possible for call->nLeft to be smaller than any particular
#include "rx_globals.h"
#include "rx_stats.h"
#ifdef AFS_PTHREAD_ENV
-#include <assert.h>
/*
* The rx_if_init_mutex mutex protects the following global variables:
* counter
* rxkad_EpochWasSet
*/
-#include <assert.h>
pthread_mutex_t rxkad_client_uid_mutex;
-#define LOCK_CUID assert(pthread_mutex_lock(&rxkad_client_uid_mutex)==0)
-#define UNLOCK_CUID assert(pthread_mutex_unlock(&rxkad_client_uid_mutex)==0)
+#define LOCK_CUID osi_Assert(pthread_mutex_lock(&rxkad_client_uid_mutex)==0)
+#define UNLOCK_CUID osi_Assert(pthread_mutex_unlock(&rxkad_client_uid_mutex)==0)
#else
#define LOCK_CUID
#define UNLOCK_CUID
(ptr)->prev->next = (ptr); \
else \
(head) = (ptr); \
- assert((head) && ((head)->prev == NULL)); \
+ osi_Assert((head) && ((head)->prev == NULL)); \
} while(0)
void rxkad_global_stats_init(void) {
- assert(pthread_mutex_init(&rxkad_global_stats_lock, (const pthread_mutexattr_t *)0) == 0);
- assert(pthread_key_create(&rxkad_stats_key, NULL) == 0);
+ osi_Assert(pthread_mutex_init(&rxkad_global_stats_lock, (const pthread_mutexattr_t *)0) == 0);
+ osi_Assert(pthread_key_create(&rxkad_stats_key, NULL) == 0);
memset(&rxkad_global_stats, 0, sizeof(rxkad_global_stats));
}
rxkad_thr_stats_init(void) {
rxkad_stats_t * rxkad_stats;
rxkad_stats = (rxkad_stats_t *)malloc(sizeof(rxkad_stats_t));
- assert(rxkad_stats != NULL && pthread_setspecific(rxkad_stats_key,rxkad_stats) == 0);
+ osi_Assert(rxkad_stats != NULL && pthread_setspecific(rxkad_stats_key,rxkad_stats) == 0);
memset(rxkad_stats,0,sizeof(rxkad_stats_t));
RXKAD_GLOBAL_STATS_LOCK;
DLL_INSERT_TAIL(rxkad_stats, rxkad_global_stats.first, rxkad_global_stats.last, next, prev);
int rxkad_stats_agg(rxkad_stats_t * rxkad_stats) {
rxkad_stats_t * thr_stats;
- assert(rxkad_stats != NULL);
+ osi_Assert(rxkad_stats != NULL);
memset(rxkad_stats, 0, sizeof(rxkad_stats_t));
RXKAD_GLOBAL_STATS_LOCK;
for (thr_stats = rxkad_global_stats.first; thr_stats != NULL; thr_stats = thr_stats->next) {
* seed
*/
-#include <assert.h>
pthread_mutex_t rxkad_random_mutex
#ifdef PTHREAD_MUTEX_INITIALIZER
= PTHREAD_MUTEX_INITIALIZER
#endif
;
-#define LOCK_RM assert(pthread_mutex_lock(&rxkad_random_mutex)==0)
-#define UNLOCK_RM assert(pthread_mutex_unlock(&rxkad_random_mutex)==0)
+#define LOCK_RM osi_Assert(pthread_mutex_lock(&rxkad_random_mutex)==0)
+#define UNLOCK_RM osi_Assert(pthread_mutex_unlock(&rxkad_random_mutex)==0)
#else
#define LOCK_RM
#define UNLOCK_RM
};
#include <pthread.h>
-#include <assert.h>
extern pthread_mutex_t rxkad_global_stats_lock;
extern pthread_key_t rxkad_stats_key;
#define BEGIN do {
#define END } while(0)
#endif
-#define RXKAD_GLOBAL_STATS_LOCK assert(pthread_mutex_lock(&rxkad_global_stats_lock)==0)
-#define RXKAD_GLOBAL_STATS_UNLOCK assert(pthread_mutex_unlock(&rxkad_global_stats_lock)==0)
+#define RXKAD_GLOBAL_STATS_LOCK osi_Assert(pthread_mutex_lock(&rxkad_global_stats_lock)==0)
+#define RXKAD_GLOBAL_STATS_UNLOCK osi_Assert(pthread_mutex_unlock(&rxkad_global_stats_lock)==0)
#define GET_RXKAD_STATS(stats) rxkad_stats_agg(stats)
#define GET_RXKAD_THR_STATS(rxkad_stats) \
BEGIN \
(rxkad_stats) = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \
if ((rxkad_stats) == NULL) { \
- assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
+ osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
} \
END
#define INC_RXKAD_STATS(stats_elem) \
rxkad_stats_t * rxkad_stats; \
rxkad_stats = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \
if (rxkad_stats == NULL) { \
- assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
+ osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
} \
rxkad_stats->stats_elem++; \
END
rxkad_stats_t * rxkad_stats; \
rxkad_stats = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \
if (rxkad_stats == NULL) { \
- assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
+ osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
} \
rxkad_stats->stats_elem--; \
END
rxkad_stats_t * rxkad_stats; \
rxkad_stats = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \
if (rxkad_stats == NULL) { \
- assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
+ osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
} \
rxkad_stats->stats_elem += inc_value; \
END
rxkad_stats_t * rxkad_stats; \
rxkad_stats = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \
if (rxkad_stats == NULL) { \
- assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
+ osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \
} \
rxkad_stats->stats_elem -= dec_value; \
END