|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
22 #include <sys/types.h>
25 #include <netinet/in.h>
53 int verbose = va_arg (*args,
int);
87 a->name = (
char *) svm_names[
i];
91 pthread_mutex_lock (&rp->
mutex);
93 pthread_mutex_unlock (&rp->
mutex);
104 show (
char *chroot_path,
int verbose)
112 fformat (stdout,
"My pid is %d\n", getpid ());
134 svm_fd = shm_open ((
char *) shm_name, O_RDWR, 0777);
138 perror (
"svm_region_map(mmap open)");
143 rp = mmap (0,
MMAP_PAGESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, svm_fd, 0);
155 while (rp->
version == 0 && deadman++ < 5)
175 PROT_READ | PROT_WRITE,
176 MAP_SHARED | MAP_FIXED, svm_fd, 0);
188 if (pthread_mutex_trylock (&rp->
mutex))
190 clib_warning (
"rp->mutex LOCKED by pid %d, tag %d, cleared...",
198 pthread_mutex_unlock (&rp->
mutex);
201 return ((
void *) rp);
222 pthread_mutex_lock (&rp->
mutex);
236 pthread_mutex_unlock (&rp->
mutex);
274 trace (
char *chroot_path,
char *
name,
int enable_disable)
343 a.root_path = chroot_path;
344 a.name = (
char *) svm_names[
i];
345 fformat (stdout,
"Checking %s region...\n",
a.name);
357 repair (
char *chroot_path,
int crash_root_region)
365 fformat (stdout,
"our pid: %d\n", getpid ());
369 a->root_path = chroot_path;
377 svm_fd = shm_open ((
char *) shm_name, O_RDWR, 0777);
381 perror (
"svm_region_map(mmap open)");
388 PROT_READ | PROT_WRITE, MAP_SHARED, svm_fd, 0);
405 PROT_READ | PROT_WRITE,
406 MAP_SHARED | MAP_FIXED, svm_fd, 0);
423 clib_warning (
"root_rp->mutex LOCKED by pid %d, tag %d, cleared...",
442 if (crash_root_region)
444 clib_warning (
"Leaving root region locked on purpose...");
458 char *chroot_path = 0;
467 if (
unformat (&input,
"show-verbose"))
469 show (chroot_path, 1);
474 show (chroot_path, 0);
477 else if (
unformat (&input,
"client-scan"))
482 else if (
unformat (&input,
"repair"))
487 else if (
unformat (&input,
"crash"))
502 else if (
unformat (&input,
"chroot %s", &chroot_u8))
504 chroot_path = (
char *) chroot_u8;
517 "%s: show | show-verbose | client-scan | trace-on <region-name>\n",
519 fformat (stdout,
" trace-off <region-name>\n");
#define SVM_GLOBAL_REGION_SIZE
void svm_region_exit(void)
svm_region_t * svm_get_root_rp(void)
int svm_region_init_chroot(const char *root_path)
void svm_region_unmap(void *rp_arg)
void * svm_map_region(svm_map_region_args_t *a)
#define clib_unix_warning(format, args...)
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void * svm_region_find_or_create(svm_map_region_args_t *a)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_dup(V)
Return copy of vector (no header, no alignment)
static void svm_pop_heap(void *oldheap)
svm_subregion_t * subregions
Fixed length block allocator. Pools are built from clib vectors and bitmaps. Use pools when repeatedl...
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
void * clib_mem_init_thread_safe(void *memory, uword memory_size)
#define hash_get_mem(h, key)
#define vec_free(V)
Free vector's memory (no header).
static svm_region_t * root_rp
u64 svm_get_global_region_base_va()
description fragment has unexpected format
u8 * format_svm_region(u8 *s, va_list *args)
static void * svm_push_pvt_heap(svm_region_t *rp)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define SVM_GLOBAL_REGION_NAME
void mheap_trace(clib_mem_heap_t *v, int enable)
#define uword_to_pointer(u, type)
void svm_client_scan(const char *root_path)
#define SVM_PVT_MHEAP_SIZE
#define clib_warning(format, args...)
static void * svm_push_data_heap(svm_region_t *rp)
u8 * shm_name_from_svm_map_region_args(svm_map_region_args_t *a)