Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandrs Saveljevs <git-no-reply@zabbix.com>2010-06-28 10:02:26 +0400
committerAleksandrs Saveljevs <git-no-reply@zabbix.com>2010-06-28 10:02:26 +0400
commit481bbc9c48697f1d163f923a8d193a4dfe639ae6 (patch)
tree88c8f167d8db2f66f105c7a024904ca399c8743f /include/memalloc.h
parent29491865397cff120b5f1f96d98e4d5f0f2c01ba (diff)
- when out of memory, we now suggest to increase a certain configuration parameter (suggested in ZBX-2565)
[svn merge svn://svn.zabbix.com/branches/1.8 -c 13063]
Diffstat (limited to 'include/memalloc.h')
-rw-r--r--include/memalloc.h47
1 files changed, 45 insertions, 2 deletions
diff --git a/include/memalloc.h b/include/memalloc.h
index e1d9d4b93a2..21638978a1b 100644
--- a/include/memalloc.h
+++ b/include/memalloc.h
@@ -35,11 +35,12 @@ typedef struct
int shm_id;
char use_lock;
ZBX_MUTEX mem_lock;
- char *mem_descr;
+ const char *mem_descr;
+ const char *mem_param;
}
zbx_mem_info_t;
-void zbx_mem_create(zbx_mem_info_t **info, key_t shm_key, int lock_name, size_t size, const char *descr);
+void zbx_mem_create(zbx_mem_info_t **info, key_t shm_key, int lock_name, size_t size, const char *descr, const char *param);
void zbx_mem_destroy(zbx_mem_info_t *info);
#define zbx_mem_malloc(info, old, size) __zbx_mem_malloc(__FILE__, __LINE__, info, old, size)
@@ -54,4 +55,46 @@ void zbx_mem_clear(zbx_mem_info_t *info);
void zbx_mem_dump_stats(zbx_mem_info_t *info);
+size_t zbx_mem_required_size(size_t size, int chunks_num, const char *descr, const char *param);
+
+#define ZBX_MEM_FUNC1_DECL_MALLOC(__prefix) \
+static void *__prefix ## _mem_malloc_func(void *old, size_t size)
+#define ZBX_MEM_FUNC1_DECL_REALLOC(__prefix) \
+static void *__prefix ## _mem_realloc_func(void *old, size_t size)
+#define ZBX_MEM_FUNC1_DECL_FREE(__prefix) \
+static void __prefix ## _mem_free_func(void *ptr)
+
+#define ZBX_MEM_FUNC1_IMPL_MALLOC(__prefix, __info) \
+ \
+static void *__prefix ## _mem_malloc_func(void *old, size_t size) \
+{ \
+ return zbx_mem_malloc(__info, old, size); \
+}
+
+#define ZBX_MEM_FUNC1_IMPL_REALLOC(__prefix, __info) \
+ \
+static void *__prefix ## _mem_realloc_func(void *old, size_t size) \
+{ \
+ return zbx_mem_realloc(__info, old, size); \
+}
+
+#define ZBX_MEM_FUNC1_IMPL_FREE(__prefix, __info) \
+ \
+static void __prefix ## _mem_free_func(void *ptr) \
+{ \
+ zbx_mem_free(__info, ptr); \
+}
+
+#define ZBX_MEM_FUNC_DECL(__prefix) \
+ \
+ZBX_MEM_FUNC1_DECL_MALLOC(__prefix); \
+ZBX_MEM_FUNC1_DECL_REALLOC(__prefix); \
+ZBX_MEM_FUNC1_DECL_FREE(__prefix);
+
+#define ZBX_MEM_FUNC_IMPL(__prefix, __info) \
+ \
+ZBX_MEM_FUNC1_IMPL_MALLOC(__prefix, __info); \
+ZBX_MEM_FUNC1_IMPL_REALLOC(__prefix, __info); \
+ZBX_MEM_FUNC1_IMPL_FREE(__prefix, __info);
+
#endif