aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-06-04 22:27:49 +0200
committerDave Barach <openvpp@barachs.net>2018-06-05 14:30:01 +0000
commit73710c7da2f8deaea83dbbbfce8737c9c6cd2949 (patch)
tree7d9cc75fe38de525a5b78634317e94b83880534a /src/vlibapi
parent0b061112f73fda45084671120411a6484d9c11d2 (diff)
VPP API: Memory trace
if you plan to put a hash into shared memory, the key sum and key equal functions MUST be set to constants such as KEY_FUNC_STRING, KEY_FUNC_MEM, etc. -lvppinfra is PIC, which means that the process which set up the hash won't have the same idea where the key sum and key compare functions live in other processes. Change-Id: Ib3b5963a0d2fb467b91e1f16274df66ac74009e9 Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vlibapi')
-rw-r--r--src/vlibapi/api_common.h2
-rw-r--r--src/vlibapi/api_shared.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/src/vlibapi/api_common.h b/src/vlibapi/api_common.h
index 3d55e2acdd6..73c5a50e850 100644
--- a/src/vlibapi/api_common.h
+++ b/src/vlibapi/api_common.h
@@ -178,6 +178,8 @@ int vl_msg_api_pd_handler (void *mp, int rv);
void vl_msg_api_set_first_available_msg_id (u16 first_avail);
u16 vl_msg_api_get_msg_ids (const char *name, int n);
u32 vl_msg_api_get_msg_index (u8 * name_and_crc);
+void *vl_msg_push_heap (void);
+void vl_msg_pop_heap (void *oldheap);
typedef clib_error_t *(vl_msg_api_init_function_t) (u32 client_index);
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index 3b9c0f47b66..24ec33b1506 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -955,6 +955,23 @@ vl_msg_api_get_msg_index (u8 * name_and_crc)
return ~0;
}
+void *
+vl_msg_push_heap (void)
+{
+ api_main_t *am = &api_main;
+ pthread_mutex_lock (&am->vlib_rp->mutex);
+ return svm_push_data_heap (am->vlib_rp);
+}
+
+void
+vl_msg_pop_heap (void *oldheap)
+{
+ api_main_t *am = &api_main;
+ svm_pop_heap (oldheap);
+ pthread_mutex_unlock (&am->vlib_rp->mutex);
+}
+
+
/*
* fd.io coding-style-patch-verification: ON
*