aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-11-30 16:46:29 -0500
committerDave Barach <openvpp@barachs.net>2018-12-12 14:02:39 +0000
commit4d1f9564da436314c2b910077a93d99df1b43f71 (patch)
tree7a9b8e78196ae0498df492f624bc8ef95b37cedd
parente351f3501953773fbd3071cd04809c1012ea64b3 (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> (cherry picked from commit b2204671dad112e3195771854b4ef00bb388d4e6)
-rw-r--r--build-root/deb/debian/vpp.service1
-rw-r--r--build-root/deb/debian/vpp.upstart3
-rw-r--r--src/vlibmemory/memory_api.c22
3 files changed, 23 insertions, 3 deletions
diff --git a/build-root/deb/debian/vpp.service b/build-root/deb/debian/vpp.service
index aa1651c4119..2e86941de8b 100644
--- a/build-root/deb/debian/vpp.service
+++ b/build-root/deb/debian/vpp.service
@@ -4,7 +4,6 @@ After=network.target
[Service]
Type=simple
-ExecStartPre=-/bin/rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api
ExecStartPre=-/sbin/modprobe uio_pci_generic
ExecStart=/usr/bin/vpp -c /etc/vpp/startup.conf
ExecStopPost=/bin/rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api
diff --git a/build-root/deb/debian/vpp.upstart b/build-root/deb/debian/vpp.upstart
index 62e1d2780e6..4a451dd45d0 100644
--- a/build-root/deb/debian/vpp.upstart
+++ b/build-root/deb/debian/vpp.upstart
@@ -1,12 +1,11 @@
description "vector packet processing engine"
-author "Cisco Systems, Inc <listname@cisco.com>"
+author "Cisco Systems, Inc <vpp-dev@lists.fd.io>"
manual
respawn
pre-start script
- rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api || true
# should be there via dkms, but if not, start anyway
modprobe uio_pci_generic || true
end script
diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c
index 1f5da4c786e..5849d719fae 100644
--- a/src/vlibmemory/memory_api.c
+++ b/src/vlibmemory/memory_api.c
@@ -898,6 +898,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);
memset (a, 0, sizeof (*a));
a->root_path = am->root_path;