extern afs_kmutex_t rx_clock_mutex;
extern afs_kmutex_t rxi_connCacheMutex;
extern afs_kmutex_t rx_event_mutex;
-extern afs_kmutex_t osi_malloc_mutex;
extern afs_kmutex_t event_handler_mutex;
extern afs_kmutex_t listener_mutex;
extern afs_kmutex_t rx_if_init_mutex;
MUTEX_INIT(&epoch_mutex, "epoch", MUTEX_DEFAULT, 0);
MUTEX_INIT(&rx_init_mutex, "init", MUTEX_DEFAULT, 0);
MUTEX_INIT(&rx_event_mutex, "event", MUTEX_DEFAULT, 0);
- MUTEX_INIT(&osi_malloc_mutex, "malloc", MUTEX_DEFAULT, 0);
MUTEX_INIT(&event_handler_mutex, "event handler", MUTEX_DEFAULT, 0);
MUTEX_INIT(&rxi_connCacheMutex, "conn cache", MUTEX_DEFAULT, 0);
MUTEX_INIT(&listener_mutex, "listener", MUTEX_DEFAULT, 0);
*/
#ifndef osi_alloc
-#ifdef AFS_PTHREAD_ENV
-/*
- * This mutex protects the following global variables:
- * osi_alloccnt
- * osi_allocsize
- */
-
-afs_kmutex_t osi_malloc_mutex;
-#define LOCK_MALLOC_STATS MUTEX_ENTER(&osi_malloc_mutex);
-#define UNLOCK_MALLOC_STATS MUTEX_EXIT(&osi_malloc_mutex);
-#else
-#define LOCK_MALLOC_STATS
-#define UNLOCK_MALLOC_STATS
-#endif /* AFS_PTHREAD_ENV */
-long osi_alloccnt = 0, osi_allocsize = 0;
static const char memZero;
char *
osi_alloc(afs_int32 x)
*/
if (x == 0)
return (char *)&memZero;
- LOCK_MALLOC_STATS;
- osi_alloccnt++;
- osi_allocsize += x;
- UNLOCK_MALLOC_STATS;
return (char *)(mem_alloc(x));
}
{
if ((x == &memZero) || !x)
return 0;
- LOCK_MALLOC_STATS;
- osi_alloccnt--;
- osi_allocsize -= size;
- UNLOCK_MALLOC_STATS;
mem_free(x, size);
return 0;
}