umem.c File Reference

#include "config.h"
#include <umem_impl.h>
#include <sys/vmem_impl_user.h>
#include "umem_base.h"
#include "vmem_base.h"
#include <sys/sysmacros.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <signal.h>
#include <unistd.h>
#include "misc.h"

Defines

#define UMEM_VMFLAGS(umflag)   (VM_NOSLEEP)
#define NUM_ALLOC_SIZES   (sizeof (umem_alloc_sizes) / sizeof (*umem_alloc_sizes))
#define UMEM_MAXBUF   16384
#define CPUHINT()   (_thr_self())
#define CPUHINT_MAX()   INT_MAX
#define CPU(mask)   (umem_cpus + (CPUHINT() & (mask)))
#define IN_UPDATE()
#define IN_REAP()   IN_UPDATE()
#define ALLOC_TABLE_4   &umem_null_cache, &umem_null_cache, &umem_null_cache, &umem_null_cache
#define ALLOC_TABLE_64
#define ALLOC_TABLE_1024
#define UMERR_MODIFIED   0
#define UMERR_REDZONE   1
#define UMERR_DUPFREE   2
#define UMERR_BADADDR   3
#define UMERR_BADBUFTAG   4
#define UMERR_BADBUFCTL   5
#define UMERR_BADCACHE   6
#define UMERR_BADSIZE   7
#define UMERR_BADBASE   8
#define UMEM_AUDIT(lp, cp, bcp)

Functions

thread_t _thr_self (void)
int _cond_wait (cond_t *cv, mutex_t *mutex)
void umem_cache_applyall (void(*func)(umem_cache_t *))
void umem_nofail_callback (umem_nofail_callback_t *cb)
void * _umem_cache_alloc (umem_cache_t *cp, int umflag)
void _umem_cache_free (umem_cache_t *cp, void *buf)
void * _umem_zalloc (size_t size, int umflag)
void * _umem_alloc (size_t size, int umflag)
void * _umem_alloc_align (size_t size, size_t align, int umflag)
void _umem_free (void *buf, size_t size)
void _umem_free_align (void *buf, size_t size)
void umem_cache_update (umem_cache_t *cp)
void umem_process_updates (void)
void umem_reap (void)
umem_cache_tumem_cache_create (char *name, size_t bufsize, size_t align, umem_constructor_t *constructor, umem_destructor_t *destructor, umem_reclaim_t *reclaim, void *private, vmem_t *vmp, int cflags)
void umem_cache_destroy (umem_cache_t *cp)
void umem_startup (caddr_t start, size_t len, size_t pagesize, caddr_t minstack, caddr_t maxstack)
int umem_init (void)

Variables

size_t pagesize
uint32_t umem_max_ncpus
uint32_t umem_stack_depth = 15
uint32_t umem_reap_interval = 10
uint_t umem_depot_contention = 2
uint_t umem_abort = 1
uint_t umem_output = 0
uint_t umem_logging = 0
uint32_t umem_mtbf = 0
size_t umem_transaction_log_size
size_t umem_content_log_size
size_t umem_failure_log_size
size_t umem_slab_log_size
size_t umem_content_maxsave = 256
size_t umem_lite_minsize = 0
size_t umem_lite_maxalign = 1024
size_t umem_maxverify
size_t umem_minfirewall
uint_t umem_flags = 0
mutex_t umem_init_lock = DEFAULTMUTEX
cond_t umem_init_cv = DEFAULTCV
thread_t umem_init_thr
int umem_init_env_ready
int umem_ready = UMEM_READY_STARTUP
mutex_t umem_flags_lock = DEFAULTMUTEX
vmem_tumem_memalign_arena
umem_log_header_tumem_transaction_log
umem_log_header_tumem_content_log
umem_log_header_tumem_failure_log
umem_log_header_tumem_slab_log
volatile uint32_t umem_reaping
thread_t umem_update_thr
struct timeval umem_update_next
volatile thread_t umem_st_update_thr
mutex_t umem_update_lock = DEFAULTMUTEX
cond_t umem_update_cv = DEFAULTCV
volatile hrtime_t umem_reap_next
mutex_t umem_cache_lock = DEFAULTMUTEX
umem_cache_t umem_null_cache
caddr_t umem_min_stack
caddr_t umem_max_stack
struct {
   hrtime_t   ump_timestamp
   int   ump_error
   void *   ump_buffer
   void *   ump_realbuf
   umem_cache_t *   ump_cache
   umem_cache_t *   ump_realcache
   umem_slab_t *   ump_slab
   umem_bufctl_t *   ump_bufctl
umem_abort_info

Define Documentation

#define ALLOC_TABLE_1024

Value:

#define ALLOC_TABLE_4   &umem_null_cache, &umem_null_cache, &umem_null_cache, &umem_null_cache

#define ALLOC_TABLE_64

Value:

#define CPU ( mask   )     (umem_cpus + (CPUHINT() & (mask)))

 
#define CPUHINT (  )     (_thr_self())

 
#define CPUHINT_MAX (  )     INT_MAX

 
#define IN_REAP (  )     IN_UPDATE()

 
#define IN_UPDATE (  ) 

Value:

#define NUM_ALLOC_SIZES   (sizeof (umem_alloc_sizes) / sizeof (*umem_alloc_sizes))

#define UMEM_AUDIT ( lp,
cp,
bcp   ) 

Value:

{                                                                       \
        umem_bufctl_audit_t *_bcp = (umem_bufctl_audit_t *)(bcp);       \
        _bcp->bc_timestamp = gethrtime();                               \
        _bcp->bc_thread = thr_self();                                   \
        _bcp->bc_depth = getpcstack(_bcp->bc_stack, umem_stack_depth,   \
            (cp != NULL) && (cp->cache_flags & UMF_CHECKSIGNAL));       \
        _bcp->bc_lastlog = umem_log_enter((lp), _bcp,                   \
            UMEM_BUFCTL_AUDIT_SIZE);                                    \
}

#define UMEM_MAXBUF   16384

#define UMEM_VMFLAGS ( umflag   )     (VM_NOSLEEP)

#define UMERR_BADADDR   3

#define UMERR_BADBASE   8

#define UMERR_BADBUFCTL   5

#define UMERR_BADBUFTAG   4

#define UMERR_BADCACHE   6

#define UMERR_BADSIZE   7

#define UMERR_DUPFREE   2

#define UMERR_MODIFIED   0

#define UMERR_REDZONE   1


Function Documentation

int _cond_wait ( cond_t cv,
mutex_t mutex 
)

thread_t _thr_self ( void   ) 

void* _umem_alloc ( size_t  size,
int  umflag 
)

void* _umem_alloc_align ( size_t  size,
size_t  align,
int  umflag 
)

void* _umem_cache_alloc ( umem_cache_t cp,
int  umflag 
)

void _umem_cache_free ( umem_cache_t cp,
void *  buf 
)

void _umem_free ( void *  buf,
size_t  size 
)

void _umem_free_align ( void *  buf,
size_t  size 
)

void* _umem_zalloc ( size_t  size,
int  umflag 
)

void umem_cache_applyall ( void(*)(umem_cache_t *)  func  ) 

umem_cache_t* umem_cache_create ( char *  name,
size_t  bufsize,
size_t  align,
umem_constructor_t constructor,
umem_destructor_t destructor,
umem_reclaim_t reclaim,
void *  private,
vmem_t vmp,
int  cflags 
)

void umem_cache_destroy ( umem_cache_t cp  ) 

void umem_cache_update ( umem_cache_t cp  ) 

int umem_init ( void   ) 

void umem_nofail_callback ( umem_nofail_callback_t cb  ) 

void umem_process_updates ( void   ) 

void umem_reap ( void   ) 

void umem_startup ( caddr_t  start,
size_t  len,
size_t  pagesize,
caddr_t  minstack,
caddr_t  maxstack 
)


Variable Documentation

size_t pagesize

uint_t umem_abort = 1

struct { ... } umem_abort_info

mutex_t umem_cache_lock = DEFAULTMUTEX

umem_log_header_t* umem_content_log

size_t umem_content_log_size

size_t umem_content_maxsave = 256

uint_t umem_depot_contention = 2

umem_log_header_t* umem_failure_log

size_t umem_failure_log_size

uint_t umem_flags = 0

mutex_t umem_flags_lock = DEFAULTMUTEX

cond_t umem_init_cv = DEFAULTCV

int umem_init_env_ready

mutex_t umem_init_lock = DEFAULTMUTEX

thread_t umem_init_thr

size_t umem_lite_maxalign = 1024

size_t umem_lite_minsize = 0

uint_t umem_logging = 0

uint32_t umem_max_ncpus

caddr_t umem_max_stack

size_t umem_maxverify

vmem_t* umem_memalign_arena

caddr_t umem_min_stack

size_t umem_minfirewall

uint32_t umem_mtbf = 0

umem_cache_t umem_null_cache

uint_t umem_output = 0

int umem_ready = UMEM_READY_STARTUP

uint32_t umem_reap_interval = 10

volatile hrtime_t umem_reap_next

volatile uint32_t umem_reaping

umem_log_header_t* umem_slab_log

size_t umem_slab_log_size

volatile thread_t umem_st_update_thr

uint32_t umem_stack_depth = 15

umem_log_header_t* umem_transaction_log

size_t umem_transaction_log_size

cond_t umem_update_cv = DEFAULTCV

mutex_t umem_update_lock = DEFAULTMUTEX

struct timeval umem_update_next

thread_t umem_update_thr

umem_bufctl_t* ump_bufctl

void* ump_buffer

umem_cache_t* ump_cache

int ump_error

void* ump_realbuf

umem_cache_t* ump_realcache

umem_slab_t* ump_slab

hrtime_t ump_timestamp


Generated on Thu Feb 7 05:40:23 2008 for umem by  doxygen 1.5.4