22 #include <sys/types.h> 25 #include <netinet/in.h> 47 u8 * var,
u8 * val,
u32 elsize);
52 pthread_mutex_lock (&rp->
mutex);
66 pthread_mutex_unlock (&rp->
mutex);
101 client->
pid = getpid ();
127 client->
pid = getpid ();
152 u32 *dead_registrations = 0;
162 sv.sival_ptr = (
void *) (
uword) value;
166 if (sigqueue (np->
pid, np->
signum, sv) == 0)
170 while (rv == EAGAIN);
177 for (i = 0; i <
vec_len (dead_registrations); i++)
180 clib_warning (
"dead reg pid %d sig %d action %d opaque %x",
225 if ((np->
pid == client->
pid)
237 (
"%s: ignore dup reg pid %d signum %d action %d opaque %x",
279 _vec_len (oldvalue->
value) = 0;
299 u8 * var,
u8 * val,
u32 elsize)
322 memset (newvalue, 0,
sizeof (*newvalue));
323 newvalue->
elsize = elsize;
327 name =
format (0,
"%s%c", var, 0);
335 char *var,
char *val)
345 (
u8 *) var, (
u8 *) val, 1 );
366 return (oldvalue->
value);
393 rv =
format (0,
"%s", rv);
397 return ((
char *) rv);
417 fformat(stdout,
"%s: %s\n", key,
438 char *var,
void *val_arg,
u32 elsize)
440 u8 *val = (
u8 *) val_arg;
469 _vec_len (copy) =
vec_len (rv);
494 (void)
fformat(stdout,
"%s:\n %U (%.2f)\n", key,
505 char *var,
u32 nbytes)
530 memset (newvalue, 0,
sizeof (*newvalue));
533 _vec_len (newvalue->
value) = nbytes;
534 name =
format (0,
"%s%c", var, 0);
537 rv = newvalue->
value;
#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)
#define SVMDB_SHM_VERSION
void svmdb_local_dump_vecs(svmdb_client_t *client)
Fixed length block allocator.
void svmdb_local_unset_vec_variable(svmdb_client_t *client, char *var)
#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)
static void region_lock(svm_region_t *rp, int tag)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#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)
Returns pointer to element at given index.
#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 svm_region_init_chroot_uid_gid(char *root_path, int uid, int gid)
void svmdb_local_set_vec_variable(svmdb_client_t *client, char *var, void *val_arg, u32 elsize)
svmdb_notify_t * notifications
#define vec_delete(V, N, M)
Delete N elements starting at element M.
Bitmaps built as vectors of machine words.
int svmdb_local_add_del_notification(svmdb_client_t *client, svmdb_notification_args_t *a)
#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)
svmdb_client_t * svmdb_map(svmdb_map_args_t *dba)
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)
static 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".