15 #ifndef __included_ssvm_h__ 16 #define __included_ssvm_h__ 20 #include <sys/types.h> 23 #include <netinet/in.h> 42 #define MMAP_PAGESIZE (clib_mem_get_page_size()) 45 #define SSVM_N_OPAQUE 7 106 while (__sync_lock_test_and_set (&h->
lock, 1))
117 while (__sync_lock_test_and_set (&h->
lock, 1))
148 return ((
void *) oldheap);
169 #define foreach_ssvm_api_error \ 170 _(NO_NAME, "No shared segment name", -100) \ 171 _(NO_SIZE, "Size not set (master)", -101) \ 172 _(CREATE_FAILURE, "Create failed", -102) \ 173 _(SET_SIZE, "Set size failed", -103) \ 174 _(MMAP, "mmap failed", -104) \ 175 _(SLAVE_TIMEOUT, "Slave map timeout", -105) 179 #define _(n,s,c) SSVM_API_ERROR_##n = c, 184 #define SSVM_API_ERROR_NO_NAME (-10)
int ssvm_master_init(ssvm_private_t *ssvm, ssvm_segment_type_t type)
Fixed length block allocator.
int ssvm_master_init_shm(ssvm_private_t *ssvm)
ssvm_shared_header_t * sh
int ssvm_slave_init_private(ssvm_private_t *ssvm)
enum ssvm_segment_type_ ssvm_segment_type_t
int ssvm_slave_init(ssvm_private_t *ssvm, ssvm_segment_type_t type)
static void * ssvm_push_heap(ssvm_shared_header_t *sh)
int ssvm_master_init_private(ssvm_private_t *ssvm)
Initialize segment in a private heap.
int attach_timeout
shm segments attach timeout (sec)
static void ssvm_pop_heap(void *oldheap)
void ssvm_delete_private(ssvm_private_t *ssvm)
#define foreach_ssvm_api_error
static void ssvm_unlock(ssvm_shared_header_t *h)
static void * ssvm_mem_alloc(ssvm_private_t *ssvm, uword size)
ssvm_segment_type_t ssvm_type(const ssvm_private_t *ssvm)
void ssvm_delete_shm(ssvm_private_t *ssvm)
static void * clib_mem_set_heap(void *heap)
int ssvm_slave_init_memfd(ssvm_private_t *memfd)
Initialize memfd segment slave.
void ssvm_delete_memfd(ssvm_private_t *memfd)
Bitmaps built as vectors of machine words.
static void * clib_mem_alloc(uword size)
void ssvm_delete(ssvm_private_t *ssvm)
u8 * ssvm_name(const ssvm_private_t *ssvm)
int ssvm_master_init_memfd(ssvm_private_t *memfd)
Initialize memfd segment master.
int ssvm_slave_init_shm(ssvm_private_t *ssvm)
#define CLIB_MEMORY_BARRIER()
static void ssvm_unlock_non_recursive(ssvm_shared_header_t *h)
static void ssvm_lock(ssvm_shared_header_t *h, u32 my_pid, u32 tag)
static void ssvm_lock_non_recursive(ssvm_shared_header_t *h, u32 tag)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".