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:
authorAndris Zeila <andris.zeila@zabbix.com>2013-05-22 14:02:50 +0400
committerAndris Zeila <andris.zeila@zabbix.com>2013-05-22 14:02:50 +0400
commit2943dde551ae5e083017c362a3925ffa5dcf6a15 (patch)
tree2fb5ea62897e5aec5e9cb107954b179819bdc908 /include
parent6207475f64c301bbdaa4408aa87fbbc99b9cae3e (diff)
.......PS. [ZBXNEXT-322] added 64 bit support to memory allocator
This allows shared memory allocation of 4GB and more (current hard limit is set to 64GB). Also added 'allow out of memory' mode. If shared memory is created with allow_oom flag, then out of memory situation is not treated as critical failure and memory allocators return NULL instead of aborting execution.
Diffstat (limited to 'include')
-rw-r--r--include/memalloc.h17
-rw-r--r--include/zbxtypes.h6
2 files changed, 15 insertions, 8 deletions
diff --git a/include/memalloc.h b/include/memalloc.h
index 432ab365166..19aab382ab0 100644
--- a/include/memalloc.h
+++ b/include/memalloc.h
@@ -28,19 +28,26 @@ typedef struct
void **buckets;
void *lo_bound;
void *hi_bound;
- uint32_t free_size;
- uint32_t used_size;
- uint32_t orig_size;
- uint32_t total_size;
+ zbx_uint64_t free_size;
+ zbx_uint64_t used_size;
+ zbx_uint64_t orig_size;
+ zbx_uint64_t total_size;
int shm_id;
char use_lock;
+
+ /* Continue execution in out of memory situation. */
+ /* Normally allocator forces exit when it runs out of allocatable memory. */
+ /* Set this flag to 1 to allow execution in out of memory situations. */
+ char allow_oom;
+
ZBX_MUTEX mem_lock;
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, const char *param);
+void zbx_mem_create(zbx_mem_info_t **info, key_t shm_key, int lock_name, zbx_uint64_t size,
+ const char *descr, const char *param, int allow_oom);
void zbx_mem_destroy(zbx_mem_info_t *info);
#define zbx_mem_malloc(info, old, size) __zbx_mem_malloc(__FILE__, __LINE__, info, old, size)
diff --git a/include/zbxtypes.h b/include/zbxtypes.h
index b0a1b45767c..556d3e2feba 100644
--- a/include/zbxtypes.h
+++ b/include/zbxtypes.h
@@ -23,9 +23,6 @@
#define ZBX_FS_DBL "%lf"
#define ZBX_FS_DBL_EXT(p) "%." #p "lf"
-#define ZBX_FS_SIZE_T "%u"
-#define zbx_fs_size_t unsigned int /* use this type only in calls to printf() for formatting size_t */
-
#define ZBX_PTR_SIZE sizeof(void *)
#if defined(_WINDOWS)
@@ -115,6 +112,9 @@
#endif /* _WINDOWS */
+#define ZBX_FS_SIZE_T ZBX_FS_UI64
+#define zbx_fs_size_t zbx_uint64_t /* use this type only in calls to printf() for formatting size_t */
+
#ifndef S_ISREG
# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
#endif