summaryrefslogtreecommitdiffstats
path: root/vlib-api
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-01-22 16:09:52 -0500
committerDave Barach <dave@barachs.net>2016-01-22 16:10:07 -0500
commit309bef25f109ff9ef03e178ac6fe233f4d778d73 (patch)
tree32f49e4638bf837cb03ec972dbdfbba29e0fc9e8 /vlib-api
parent61efa140b1f44e0c568697fbc31cf3f430131ab2 (diff)
Enable shared-VM namespace support
Required prep work for gracefully supporting "... dpdk { proc-type secondary }" - multiple processes sharing a physical host, VM, container, etc. Change-Id: Ic3eb72f4093e26d7c86dde3b8799264f1d0c218b Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vlib-api')
-rw-r--r--vlib-api/vlibmemory/memory_shared.c9
-rw-r--r--vlib-api/vlibmemory/memory_vlib.c14
2 files changed, 12 insertions, 11 deletions
diff --git a/vlib-api/vlibmemory/memory_shared.c b/vlib-api/vlibmemory/memory_shared.c
index de1eafda..ecd5cff7 100644
--- a/vlib-api/vlibmemory/memory_shared.c
+++ b/vlib-api/vlibmemory/memory_shared.c
@@ -192,6 +192,13 @@ static void vl_msg_api_free_nolock (void *a)
svm_pop_heap (oldheap);
}
+void vl_set_memory_root_path (char *name)
+{
+ api_main_t *am = &api_main;
+
+ am->root_path = name;
+}
+
int vl_map_shmem (char *region_name, int is_vlib)
{
svm_map_region_args_t *a = 0;
@@ -203,7 +210,7 @@ int vl_map_shmem (char *region_name, int is_vlib)
struct timespec ts, tsrem;
if (is_vlib == 0)
- svm_region_init();
+ svm_region_init_chroot(am->root_path);
vec_validate (a, 0);
diff --git a/vlib-api/vlibmemory/memory_vlib.c b/vlib-api/vlibmemory/memory_vlib.c
index 57cb8f74..7ba76ec4 100644
--- a/vlib-api/vlibmemory/memory_vlib.c
+++ b/vlib-api/vlibmemory/memory_vlib.c
@@ -1046,9 +1046,10 @@ VLIB_CLI_COMMAND (trace, static) = {
clib_error_t *
vlibmemory_init (vlib_main_t * vm)
{
- /* Do this early, to avoid glibc malloc fubar */
- svm_region_init();
- return 0;
+ api_main_t *am = &api_main;
+ /* Normally NULL, can be set by cmd line "chroot {prefix foo}" */
+ svm_region_init_chroot (am->root_path);
+ return 0;
}
VLIB_INIT_FUNCTION (vlibmemory_init);
@@ -1060,13 +1061,6 @@ void vl_set_memory_region_name (char *name)
am->region_name = name;
}
-void vl_set_memory_root_path (char *name)
-{
- api_main_t *am = &api_main;
-
- am->root_path = name;
-}
-
static int range_compare (vl_api_msg_range_t * a0, vl_api_msg_range_t * a1)
{
int len0, len1, clen;