diff options
author | Aleksandrs Saveljevs <git-no-reply@zabbix.com> | 2010-06-28 10:02:26 +0400 |
---|---|---|
committer | Aleksandrs Saveljevs <git-no-reply@zabbix.com> | 2010-06-28 10:02:26 +0400 |
commit | 481bbc9c48697f1d163f923a8d193a4dfe639ae6 (patch) | |
tree | 88c8f167d8db2f66f105c7a024904ca399c8743f /include | |
parent | 29491865397cff120b5f1f96d98e4d5f0f2c01ba (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')
-rw-r--r-- | include/daemon.h | 2 | ||||
-rw-r--r-- | include/ipc.h | 11 | ||||
-rw-r--r-- | include/memalloc.h | 47 | ||||
-rw-r--r-- | include/pid.h | 2 | ||||
-rw-r--r-- | include/zbxsecurity.h | 27 |
5 files changed, 56 insertions, 33 deletions
diff --git a/include/daemon.h b/include/daemon.h index 65dc8a27985..8988f896164 100644 --- a/include/daemon.h +++ b/include/daemon.h @@ -21,7 +21,7 @@ #define ZABBIX_DAEMON_H #if defined(_WINDOWS) -# error "This module allowed only for Linux OS" +# error "This module allowed only for Unix OS" #endif /* _WINDOWS */ #define USE_PID_FILE 1 diff --git a/include/ipc.h b/include/ipc.h index fd1b62de6ae..8f486ee5987 100644 --- a/include/ipc.h +++ b/include/ipc.h @@ -24,7 +24,14 @@ # error "This module allowed only for Unix OS" #endif /* _WINDOWS */ -key_t zbx_ftok(char *path, int id); -int zbx_shmget(key_t key, size_t size); +#define ZBX_IPC_CONFIG_ID 'g' +#define ZBX_IPC_HISTORY_ID 'h' +#define ZBX_IPC_HISTORY_TEXT_ID 'x' +#define ZBX_IPC_TREND_ID 't' +#define ZBX_IPC_STRPOOL_ID 's' +#define ZBX_IPC_COLLECTOR_ID 'l' + +key_t zbx_ftok(char *path, int id); +int zbx_shmget(key_t key, size_t size); #endif 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 diff --git a/include/pid.h b/include/pid.h index ddec0ef1e49..d9a290f5ba1 100644 --- a/include/pid.h +++ b/include/pid.h @@ -21,7 +21,7 @@ #define ZABBIX_PID_H #if defined(_WINDOWS) -# error "This module allowed only for Linux OS" +# error "This module allowed only for Unix OS" #endif /* _WINDOWS */ int create_pid_file(const char *pidfile); diff --git a/include/zbxsecurity.h b/include/zbxsecurity.h deleted file mode 100644 index 51d552f78da..00000000000 --- a/include/zbxsecurity.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -** ZABBIX -** Copyright (C) 2000-2005 SIA Zabbix -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -**/ - -#ifndef ZABBIX_ZBXSECURITY_H -#define ZABBIX_ZBXSECURITY_H - -#include "zbxsock.h" - -int check_security(ZBX_SOCKET sock, char *ip_list, int allow_if_empty); - -#endif /* ZABBIX_ZBXSECURITY_H */ |