diff options
author | Armands Arseniuss Skolmeisters <armands.skolmeisters@zabbix.com> | 2022-11-03 12:29:41 +0300 |
---|---|---|
committer | Armands Arseniuss Skolmeisters <armands.skolmeisters@zabbix.com> | 2022-11-03 12:29:41 +0300 |
commit | b7bdeb4603aa235ca2a3795c827334a145574edf (patch) | |
tree | 1073dc2b7cbe911835b1bdcd053796b3b6b7837c /include | |
parent | 2b8f1d8f6e6f2b64308088bc8689a0bc9f354422 (diff) | |
parent | 4b1a5e04bc24e5fdcf5d602120321bd539d20f8b (diff) |
...G...... [DEV-2302] refactored zbxwin32 and zbxwinservice libraries
* commit '4b1a5e04bc24e5fdcf5d602120321bd539d20f8b':
...G...... [DEV-2302] specified unused arguments in zbxwinservice library
...G...... [DEV-2302] refactored minor adjustments in zbxwin32 library
...G...... [DEV-2302] added zbx_ prefix to zbxwin32 macros
...G...... [DEV-2302] removed include dublication
...G...... [DEV-2302] fixed unused function warning
...G...... [DEV-2302] refactored macros in zbxwin32 library
...G...... [DEV-2302] removed external references from zbxwin32 and zbxwinservice libraries
...G...... [DEV-2302] extracted zbxwinservice from zbxwin32
...G...... [DEV-2302] refactored zbxwin32 library
Diffstat (limited to 'include')
-rw-r--r-- | include/disk.h | 31 | ||||
-rw-r--r-- | include/zbxcommon.h | 1 | ||||
-rw-r--r-- | include/zbxwin32.h (renamed from include/perfmon.h) | 37 | ||||
-rw-r--r-- | include/zbxwinservice.h | 7 |
4 files changed, 28 insertions, 48 deletions
diff --git a/include/disk.h b/include/disk.h deleted file mode 100644 index e544863e612..00000000000 --- a/include/disk.h +++ /dev/null @@ -1,31 +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_DISK_H -#define ZABBIX_DISK_H - -#include "config.h" - -#if !defined(_WINDOWS) && !defined(__MINGW32__) -# error "This module is only available for Windows OS" -#endif - -zbx_uint64_t get_cluster_size(const char *path, char **error); - -#endif /* ZABBIX_DISK_H */ diff --git a/include/zbxcommon.h b/include/zbxcommon.h index a950e280195..284cffb1286 100644 --- a/include/zbxcommon.h +++ b/include/zbxcommon.h @@ -834,6 +834,7 @@ void zbx_version(void); const char *get_program_name(const char *path); typedef unsigned char (*zbx_get_program_type_f)(void); +typedef const char *(*zbx_get_progname_f)(void); typedef enum { diff --git a/include/perfmon.h b/include/zbxwin32.h index c52c85a2f9b..a8382c38d17 100644 --- a/include/perfmon.h +++ b/include/zbxwin32.h @@ -17,15 +17,21 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#ifndef ZABBIX_PERFMON_H -#define ZABBIX_PERFMON_H +#ifndef ZABBIX_WIN32_H +#define ZABBIX_WIN32_H +#include "config.h" #include "zbxsysinc.h" +#include "zbxtypes.h" +#include "zbxcommon.h" #if !defined(_WINDOWS) && !defined(__MINGW32__) # error "This module is only available for Windows OS" #endif +#define zbx_get_builtin_object_name(ctr) zbx_get_counter_name(zbx_get_builtin_object_index(ctr)) +#define zbx_get_builtin_counter_name(ctr) zbx_get_counter_name(zbx_get_builtin_counter_index(ctr)) + /* this struct must be only modified along with mapping builtin_counter_ref[] in perfmon.c */ typedef enum { @@ -80,22 +86,27 @@ typedef struct perf_counter_data } zbx_perf_counter_data_t; +zbx_uint64_t zbx_get_cluster_size(const char *path, char **error); + PDH_STATUS zbx_PdhMakeCounterPath(const char *function, PDH_COUNTER_PATH_ELEMENTS *cpe, char *counterpath); PDH_STATUS zbx_PdhOpenQuery(const char *function, PDH_HQUERY query); PDH_STATUS zbx_PdhAddCounter(const char *function, zbx_perf_counter_data_t *counter, PDH_HQUERY query, const char *counterpath, zbx_perf_counter_lang_t lang, PDH_HCOUNTER *handle); PDH_STATUS zbx_PdhCollectQueryData(const char *function, const char *counterpath, PDH_HQUERY query); -PDH_STATUS zbx_PdhGetRawCounterValue(const char *function, const char *counterpath, PDH_HCOUNTER handle, PPDH_RAW_COUNTER value); +PDH_STATUS zbx_PdhGetRawCounterValue(const char *function, const char *counterpath, PDH_HCOUNTER handle, + PPDH_RAW_COUNTER value); + +PDH_STATUS zbx_calculate_counter_value(const char *function, const char *counterpath, + zbx_perf_counter_lang_t lang, double *value); +wchar_t *zbx_get_counter_name(DWORD pdhIndex); +int zbx_check_counter_path(char *counterPath, int convert_from_numeric); +int zbx_init_builtin_counter_indexes(void); +DWORD zbx_get_builtin_object_index(zbx_builtin_counter_ref_t counter_ref); +DWORD zbx_get_builtin_counter_index(zbx_builtin_counter_ref_t counter_ref); +wchar_t *zbx_get_all_counter_names(HKEY reg_key, wchar_t *reg_value_name); -PDH_STATUS calculate_counter_value(const char *function, const char *counterpath, zbx_perf_counter_lang_t lang, double *value); -wchar_t *get_counter_name(DWORD pdhIndex); -int check_counter_path(char *counterPath, int convert_from_numeric); -int init_builtin_counter_indexes(void); -DWORD get_builtin_object_index(zbx_builtin_counter_ref_t counter_ref); -DWORD get_builtin_counter_index(zbx_builtin_counter_ref_t counter_ref); -wchar_t *get_all_counter_names(HKEY reg_key, wchar_t *reg_value_name); +int zbx_win_exception_filter(struct _EXCEPTION_POINTERS *ep); -#define get_builtin_object_name(ctr) get_counter_name(get_builtin_object_index(ctr)) -#define get_builtin_counter_name(ctr) get_counter_name(get_builtin_counter_index(ctr)) +void zbx_init_library_win32(zbx_get_progname_f get_progname); -#endif /* ZABBIX_PERFMON_H */ +#endif /* ZABBIX_WIN32_H */ diff --git a/include/zbxwinservice.h b/include/zbxwinservice.h index 9ac2e3b866f..4313b585ec0 100644 --- a/include/zbxwinservice.h +++ b/include/zbxwinservice.h @@ -26,17 +26,16 @@ #include "zbxthreads.h" -extern ZBX_THREAD_HANDLE *threads; +typedef void (*zbx_on_exit_t)(int); -void service_start(int flags); +void zbx_service_start(int flags); int ZabbixCreateService(const char *path, int multiple_agents, const char *config_file); int ZabbixRemoveService(void); int ZabbixStartService(void); int ZabbixStopService(void); -typedef void (*zbx_on_exit_t)(int); -void set_parent_signal_handler(zbx_on_exit_t zbx_on_exit_cb_arg); +void zbx_set_parent_signal_handler(zbx_on_exit_t zbx_on_exit_cb_arg); int ZBX_IS_RUNNING(void); void ZBX_DO_EXIT(void); |