Module: kamailio
Branch: master
Commit: 9645be245f899fa8ae11a6be045d2ef83fd66bf5
URL:
https://github.com/kamailio/kamailio/commit/9645be245f899fa8ae11a6be045d2ef…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-09-09T18:44:46+02:00
core: mem - use own functions for shm mod stats get operation
- protect with global lock for shm stats
---
Modified: src/core/mem/f_malloc.c
Modified: src/core/mem/q_malloc.c
Modified: src/core/mem/tlsf_malloc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/9645be245f899fa8ae11a6be045d2ef…
Patch:
https://github.com/kamailio/kamailio/commit/9645be245f899fa8ae11a6be045d2ef…
---
diff --git a/src/core/mem/f_malloc.c b/src/core/mem/f_malloc.c
index 2363700c0b..38f686ff2c 100644
--- a/src/core/mem/f_malloc.c
+++ b/src/core/mem/f_malloc.c
@@ -1367,6 +1367,16 @@ void fm_shm_sums(void* qmp)
fm_sums(qmp);
fm_shm_unlock();
}
+void fm_shm_mod_get_stats(void *qmp, void **qm_rootp)
+{
+ fm_shm_lock();
+ fm_mod_get_stats(qmp, qm_rootp);
+ fm_shm_unlock();
+}
+void fm_shm_mod_free_stats(void *qm_rootp)
+{
+ fm_mod_free_stats(qm_rootp);
+}
/**
@@ -1413,8 +1423,8 @@ int fm_malloc_init_shm_manager(void)
ma.xavailable = fm_shm_available;
ma.xsums = fm_shm_sums;
ma.xdestroy = fm_malloc_destroy_shm_manager;
- ma.xmodstats = fm_mod_get_stats;
- ma.xfmodstats = fm_mod_free_stats;
+ ma.xmodstats = fm_shm_mod_get_stats;
+ ma.xfmodstats = fm_shm_mod_free_stats;
ma.xglock = fm_shm_glock;
ma.xgunlock = fm_shm_gunlock;
diff --git a/src/core/mem/q_malloc.c b/src/core/mem/q_malloc.c
index b518bfab81..94f972eae9 100644
--- a/src/core/mem/q_malloc.c
+++ b/src/core/mem/q_malloc.c
@@ -1350,7 +1350,16 @@ void qm_shm_sums(void* qmp)
qm_sums(qmp);
qm_shm_unlock();
}
-
+void qm_shm_mod_get_stats(void *qmp, void **qm_rootp)
+{
+ qm_shm_lock();
+ qm_mod_get_stats(qmp, qm_rootp);
+ qm_shm_unlock();
+}
+void qm_shm_mod_free_stats(void *qm_rootp)
+{
+ qm_mod_free_stats(qm_rootp);
+}
/**
* \brief Destroy memory pool
@@ -1396,8 +1405,8 @@ int qm_malloc_init_shm_manager(void)
ma.xavailable = qm_shm_available;
ma.xsums = qm_shm_sums;
ma.xdestroy = qm_malloc_destroy_shm_manager;
- ma.xmodstats = qm_mod_get_stats;
- ma.xfmodstats = qm_mod_free_stats;
+ ma.xmodstats = qm_shm_mod_get_stats;
+ ma.xfmodstats = qm_shm_mod_free_stats;
ma.xglock = qm_shm_glock;
ma.xgunlock = qm_shm_gunlock;
diff --git a/src/core/mem/tlsf_malloc.c b/src/core/mem/tlsf_malloc.c
index 33bbf4869d..10db30264b 100644
--- a/src/core/mem/tlsf_malloc.c
+++ b/src/core/mem/tlsf_malloc.c
@@ -1607,6 +1607,16 @@ void tlsf_shm_sums(void* tlsfmp)
tlsf_sums(tlsfmp);
tlsf_shm_unlock();
}
+void tlsf_shm_mod_get_stats(void *qmp, void **qm_rootp)
+{
+ tlsf_shm_lock();
+ tlsf_mod_get_stats(qmp, qm_rootp);
+ tlsf_shm_unlock();
+}
+void tlsf_shm_mod_free_stats(void *qm_rootp)
+{
+ tlsf_mod_free_stats(qm_rootp);
+}
/**
@@ -1653,8 +1663,8 @@ int tlsf_malloc_init_shm_manager(void)
ma.xavailable = tlsf_shm_available;
ma.xsums = tlsf_shm_sums;
ma.xdestroy = tlsf_malloc_destroy_shm_manager;
- ma.xmodstats = tlsf_mod_get_stats;
- ma.xfmodstats = tlsf_mod_free_stats;
+ ma.xmodstats = tlsf_shm_mod_get_stats;
+ ma.xfmodstats = tlsf_shm_mod_free_stats;
ma.xglock = tlsf_shm_glock;
ma.xgunlock = tlsf_shm_gunlock;