summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/svm/svm.c13
-rw-r--r--src/svm/svm_common.h2
-rw-r--r--src/vlibmemory/memory_shared.c8
3 files changed, 15 insertions, 8 deletions
diff --git a/src/svm/svm.c b/src/svm/svm.c
index 0442ecb2950..663324e0a77 100644
--- a/src/svm/svm.c
+++ b/src/svm/svm.c
@@ -733,7 +733,7 @@ svm_mutex_cleanup (void)
}
}
-static void
+static int
svm_region_init_internal (svm_map_region_args_t * a)
{
svm_region_t *rp;
@@ -742,7 +742,7 @@ svm_region_init_internal (svm_map_region_args_t * a)
/* guard against klutz calls */
if (root_rp)
- return;
+ return -1;
root_rp_refcount++;
@@ -757,7 +757,8 @@ svm_region_init_internal (svm_map_region_args_t * a)
a->baseva += randomize_baseva;
rp = svm_map_region (a);
- ASSERT (rp);
+ if (!rp)
+ return -1;
region_lock (rp, 3);
@@ -778,6 +779,8 @@ svm_region_init_internal (svm_map_region_args_t * a)
}
region_unlock (rp);
root_rp = rp;
+
+ return 0;
}
void
@@ -797,7 +800,7 @@ svm_region_init (void)
svm_region_init_internal (a);
}
-void
+int
svm_region_init_chroot (const char *root_path)
{
svm_map_region_args_t _a, *a = &_a;
@@ -811,7 +814,7 @@ svm_region_init_chroot (const char *root_path)
a->uid = 0;
a->gid = 0;
- svm_region_init_internal (a);
+ return svm_region_init_internal (a);
}
void
diff --git a/src/svm/svm_common.h b/src/svm/svm_common.h
index 1f184432967..1f6d83c0a37 100644
--- a/src/svm/svm_common.h
+++ b/src/svm/svm_common.h
@@ -110,7 +110,7 @@ typedef struct
void *svm_region_find_or_create (svm_map_region_args_t * a);
void svm_region_init (void);
-void svm_region_init_chroot (const char *root_path);
+int svm_region_init_chroot (const char *root_path);
void svm_region_init_chroot_uid_gid (const char *root_path, int uid, int gid);
void svm_region_init_args (svm_map_region_args_t * a);
void svm_region_exit (void);
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c
index 9bab65730ef..fbdabd06e36 100644
--- a/src/vlibmemory/memory_shared.c
+++ b/src/vlibmemory/memory_shared.c
@@ -337,7 +337,7 @@ vl_map_shmem (const char *region_name, int is_vlib)
void *oldheap;
vl_shmem_hdr_t *shmem_hdr = 0;
api_main_t *am = &api_main;
- int i;
+ int i, rv;
struct timespec ts, tsrem;
u32 vlib_input_queue_length;
@@ -352,7 +352,11 @@ vl_map_shmem (const char *region_name, int is_vlib)
}
if (is_vlib == 0)
- svm_region_init_chroot (am->root_path);
+ {
+ rv = svm_region_init_chroot (am->root_path);
+ if (rv)
+ return rv;
+ }
if (a->root_path != NULL)
{