svm = am->vlib_rp;
int private_registration = 0;
- /*
- * Note: the API message handling path will set am->vlib_rp
- * as appropriate for pairwise / private memory segments
- */
- rp = vl_msg_api_alloc (sizeof (*rp));
- rp->_vl_msg_id = ntohs (VL_API_MEMCLNT_DELETE_REPLY);
- rp->handle = mp->handle;
- rp->response = 1;
-
- vl_msg_api_send_shmem (regp->vl_input_queue, (u8 *) & rp);
-
- if (client_index != regp->vl_api_registration_pool_index)
+ /* Send reply unless client asked us to do the cleanup */
+ if (!mp->do_cleanup)
{
- clib_warning ("mismatch client_index %d pool_index %d",
- client_index, regp->vl_api_registration_pool_index);
- vl_msg_api_free (rp);
- return;
+ /*
+ * Note: the API message handling path will set am->vlib_rp
+ * as appropriate for pairwise / private memory segments
+ */
+ rp = vl_msg_api_alloc (sizeof (*rp));
+ rp->_vl_msg_id = ntohs (VL_API_MEMCLNT_DELETE_REPLY);
+ rp->handle = mp->handle;
+ rp->response = 1;
+
+ vl_msg_api_send_shmem (regp->vl_input_queue, (u8 *) & rp);
+ if (client_index != regp->vl_api_registration_pool_index)
+ {
+ clib_warning ("mismatch client_index %d pool_index %d",
+ client_index,
+ regp->vl_api_registration_pool_index);
+ vl_msg_api_free (rp);
+ return;
+ }
}
/* For horizontal scaling, add a hash table... */
regp->vl_api_registration_pool_index);
pthread_mutex_lock (&svm->mutex);
oldheap = svm_push_data_heap (svm);
+ if (mp->do_cleanup)
+ svm_queue_free (regp->vl_input_queue);
vec_free (regp->name);
/* Poison the old registration */
clib_memset (regp, 0xF1, sizeof (*regp));
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;