#include "sharedmem.h"
Include dependency graph for debian/libsharedmem1-dev/usr/include/shmalloc.h:
Go to the source code of this file.
Data Structures | |
struct | _sharedmem_block_t |
struct | _sharedmem_alloc_t |
Defines | |
#define | SHAREDMEM_ALIGN 8 |
#define | SHAREDMEM_BLOCK_INUSE 0x1 |
#define | SHAREDMEM_FLAGS_MASK 0x1 |
#define | SHMALLOC_SHAREDMEM(i) ((i)->shminst) |
Typedefs | |
typedef _sharedmem_block_t | sharedmem_block_t |
typedef _sharedmem_alloc_t | sharedmem_alloc_t |
Functions | |
int | sharedmem_alloc_create (sharedmem_alloc_t *inst, sharedmem_t *shminst) |
long | sharedmem_alloc (sharedmem_alloc_t *inst, size_t size) |
long | sharedmem_realloc (sharedmem_alloc_t *inst, long old_offset, size_t size) |
int | sharedmem_free (sharedmem_alloc_t *inst, long offset) |
void * | sharedmem_alloc_get_ptr (sharedmem_alloc_t *inst, long offset) |
int | sharedmem_alloc_grow (sharedmem_alloc_t *inst, size_t new_size) |
void | sharedmem_alloc_list_allocs (sharedmem_alloc_t *inst) |
void | sharedmem_alloc_list_frees (sharedmem_alloc_t *inst) |
#define SHAREDMEM_ALIGN 8 |
Align has to be big enough to hold block flags
Definition at line 36 of file debian/libsharedmem1-dev/usr/include/shmalloc.h.
#define SHAREDMEM_BLOCK_INUSE 0x1 |
Flags for blocks.
Definition at line 39 of file debian/libsharedmem1-dev/usr/include/shmalloc.h.
#define SHAREDMEM_FLAGS_MASK 0x1 |
Mask for flags.
Definition at line 42 of file debian/libsharedmem1-dev/usr/include/shmalloc.h.
#define SHMALLOC_SHAREDMEM | ( | i | ) | ((i)->shminst) |
Get pointer to shared memory object.
Definition at line 70 of file debian/libsharedmem1-dev/usr/include/shmalloc.h.
Referenced by sharedmem_alloc(), sharedmem_alloc_create(), sharedmem_alloc_get_ptr(), sharedmem_alloc_grow(), sharedmem_free(), and sharedmem_realloc().
typedef struct _sharedmem_alloc_t sharedmem_alloc_t |
Allocator descriptor.
typedef struct _sharedmem_block_t sharedmem_block_t |
Allocation block control structure.
long sharedmem_alloc | ( | sharedmem_alloc_t * | inst, | |
size_t | size | |||
) |
Allocate arbitrary sized block from shared memory.
inst | Instance of shared memory allocator object | |
size | Size of block to allocate |
Definition at line 379 of file shmalloc.c.
int sharedmem_alloc_create | ( | sharedmem_alloc_t * | inst, | |
sharedmem_t * | shminst | |||
) |
Initialize allocator on shared memory.
inst | Instance of shared memory allocator object | |
shminst | Instance of shared memory object |
Definition at line 350 of file shmalloc.c.
void* sharedmem_alloc_get_ptr | ( | sharedmem_alloc_t * | inst, | |
long | offset | |||
) |
Get mapped pointer for offset.
inst | Instance of shared memory allocator object. | |
offset | Offset to get pointer for |
Definition at line 492 of file shmalloc.c.
Referenced by sharedmem_realloc().
int sharedmem_alloc_grow | ( | sharedmem_alloc_t * | inst, | |
size_t | new_size | |||
) |
Grow the parent shared memory block and reflect the change in allocator.
inst | Instance of sharedmemory allocator object. | |
new_size | New size of the block |
Definition at line 501 of file shmalloc.c.
void sharedmem_alloc_list_allocs | ( | sharedmem_alloc_t * | inst | ) |
Print list of allocations to stderr.
inst | Instance of shared memory allocator object. |
Definition at line 538 of file shmalloc.c.
void sharedmem_alloc_list_frees | ( | sharedmem_alloc_t * | inst | ) |
Print list of free areas to stderr.
inst | Instance of shared memory allocator object. |
Definition at line 562 of file shmalloc.c.
int sharedmem_free | ( | sharedmem_alloc_t * | inst, | |
long | offset | |||
) |
Free previously allocated shared memory block.
inst | Instance of shared memory allocator object. | |
offset | Offset to free |
Definition at line 474 of file shmalloc.c.
Referenced by sharedmem_realloc().
long sharedmem_realloc | ( | sharedmem_alloc_t * | inst, | |
long | old_offset, | |||
size_t | size | |||
) |
Reallocate block from shared memory.
inst | Instance of shared memory allocator object | |
old_offset | Offset to reallocate | |
size | New size for the block |
Definition at line 399 of file shmalloc.c.