Module: kamailio
Branch: master
Commit: 427e47b500ee92cee096162b3419ef63f893cfa5
URL:
https://github.com/kamailio/kamailio/commit/427e47b500ee92cee096162b3419ef6…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2018-12-28T17:55:36+01:00
core: add PKG*, SYS* and SHM* macro error helper for message and size and message
- add more PKG_MEM_ERROR, PKG_MEM_CRITICAL, SHM_MEM_ERROR, SHM_MEM_CRITICAL,
SYS_MEM_ERROR and SYS_MEM_CRITICAL error logging helper
- *_MSG(m) to add an additional error string
- *_SZ(s,m) to add the size of the failed allocation, additional error string
---
Modified: src/core/mem/pkg.h
Modified: src/core/mem/shm.h
---
Diff:
https://github.com/kamailio/kamailio/commit/427e47b500ee92cee096162b3419ef6…
Patch:
https://github.com/kamailio/kamailio/commit/427e47b500ee92cee096162b3419ef6…
---
diff --git a/src/core/mem/pkg.h b/src/core/mem/pkg.h
index 0222baffe0..f5544f5818 100644
--- a/src/core/mem/pkg.h
+++ b/src/core/mem/pkg.h
@@ -111,17 +111,36 @@ void pkg_print_manager(void);
# define pkg_mod_free_stats(x) do{}while(0)
#endif /*PKG_MALLOC*/
+
/** generic logging helper for allocation errors in private memory pool/ system */
#ifdef SYS_MALLOC
#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from sys
pool\n")
+#define PKG_MEM_ERROR_MSG(m) LM_ERR("could not allocate private memory from sys pool
- %s\n", m);
+#define PKG_MEM_ERROR_SZ(s, m) LM_ERR("could not allocate private memory from sys
pool, size: %u - %s\n", (unsigned int)s, m);
+
#define PKG_MEM_CRITICAL LM_CRIT("could not allocate private memory from sys
pool\n")
+#define PKG_MEM_CRITICAL_MSG(m) LM_CRIT("could not allocate private memory from sys
pool - %s\n", m);
+#define PKG_MEM_CRITICAL_SZ(s, m) LM_CRIT("could not allocate private memory from
sys pool, size: %u - %s\n", (unsigned int)s, m);
+
+
#else
#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from pkg
pool\n")
+#define PKG_MEM_ERROR_MSG(m) LM_ERR("could not allocate private memory from pkg pool
- %s\n", m);
+#define PKG_MEM_ERROR_SZ(s, m) LM_ERR("could not allocate private memory from pkg
pool, size: %u - %s\n", (unsigned int)s, m);
+
#define PKG_MEM_CRITICAL LM_CRIT("could not allocate private memory from pkg
pool\n")
+#define PKG_MEM_CRITICAL_MSG(m) LM_CRIT("could not allocate private memory from pkg
pool - %s\n", m);
+#define PKG_MEM_CRITICAL_SZ(s, m) LM_CRIT("could not allocate private memory from
pkg pool, size: %u - %s\n", (unsigned int)s, m);
#endif
+
/** generic logging helper for allocation errors in system memory */
#define SYS_MEM_ERROR LM_ERR("could not allocate memory from system\n")
+#define SYS_MEM_ERROR_MSG(m) LM_ERR("could not allocate memory from system -
%s\n", m);
+#define SYS_MEM_ERROR_SZ(s, m) LM_ERR("could not allocate memory from system, size:
%u - %s\n", (unsigned int)s, m);
+
#define SYS_MEM_CRITICAL LM_CRIT("could not allocate memory from system\n")
+#define SYS_MEM_CRITICAL_MSG(m) LM_CRIT("could not allocate memory from system -
%s\n", m);
+#define SYS_MEM_CRITICAL_SZ(s, m) LM_CRIT("could not allocate memory from system,
size: %u - %s\n", (unsigned int)s, m);
#endif
diff --git a/src/core/mem/shm.h b/src/core/mem/shm.h
index a726eefdb0..5da3e27664 100644
--- a/src/core/mem/shm.h
+++ b/src/core/mem/shm.h
@@ -98,6 +98,11 @@ int shm_address_in(void *p);
/** generic logging helper for allocation errors in shared memory pool */
#define SHM_MEM_ERROR LM_ERR("could not allocate shared memory from shm
pool\n")
+#define SHM_MEM_ERROR_MSG(m) LM_ERR("could not allocate shared memory from shm pool
- %s\n", m);
+#define SHM_MEM_ERROR_SZ(s, m) LM_ERR("could not allocate shared memory from shm
pool, size: %u - %s\n", (unsigned int)s, m);
+
#define SHM_MEM_CRITICAL LM_CRIT("could not allocate shared memory from shm
pool\n")
+#define SHM_MEM_CRITICAL_MSG(m) LM_CRIT("could not allocate shared memory from shm
pool - %s\n", m);
+#define SHM_MEM_CRITICAL_SZ(s, m) LM_CRIT("could not allocate shared memory from shm
pool, size: %u - %s\n", (unsigned int)s, m);
#endif