diff options
Diffstat (limited to 'src/libs/zbxcommon/misc.c')
-rw-r--r-- | src/libs/zbxcommon/misc.c | 178 |
1 files changed, 0 insertions, 178 deletions
diff --git a/src/libs/zbxcommon/misc.c b/src/libs/zbxcommon/misc.c index 3a5c5cf3409..59638681871 100644 --- a/src/libs/zbxcommon/misc.c +++ b/src/libs/zbxcommon/misc.c @@ -126,8 +126,6 @@ out: /****************************************************************************** * * - * Function: get_program_name * - * * * Purpose: return program name without path * * * * Parameters: path * @@ -152,8 +150,6 @@ const char *get_program_name(const char *path) /****************************************************************************** * * - * Function: zbx_timespec * - * * * Purpose: Gets the current time. * * * * Author: Alexander Vladishev * @@ -275,8 +271,6 @@ void zbx_timespec(zbx_timespec_t *ts) /****************************************************************************** * * - * Function: zbx_time * - * * * Purpose: Gets the current time. * * * * Return value: Time in seconds * @@ -298,8 +292,6 @@ double zbx_time(void) /****************************************************************************** * * - * Function: zbx_current_time * - * * * Purpose: Gets the current time including UTC offset * * * * Return value: Time in seconds * @@ -314,8 +306,6 @@ double zbx_current_time(void) /****************************************************************************** * * - * Function: zbx_is_leap_year * - * * * Return value: SUCCEED - year is a leap year * * FAIL - year is not a leap year * * * @@ -327,8 +317,6 @@ int zbx_is_leap_year(int year) /****************************************************************************** * * - * Function: zbx_get_time * - * * * Purpose: * * get current time and store it in memory locations provided by caller * * * @@ -378,8 +366,6 @@ void zbx_get_time(struct tm *tm, long *milliseconds, zbx_timezone_t *tz) /****************************************************************************** * * - * Function: zbx_get_timezone_offset * - * * * Purpose: get time offset from UTC * * * * Parameters: t - [IN] input time to calculate offset with * @@ -421,8 +407,6 @@ long zbx_get_timezone_offset(time_t t, struct tm *tm) /****************************************************************************** * * - * Function: zbx_localtime * - * * * Purpose: get broken-down representation of the time in specified time zone * * * * Parameters: time - [IN] input time * @@ -468,8 +452,6 @@ struct tm *zbx_localtime(const time_t *time, const char *tz) /****************************************************************************** * * - * Function: zbx_utc_time * - * * * Purpose: get UTC time from time from broken down time elements * * * * Parameters: * @@ -509,8 +491,6 @@ int zbx_utc_time(int year, int mon, int mday, int hour, int min, int sec, int *t /****************************************************************************** * * - * Function: zbx_day_in_month * - * * * Purpose: returns number of days in a month * * * * Parameters: * @@ -536,8 +516,6 @@ int zbx_day_in_month(int year, int mon) /****************************************************************************** * * - * Function: zbx_get_duration_ms * - * * * Purpose: get duration in milliseconds since time stamp till current time * * * * Parameters: * @@ -557,8 +535,6 @@ zbx_uint64_t zbx_get_duration_ms(const zbx_timespec_t *ts) /****************************************************************************** * * - * Function: zbx_calloc2 * - * * * Purpose: allocates nmemb * size bytes of memory and fills it with zeros * * * * Return value: returns a pointer to the newly allocated memory * @@ -596,8 +572,6 @@ void *zbx_calloc2(const char *filename, int line, void *old, size_t nmemb, size_ /****************************************************************************** * * - * Function: zbx_malloc2 * - * * * Purpose: allocates size bytes of memory * * * * Return value: returns a pointer to the newly allocated memory * @@ -635,8 +609,6 @@ void *zbx_malloc2(const char *filename, int line, void *old, size_t size) /****************************************************************************** * * - * Function: zbx_realloc2 * - * * * Purpose: changes the size of the memory block pointed to by old * * to size bytes * * * @@ -686,8 +658,6 @@ char *zbx_strdup2(const char *filename, int line, char *old, const char *str) /**************************************************************************************** * * - * Function: zbx_guaranteed_memset * - * * * Purpose: For overwriting sensitive data in memory. * * Similar to memset() but should not be optimized out by a compiler. * * * @@ -709,8 +679,6 @@ void *zbx_guaranteed_memset(void *v, int c, size_t n) /****************************************************************************** * * - * Function: __zbx_zbx_setproctitle * - * * * Purpose: set process title * * * * Author: Eugene Grigorjev * @@ -738,8 +706,6 @@ void zbx_setproctitle(const char *fmt, ...) /****************************************************************************** * * - * Function: check_time_period * - * * * Purpose: check if current time is within given period * * * * Parameters: period - [IN] preprocessed time period * @@ -763,8 +729,6 @@ static int check_time_period(const zbx_time_period_t period, struct tm *tm) /****************************************************************************** * * - * Function: get_current_delay * - * * * Purpose: return delay value that is currently applicable * * * * Parameters: default_delay - [IN] default delay value, can be overridden * @@ -797,8 +761,6 @@ static int get_current_delay(int default_delay, const zbx_flexible_interval_t *f /****************************************************************************** * * - * Function: get_next_delay_interval * - * * * Purpose: return time when next delay settings take effect * * * * Parameters: flex_intervals - [IN] preprocessed flexible intervals * @@ -857,8 +819,6 @@ static int get_next_delay_interval(const zbx_flexible_interval_t *flex_intervals /****************************************************************************** * * - * Function: time_parse * - * * * Purpose: parses time of day * * * * Parameters: time - [OUT] number of seconds since the beginning of * @@ -909,8 +869,6 @@ static int time_parse(int *time, const char *text, int len, int *parsed_len) /****************************************************************************** * * - * Function: time_period_parse * - * * * Purpose: parses time period * * * * Parameters: period - [OUT] time period structure * @@ -978,8 +936,6 @@ static int time_period_parse(zbx_time_period_t *period, const char *text, int le /****************************************************************************** * * - * Function: zbx_check_time_period * - * * * Purpose: validate time period and check if specified time is within it * * * * Parameters: period - [IN] semicolon-separated list of time periods in one * @@ -1026,8 +982,6 @@ int zbx_check_time_period(const char *period, time_t time, const char *tz, int * /****************************************************************************** * * - * Function: flexible_interval_free * - * * * Purpose: frees flexible interval * * * * Parameters: interval - [IN] flexible interval * @@ -1046,8 +1000,6 @@ static void flexible_interval_free(zbx_flexible_interval_t *interval) /****************************************************************************** * * - * Function: flexible_interval_parse * - * * * Purpose: parses flexible interval * * * * Parameters: interval - [IN/OUT] the first interval * @@ -1079,8 +1031,6 @@ static int flexible_interval_parse(zbx_flexible_interval_t *interval, const char /****************************************************************************** * * - * Function: calculate_dayofweek * - * * * Purpose: calculates day of week * * * * Parameters: year - [IN] the year (>1752) * @@ -1102,8 +1052,6 @@ static int calculate_dayofweek(int year, int mon, int mday) /****************************************************************************** * * - * Function: scheduler_filter_free * - * * * Purpose: frees scheduler interval filter * * * * Parameters: filter - [IN] scheduler interval filter * @@ -1122,8 +1070,6 @@ static void scheduler_filter_free(zbx_scheduler_filter_t *filter) /****************************************************************************** * * - * Function: scheduler_interval_free * - * * * Purpose: frees scheduler interval * * * * Parameters: interval - [IN] scheduler interval * @@ -1149,8 +1095,6 @@ static void scheduler_interval_free(zbx_scheduler_interval_t *interval) /****************************************************************************** * * - * Function: scheduler_parse_filter_r * - * * * Purpose: parses text string into scheduler filter * * * * Parameters: filter - [IN/OUT] the first filter * @@ -1273,8 +1217,6 @@ static int scheduler_parse_filter_r(zbx_scheduler_filter_t **filter, const char /****************************************************************************** * * - * Function: scheduler_parse_filter * - * * * Purpose: parses text string into scheduler filter * * * * Parameters: filter - [IN/OUT] the first filter * @@ -1305,8 +1247,6 @@ static int scheduler_parse_filter(zbx_scheduler_filter_t **filter, const char *t /****************************************************************************** * * - * Function: scheduler_interval_parse * - * * * Purpose: parses scheduler interval * * * * Parameters: interval - [IN/OUT] the first interval * @@ -1395,8 +1335,6 @@ static int scheduler_interval_parse(zbx_scheduler_interval_t *interval, const ch /****************************************************************************** * * - * Function: scheduler_get_nearest_filter_value * - * * * Purpose: gets the next nearest value that satisfies the filter chain * * * * Parameters: filter - [IN] the filter chain * @@ -1448,8 +1386,6 @@ static int scheduler_get_nearest_filter_value(const zbx_scheduler_filter_t *filt /****************************************************************************** * * - * Function: scheduler_get_wday_nextcheck * - * * * Purpose: calculates the next day that satisfies the week day filter * * * * Parameters: interval - [IN] the scheduler interval * @@ -1493,8 +1429,6 @@ static int scheduler_get_wday_nextcheck(const zbx_scheduler_interval_t *interval /****************************************************************************** * * - * Function: scheduler_validate_wday_filter * - * * * Purpose: checks if the specified date satisfies week day filter * * * * Parameters: interval - [IN] the scheduler interval * @@ -1537,8 +1471,6 @@ static int scheduler_validate_wday_filter(const zbx_scheduler_interval_t *interv /****************************************************************************** * * - * Function: scheduler_get_day_nextcheck * - * * * Purpose: calculates the next day that satisfies month and week day filters * * * * Parameters: interval - [IN] the scheduler interval * @@ -1585,8 +1517,6 @@ static int scheduler_get_day_nextcheck(const zbx_scheduler_interval_t *interval, /****************************************************************************** * * - * Function: scheduler_get_filter_nextcheck * - * * * Purpose: calculates the time/day that satisfies the specified filter * * * * Parameters: interval - [IN] the scheduler interval * @@ -1652,8 +1582,6 @@ static int scheduler_get_filter_nextcheck(const zbx_scheduler_interval_t *interv /****************************************************************************** * * - * Function: scheduler_apply_day_filter * - * * * Purpose: applies day filter to the specified time/day calculating the next * * scheduled check * * * @@ -1687,8 +1615,6 @@ static void scheduler_apply_day_filter(zbx_scheduler_interval_t *interval, struc /****************************************************************************** * * - * Function: scheduler_apply_hour_filter * - * * * Purpose: applies hour filter to the specified time/day calculating the * * next scheduled check * * * @@ -1719,8 +1645,6 @@ static void scheduler_apply_hour_filter(zbx_scheduler_interval_t *interval, stru /****************************************************************************** * * - * Function: scheduler_apply_minute_filter * - * * * Purpose: applies minute filter to the specified time/day calculating the * * next scheduled check * * * @@ -1748,8 +1672,6 @@ static void scheduler_apply_minute_filter(zbx_scheduler_interval_t *interval, st /****************************************************************************** * * - * Function: scheduler_apply_second_filter * - * * * Purpose: applies second filter to the specified time/day calculating the * * next scheduled check * * * @@ -1771,8 +1693,6 @@ static void scheduler_apply_second_filter(zbx_scheduler_interval_t *interval, st /****************************************************************************** * * - * Function: scheduler_find_dst_change * - * * * Purpose: finds daylight saving change time inside specified time period * * * * Parameters: time_start - [IN] the time period start * @@ -1821,8 +1741,6 @@ static time_t scheduler_find_dst_change(time_t time_start, time_t time_end) /****************************************************************************** * * - * Function: scheduler_tm_inc * - * * * Purpose: increment struct tm value by one second * * * * Parameters: tm - [IN/OUT] the tm structure to increment * @@ -1856,8 +1774,6 @@ static void scheduler_tm_inc(struct tm *tm) /****************************************************************************** * * - * Function: scheduler_get_nextcheck * - * * * Purpose: finds the next timestamp satisfying one of intervals. * * * * Parameters: interval - [IN] the scheduler interval * @@ -1916,8 +1832,6 @@ static time_t scheduler_get_nextcheck(zbx_scheduler_interval_t *interval, time_t /****************************************************************************** * * - * Function: parse_user_macro * - * * * Purpose: parses user macro and finds it's length * * * * Parameters: str - [IN] string to check * @@ -1946,8 +1860,6 @@ static int parse_user_macro(const char *str, int *len) /****************************************************************************** * * - * Function: parse_simple_interval * - * * * Purpose: parses user macro and finds it's length * * * * Parameters: str - [IN] string to check * @@ -1978,8 +1890,6 @@ static int parse_simple_interval(const char *str, int *len, char sep, int *value /****************************************************************************** * * - * Function: zbx_validate_interval * - * * * Purpose: validate update interval, flexible and scheduling intervals * * * * Parameters: str - [IN] string to check * @@ -2099,8 +2009,6 @@ int zbx_validate_interval(const char *str, char **error) /****************************************************************************** * * - * Function: zbx_interval_preproc * - * * * Purpose: parses item and low-level discovery rule update intervals * * * * Parameters: interval_str - [IN] update interval string to parse * @@ -2203,8 +2111,6 @@ fail: /****************************************************************************** * * - * Function: zbx_custom_interval_free * - * * * Purpose: frees custom update intervals * * * * Parameters: custom_intervals - [IN] custom intervals * @@ -2219,8 +2125,6 @@ void zbx_custom_interval_free(zbx_custom_interval_t *custom_intervals) /****************************************************************************** * * - * Function: calculate_item_nextcheck * - * * * Purpose: calculate nextcheck timestamp for item * * * * Parameters: seed - [IN] the seed value applied to delay to * @@ -2322,8 +2226,6 @@ int calculate_item_nextcheck(zbx_uint64_t seed, int item_type, int simple_interv } /****************************************************************************** * * - * Function: calculate_item_nextcheck_unreachable * - * * * Purpose: calculate nextcheck timestamp for item on unreachable host * * * * Parameters: simple_interval - [IN] default delay value, can be overridden * @@ -2374,8 +2276,6 @@ int calculate_item_nextcheck_unreachable(int simple_interval, const zbx_custom_i } /****************************************************************************** * * - * Function: calculate_proxy_nextcheck * - * * * Purpose: calculate nextcheck timestamp for passive proxy * * * * Parameters: hostid - [IN] host identifier from database * @@ -2401,8 +2301,6 @@ time_t calculate_proxy_nextcheck(zbx_uint64_t hostid, unsigned int delay, time_t /****************************************************************************** * * - * Function: is_ip4 * - * * * Purpose: is string IPv4 address * * * * Parameters: ip - string * @@ -2454,8 +2352,6 @@ int is_ip4(const char *ip) /****************************************************************************** * * - * Function: is_ip6 * - * * * Purpose: is string IPv6 address * * * * Parameters: ip - string * @@ -2520,8 +2416,6 @@ int is_ip6(const char *ip) /****************************************************************************** * * - * Function: is_supported_ip * - * * * Purpose: is string IP address of supported version * * * * Parameters: ip - string * @@ -2545,8 +2439,6 @@ int is_supported_ip(const char *ip) /****************************************************************************** * * - * Function: is_ip * - * * * Purpose: is string IP address * * * * Parameters: ip - string * @@ -2564,8 +2456,6 @@ int is_ip(const char *ip) /****************************************************************************** * * - * Function: zbx_validate_hostname * - * * * Purpose: check if string is a valid internet hostname * * * * Parameters: hostname - [IN] hostname string to be checked * @@ -2609,8 +2499,6 @@ int zbx_validate_hostname(const char *hostname) /****************************************************************************** * * - * Function: ip_in_list * - * * * Purpose: check if ip matches range of ip addresses * * * * Parameters: list - [IN] comma-separated list of ip ranges * @@ -2669,8 +2557,6 @@ out: /****************************************************************************** * * - * Function: int_in_list * - * * * Purpose: check if integer matches a list of integers * * * * Parameters: list - integers [i1-i2,i3,i4,i5-i6] (10-25,45,67-699) * @@ -2737,8 +2623,6 @@ int zbx_double_compare(double a, double b) /****************************************************************************** * * - * Function: is_double_suffix * - * * * Purpose: check if the string is double * * * * Parameters: str - string to check * @@ -2788,8 +2672,6 @@ static int is_double_valid_syntax(const char *str) /****************************************************************************** * * - * Function: is_double * - * * * Purpose: validate and optionally convert a string to a number of type * * 'double' * * * @@ -2830,8 +2712,6 @@ int is_double(const char *str, double *value) /****************************************************************************** * * - * Function: is_time_suffix * - * * * Purpose: check if the string is a non-negative integer with or without * * supported time suffix * * * @@ -2932,8 +2812,6 @@ int _wis_uint(const wchar_t *wide_string) /****************************************************************************** * * - * Function: is_uint_n_range * - * * * Purpose: check if the string is unsigned integer within the specified * * range and optionally store it into value parameter * * * @@ -2994,8 +2872,6 @@ int is_uint_n_range(const char *str, size_t n, void *value, size_t size, zbx_uin /****************************************************************************** * * - * Function: is_hex_n_range * - * * * Purpose: check if the string is unsigned hexadecimal integer within the * * specified range and optionally store it into value parameter * * * @@ -3058,8 +2934,6 @@ int is_hex_n_range(const char *str, size_t n, void *value, size_t size, zbx_uint /****************************************************************************** * * - * Function: is_boolean * - * * * Purpose: check if the string is boolean * * * * Parameters: str - string to check * @@ -3100,8 +2974,6 @@ int is_boolean(const char *str, zbx_uint64_t *value) /****************************************************************************** * * - * Function: is_uoct * - * * * Purpose: check if the string is unsigned octal * * * * Parameters: str - string to check * @@ -3138,8 +3010,6 @@ int is_uoct(const char *str) /****************************************************************************** * * - * Function: is_uhex * - * * * Purpose: check if the string is unsigned hexadecimal representation of * * data in the form "0-9, a-f or A-F" * * * @@ -3177,8 +3047,6 @@ int is_uhex(const char *str) /****************************************************************************** * * - * Function: is_hex_string * - * * * Purpose: check if the string is a hexadecimal representation of data in * * the form "F4 CE 46 01 0C 44 8B F4\nA0 2C 29 74 5D 3F 13 49\n" * * * @@ -3217,8 +3085,6 @@ int is_hex_string(const char *str) /****************************************************************************** * * - * Function: get_nearestindex * - * * * Purpose: get nearest index position of sorted elements in array * * * * Parameters: p - pointer to array of elements * @@ -3264,8 +3130,6 @@ int get_nearestindex(const void *p, size_t sz, int num, zbx_uint64_t id) /****************************************************************************** * * - * Function: uint64_array_add * - * * * Purpose: add uint64 value to dynamic array * * * * Author: Alexander Vladishev * @@ -3301,8 +3165,6 @@ int uint64_array_add(zbx_uint64_t **values, int *alloc, int *num, zbx_uint64_t v /****************************************************************************** * * - * Function: uint64_array_exists * - * * * Author: Alexander Vladishev * * * ******************************************************************************/ @@ -3319,8 +3181,6 @@ int uint64_array_exists(const zbx_uint64_t *values, int num, zbx_uint64_t value) /****************************************************************************** * * - * Function: uint64_array_remove * - * * * Purpose: remove uint64 values from array * * * * Author: Alexander Vladishev * @@ -3370,8 +3230,6 @@ zbx_uint64_t suffix2factor(char c) /****************************************************************************** * * - * Function: str2uint64 * - * * * Purpose: convert string to 64bit unsigned integer * * * * Parameters: str - string to convert * @@ -3410,8 +3268,6 @@ int str2uint64(const char *str, const char *suffixes, zbx_uint64_t *value) /****************************************************************************** * * - * Function: str2double * - * * * Purpose: convert string to double * * * * Parameters: str - string to convert * @@ -3435,8 +3291,6 @@ double str2double(const char *str) /****************************************************************************** * * - * Function: is_hostname_char * - * * * Return value: SUCCEED - the char is allowed in the host name * * FAIL - otherwise * * * @@ -3459,8 +3313,6 @@ int is_hostname_char(unsigned char c) /****************************************************************************** * * - * Function: is_key_char * - * * * Return value: SUCCEED - the char is allowed in the item key * * FAIL - otherwise * * * @@ -3483,8 +3335,6 @@ int is_key_char(unsigned char c) /****************************************************************************** * * - * Function: is_function_char * - * * * Return value: SUCCEED - the char is allowed in the trigger function * * FAIL - otherwise * * * @@ -3504,8 +3354,6 @@ int is_function_char(unsigned char c) /****************************************************************************** * * - * Function: is_macro_char * - * * * Return value: SUCCEED - the char is allowed in the macro name * * FAIL - otherwise * * * @@ -3531,8 +3379,6 @@ int is_macro_char(unsigned char c) /****************************************************************************** * * - * Function: is_discovery_macro * - * * * Purpose: checks if the name is a valid discovery macro * * * * Return value: SUCCEED - the name is a valid discovery macro * @@ -3559,8 +3405,6 @@ int is_discovery_macro(const char *name) /****************************************************************************** * * - * Function: zbx_get_function_type * - * * * Purpose: Returns function type based on its name * * * * Return value: Function type. * @@ -3582,8 +3426,6 @@ zbx_function_type_t zbx_get_function_type(const char *func) /****************************************************************************** * * - * Function: make_hostname * - * * * Purpose: replace all not-allowed hostname characters in the string * * * * Parameters: host - the target C-style string * @@ -3608,8 +3450,6 @@ void make_hostname(char *host) /****************************************************************************** * * - * Function: get_interface_type_by_item_type * - * * * Purpose: * * * * Parameters: * @@ -3648,8 +3488,6 @@ unsigned char get_interface_type_by_item_type(unsigned char type) /****************************************************************************** * * - * Function: calculate_sleeptime * - * * * Purpose: calculate sleep time for Zabbix processes * * * * Parameters: nextcheck - [IN] next check or -1 (FAIL) if nothing to do * @@ -3680,8 +3518,6 @@ int calculate_sleeptime(int nextcheck, int max_sleeptime) /****************************************************************************** * * - * Function: parse_serveractive_element * - * * * Purpose: parse a ServerActive element like "IP<:port>" or "[IPv6]<:port>" * * * ******************************************************************************/ @@ -3783,8 +3619,6 @@ int zbx_alarm_timed_out(void) /****************************************************************************** * * - * Function: zbx_create_token * - * * * Purpose: creates semi-unique token based on the seed and current timestamp * * * * Parameters: seed - [IN] the seed * @@ -3827,8 +3661,6 @@ char *zbx_create_token(zbx_uint64_t seed) #if !defined(_WINDOWS) && defined(HAVE_RESOLV_H) /****************************************************************************** * * - * Function: update_resolver_conf * - * * * Purpose: react to "/etc/resolv.conf" update * * * * Comments: it is intended to call this function in the end of each process * @@ -3858,8 +3690,6 @@ static void update_resolver_conf(void) /****************************************************************************** * * - * Function: zbx_update_env * - * * * Purpose: throttling of update "/etc/resolv.conf" and "stdio" to the new * * log file after rotation * * * @@ -3883,8 +3713,6 @@ void zbx_update_env(double time_now) /****************************************************************************** * * - * Function: zbx_dc_get_agent_item_nextcheck * - * * * Purpose: calculate item nextcheck for Zabbix agent type items * * * ******************************************************************************/ @@ -3908,8 +3736,6 @@ int zbx_get_agent_item_nextcheck(zbx_uint64_t itemid, const char *delay, int now /****************************************************************************** * * - * Function: zbx_get_report_nextcheck * - * * * Purpose: calculate report nextcheck * * * * Parameters: now - [IN] the current timestamp * @@ -3988,8 +3814,6 @@ void zbx_free_tag(zbx_tag_t *tag) /****************************************************************************** * * - * Function: zbx_md5buf2str * - * * * Purpose: get a textual representation of md5 sum * * * * Parameters: * @@ -4016,8 +3840,6 @@ void zbx_md5buf2str(const md5_byte_t *md5, char *str) /****************************************************************************** * * - * Function: zbx_hex2bin * - * * * Purpose: * * convert ASCII hex digit string to a binary representation (byte * * string) * |