summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/memory_api.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-11-30 16:46:29 -0500
committerDamjan Marion <dmarion@me.com>2018-12-01 00:32:56 +0000
commitb2204671dad112e3195771854b4ef00bb388d4e6 (patch)
tree85966f1700b7413747ed223aaf90f38537de367e /src/vlibmemory/memory_api.c
parentdd89173cc177f7130eca426eb4fa5737ec59c91d (diff)
Delete shared memory segment files when vpp starts
Should have been done this way years ago. My bad. Change-Id: Ic7bf937fb6c4dc5c1b6ae64f2ecf8608b62e7039 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlibmemory/memory_api.c')
-rw-r--r--src/vlibmemory/memory_api.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c
index 7a7644a0998..544e59ddb69 100644
--- a/src/vlibmemory/memory_api.c
+++ b/src/vlibmemory/memory_api.c
@@ -932,6 +932,28 @@ vlibmemory_init (vlib_main_t * vm)
api_main_t *am = &api_main;
svm_map_region_args_t _a, *a = &_a;
clib_error_t *error;
+ u8 *remove_path1, *remove_path2;
+
+ /*
+ * By popular request / to avoid support fires, remove any old api segment
+ * files Right Here.
+ */
+ if (am->root_path == 0)
+ {
+ remove_path1 = format (0, "/dev/shm/global_vm%c", 0);
+ remove_path2 = format (0, "/dev/shm/vpe-api%c", 0);
+ }
+ else
+ {
+ remove_path1 = format (0, "/dev/shm/%s-global_vm%c", am->root_path, 0);
+ remove_path2 = format (0, "/dev/shm/%s-vpe-api%c", am->root_path, 0);
+ }
+
+ (void) unlink ((char *) remove_path1);
+ (void) unlink ((char *) remove_path2);
+
+ vec_free (remove_path1);
+ vec_free (remove_path2);
clib_memset (a, 0, sizeof (*a));
a->root_path = am->root_path;