diff options
author | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-04-05 17:54:12 +0300 |
---|---|---|
committer | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-04-05 17:54:12 +0300 |
commit | a621164966ba53456cc7477ad859f7453177d50c (patch) | |
tree | 0db2d019f6515c4cf18f2e8981fa896c5f8031c2 /src | |
parent | 5fc6fef856e1fbf2b0caf8b0d07947e5c30b5af7 (diff) | |
parent | 2793f51c62480cfb620aff4763bd1bc682125e14 (diff) |
.......... [DEV-2133] updated to latest master
Diffstat (limited to 'src')
127 files changed, 235 insertions, 695 deletions
diff --git a/src/libs/zbxalgo/Makefile.am b/src/libs/zbxalgo/Makefile.am index a57a7d9a16b..0ff55ad1565 100644 --- a/src/libs/zbxalgo/Makefile.am +++ b/src/libs/zbxalgo/Makefile.am @@ -11,6 +11,7 @@ endif endif libzbxalgo_a_SOURCES = \ + algodefs.h \ algodefs.c \ binaryheap.c \ $(EVALUATE_C) \ @@ -21,5 +22,4 @@ libzbxalgo_a_SOURCES = \ prediction.c \ queue.c \ vector.c \ - vectorimpl.h \ serialize.c diff --git a/src/libs/zbxalgo/algodefs.c b/src/libs/zbxalgo/algodefs.c index b6f2afd4e17..96fd9226ff0 100644 --- a/src/libs/zbxalgo/algodefs.c +++ b/src/libs/zbxalgo/algodefs.c @@ -17,80 +17,12 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" - #include "zbxalgo.h" +#include "algodefs.h" -typedef unsigned char uchar; - -/* - * Bob Jenkins hash function (see http://burtleburtle.net/bob/hash/evahash.html) - */ -zbx_hash_t zbx_hash_lookup2(const void *data, size_t len, zbx_hash_t seed) -{ - const uchar *p = (const uchar *)data; - - zbx_hash_t a, b, c; - -#define mix(a, b, c) \ -{ \ - a = a - b; a = a - c; a = a ^ (c >> 13); \ - b = b - c; b = b - a; b = b ^ (a << 8); \ - c = c - a; c = c - b; c = c ^ (b >> 13); \ - a = a - b; a = a - c; a = a ^ (c >> 12); \ - b = b - c; b = b - a; b = b ^ (a << 16); \ - c = c - a; c = c - b; c = c ^ (b >> 5); \ - a = a - b; a = a - c; a = a ^ (c >> 3); \ - b = b - c; b = b - a; b = b ^ (a << 10); \ - c = c - a; c = c - b; c = c ^ (b >> 15); \ -} - - a = b = 0x9e3779b9u; - c = seed; - - while (len >= 12) - { - a = a + (p[0] + ((zbx_hash_t)p[1] << 8) + ((zbx_hash_t)p[2] << 16) + ((zbx_hash_t)p[3] << 24)); - b = b + (p[4] + ((zbx_hash_t)p[5] << 8) + ((zbx_hash_t)p[6] << 16) + ((zbx_hash_t)p[7] << 24)); - c = c + (p[8] + ((zbx_hash_t)p[9] << 8) + ((zbx_hash_t)p[10] << 16) + ((zbx_hash_t)p[11] << 24)); - - mix(a, b, c); - - p += 12; - len -= 12; - } - - c = c + (zbx_hash_t)len; - - switch (len) - { - case 11: c = c + ((zbx_hash_t)p[10] << 24); - ZBX_FALLTHROUGH; - case 10: c = c + ((zbx_hash_t)p[9] << 16); - ZBX_FALLTHROUGH; - case 9: c = c + ((zbx_hash_t)p[8] << 8); - ZBX_FALLTHROUGH; - case 8: b = b + ((zbx_hash_t)p[7] << 24); - ZBX_FALLTHROUGH; - case 7: b = b + ((zbx_hash_t)p[6] << 16); - ZBX_FALLTHROUGH; - case 6: b = b + ((zbx_hash_t)p[5] << 8); - ZBX_FALLTHROUGH; - case 5: b = b + p[4]; - ZBX_FALLTHROUGH; - case 4: a = a + ((zbx_hash_t)p[3] << 24); - ZBX_FALLTHROUGH; - case 3: a = a + ((zbx_hash_t)p[2] << 16); - ZBX_FALLTHROUGH; - case 2: a = a + ((zbx_hash_t)p[1] << 8); - ZBX_FALLTHROUGH; - case 1: a = a + p[0]; - } - - mix(a, b, c); +#include "common.h" - return c; -} +typedef unsigned char uchar; /* * modified FNV hash function (see http://www.isthe.com/chongo/tech/comp/fnv/) @@ -118,123 +50,6 @@ zbx_hash_t zbx_hash_modfnv(const void *data, size_t len, zbx_hash_t seed) } /* - * Murmur (see http://sites.google.com/site/murmurhash/) - */ -zbx_hash_t zbx_hash_murmur2(const void *data, size_t len, zbx_hash_t seed) -{ - const uchar *p = (const uchar *)data; - - zbx_hash_t hash; - - const zbx_hash_t m = 0x5bd1e995u; - const zbx_hash_t r = 24; - - hash = seed ^ (zbx_hash_t)len; - - while (len >= 4) - { - zbx_hash_t k; - - k = p[0]; - k |= p[1] << 8; - k |= p[2] << 16; - k |= p[3] << 24; - - k *= m; - k ^= k >> r; - k *= m; - - hash *= m; - hash ^= k; - - p += 4; - len -= 4; - } - - switch (len) - { - case 3: hash ^= p[2] << 16; - ZBX_FALLTHROUGH; - case 2: hash ^= p[1] << 8; - ZBX_FALLTHROUGH; - case 1: hash ^= p[0]; - hash *= m; - } - - hash ^= hash >> 13; - hash *= m; - hash ^= hash >> 15; - - return hash; -} - -/* - * sdbm (see http://www.cse.yorku.ca/~oz/hash.html) - */ -zbx_hash_t zbx_hash_sdbm(const void *data, size_t len, zbx_hash_t seed) -{ - const uchar *p = (const uchar *)data; - - zbx_hash_t hash = seed; - -#if 1 - - while (len-- >= 1) - { - /* hash = *(p++) + hash * 65599; */ - - hash = *(p++) + (hash << 6) + (hash << 16) - hash; - } - -#else /* Duff's device */ - -#define HASH_STEP len--; \ - hash = *(p++) + (hash << 6) + (hash << 16) - hash - - switch (len & 7) - { - do - { - HASH_STEP; - case 7: HASH_STEP; - case 6: HASH_STEP; - case 5: HASH_STEP; - case 4: HASH_STEP; - case 3: HASH_STEP; - case 2: HASH_STEP; - case 1: HASH_STEP; - case 0: ; - } - while (len >= 8); - } - -#endif - - return hash; -} - -/* - * djb2 (see http://www.cse.yorku.ca/~oz/hash.html) - */ -zbx_hash_t zbx_hash_djb2(const void *data, size_t len, zbx_hash_t seed) -{ - const uchar *p = (const uchar *)data; - - zbx_hash_t hash; - - hash = 5381u ^ seed; - - while (len-- >= 1) - { - /* hash = hash * 33 + *(p++); */ - - hash = ((hash << 5) + hash) + *(p++); - } - - return hash; -} - -/* * see http://xoshiro.di.unimi.it/splitmix64.c */ zbx_hash_t zbx_hash_splittable64(const void *data) @@ -364,7 +179,7 @@ void zbx_default_mem_free_func(void *ptr) /* numeric functions */ -int is_prime(int n) +static int is_prime(int n) { int i; diff --git a/src/libs/zbxalgo/algodefs.h b/src/libs/zbxalgo/algodefs.h new file mode 100644 index 00000000000..36355330fb4 --- /dev/null +++ b/src/libs/zbxalgo/algodefs.h @@ -0,0 +1,25 @@ +/* +** Zabbix +** Copyright (C) 2001-2022 Zabbix SIA +** +** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +**/ + +#ifndef ZABBIX_ALGO_H +#define ZABBIX_ALGO_H + +int next_prime(int n); + +#endif /* ZABBIX_ALGO_H */ diff --git a/src/libs/zbxalgo/binaryheap.c b/src/libs/zbxalgo/binaryheap.c index 8768c24630f..eabac8786eb 100644 --- a/src/libs/zbxalgo/binaryheap.c +++ b/src/libs/zbxalgo/binaryheap.c @@ -17,11 +17,11 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "zbxalgo.h" + #include "common.h" #include "log.h" -#include "zbxalgo.h" - static void swap(zbx_binary_heap_t *heap, int index_1, int index_2); static void __binary_heap_ensure_free_space(zbx_binary_heap_t *heap); diff --git a/src/libs/zbxalgo/evaluate.c b/src/libs/zbxalgo/evaluate.c index b324a818407..c73888d4f0d 100644 --- a/src/libs/zbxalgo/evaluate.c +++ b/src/libs/zbxalgo/evaluate.c @@ -17,8 +17,9 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "zbxalgo.h" + +#include "common.h" #include "zbxvariant.h" #include "log.h" @@ -187,7 +188,7 @@ static void variant_convert_to_double(zbx_variant_t *var) { if (ZBX_VARIANT_STR == var->type) { - double var_double_value = evaluate_string_to_double(var->data.str); + double var_double_value = zbx_evaluate_string_to_double(var->data.str); if (ZBX_INFINITY == var_double_value) { zbx_snprintf(buffer, max_buffer_len, "Cannot evaluate expression:" @@ -219,7 +220,7 @@ static double variant_get_double(const zbx_variant_t *var) case ZBX_VARIANT_DBL: return var->data.dbl; case ZBX_VARIANT_STR: - return evaluate_string_to_double(var->data.str); + return zbx_evaluate_string_to_double(var->data.str); default: THIS_SHOULD_NEVER_HAPPEN; return ZBX_INFINITY; @@ -953,7 +954,7 @@ static zbx_variant_t evaluate_term1(int *unknown_idx) * Purpose: evaluate an expression like "(26.416>10) or (0=1)" * * * ******************************************************************************/ -int evaluate(double *value, const char *expression, char *error, size_t max_error_len, +int zbx_evaluate(double *value, const char *expression, char *error, size_t max_error_len, zbx_vector_ptr_t *unknown_msgs) { int unknown_idx = -13; /* index of message in 'unknown_msgs' vector, set to invalid value */ @@ -1052,7 +1053,7 @@ int evaluate(double *value, const char *expression, char *error, size_t max_erro * FAIL - expression evaluation failed * * * ******************************************************************************/ -int evaluate_unknown(const char *expression, double *value, char *error, size_t max_error_len) +int zbx_evaluate_unknown(const char *expression, double *value, char *error, size_t max_error_len) { const char *__function_name = "evaluate_with_unknown"; zbx_variant_t res; @@ -1096,7 +1097,7 @@ int evaluate_unknown(const char *expression, double *value, char *error, size_t * Return value: - the resulting double * * * ******************************************************************************/ -double evaluate_string_to_double(const char *in) +double zbx_evaluate_string_to_double(const char *in) { int len; double result_double_value; diff --git a/src/libs/zbxalgo/hashmap.c b/src/libs/zbxalgo/hashmap.c index 30943c0794f..8fb4ea74735 100644 --- a/src/libs/zbxalgo/hashmap.c +++ b/src/libs/zbxalgo/hashmap.c @@ -17,9 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" - #include "zbxalgo.h" +#include "algodefs.h" + +#include "common.h" static void __hashmap_ensure_free_entry(zbx_hashmap_t *hm, ZBX_HASHMAP_SLOT_T *slot); diff --git a/src/libs/zbxalgo/hashset.c b/src/libs/zbxalgo/hashset.c index f23fc549cdc..a75fa0f8bf1 100644 --- a/src/libs/zbxalgo/hashset.c +++ b/src/libs/zbxalgo/hashset.c @@ -17,11 +17,12 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "zbxalgo.h" +#include "algodefs.h" + #include "common.h" #include "log.h" -#include "zbxalgo.h" - static void __hashset_free_entry(zbx_hashset_t *hs, ZBX_HASHSET_ENTRY_T *entry); #define CRIT_LOAD_FACTOR 4/5 diff --git a/src/libs/zbxalgo/int128.c b/src/libs/zbxalgo/int128.c index 9663fce24d0..d4d43974e3c 100644 --- a/src/libs/zbxalgo/int128.c +++ b/src/libs/zbxalgo/int128.c @@ -17,9 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "zbxtypes.h" #include "zbxalgo.h" +#include "zbxtypes.h" + #define UINT64_BIT_COUNT (sizeof(zbx_uint64_t) << 3) #define UINT32_BIT_COUNT (UINT64_BIT_COUNT >> 1) #define UINT32_BIT_MASK (~((~__UINT64_C(0)) << UINT32_BIT_COUNT)) @@ -115,6 +116,9 @@ static int ucmp128_128(const zbx_uint128_t *value1, const zbx_uint128_t *value2) return value1->lo < value2->lo ? -1 : 1; } +/* 128 bit unsigned integer handling */ +#define uset128(base, hi64, lo64) (base)->hi = hi64; (base)->lo = lo64 + /****************************************************************************** * * * Purpose: Multiplication of 64 bit unsigned integer with 32 bit unsigned * @@ -126,7 +130,7 @@ static int ucmp128_128(const zbx_uint128_t *value1, const zbx_uint128_t *value2) * shift - [IN] the number of bits to shift the result by before * * adding it to the base value. * * * - * Comments: This is a helper function for umul64_64 implementation. * + * Comments: This is a helper function for zbx_umul64_64 implementation. * * * ******************************************************************************/ static void umul64_32_shift(zbx_uint128_t *base, zbx_uint64_t value, zbx_uint64_t factor, int shift) @@ -135,11 +139,11 @@ static void umul64_32_shift(zbx_uint128_t *base, zbx_uint64_t value, zbx_uint64_ uset128(&buffer, 0, (value & UINT32_BIT_MASK) * factor); ushiftl128(&buffer, shift); - uinc128_128(base, &buffer); + zbx_uinc128_128(base, &buffer); uset128(&buffer, 0, (value >> UINT32_BIT_COUNT) * factor); ushiftl128(&buffer, UINT32_BIT_COUNT + shift); - uinc128_128(base, &buffer); + zbx_uinc128_128(base, &buffer); } /****************************************************************************** @@ -151,7 +155,7 @@ static void umul64_32_shift(zbx_uint128_t *base, zbx_uint64_t value, zbx_uint64_ * value - [IN] the value to increment by. * * * ******************************************************************************/ -void uinc128_64(zbx_uint128_t *base, zbx_uint64_t value) +void zbx_uinc128_64(zbx_uint128_t *base, zbx_uint64_t value) { zbx_uint64_t low = base->lo; @@ -170,7 +174,7 @@ void uinc128_64(zbx_uint128_t *base, zbx_uint64_t value) * value - [IN] the value to increment by. * * * ******************************************************************************/ -void uinc128_128(zbx_uint128_t *base, const zbx_uint128_t *value) +void zbx_uinc128_128(zbx_uint128_t *base, const zbx_uint128_t *value) { zbx_uint64_t low = base->lo; @@ -190,7 +194,7 @@ void uinc128_128(zbx_uint128_t *base, const zbx_uint128_t *value) * factor - [IN] the factor to multiply by. * * * ******************************************************************************/ -void umul64_64(zbx_uint128_t *result, zbx_uint64_t value, zbx_uint64_t factor) +void zbx_umul64_64(zbx_uint128_t *result, zbx_uint64_t value, zbx_uint64_t factor) { uset128(result, 0, 0); /* multiply the value with lower double word of factor and add the result */ @@ -209,7 +213,7 @@ void umul64_64(zbx_uint128_t *result, zbx_uint64_t value, zbx_uint64_t factor) * value - [IN] the divisor. * * * ******************************************************************************/ -void udiv128_64(zbx_uint128_t *result, const zbx_uint128_t *dividend, zbx_uint64_t value) +void zbx_udiv128_64(zbx_uint128_t *result, const zbx_uint128_t *dividend, zbx_uint64_t value) { zbx_uint128_t reminder, divisor; zbx_uint64_t result_mask = __UINT64_C(1) << (UINT64_BIT_COUNT - 1); @@ -256,3 +260,5 @@ void udiv128_64(zbx_uint128_t *result, const zbx_uint128_t *dividend, zbx_uint64 /* reminder is less than 64 bits, proceed with 64bit division */ result->lo |= reminder.lo / value; } + +#undef uset128 diff --git a/src/libs/zbxalgo/linked_list.c b/src/libs/zbxalgo/linked_list.c index b75bc1b8132..8964958edcb 100644 --- a/src/libs/zbxalgo/linked_list.c +++ b/src/libs/zbxalgo/linked_list.c @@ -17,9 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "zbxalgo.h" +#include "common.h" + /****************************************************************************** * * * Purpose: create singly linked list (with custom memory functions) * diff --git a/src/libs/zbxalgo/prediction.c b/src/libs/zbxalgo/prediction.c index efea3e720c8..4efe4200fba 100644 --- a/src/libs/zbxalgo/prediction.c +++ b/src/libs/zbxalgo/prediction.c @@ -17,11 +17,11 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "zbxalgo.h" + #include "common.h" #include "log.h" -#include "zbxalgo.h" - #define DB_INFINITY (1e12 - 1e-4) #define ZBX_MATH_EPSILON (1e-6) diff --git a/src/libs/zbxalgo/queue.c b/src/libs/zbxalgo/queue.c index 3ae69e445e4..a2feaf44049 100644 --- a/src/libs/zbxalgo/queue.c +++ b/src/libs/zbxalgo/queue.c @@ -17,9 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "zbxalgo.h" +#include "common.h" + /****************************************************************************** * * * Purpose: calculates the number of values in queue * diff --git a/src/libs/zbxalgo/serialize.c b/src/libs/zbxalgo/serialize.c index c045b2f4b8a..91284c33a9f 100644 --- a/src/libs/zbxalgo/serialize.c +++ b/src/libs/zbxalgo/serialize.c @@ -17,9 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "zbxserialize.h" + #include "string.h" #include "zbxtypes.h" -#include "zbxserialize.h" /****************************************************************************** * * diff --git a/src/libs/zbxalgo/vector.c b/src/libs/zbxalgo/vector.c index 18b4debcaa5..8f922a2729d 100644 --- a/src/libs/zbxalgo/vector.c +++ b/src/libs/zbxalgo/vector.c @@ -17,10 +17,9 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" - #include "zbxalgo.h" -#include "vectorimpl.h" + +#include "common.h" ZBX_VECTOR_IMPL(uint64, zbx_uint64_t) ZBX_PTR_VECTOR_IMPL(str, char *) diff --git a/src/libs/zbxalgo/vectorimpl.h b/src/libs/zbxalgo/vectorimpl.h deleted file mode 100644 index 6323f2c45f7..00000000000 --- a/src/libs/zbxalgo/vectorimpl.h +++ /dev/null @@ -1,296 +0,0 @@ -/* -** Zabbix -** Copyright (C) 2001-2022 Zabbix SIA -** -** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -**/ - -#ifndef ZABBIX_VECTORIMPL_H -#define ZABBIX_VECTORIMPL_H - -#define ZBX_VECTOR_ARRAY_GROWTH_FACTOR 3/2 - -#include "log.h" - -#define ZBX_VECTOR_IMPL(__id, __type) \ - \ -static void __vector_ ## __id ## _ensure_free_space(zbx_vector_ ## __id ## _t *vector) \ -{ \ - if (NULL == vector->values) \ - { \ - vector->values_num = 0; \ - vector->values_alloc = 32; \ - vector->values = (__type *)vector->mem_malloc_func(NULL, (size_t)vector->values_alloc * \ - sizeof(__type)); \ - } \ - else if (vector->values_num == vector->values_alloc) \ - { \ - vector->values_alloc = MAX(vector->values_alloc + 1, vector->values_alloc * \ - ZBX_VECTOR_ARRAY_GROWTH_FACTOR); \ - vector->values = (__type *)vector->mem_realloc_func(vector->values, \ - (size_t)vector->values_alloc * sizeof(__type)); \ - } \ -} \ - \ -void zbx_vector_ ## __id ## _create(zbx_vector_ ## __id ## _t *vector) \ -{ \ - zbx_vector_ ## __id ## _create_ext(vector, \ - ZBX_DEFAULT_MEM_MALLOC_FUNC, \ - ZBX_DEFAULT_MEM_REALLOC_FUNC, \ - ZBX_DEFAULT_MEM_FREE_FUNC); \ -} \ - \ -void zbx_vector_ ## __id ## _create_ext(zbx_vector_ ## __id ## _t *vector, \ - zbx_mem_malloc_func_t mem_malloc_func, \ - zbx_mem_realloc_func_t mem_realloc_func, \ - zbx_mem_free_func_t mem_free_func) \ -{ \ - vector->values = NULL; \ - vector->values_num = 0; \ - vector->values_alloc = 0; \ - \ - vector->mem_malloc_func = mem_malloc_func; \ - vector->mem_realloc_func = mem_realloc_func; \ - vector->mem_free_func = mem_free_func; \ -} \ - \ -void zbx_vector_ ## __id ## _destroy(zbx_vector_ ## __id ## _t *vector) \ -{ \ - if (NULL != vector->values) \ - { \ - vector->mem_free_func(vector->values); \ - vector->values = NULL; \ - vector->values_num = 0; \ - vector->values_alloc = 0; \ - } \ - \ - vector->mem_malloc_func = NULL; \ - vector->mem_realloc_func = NULL; \ - vector->mem_free_func = NULL; \ -} \ - \ -void zbx_vector_ ## __id ## _append(zbx_vector_ ## __id ## _t *vector, __type value) \ -{ \ - __vector_ ## __id ## _ensure_free_space(vector); \ - vector->values[vector->values_num++] = value; \ -} \ - \ -void zbx_vector_ ## __id ## _append_ptr(zbx_vector_ ## __id ## _t *vector, __type *value) \ -{ \ - __vector_ ## __id ## _ensure_free_space(vector); \ - vector->values[vector->values_num++] = *value; \ -} \ - \ -void zbx_vector_ ## __id ## _append_array(zbx_vector_ ## __id ## _t *vector, __type const *values, \ - int values_num) \ -{ \ - zbx_vector_ ## __id ## _reserve(vector, (size_t)(vector->values_num + values_num)); \ - memcpy(vector->values + vector->values_num, values, (size_t)values_num * sizeof(__type)); \ - vector->values_num = vector->values_num + values_num; \ -} \ - \ -void zbx_vector_ ## __id ## _remove_noorder(zbx_vector_ ## __id ## _t *vector, int index) \ -{ \ - if (!(0 <= index && index < vector->values_num)) \ - { \ - zabbix_log(LOG_LEVEL_CRIT, "removing a non-existent element at index %d", index); \ - exit(EXIT_FAILURE); \ - } \ - \ - vector->values[index] = vector->values[--vector->values_num]; \ -} \ - \ -void zbx_vector_ ## __id ## _remove(zbx_vector_ ## __id ## _t *vector, int index) \ -{ \ - if (!(0 <= index && index < vector->values_num)) \ - { \ - zabbix_log(LOG_LEVEL_CRIT, "removing a non-existent element at index %d", index); \ - exit(EXIT_FAILURE); \ - } \ - \ - vector->values_num--; \ - memmove(&vector->values[index], &vector->values[index + 1], \ - sizeof(__type) * (size_t)(vector->values_num - index)); \ -} \ - \ -void zbx_vector_ ## __id ## _sort(zbx_vector_ ## __id ## _t *vector, zbx_compare_func_t compare_func) \ -{ \ - if (2 <= vector->values_num) \ - qsort(vector->values, (size_t)vector->values_num, sizeof(__type), compare_func); \ -} \ - \ -void zbx_vector_ ## __id ## _uniq(zbx_vector_ ## __id ## _t *vector, zbx_compare_func_t compare_func) \ -{ \ - if (2 <= vector->values_num) \ - { \ - int i, j = 1; \ - \ - for (i = 1; i < vector->values_num; i++) \ - { \ - if (0 != compare_func(&vector->values[i - 1], &vector->values[i])) \ - vector->values[j++] = vector->values[i]; \ - } \ - \ - vector->values_num = j; \ - } \ -} \ - \ -int zbx_vector_ ## __id ## _nearestindex(const zbx_vector_ ## __id ## _t *vector, const __type value, \ - zbx_compare_func_t compare_func) \ -{ \ - int lo = 0, hi = vector->values_num, mid, c; \ - \ - while (1 <= hi - lo) \ - { \ - mid = (lo + hi) / 2; \ - \ - c = compare_func(&vector->values[mid], &value); \ - \ - if (0 > c) \ - { \ - lo = mid + 1; \ - } \ - else if (0 == c) \ - { \ - return mid; \ - } \ - else \ - hi = mid; \ - } \ - \ - return hi; \ -} \ - \ -int zbx_vector_ ## __id ## _bsearch(const zbx_vector_ ## __id ## _t *vector, const __type value, \ - zbx_compare_func_t compare_func) \ -{ \ - __type *ptr; \ - \ - ptr = (__type *)zbx_bsearch(&value, vector->values, (size_t)vector->values_num, sizeof(__type), \ - compare_func); \ - \ - if (NULL != ptr) \ - return (int)(ptr - vector->values); \ - else \ - return FAIL; \ -} \ - \ -int zbx_vector_ ## __id ## _lsearch(const zbx_vector_ ## __id ## _t *vector, const __type value, int *index,\ - zbx_compare_func_t compare_func) \ -{ \ - while (*index < vector->values_num) \ - { \ - int c = compare_func(&vector->values[*index], &value); \ - \ - if (0 > c) \ - { \ - (*index)++; \ - continue; \ - } \ - \ - if (0 == c) \ - return SUCCEED; \ - \ - if (0 < c) \ - break; \ - } \ - \ - return FAIL; \ -} \ - \ -int zbx_vector_ ## __id ## _search(const zbx_vector_ ## __id ## _t *vector, const __type value, \ - zbx_compare_func_t compare_func) \ -{ \ - int index; \ - \ - for (index = 0; index < vector->values_num; index++) \ - { \ - if (0 == compare_func(&vector->values[index], &value)) \ - return index; \ - } \ - \ - return FAIL; \ -} \ - \ - \ -void zbx_vector_ ## __id ## _setdiff(zbx_vector_ ## __id ## _t *left, const zbx_vector_ ## __id ## _t *right,\ - zbx_compare_func_t compare_func) \ -{ \ - int c, block_start, deleted = 0, left_index = 0, right_index = 0; \ - \ - while (left_index < left->values_num && right_index < right->values_num) \ - { \ - c = compare_func(&left->values[left_index], &right->values[right_index]); \ - \ - if (0 >= c) \ - left_index++; \ - \ - if (0 <= c) \ - right_index++; \ - \ - if (0 != c) \ - continue; \ - \ - if (0 < deleted++) \ - { \ - memmove(&left->values[block_start - deleted + 1], &left->values[block_start], \ - (size_t)(left_index - 1 - block_start) * sizeof(__type)); \ - } \ - \ - block_start = left_index; \ - } \ - \ - if (0 < deleted) \ - { \ - memmove(&left->values[block_start - deleted], &left->values[block_start], \ - (size_t)(left->values_num - block_start) * sizeof(__type)); \ - left->values_num -= deleted; \ - } \ -} \ - \ -void zbx_vector_ ## __id ## _reserve(zbx_vector_ ## __id ## _t *vector, size_t size) \ -{ \ - if ((int)size > vector->values_alloc) \ - { \ - vector->values_alloc = (int)size; \ - vector->values = (__type *)vector->mem_realloc_func(vector->values, \ - (size_t)vector->values_alloc * sizeof(__type)); \ - } \ -} \ - \ -void zbx_vector_ ## __id ## _clear(zbx_vector_ ## __id ## _t *vector) \ -{ \ - vector->values_num = 0; \ -} - -#define ZBX_PTR_VECTOR_IMPL(__id, __type) \ - \ -ZBX_VECTOR_IMPL(__id, __type) \ - \ -void zbx_vector_ ## __id ## _clear_ext(zbx_vector_ ## __id ## _t *vector, \ - zbx_ ## __id ## _free_func_t free_func) \ -{ \ - if (0 != vector->values_num) \ - { \ - int index; \ - \ - for (index = 0; index < vector->values_num; index++) \ - free_func(vector->values[index]); \ - \ - vector->values_num = 0; \ - } \ -} - -#endif /* ZABBIX_VECTORIMPL_H */ diff --git a/src/libs/zbxcommon/variant.c b/src/libs/zbxcommon/variant.c index aee2dadd6f5..9c3428b8c18 100644 --- a/src/libs/zbxcommon/variant.c +++ b/src/libs/zbxcommon/variant.c @@ -17,11 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "log.h" #include "zbxvariant.h" -#include "../zbxalgo/vectorimpl.h" +#include "common.h" +#include "log.h" ZBX_VECTOR_IMPL(var, zbx_variant_t) diff --git a/src/libs/zbxcommshigh/commshigh.c b/src/libs/zbxcommshigh/commshigh.c index f632fbe5ac0..ff6ec916df4 100644 --- a/src/libs/zbxcommshigh/commshigh.c +++ b/src/libs/zbxcommshigh/commshigh.c @@ -24,7 +24,7 @@ #include "log.h" #if !defined(_WINDOWS) && !defined(__MINGW32) -#include "daemon.h" +#include "zbxnix.h" #endif #include "zbxalgo.h" diff --git a/src/libs/zbxdbcache/dbcache.c b/src/libs/zbxdbcache/dbcache.c index ade22f81743..67fe08ec054 100644 --- a/src/libs/zbxdbcache/dbcache.c +++ b/src/libs/zbxdbcache/dbcache.c @@ -29,10 +29,9 @@ #include "module.h" #include "export.h" #include "zbxhistory.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxavailability.h" #include "zbxtrends.h" -#include "../zbxalgo/vectorimpl.h" static zbx_shmem_info_t *hc_index_mem = NULL; static zbx_shmem_info_t *hc_mem = NULL; @@ -409,7 +408,7 @@ static void dc_insert_trends_in_db(ZBX_DC_TREND *trends, int trends_num, unsigne zbx_uint128_t avg; /* calculate the trend average value */ - udiv128_64(&avg, &trend->value_avg.ui64, trend->num); + zbx_udiv128_64(&avg, &trend->value_avg.ui64, trend->num); zbx_db_insert_add_values(&db_insert, trend->itemid, trend->clock, trend->num, trend->value_min.ui64, avg.lo, trend->value_max.ui64); @@ -544,9 +543,9 @@ static void dc_trends_update_uint(ZBX_DC_TREND *trend, DB_ROW row, int num, size trend->value_max.ui64 = value_max.ui64; /* calculate the trend average value */ - umul64_64(&avg, num, value_avg.ui64); - uinc128_128(&trend->value_avg.ui64, &avg); - udiv128_64(&avg, &trend->value_avg.ui64, trend->num + num); + zbx_umul64_64(&avg, num, value_avg.ui64); + zbx_uinc128_128(&trend->value_avg.ui64, &avg); + zbx_udiv128_64(&avg, &trend->value_avg.ui64, trend->num + num); trend->num += num; @@ -819,7 +818,7 @@ static void DCadd_trend(const ZBX_DC_HISTORY *history, ZBX_DC_TREND **trends, in trend->value_min.ui64 = history->value.ui64; if (trend->num == 0 || history->value.ui64 > trend->value_max.ui64) trend->value_max.ui64 = history->value.ui64; - uinc128_64(&trend->value_avg.ui64, history->value.ui64); + zbx_uinc128_64(&trend->value_avg.ui64, history->value.ui64); break; } trend->num++; @@ -1189,7 +1188,7 @@ static void DCexport_trends(const ZBX_DC_TREND *trends, int trends_num, zbx_hash break; case ITEM_VALUE_TYPE_UINT64: zbx_json_adduint64(&json, ZBX_PROTO_TAG_MIN, trend->value_min.ui64); - udiv128_64(&avg, &trend->value_avg.ui64, trend->num); + zbx_udiv128_64(&avg, &trend->value_avg.ui64, trend->num); zbx_json_adduint64(&json, ZBX_PROTO_TAG_AVG, avg.lo); zbx_json_adduint64(&json, ZBX_PROTO_TAG_MAX, trend->value_max.ui64); break; diff --git a/src/libs/zbxdbcache/dbconfig.c b/src/libs/zbxdbcache/dbconfig.c index e7affcc8b19..743b3678d1c 100644 --- a/src/libs/zbxdbcache/dbconfig.c +++ b/src/libs/zbxdbcache/dbconfig.c @@ -26,7 +26,6 @@ #include "cfg.h" #include "zbxhash.h" #include "../zbxcrypto/tls_tcp_active.h" -#include "../zbxalgo/vectorimpl.h" #include "../zbxkvs/kvs.h" #include "../zbxvault/vault.h" #include "base64.h" diff --git a/src/libs/zbxdbcache/valuecache.c b/src/libs/zbxdbcache/valuecache.c index 9da241c5e71..b4fea200da6 100644 --- a/src/libs/zbxdbcache/valuecache.c +++ b/src/libs/zbxdbcache/valuecache.c @@ -21,7 +21,6 @@ #include "log.h" #include "dbcache.h" -#include "vectorimpl.h" #include "mutexs.h" /* diff --git a/src/libs/zbxdbhigh/graph_linking.c b/src/libs/zbxdbhigh/graph_linking.c index 31617627eef..15f3621678c 100644 --- a/src/libs/zbxdbhigh/graph_linking.c +++ b/src/libs/zbxdbhigh/graph_linking.c @@ -22,7 +22,6 @@ #include "db.h" #include "../../libs/zbxaudit/audit.h" #include "../../libs/zbxaudit/audit_graph.h" -#include "../../libs/zbxalgo/vectorimpl.h" typedef struct { diff --git a/src/libs/zbxdbhigh/host.c b/src/libs/zbxdbhigh/host.c index 2f17bafaeaa..a450092b85d 100644 --- a/src/libs/zbxdbhigh/host.c +++ b/src/libs/zbxdbhigh/host.c @@ -29,7 +29,6 @@ #include "../../libs/zbxaudit/audit.h" #include "trigger_linking.h" #include "graph_linking.h" -#include "../zbxalgo/vectorimpl.h" #include "db.h" diff --git a/src/libs/zbxdbhigh/tag.c b/src/libs/zbxdbhigh/tag.c index 02e9506a461..21e4d5593b0 100644 --- a/src/libs/zbxdbhigh/tag.c +++ b/src/libs/zbxdbhigh/tag.c @@ -18,7 +18,6 @@ **/ #include "common.h" -#include "../zbxalgo/vectorimpl.h" #include "db.h" diff --git a/src/libs/zbxdbhigh/template_item.c b/src/libs/zbxdbhigh/template_item.c index 863dd105dc1..104f6cd1424 100644 --- a/src/libs/zbxdbhigh/template_item.c +++ b/src/libs/zbxdbhigh/template_item.c @@ -22,7 +22,6 @@ #include "db.h" #include "log.h" #include "dbcache.h" -#include "../zbxalgo/vectorimpl.h" #include "../../libs/zbxaudit/audit.h" #include "../../libs/zbxaudit/audit_item.h" diff --git a/src/libs/zbxdbhigh/trigger_dep_linking.c b/src/libs/zbxdbhigh/trigger_dep_linking.c index 5f97a5e3bd0..6ff39733dc1 100644 --- a/src/libs/zbxdbhigh/trigger_dep_linking.c +++ b/src/libs/zbxdbhigh/trigger_dep_linking.c @@ -22,7 +22,6 @@ #include "db.h" #include "log.h" #include "../../libs/zbxaudit/audit_trigger.h" -#include "../../libs/zbxalgo/vectorimpl.h" typedef struct { diff --git a/src/libs/zbxdbhigh/trigger_linking.c b/src/libs/zbxdbhigh/trigger_linking.c index 06526e90b33..657c22c1e51 100644 --- a/src/libs/zbxdbhigh/trigger_linking.c +++ b/src/libs/zbxdbhigh/trigger_linking.c @@ -24,7 +24,6 @@ #include "log.h" #include "../../libs/zbxaudit/audit.h" #include "../../libs/zbxaudit/audit_trigger.h" -#include "../../libs/zbxalgo/vectorimpl.h" #include "trigger_dep_linking.h" typedef struct diff --git a/src/libs/zbxdbupgrade/dbupgrade.c b/src/libs/zbxdbupgrade/dbupgrade.c index e1a454d2d47..0d3e6977bf3 100644 --- a/src/libs/zbxdbupgrade/dbupgrade.c +++ b/src/libs/zbxdbupgrade/dbupgrade.c @@ -17,12 +17,11 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "zbxdbupgrade.h" #include "dbupgrade.h" -#include "common.h" #include "db.h" #include "log.h" -#include "zbxdbupgrade.h" typedef struct { diff --git a/src/libs/zbxdbupgrade/dbupgrade_2010.c b/src/libs/zbxdbupgrade/dbupgrade_2010.c index d2374f956a1..aff08f1d997 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_2010.c +++ b/src/libs/zbxdbupgrade/dbupgrade_2010.c @@ -17,9 +17,9 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" + +#include "db.h" #include "log.h" #include "sysinfo.h" diff --git a/src/libs/zbxdbupgrade/dbupgrade_2020.c b/src/libs/zbxdbupgrade/dbupgrade_2020.c index 9d0a91202d9..19888a4d76d 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_2020.c +++ b/src/libs/zbxdbupgrade/dbupgrade_2020.c @@ -17,7 +17,6 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "dbupgrade.h" /* diff --git a/src/libs/zbxdbupgrade/dbupgrade_2030.c b/src/libs/zbxdbupgrade/dbupgrade_2030.c index 769c42020eb..22a39561c2f 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_2030.c +++ b/src/libs/zbxdbupgrade/dbupgrade_2030.c @@ -17,9 +17,9 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" + +#include "db.h" #include "log.h" /* diff --git a/src/libs/zbxdbupgrade/dbupgrade_2040.c b/src/libs/zbxdbupgrade/dbupgrade_2040.c index 91bcaed031d..499cd005692 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_2040.c +++ b/src/libs/zbxdbupgrade/dbupgrade_2040.c @@ -17,9 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "dbupgrade.h" +#include "common.h" + /* * 2.4 maintenance database patches */ diff --git a/src/libs/zbxdbupgrade/dbupgrade_2050.c b/src/libs/zbxdbupgrade/dbupgrade_2050.c index 6b777c6730b..95383d0743a 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_2050.c +++ b/src/libs/zbxdbupgrade/dbupgrade_2050.c @@ -17,9 +17,9 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" + +#include "db.h" #include "sysinfo.h" #include "log.h" diff --git a/src/libs/zbxdbupgrade/dbupgrade_3000.c b/src/libs/zbxdbupgrade/dbupgrade_3000.c index 67885a2ea4f..2d6feb117ab 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_3000.c +++ b/src/libs/zbxdbupgrade/dbupgrade_3000.c @@ -17,7 +17,6 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "dbupgrade.h" /* diff --git a/src/libs/zbxdbupgrade/dbupgrade_3010.c b/src/libs/zbxdbupgrade/dbupgrade_3010.c index ed304125e0e..2a2b35b935b 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_3010.c +++ b/src/libs/zbxdbupgrade/dbupgrade_3010.c @@ -17,9 +17,9 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" + +#include "db.h" #include "log.h" /* diff --git a/src/libs/zbxdbupgrade/dbupgrade_3020.c b/src/libs/zbxdbupgrade/dbupgrade_3020.c index 14f6b126c44..2f9f002f92d 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_3020.c +++ b/src/libs/zbxdbupgrade/dbupgrade_3020.c @@ -17,10 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" +#include "db.h" + /* * 3.2 maintenance database patches */ diff --git a/src/libs/zbxdbupgrade/dbupgrade_3030.c b/src/libs/zbxdbupgrade/dbupgrade_3030.c index 5b9e09de204..bf5e70579e2 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_3030.c +++ b/src/libs/zbxdbupgrade/dbupgrade_3030.c @@ -17,9 +17,9 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" + +#include "db.h" #include "log.h" /* diff --git a/src/libs/zbxdbupgrade/dbupgrade_3040.c b/src/libs/zbxdbupgrade/dbupgrade_3040.c index d0c0eabaccd..848ecb59712 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_3040.c +++ b/src/libs/zbxdbupgrade/dbupgrade_3040.c @@ -17,9 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "dbupgrade.h" + #include "common.h" #include "db.h" -#include "dbupgrade.h" /* * 3.4 maintenance database patches diff --git a/src/libs/zbxdbupgrade/dbupgrade_3050.c b/src/libs/zbxdbupgrade/dbupgrade_3050.c index cb6eae3ff51..dca7a0c57be 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_3050.c +++ b/src/libs/zbxdbupgrade/dbupgrade_3050.c @@ -17,9 +17,9 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" + +#include "db.h" #include "zbxtasks.h" #include "zbxregexp.h" #include "log.h" diff --git a/src/libs/zbxdbupgrade/dbupgrade_4000.c b/src/libs/zbxdbupgrade/dbupgrade_4000.c index e7bd6d2fdd9..1f1ae92c2c0 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_4000.c +++ b/src/libs/zbxdbupgrade/dbupgrade_4000.c @@ -17,11 +17,11 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" #include "dbupgrade_macros.h" +#include "db.h" + /* * 4.0 maintenance database patches */ diff --git a/src/libs/zbxdbupgrade/dbupgrade_4010.c b/src/libs/zbxdbupgrade/dbupgrade_4010.c index c426e5b75c2..f29b95270a9 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_4010.c +++ b/src/libs/zbxdbupgrade/dbupgrade_4010.c @@ -17,10 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" +#include "db.h" + extern unsigned char program_type; /* diff --git a/src/libs/zbxdbupgrade/dbupgrade_4020.c b/src/libs/zbxdbupgrade/dbupgrade_4020.c index af44b3b336c..6633710350e 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_4020.c +++ b/src/libs/zbxdbupgrade/dbupgrade_4020.c @@ -17,7 +17,6 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "dbupgrade.h" extern unsigned char program_type; diff --git a/src/libs/zbxdbupgrade/dbupgrade_4030.c b/src/libs/zbxdbupgrade/dbupgrade_4030.c index c9bce2992e4..dfa9a3f7ab4 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_4030.c +++ b/src/libs/zbxdbupgrade/dbupgrade_4030.c @@ -17,10 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" +#include "db.h" + /* * 4.4 development database patches */ diff --git a/src/libs/zbxdbupgrade/dbupgrade_4040.c b/src/libs/zbxdbupgrade/dbupgrade_4040.c index 71de56fd179..36c20e8c233 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_4040.c +++ b/src/libs/zbxdbupgrade/dbupgrade_4040.c @@ -17,7 +17,6 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "dbupgrade.h" extern unsigned char program_type; diff --git a/src/libs/zbxdbupgrade/dbupgrade_4050.c b/src/libs/zbxdbupgrade/dbupgrade_4050.c index 9508e28cfb0..4b62ffa28be 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_4050.c +++ b/src/libs/zbxdbupgrade/dbupgrade_4050.c @@ -17,12 +17,11 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" + +#include "db.h" #include "log.h" #include "zbxalgo.h" -#include "../zbxalgo/vectorimpl.h" /* * 5.0 development database patches diff --git a/src/libs/zbxdbupgrade/dbupgrade_5000.c b/src/libs/zbxdbupgrade/dbupgrade_5000.c index 89cfe23becb..ea4db0f7057 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_5000.c +++ b/src/libs/zbxdbupgrade/dbupgrade_5000.c @@ -17,7 +17,6 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "dbupgrade.h" extern unsigned char program_type; diff --git a/src/libs/zbxdbupgrade/dbupgrade_5010.c b/src/libs/zbxdbupgrade/dbupgrade_5010.c index c7e8fa983f6..09d6f8b424f 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_5010.c +++ b/src/libs/zbxdbupgrade/dbupgrade_5010.c @@ -17,12 +17,11 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" + +#include "db.h" #include "log.h" #include "zbxalgo.h" -#include "../zbxalgo/vectorimpl.h" /* * 5.2 development database patches diff --git a/src/libs/zbxdbupgrade/dbupgrade_5020.c b/src/libs/zbxdbupgrade/dbupgrade_5020.c index 6cdf43d7cd4..a488d261a4f 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_5020.c +++ b/src/libs/zbxdbupgrade/dbupgrade_5020.c @@ -17,7 +17,6 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "dbupgrade.h" extern unsigned char program_type; diff --git a/src/libs/zbxdbupgrade/dbupgrade_5030.c b/src/libs/zbxdbupgrade/dbupgrade_5030.c index ce223e25d51..02bf8102a9c 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_5030.c +++ b/src/libs/zbxdbupgrade/dbupgrade_5030.c @@ -17,16 +17,15 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" +#include "dbupgrade.h" +#include "dbupgrade_macros.h" + #include "zbxeval.h" #include "log.h" #include "db.h" -#include "dbupgrade.h" -#include "dbupgrade_macros.h" #include "zbxregexp.h" #include "zbxalgo.h" #include "zbxjson.h" -#include "../zbxalgo/vectorimpl.h" #include "sysinfo.h" #include "zbxhash.h" diff --git a/src/libs/zbxdbupgrade/dbupgrade_5040.c b/src/libs/zbxdbupgrade/dbupgrade_5040.c index c9dfc5ac0a0..086603da3eb 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_5040.c +++ b/src/libs/zbxdbupgrade/dbupgrade_5040.c @@ -17,7 +17,6 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" #include "dbupgrade.h" extern unsigned char program_type; diff --git a/src/libs/zbxdbupgrade/dbupgrade_5050.c b/src/libs/zbxdbupgrade/dbupgrade_5050.c index 764540eabd7..1b251780111 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_5050.c +++ b/src/libs/zbxdbupgrade/dbupgrade_5050.c @@ -17,12 +17,11 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "common.h" -#include "db.h" #include "dbupgrade.h" #include "dbupgrade_macros.h" + +#include "db.h" #include "log.h" -#include "../zbxalgo/vectorimpl.h" #include "zbxhash.h" extern unsigned char program_type; diff --git a/src/libs/zbxdbupgrade/dbupgrade_macros.c b/src/libs/zbxdbupgrade/dbupgrade_macros.c index 30a7efae50d..5ba23ef91b1 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_macros.c +++ b/src/libs/zbxdbupgrade/dbupgrade_macros.c @@ -20,8 +20,6 @@ #include "dbupgrade_macros.h" #include "db.h" -#include "log.h" -#include "../zbxalgo/vectorimpl.h" /* Function argument descriptors. */ /* Used in varargs list to describe following parameter mapping to old position. */ diff --git a/src/libs/zbxdbupgrade/dbupgrade_macros.h b/src/libs/zbxdbupgrade/dbupgrade_macros.h index bec9804a9ef..0626258b526 100644 --- a/src/libs/zbxdbupgrade/dbupgrade_macros.h +++ b/src/libs/zbxdbupgrade/dbupgrade_macros.h @@ -20,7 +20,6 @@ #ifndef ZABBIX_DBUPGRADE_MACROS_H #define ZABBIX_DBUPGRADE_MACROS_H -#include "common.h" #include "zbxalgo.h" #include "zbxdb.h" diff --git a/src/libs/zbxeval/calc.c b/src/libs/zbxeval/calc.c index 00b9dd18304..6cf2dec8992 100644 --- a/src/libs/zbxeval/calc.c +++ b/src/libs/zbxeval/calc.c @@ -21,7 +21,6 @@ #include "common.h" #include "zbxalgo.h" -#include "../../libs/zbxalgo/vectorimpl.h" typedef struct { diff --git a/src/libs/zbxeval/parse.c b/src/libs/zbxeval/parse.c index 35fae087a63..edc55a492fc 100644 --- a/src/libs/zbxeval/parse.c +++ b/src/libs/zbxeval/parse.c @@ -20,8 +20,6 @@ #include "zbxeval.h" #include "eval.h" -#include "../zbxalgo/vectorimpl.h" - ZBX_VECTOR_IMPL(eval_token, zbx_eval_token_t) static int is_whitespace(char c) diff --git a/src/libs/zbxhistory/history.c b/src/libs/zbxhistory/history.c index 4b364e88202..d37301c6ded 100644 --- a/src/libs/zbxhistory/history.c +++ b/src/libs/zbxhistory/history.c @@ -21,7 +21,6 @@ #include "common.h" #include "log.h" -#include "../zbxalgo/vectorimpl.h" ZBX_VECTOR_IMPL(history_record, zbx_history_record_t) diff --git a/src/libs/zbxjson/jsonpath.c b/src/libs/zbxjson/jsonpath.c index 0709ebd3e36..aaf1e17c4ad 100644 --- a/src/libs/zbxjson/jsonpath.c +++ b/src/libs/zbxjson/jsonpath.c @@ -25,7 +25,6 @@ #include "json.h" #include "json_parser.h" #include "zbxvariant.h" -#include "../zbxalgo/vectorimpl.h" typedef struct { diff --git a/src/libs/zbxnix/Makefile.am b/src/libs/zbxnix/Makefile.am index 88ccea05cbb..644ea9ab7a7 100644 --- a/src/libs/zbxnix/Makefile.am +++ b/src/libs/zbxnix/Makefile.am @@ -12,5 +12,6 @@ libzbxnix_a_SOURCES = \ fatal.h \ ipc.c \ pid.c \ + pid.h \ sigcommon.h \ sighandler.c diff --git a/src/libs/zbxnix/control.c b/src/libs/zbxnix/control.c index 3ec54fe8197..dd21b035478 100644 --- a/src/libs/zbxnix/control.c +++ b/src/libs/zbxnix/control.c @@ -17,6 +17,7 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "zbxnix.h" #include "control.h" #include "common.h" @@ -121,7 +122,7 @@ static int parse_log_level_options(const char *opt, size_t len, unsigned int *sc * FAIL - an error occurred * * * ******************************************************************************/ -int parse_rtc_options(const char *opt, int *message) +int zbx_parse_rtc_options(const char *opt, int *message) { unsigned int scope, data, command; diff --git a/src/libs/zbxnix/control.h b/src/libs/zbxnix/control.h index 534297c8fb4..456629af1af 100644 --- a/src/libs/zbxnix/control.h +++ b/src/libs/zbxnix/control.h @@ -24,6 +24,4 @@ #define ZBX_RTC_LOG_SCOPE_PROC 0 #define ZBX_RTC_LOG_SCOPE_PID 1 -int parse_rtc_options(const char *opt, int *message); - -#endif +#endif /* ZABBIX_CONTROL_H */ diff --git a/src/libs/zbxnix/coredump.c b/src/libs/zbxnix/coredump.c index d1fab9282cd..a55c9c58acf 100644 --- a/src/libs/zbxnix/coredump.c +++ b/src/libs/zbxnix/coredump.c @@ -17,9 +17,10 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "zbxnix.h" + #include "common.h" #include "log.h" -#include "zbxnix.h" #if defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL) /****************************************************************************** diff --git a/src/libs/zbxnix/daemon.c b/src/libs/zbxnix/daemon.c index cde17b0fe47..07a60eed431 100644 --- a/src/libs/zbxnix/daemon.c +++ b/src/libs/zbxnix/daemon.c @@ -17,17 +17,16 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "daemon.h" +#include "zbxnix.h" + +#include "fatal.h" +#include "sigcommon.h" #include "common.h" -#include "pid.h" #include "cfg.h" #include "log.h" #include "control.h" - -#include "fatal.h" -#include "sighandler.h" -#include "sigcommon.h" +#include "pid.h" char *CONFIG_PID_FILE = NULL; static int parent_pid = -1; @@ -317,7 +316,7 @@ static void set_daemon_signal_handlers(void) * Comments: it doesn't allow running under 'root' if allow_root is zero * * * ******************************************************************************/ -int daemon_start(int allow_root, const char *user, unsigned int flags) +int zbx_daemon_start(int allow_root, const char *user, unsigned int flags) { struct passwd *pwd; @@ -395,7 +394,7 @@ int daemon_start(int allow_root, const char *user, unsigned int flags) if (FAIL == create_pid_file(CONFIG_PID_FILE)) exit(EXIT_FAILURE); - atexit(daemon_stop); + atexit(zbx_daemon_stop); parent_pid = (int)getpid(); @@ -410,7 +409,7 @@ int daemon_start(int allow_root, const char *user, unsigned int flags) return MAIN_ZABBIX_ENTRY(flags); } -void daemon_stop(void) +void zbx_daemon_stop(void) { /* this function is registered using atexit() to be called when we terminate */ /* there should be nothing like logging or calls to exit() beyond this point */ diff --git a/src/libs/zbxnix/dshm.c b/src/libs/zbxnix/dshm.c index deb7893c8c9..ffab09967fb 100644 --- a/src/libs/zbxnix/dshm.c +++ b/src/libs/zbxnix/dshm.c @@ -17,8 +17,9 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "zbxnix.h" + #include "common.h" -#include "ipc.h" #include "log.h" extern char *CONFIG_FILE; diff --git a/src/libs/zbxnix/fatal.h b/src/libs/zbxnix/fatal.h index 0ef1f02972e..78d882298b1 100644 --- a/src/libs/zbxnix/fatal.h +++ b/src/libs/zbxnix/fatal.h @@ -26,6 +26,6 @@ #define ZBX_FATAL_LOG_FULL_INFO (ZBX_FATAL_LOG_PC_REG_SF | ZBX_FATAL_LOG_BACKTRACE | ZBX_FATAL_LOG_MEM_MAP) const char *get_signal_name(int sig); -void zbx_log_fatal_info(void *context, unsigned int flags); +void zbx_log_fatal_info(void *context, unsigned int flags); -#endif +#endif /* ZABBIX_FATAL_H */ diff --git a/src/libs/zbxnix/ipc.c b/src/libs/zbxnix/ipc.c index 2b35b974e51..2899322c935 100644 --- a/src/libs/zbxnix/ipc.c +++ b/src/libs/zbxnix/ipc.c @@ -17,7 +17,7 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "ipc.h" +#include "zbxnix.h" #include "common.h" #include "log.h" diff --git a/src/libs/zbxnix/pid.c b/src/libs/zbxnix/pid.c index 6ff7d180363..20d1be0fe21 100644 --- a/src/libs/zbxnix/pid.c +++ b/src/libs/zbxnix/pid.c @@ -17,10 +17,12 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ +#include "zbxnix.h" #include "pid.h" #include "common.h" #include "log.h" + static FILE *fpid = NULL; static int fdpid = -1; diff --git a/src/libs/zbxnix/pid.h b/src/libs/zbxnix/pid.h new file mode 100644 index 00000000000..d501d6d39cf --- /dev/null +++ b/src/libs/zbxnix/pid.h @@ -0,0 +1,34 @@ +/* +** Zabbix +** Copyright (C) 2001-2022 Zabbix SIA +** +** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +**/ + +#ifndef ZABBIX_PID_H +#define ZABBIX_PID_H + +#include "sysinc.h" + +#ifdef _WINDOWS +# error "This module allowed only for Unix OS" +#endif + +#include "threads.h" + +int create_pid_file(const char *pidfile); +int read_pid_file(const char *pidfile, pid_t *pid, char *error, size_t max_error_len); +void drop_pid_file(const char *pidfile); +#endif /* ZABBIX_PID_H */ diff --git a/src/libs/zbxnix/sighandler.c b/src/libs/zbxnix/sighandler.c index 29f579a2cb2..458e2e7d6ee 100644 --- a/src/libs/zbxnix/sighandler.c +++ b/src/libs/zbxnix/sighandler.c @@ -17,14 +17,13 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "sighandler.h" +#include "zbxnix.h" +#include "sigcommon.h" #include "common.h" #include "log.h" #include "fatal.h" -#include "sigcommon.h" #include "zbxcrypto.h" -#include "daemon.h" int sig_parent_pid = -1; volatile sig_atomic_t sig_exiting; diff --git a/src/libs/zbxrtc/rtc_service.c b/src/libs/zbxrtc/rtc_service.c index fdd0b7bd560..13781111576 100644 --- a/src/libs/zbxrtc/rtc_service.c +++ b/src/libs/zbxrtc/rtc_service.c @@ -17,14 +17,14 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "zbxserialize.h" -#include "zbxjson.h" -#include "daemon.h" #include "zbxrtc.h" #include "rtc.h" + +#include "zbxserialize.h" +#include "zbxjson.h" +#include "zbxnix.h" #include "log.h" #include "zbxdiag.h" -#include "../../libs/zbxalgo/vectorimpl.h" ZBX_PTR_VECTOR_IMPL(rtc_sub, zbx_rtc_sub_t *) ZBX_PTR_VECTOR_IMPL(rtc_hook, zbx_rtc_hook_t *) diff --git a/src/libs/zbxself/selfmon.c b/src/libs/zbxself/selfmon.c index 8c298bfd040..ff759582b3b 100644 --- a/src/libs/zbxself/selfmon.c +++ b/src/libs/zbxself/selfmon.c @@ -24,7 +24,7 @@ #ifndef _WINDOWS # include "mutexs.h" -# include "ipc.h" +# include "zbxnix.h" # include "log.h" # define MAX_HISTORY 60 diff --git a/src/libs/zbxserver/anomalystl.c b/src/libs/zbxserver/anomalystl.c index 6038caf9fcd..2d2ec774b94 100644 --- a/src/libs/zbxserver/anomalystl.c +++ b/src/libs/zbxserver/anomalystl.c @@ -22,7 +22,6 @@ #include "common.h" #include "log.h" #include "zbxeval.h" -#include "../zbxalgo/vectorimpl.h" ZBX_PTR_VECTOR_DECL(VV, zbx_vector_history_record_t *) ZBX_PTR_VECTOR_IMPL(VV, zbx_vector_history_record_t *) diff --git a/src/libs/zbxserver/evalfunc.c b/src/libs/zbxserver/evalfunc.c index c38d616a39f..8ef78f3d93b 100644 --- a/src/libs/zbxserver/evalfunc.c +++ b/src/libs/zbxserver/evalfunc.c @@ -24,7 +24,6 @@ #include "zbxregexp.h" #include "valuecache.h" #include "zbxtrends.h" -#include "../zbxalgo/vectorimpl.h" #include "anomalystl.h" #include "evalfunc_common.h" @@ -390,8 +389,8 @@ static int evaluate_value_by_map(char *value, size_t max_len, zbx_vector_valuema { double num1, num2; - if (ZBX_INFINITY != (num1 = evaluate_string_to_double(value)) && - ZBX_INFINITY != (num2 = evaluate_string_to_double(valuemap->value)) && + if (ZBX_INFINITY != (num1 = zbx_evaluate_string_to_double(value)) && + ZBX_INFINITY != (num2 = zbx_evaluate_string_to_double(valuemap->value)) && SUCCEED == zbx_double_compare(num1, num2)) { goto map_value; @@ -417,18 +416,18 @@ static int evaluate_value_by_map(char *value, size_t max_len, zbx_vector_valuema } if (ITEM_VALUE_TYPE_STR != value_type && - ZBX_INFINITY != (input_value = evaluate_string_to_double(value))) + ZBX_INFINITY != (input_value = zbx_evaluate_string_to_double(value))) { double min, max; if (ZBX_VALUEMAP_TYPE_LESS_OR_EQUAL == valuemap->type && - ZBX_INFINITY != (max = evaluate_string_to_double(valuemap->value))) + ZBX_INFINITY != (max = zbx_evaluate_string_to_double(valuemap->value))) { if (input_value <= max) goto map_value; } else if (ZBX_VALUEMAP_TYPE_GREATER_OR_EQUAL == valuemap->type && - ZBX_INFINITY != (min = evaluate_string_to_double(valuemap->value))) + ZBX_INFINITY != (min = zbx_evaluate_string_to_double(valuemap->value))) { if (input_value >= min) goto map_value; @@ -463,14 +462,14 @@ static int evaluate_value_by_map(char *value, size_t max_len, zbx_vector_valuema if (NULL == ptr) { - min = evaluate_string_to_double(range_str); + min = zbx_evaluate_string_to_double(range_str); found = ZBX_INFINITY != min && SUCCEED == zbx_double_compare(input_value, min); } else { *ptr = '\0'; - min = evaluate_string_to_double(range_str); - max = evaluate_string_to_double(ptr + 1); + min = zbx_evaluate_string_to_double(range_str); + max = zbx_evaluate_string_to_double(ptr + 1); if (ZBX_INFINITY != min && ZBX_INFINITY != max && input_value >= min && input_value <= max) { diff --git a/src/libs/zbxserver/expression.c b/src/libs/zbxserver/expression.c index c55763b03fa..a54e4e89cdf 100644 --- a/src/libs/zbxserver/expression.c +++ b/src/libs/zbxserver/expression.c @@ -27,7 +27,6 @@ #include "zbxeval.h" #include "valuecache.h" #include "macrofunc.h" -#include "../zbxalgo/vectorimpl.h" #include "zbxxml.h" typedef struct diff --git a/src/libs/zbxservice/service.c b/src/libs/zbxservice/service.c index 0e5b3c4659d..904a94ff60d 100644 --- a/src/libs/zbxservice/service.c +++ b/src/libs/zbxservice/service.c @@ -21,7 +21,6 @@ #include "log.h" #include "zbxipcservice.h" -#include "../../libs/zbxalgo/vectorimpl.h" ZBX_PTR_VECTOR_IMPL(service, DB_SERVICE *) void zbx_service_flush(zbx_uint32_t code, unsigned char *data, zbx_uint32_t size) diff --git a/src/libs/zbxsysinfo/sysinfo.c b/src/libs/zbxsysinfo/sysinfo.c index af3258266f1..e527d49f3b6 100644 --- a/src/libs/zbxsysinfo/sysinfo.c +++ b/src/libs/zbxsysinfo/sysinfo.c @@ -23,7 +23,7 @@ #include "alias.h" #include "threads.h" #if !defined(_WINDOWS) && !defined(__MINGW32__) -#include "sighandler.h" +#include "zbxnix.h" #endif #include "zbxalgo.h" #include "zbxregexp.h" diff --git a/src/libs/zbxsysinfo/win32/wmi.cpp b/src/libs/zbxsysinfo/win32/wmi.cpp index ed3578bbea9..375446ad765 100644 --- a/src/libs/zbxsysinfo/win32/wmi.cpp +++ b/src/libs/zbxsysinfo/win32/wmi.cpp @@ -25,7 +25,6 @@ extern "C" # include "sysinfo.h" # include "log.h" # include "zbxalgo.h" -# include "../../zbxalgo/vectorimpl.h" # include "zbxjson.h" # include "cfg.h" } diff --git a/src/libs/zbxxml/xml.c b/src/libs/zbxxml/xml.c index 98d05f17011..dd943cbf791 100644 --- a/src/libs/zbxxml/xml.c +++ b/src/libs/zbxxml/xml.c @@ -28,8 +28,6 @@ # include <libxml/xpath.h> #endif -#include "../zbxalgo/vectorimpl.h" - typedef struct _zbx_xml_node_t zbx_xml_node_t; ZBX_PTR_VECTOR_DECL(xml_node_ptr, zbx_xml_node_t *) diff --git a/src/zabbix_agent/active.c b/src/zabbix_agent/active.c index a6b86de87ab..145cb5a672a 100644 --- a/src/zabbix_agent/active.c +++ b/src/zabbix_agent/active.c @@ -37,7 +37,7 @@ extern ZBX_THREAD_LOCAL char *CONFIG_HOSTNAME; #if defined(ZABBIX_SERVICE) # include "service.h" #elif defined(ZABBIX_DAEMON) -# include "daemon.h" +# include "zbxnix.h" #endif #include "zbxcrypto.h" diff --git a/src/zabbix_agent/listener.c b/src/zabbix_agent/listener.c index 6e67a3f373e..ea6ae1d1750 100644 --- a/src/zabbix_agent/listener.c +++ b/src/zabbix_agent/listener.c @@ -31,7 +31,7 @@ extern ZBX_THREAD_LOCAL int server_num, process_num; #if defined(ZABBIX_SERVICE) # include "service.h" #elif defined(ZABBIX_DAEMON) -# include "daemon.h" +# include "zbxnix.h" #endif #include "zbxcrypto.h" diff --git a/src/zabbix_agent/logfiles/persistent_state.c b/src/zabbix_agent/logfiles/persistent_state.c index a59e651e67b..4622c76b893 100644 --- a/src/zabbix_agent/logfiles/persistent_state.c +++ b/src/zabbix_agent/logfiles/persistent_state.c @@ -23,7 +23,6 @@ #include "logfiles.h" #include "zbxjson.h" #include "zbxcrypto.h" -#include "../../libs/zbxalgo/vectorimpl.h" /* tags for agent persistent storage files */ #define ZBX_PERSIST_TAG_FILENAME "filename" diff --git a/src/zabbix_agent/procstat.c b/src/zabbix_agent/procstat.c index e7b8613df34..40383921df7 100644 --- a/src/zabbix_agent/procstat.c +++ b/src/zabbix_agent/procstat.c @@ -21,7 +21,7 @@ #include "log.h" #include "stats.h" -#include "ipc.h" +#include "zbxnix.h" #ifdef ZBX_PROCSTAT_COLLECTOR diff --git a/src/zabbix_agent/stats.c b/src/zabbix_agent/stats.c index 22187800a13..dcb40af24d9 100644 --- a/src/zabbix_agent/stats.c +++ b/src/zabbix_agent/stats.c @@ -29,7 +29,7 @@ /* defined in sysinfo lib */ extern int get_cpu_num_win32(void); #else -# include "daemon.h" +# include "zbxnix.h" #endif ZBX_COLLECTOR_DATA *collector = NULL; diff --git a/src/zabbix_agent/stats.h b/src/zabbix_agent/stats.h index a858cd8b9b5..9020fc23660 100644 --- a/src/zabbix_agent/stats.h +++ b/src/zabbix_agent/stats.h @@ -24,7 +24,7 @@ #ifndef _WINDOWS # include "diskdevices.h" -# include "ipc.h" +# include "zbxnix.h" #endif #include "cpustat.h" diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c index 454d1c404f5..e66fea0b8d4 100644 --- a/src/zabbix_agent/zabbix_agentd.c +++ b/src/zabbix_agent/zabbix_agentd.c @@ -103,8 +103,6 @@ int CONFIG_TCP_MAX_BACKLOG_SIZE = SOMAXCONN; # include "perfstat.h" #else # include "zbxnix.h" -# include "sighandler.h" -# include "daemon.h" #endif #include "active.h" #include "listener.h" @@ -114,7 +112,7 @@ int CONFIG_TCP_MAX_BACKLOG_SIZE = SOMAXCONN; #if defined(ZABBIX_SERVICE) # include "service.h" #elif defined(ZABBIX_DAEMON) -# include "daemon.h" +# include "zbxnix.h" #endif #include "setproctitle.h" @@ -360,7 +358,7 @@ static int parse_commandline(int argc, char **argv, ZBX_TASK_EX *t) break; #ifndef _WINDOWS case 'R': - if (SUCCEED != parse_rtc_options(zbx_optarg, &t->data)) + if (SUCCEED != zbx_parse_rtc_options(zbx_optarg, &t->data)) exit(EXIT_FAILURE); t->task = ZBX_TASK_RUNTIME_CONTROL; @@ -1464,7 +1462,7 @@ int main(int argc, char **argv) break; } - START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER, t.flags); + ZBX_START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER, t.flags); exit(EXIT_SUCCESS); } diff --git a/src/zabbix_proxy/datasender/datasender.c b/src/zabbix_proxy/datasender/datasender.c index 63516c2da11..16f7278c363 100644 --- a/src/zabbix_proxy/datasender/datasender.c +++ b/src/zabbix_proxy/datasender/datasender.c @@ -22,7 +22,7 @@ #include "zbxcommshigh.h" #include "db.h" #include "log.h" -#include "daemon.h" +#include "zbxnix.h" #include "proxy.h" #include "zbxself.h" #include "zbxtasks.h" diff --git a/src/zabbix_proxy/heart/heart.c b/src/zabbix_proxy/heart/heart.c index 9e8344f0e7a..179a0218c68 100644 --- a/src/zabbix_proxy/heart/heart.c +++ b/src/zabbix_proxy/heart/heart.c @@ -19,7 +19,7 @@ #include "heart.h" -#include "daemon.h" +#include "zbxnix.h" #include "log.h" #include "zbxjson.h" #include "zbxself.h" diff --git a/src/zabbix_proxy/housekeeper/housekeeper.c b/src/zabbix_proxy/housekeeper/housekeeper.c index a52f3649e0a..fcdce043a82 100644 --- a/src/zabbix_proxy/housekeeper/housekeeper.c +++ b/src/zabbix_proxy/housekeeper/housekeeper.c @@ -20,7 +20,7 @@ #include "housekeeper.h" #include "log.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "dbcache.h" #include "zbxrtc.h" diff --git a/src/zabbix_proxy/proxy.c b/src/zabbix_proxy/proxy.c index 5291d45a76d..dd057b1b673 100644 --- a/src/zabbix_proxy/proxy.c +++ b/src/zabbix_proxy/proxy.c @@ -30,7 +30,6 @@ #include "zbxmodules.h" #include "zbxnix.h" -#include "daemon.h" #include "zbxself.h" #include "../zabbix_server/dbsyncer/dbsyncer.h" @@ -55,7 +54,6 @@ #include "../zabbix_server/availability/avail_manager.h" #include "../libs/zbxvault/vault.h" #include "zbxdiag.h" -#include "sighandler.h" #include "zbxrtc.h" #ifdef HAVE_OPENIPMI @@ -1037,7 +1035,7 @@ int main(int argc, char **argv) exit(SUCCEED == ret ? EXIT_SUCCESS : EXIT_FAILURE); } - return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, t.flags); + return zbx_daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, t.flags); } static void zbx_check_db(void) diff --git a/src/zabbix_proxy/proxyconfig/proxyconfig.c b/src/zabbix_proxy/proxyconfig/proxyconfig.c index f35efc61b4d..9bd68553b83 100644 --- a/src/zabbix_proxy/proxyconfig/proxyconfig.c +++ b/src/zabbix_proxy/proxyconfig/proxyconfig.c @@ -20,7 +20,7 @@ #include "proxyconfig.h" #include "log.h" -#include "daemon.h" +#include "zbxnix.h" #include "proxy.h" #include "zbxself.h" diff --git a/src/zabbix_proxy/taskmanager/taskmanager.c b/src/zabbix_proxy/taskmanager/taskmanager.c index 8e38c63880a..2057925e6ae 100644 --- a/src/zabbix_proxy/taskmanager/taskmanager.c +++ b/src/zabbix_proxy/taskmanager/taskmanager.c @@ -19,7 +19,7 @@ #include "taskmanager.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "zbxtasks.h" #include "log.h" diff --git a/src/zabbix_server/actions.c b/src/zabbix_server/actions.c index a17b57e55d9..2309db15d44 100644 --- a/src/zabbix_server/actions.c +++ b/src/zabbix_server/actions.c @@ -2647,7 +2647,7 @@ static int check_action_conditions(zbx_uint64_t eventid, const zbx_action_eval_t if (CONDITION_EVAL_TYPE_EXPRESSION == action->evaltype) { - if (SUCCEED == evaluate(&eval_result, expression, error, sizeof(error), NULL)) + if (SUCCEED == zbx_evaluate(&eval_result, expression, error, sizeof(error), NULL)) ret = (SUCCEED != zbx_double_compare(eval_result, 0) ? SUCCEED : FAIL); zbx_free(expression); diff --git a/src/zabbix_server/alerter/alert_manager.c b/src/zabbix_server/alerter/alert_manager.c index cb0530fa827..30543c50222 100644 --- a/src/zabbix_server/alerter/alert_manager.c +++ b/src/zabbix_server/alerter/alert_manager.c @@ -19,7 +19,7 @@ #include "alert_manager.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "zbxserver.h" diff --git a/src/zabbix_server/alerter/alert_syncer.c b/src/zabbix_server/alerter/alert_syncer.c index 6dac2822384..14793e9feff 100644 --- a/src/zabbix_server/alerter/alert_syncer.c +++ b/src/zabbix_server/alerter/alert_syncer.c @@ -19,12 +19,11 @@ #include "alert_syncer.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "alerter_protocol.h" #include "service_protocol.h" -#include "../../libs/zbxalgo/vectorimpl.h" #include "dbcache.h" #define ZBX_POLL_INTERVAL 1 diff --git a/src/zabbix_server/alerter/alerter.c b/src/zabbix_server/alerter/alerter.c index 0439b0acff4..41594e855db 100644 --- a/src/zabbix_server/alerter/alerter.c +++ b/src/zabbix_server/alerter/alerter.c @@ -20,7 +20,7 @@ #include "alerter.h" #include "log.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxmedia.h" #include "zbxself.h" #include "zbxexec.h" diff --git a/src/zabbix_server/availability/avail_manager.c b/src/zabbix_server/availability/avail_manager.c index 2394e334cb7..a74f943e1f4 100644 --- a/src/zabbix_server/availability/avail_manager.c +++ b/src/zabbix_server/availability/avail_manager.c @@ -23,8 +23,7 @@ #include "zbxself.h" #include "zbxavailability.h" #include "zbxipcservice.h" -#include "daemon.h" -#include "sighandler.h" +#include "zbxnix.h" #include "dbcache.h" extern ZBX_THREAD_LOCAL unsigned char process_type; diff --git a/src/zabbix_server/dbconfig/dbconfig.c b/src/zabbix_server/dbconfig/dbconfig.c index 50969165ba0..afb4f193fca 100644 --- a/src/zabbix_server/dbconfig/dbconfig.c +++ b/src/zabbix_server/dbconfig/dbconfig.c @@ -19,7 +19,7 @@ #include "dbconfig.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "dbcache.h" diff --git a/src/zabbix_server/dbsyncer/dbsyncer.c b/src/zabbix_server/dbsyncer/dbsyncer.c index b7f0b62a7a9..f58606c7c16 100644 --- a/src/zabbix_server/dbsyncer/dbsyncer.c +++ b/src/zabbix_server/dbsyncer/dbsyncer.c @@ -20,9 +20,8 @@ #include "dbsyncer.h" #include "log.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" -#include "sighandler.h" #include "dbcache.h" #include "export.h" diff --git a/src/zabbix_server/discoverer/discoverer.c b/src/zabbix_server/discoverer/discoverer.c index 0217be641a2..5bd542b119c 100644 --- a/src/zabbix_server/discoverer/discoverer.c +++ b/src/zabbix_server/discoverer/discoverer.c @@ -26,7 +26,7 @@ #include "zbxself.h" #include "zbxrtc.h" -#include "daemon.h" +#include "zbxnix.h" #include "../poller/checks_agent.h" #include "../poller/checks_snmp.h" #include "zbxcrypto.h" diff --git a/src/zabbix_server/escalator/escalator.c b/src/zabbix_server/escalator/escalator.c index 488d5ed91eb..36b686ca10c 100644 --- a/src/zabbix_server/escalator/escalator.c +++ b/src/zabbix_server/escalator/escalator.c @@ -19,10 +19,9 @@ #include "escalator.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxserver.h" #include "zbxself.h" -#include "../../libs/zbxalgo/vectorimpl.h" #include "../actions.h" #include "../scripts/scripts.h" #include "zbxcrypto.h" diff --git a/src/zabbix_server/events.c b/src/zabbix_server/events.c index 5fa9b5b4842..935e7a0a022 100644 --- a/src/zabbix_server/events.c +++ b/src/zabbix_server/events.c @@ -809,7 +809,7 @@ static zbx_correlation_match_result_t correlation_match_new_event(zbx_correlatio pos = token.loc.r; } - if (SUCCEED == evaluate_unknown(expression, &result, error, sizeof(error))) + if (SUCCEED == zbx_evaluate_unknown(expression, &result, error, sizeof(error))) { if (result == ZBX_UNKNOWN) ret = CORRELATION_MAY_MATCH; diff --git a/src/zabbix_server/ha/ha_manager.c b/src/zabbix_server/ha/ha_manager.c index 7ab6cedfe66..bc4c64cc628 100644 --- a/src/zabbix_server/ha/ha_manager.c +++ b/src/zabbix_server/ha/ha_manager.c @@ -25,7 +25,6 @@ #include "zbxserialize.h" #include "threads.h" #include "mutexs.h" -#include "../../libs/zbxalgo/vectorimpl.h" #include "../../libs/zbxaudit/audit.h" #include "../../libs/zbxaudit/audit_ha.h" #include "../../libs/zbxaudit/audit_settings.h" diff --git a/src/zabbix_server/housekeeper/housekeeper.c b/src/zabbix_server/housekeeper/housekeeper.c index cb99393cbc0..a8ac984be6e 100644 --- a/src/zabbix_server/housekeeper/housekeeper.c +++ b/src/zabbix_server/housekeeper/housekeeper.c @@ -19,7 +19,7 @@ #include "housekeeper.h" #include "log.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "zbxserver.h" #include "zbxrtc.h" diff --git a/src/zabbix_server/housekeeper/trigger_housekeeper.c b/src/zabbix_server/housekeeper/trigger_housekeeper.c index 68596044815..e49049da751 100644 --- a/src/zabbix_server/housekeeper/trigger_housekeeper.c +++ b/src/zabbix_server/housekeeper/trigger_housekeeper.c @@ -21,7 +21,7 @@ #include "log.h" #include "zbxself.h" -#include "daemon.h" +#include "zbxnix.h" #include "service_protocol.h" #include "zbxrtc.h" diff --git a/src/zabbix_server/httppoller/httppoller.c b/src/zabbix_server/httppoller/httppoller.c index 8004df11c45..e80d6a9d5d4 100644 --- a/src/zabbix_server/httppoller/httppoller.c +++ b/src/zabbix_server/httppoller/httppoller.c @@ -22,7 +22,7 @@ #include "common.h" #include "db.h" #include "log.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "httptest.h" diff --git a/src/zabbix_server/httppoller/httptest.c b/src/zabbix_server/httppoller/httptest.c index b7006a736d0..bd73a78c75c 100644 --- a/src/zabbix_server/httppoller/httptest.c +++ b/src/zabbix_server/httppoller/httptest.c @@ -21,7 +21,7 @@ #include "log.h" #include "preproc.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxserver.h" #include "zbxregexp.h" #include "zbxhttp.h" diff --git a/src/zabbix_server/ipmi/ipmi_manager.c b/src/zabbix_server/ipmi/ipmi_manager.c index 6dba5990aa7..558b1ccd2b1 100644 --- a/src/zabbix_server/ipmi/ipmi_manager.c +++ b/src/zabbix_server/ipmi/ipmi_manager.c @@ -23,7 +23,7 @@ #include "ipmi_manager.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "zbxipcservice.h" diff --git a/src/zabbix_server/ipmi/ipmi_poller.c b/src/zabbix_server/ipmi/ipmi_poller.c index 36eec2c71b5..eae6d00cec0 100644 --- a/src/zabbix_server/ipmi/ipmi_poller.c +++ b/src/zabbix_server/ipmi/ipmi_poller.c @@ -23,7 +23,7 @@ #include "ipmi_poller.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "zbxipcservice.h" diff --git a/src/zabbix_server/lld/lld.c b/src/zabbix_server/lld/lld.c index 6bf5120538e..1ac6fe02e39 100644 --- a/src/zabbix_server/lld/lld.c +++ b/src/zabbix_server/lld/lld.c @@ -394,7 +394,7 @@ static int filter_evaluate_or(const lld_filter_t *filter, const struct zbx_json_ * * * Comments: 1) replace {item_condition} references with action condition * * evaluation results (1 or 0) * - * 2) call evaluate() to calculate the final result * + * 2) call zbx_evaluate() to calculate the final result * * * ******************************************************************************/ static int filter_evaluate_expression(const lld_filter_t *filter, const struct zbx_json_parse *jp_row, @@ -427,7 +427,7 @@ static int filter_evaluate_expression(const lld_filter_t *filter, const struct z } } - if (SUCCEED == evaluate(&result, expression, error, sizeof(error), NULL)) + if (SUCCEED == zbx_evaluate(&result, expression, error, sizeof(error), NULL)) ret = (SUCCEED != zbx_double_compare(result, 0) ? SUCCEED : FAIL); zbx_free(expression); diff --git a/src/zabbix_server/lld/lld_manager.c b/src/zabbix_server/lld/lld_manager.c index 774c9f7ffac..9ef208f22cb 100644 --- a/src/zabbix_server/lld/lld_manager.c +++ b/src/zabbix_server/lld/lld_manager.c @@ -19,7 +19,7 @@ #include "lld_manager.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "zbxipcservice.h" diff --git a/src/zabbix_server/lld/lld_worker.c b/src/zabbix_server/lld/lld_worker.c index 55740eae00b..b8fff40da77 100644 --- a/src/zabbix_server/lld/lld_worker.c +++ b/src/zabbix_server/lld/lld_worker.c @@ -19,7 +19,7 @@ #include "lld_worker.h" -#include "daemon.h" +#include "zbxnix.h" #include "log.h" #include "zbxipcservice.h" #include "zbxself.h" diff --git a/src/zabbix_server/pinger/pinger.c b/src/zabbix_server/pinger/pinger.c index 500d1929a79..64629dc3eae 100644 --- a/src/zabbix_server/pinger/pinger.c +++ b/src/zabbix_server/pinger/pinger.c @@ -22,7 +22,7 @@ #include "log.h" #include "zbxserver.h" #include "zbxicmpping.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "preproc.h" diff --git a/src/zabbix_server/poller/poller.c b/src/zabbix_server/poller/poller.c index dc9233a278a..d4467ea3056 100644 --- a/src/zabbix_server/poller/poller.c +++ b/src/zabbix_server/poller/poller.c @@ -19,7 +19,7 @@ #include "poller.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxserver.h" #include "zbxself.h" #include "preproc.h" diff --git a/src/zabbix_server/preprocessor/preproc_cache.c b/src/zabbix_server/preprocessor/preproc_cache.c index 1ea66e5267a..9b7cff0731e 100644 --- a/src/zabbix_server/preprocessor/preproc_cache.c +++ b/src/zabbix_server/preprocessor/preproc_cache.c @@ -17,7 +17,6 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#include "../../libs/zbxalgo/vectorimpl.h" #include "zbxprometheus.h" #include "item_preproc.h" diff --git a/src/zabbix_server/preprocessor/preproc_manager.c b/src/zabbix_server/preprocessor/preproc_manager.c index 004eda81111..99d59c9ca72 100644 --- a/src/zabbix_server/preprocessor/preproc_manager.c +++ b/src/zabbix_server/preprocessor/preproc_manager.c @@ -19,7 +19,7 @@ #include "preproc_manager.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "zbxlld.h" diff --git a/src/zabbix_server/preprocessor/preproc_worker.c b/src/zabbix_server/preprocessor/preproc_worker.c index 96edee89e0a..7b8c3739bd6 100644 --- a/src/zabbix_server/preprocessor/preproc_worker.c +++ b/src/zabbix_server/preprocessor/preproc_worker.c @@ -20,7 +20,7 @@ #include "preproc_worker.h" #include "common.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "zbxipcservice.h" diff --git a/src/zabbix_server/preprocessor/preprocessing.c b/src/zabbix_server/preprocessor/preprocessing.c index c7a0a841b46..729ed3e8fdf 100644 --- a/src/zabbix_server/preprocessor/preprocessing.c +++ b/src/zabbix_server/preprocessor/preprocessing.c @@ -24,7 +24,6 @@ #include "zbxserialize.h" #include "preproc_history.h" #include "item_preproc.h" -#include "../../libs/zbxalgo/vectorimpl.h" #define PACKED_FIELD_RAW 0 #define PACKED_FIELD_STRING 1 diff --git a/src/zabbix_server/proxypoller/proxypoller.c b/src/zabbix_server/proxypoller/proxypoller.c index 28661633cc2..041ca3fdcc7 100644 --- a/src/zabbix_server/proxypoller/proxypoller.c +++ b/src/zabbix_server/proxypoller/proxypoller.c @@ -20,7 +20,7 @@ #include "proxypoller.h" #include "common.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "zbxserver.h" #include "db.h" diff --git a/src/zabbix_server/reporter/report_manager.c b/src/zabbix_server/reporter/report_manager.c index 1c1e8dcdbe6..9115d92286e 100644 --- a/src/zabbix_server/reporter/report_manager.c +++ b/src/zabbix_server/reporter/report_manager.c @@ -20,13 +20,12 @@ #include "report_manager.h" #include "zbxself.h" -#include "daemon.h" +#include "zbxnix.h" #include "base64.h" #include "zbxreport.h" #include "zbxhash.h" #include "../../libs/zbxcrypto/hmac_sha256.h" #include "sha256crypt.h" -#include "../../libs/zbxalgo/vectorimpl.h" #include "zbxalert.h" #include "zbxserver.h" #include "report_protocol.h" diff --git a/src/zabbix_server/reporter/report_writer.c b/src/zabbix_server/reporter/report_writer.c index 1de9efdc81d..196a4cc87b7 100644 --- a/src/zabbix_server/reporter/report_writer.c +++ b/src/zabbix_server/reporter/report_writer.c @@ -19,7 +19,7 @@ #include "report_writer.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "zbxjson.h" diff --git a/src/zabbix_server/selfmon/selfmon.c b/src/zabbix_server/selfmon/selfmon.c index bc38d6d32db..dafdc639a47 100644 --- a/src/zabbix_server/selfmon/selfmon.c +++ b/src/zabbix_server/selfmon/selfmon.c @@ -19,7 +19,7 @@ #include "selfmon.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c index 48b36fe1995..fa535c53775 100644 --- a/src/zabbix_server/server.c +++ b/src/zabbix_server/server.c @@ -25,7 +25,6 @@ #include "export.h" #include "zbxself.h" -#include "sighandler.h" #include "cfg.h" #include "zbxdbupgrade.h" @@ -34,7 +33,6 @@ #include "mutexs.h" #include "zbxmodules.h" #include "zbxnix.h" -#include "daemon.h" #include "alerter/alerter.h" #include "alerter/alert_manager.h" @@ -1096,7 +1094,7 @@ int main(int argc, char **argv) exit(SUCCEED == ret ? EXIT_SUCCESS : EXIT_FAILURE); } - return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, t.flags); + return zbx_daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, t.flags); } static void zbx_check_db(void) diff --git a/src/zabbix_server/service/service_actions.c b/src/zabbix_server/service/service_actions.c index e035edcc4ad..61dd72651ba 100644 --- a/src/zabbix_server/service/service_actions.c +++ b/src/zabbix_server/service/service_actions.c @@ -209,7 +209,7 @@ static int service_update_match_action(const zbx_service_update_t *update, const zbx_strcpy_alloc(&expr, &expr_alloc, &expr_offset, action->formula + last_pos); - if (FAIL == evaluate(&res, expr, error, sizeof(error), NULL)) + if (FAIL == zbx_evaluate(&res, expr, error, sizeof(error), NULL)) { zabbix_log(LOG_LEVEL_DEBUG, "cannot evaluate action \"" ZBX_FS_UI64 "\" formula \"%s\": %s", action->actionid, action->formula, error); diff --git a/src/zabbix_server/service/service_manager.c b/src/zabbix_server/service/service_manager.c index 2398f82f0e4..f64364f581b 100644 --- a/src/zabbix_server/service/service_manager.c +++ b/src/zabbix_server/service/service_manager.c @@ -21,7 +21,7 @@ #include "log.h" #include "zbxself.h" -#include "daemon.h" +#include "zbxnix.h" #include "service_protocol.h" #include "service_actions.h" #include "zbxserialize.h" diff --git a/src/zabbix_server/snmptrapper/snmptrapper.c b/src/zabbix_server/snmptrapper/snmptrapper.c index d5d3aebbc89..66ff3e43351 100644 --- a/src/zabbix_server/snmptrapper/snmptrapper.c +++ b/src/zabbix_server/snmptrapper/snmptrapper.c @@ -20,7 +20,7 @@ #include "snmptrapper.h" #include "zbxself.h" -#include "daemon.h" +#include "zbxnix.h" #include "log.h" #include "proxy.h" #include "zbxserver.h" diff --git a/src/zabbix_server/taskmanager/taskmanager.c b/src/zabbix_server/taskmanager/taskmanager.c index 5d6a97c8fbb..e0788e9da0e 100644 --- a/src/zabbix_server/taskmanager/taskmanager.c +++ b/src/zabbix_server/taskmanager/taskmanager.c @@ -19,7 +19,7 @@ #include "taskmanager.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #include "log.h" #include "dbcache.h" diff --git a/src/zabbix_server/timer/timer.c b/src/zabbix_server/timer/timer.c index aec1e485f6a..0c2f4e0d3ff 100644 --- a/src/zabbix_server/timer/timer.c +++ b/src/zabbix_server/timer/timer.c @@ -21,7 +21,7 @@ #include "log.h" #include "dbcache.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" #define ZBX_TIMER_DELAY SEC_PER_MIN diff --git a/src/zabbix_server/trapper/proxydata.c b/src/zabbix_server/trapper/proxydata.c index 587c2daeefe..eaeb30585df 100644 --- a/src/zabbix_server/trapper/proxydata.c +++ b/src/zabbix_server/trapper/proxydata.c @@ -24,7 +24,7 @@ #include "zbxtasks.h" #include "mutexs.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxcompress.h" #include "zbxcommshigh.h" diff --git a/src/zabbix_server/trapper/trapper.c b/src/zabbix_server/trapper/trapper.c index 9180303552f..e00bb1b207a 100644 --- a/src/zabbix_server/trapper/trapper.c +++ b/src/zabbix_server/trapper/trapper.c @@ -26,7 +26,7 @@ #include "nodecommand.h" #include "proxyconfig.h" #include "proxydata.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxcrypto.h" #include "zbxcommshigh.h" #include "../../libs/zbxserver/zabbix_stats.h" diff --git a/src/zabbix_server/vmware/vmware.c b/src/zabbix_server/vmware/vmware.c index 036f007af89..6395b5f7f89 100644 --- a/src/zabbix_server/vmware/vmware.c +++ b/src/zabbix_server/vmware/vmware.c @@ -27,9 +27,8 @@ #include "mutexs.h" #include "zbxshmem.h" #include "log.h" -#include "daemon.h" +#include "zbxnix.h" #include "zbxself.h" -#include "../../libs/zbxalgo/vectorimpl.h" /* * The VMware data (zbx_vmware_service_t structure) are stored in shared memory. |