22 #include <sys/types.h> 25 #include <netinet/in.h> 47 u8 * var,
u8 * val,
u32 elsize);
51 pthread_mutex_lock(&rp->
mutex);
64 pthread_mutex_unlock(&rp->
mutex);
95 client->
pid = getpid();
121 client->
pid = getpid();
163 u32 *dead_registrations = 0;
171 sv.sival_ptr = (
void *)(
uword)value;
174 if (sigqueue (np->
pid, np->
signum, sv) == 0)
177 }
while (rv == EAGAIN);
184 for (i = 0; i <
vec_len (dead_registrations); i++) {
186 clib_warning (
"dead reg pid %d sig %d action %d opaque %x",
228 if ((np->
pid == client->
pid)
237 "%s: ignore dup reg pid %d signum %d action %d opaque %x",
277 _vec_len (oldvalue->
value) = 0;
295 u8 * var,
u8 * val,
u32 elsize)
315 memset (newvalue, 0,
sizeof (*newvalue));
316 newvalue->
elsize = elsize;
320 name =
format (0,
"%s%c", var, 0);
327 char *var,
char *val)
337 (
u8 *) var, (
u8 *) val, 1 );
357 return (oldvalue->
value);
382 rv =
format (0,
"%s", rv);
386 return ((
char *) rv);
404 fformat(stdout,
"%s: %s\n", key,
422 char *var,
void *val_arg,
u32 elsize)
424 u8 *val = (
u8 *)val_arg;
484 char *var,
u32 nbytes)
506 memset (newvalue, 0,
sizeof (*newvalue));
509 _vec_len (newvalue->
value) = nbytes;
510 name =
format (0,
"%s%c", var, 0);
513 rv = newvalue->
value;
static svmdb_client_t * svmdb_map_internal(char *root_path, uword size)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
svm_region_t * svm_get_root_rp(void)
sll srl srl sll sra u16x4 i
static void svm_pop_heap(void *oldheap)
void * svmdb_local_get_variable_reference(svmdb_client_t *client, svmdb_namespace_t namespace, char *var)
static void(BVT(clib_bihash)*h, BVT(clib_bihash_value)*v)
#define SVMDB_SHM_VERSION
void svmdb_local_dump_vecs(svmdb_client_t *client)
void svmdb_local_unset_vec_variable(svmdb_client_t *client, char *var)
svmdb_client_t * svmdb_map_chroot_size(char *root_path, uword size)
svmdb_client_t * svmdb_map(void)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define hash_set_mem(h, key, value)
#define hash_get_pair_mem(h, key)
#define vec_alloc(V, N)
Allocate space for N more elements (no header, unspecified alignment)
void svmdb_unmap(svmdb_client_t *client)
void svmdb_local_dump_strings(svmdb_client_t *client)
static void * svm_push_data_heap(svm_region_t *rp)
uword * namespaces[SVMDB_N_NAMESPACES]
void * svm_region_find_or_create(svm_map_region_args_t *a)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_warning(format, args...)
#define hash_create_string(elts, value_bytes)
#define pool_elt_at_index(p, i)
#define SVMDB_DEFAULT_SIZE
char * svmdb_local_get_string_variable(svmdb_client_t *client, char *var)
#define hash_foreach_mem(key_var, value_var, h, body)
static void * svm_push_pvt_heap(svm_region_t *rp)
static void local_unset_variable_nolock(svmdb_client_t *client, svmdb_namespace_t namespace, char *var)
static u8 * local_get_variable_nolock(svmdb_client_t *client, svmdb_namespace_t namespace, u8 *var)
void * svmdb_local_find_or_add_vec_variable(svmdb_client_t *client, char *var, u32 nbytes)
#define vec_free(V)
Free vector's memory (no header).
#define clib_memcpy(a, b, c)
void svmdb_local_set_vec_variable(svmdb_client_t *client, char *var, void *val_arg, u32 elsize)
svmdb_notify_t * notifications
void svm_region_init_chroot(char *root_path)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
always_inline void region_lock(svm_region_t *rp, int tag)
int svmdb_local_add_del_notification(svmdb_client_t *client, svmdb_notification_args_t *a)
svmdb_client_t * svmdb_map_size(uword size)
svmdb_client_t * svmdb_map_chroot(char *root_path)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void svmdb_local_unset_string_variable(svmdb_client_t *client, char *var)
static void local_set_variable_nolock(svmdb_client_t *client, svmdb_namespace_t namespace, u8 *var, u8 *val, u32 elsize)
void svm_region_unmap(void *rp_arg)
void * svmdb_local_get_vec_variable(svmdb_client_t *client, char *var, u32 elsize)
#define hash_get_mem(h, key)
void svmdb_local_set_string_variable(svmdb_client_t *client, char *var, char *val)
always_inline void region_unlock(svm_region_t *rp)
static void notify_value(svmdb_value_t *v, svmdb_action_t a)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".