Source
xxxxxxxxxx
zbx_hashset_create_ext(&service->cust_queries, 100, vmware_cust_query_hash_func, vmware_cust_query_compare_func,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
static zbx_shmem_info_t *vmware_mem = NULL;
zbx_shmem_info_t *vmware_shmem_get_vmware_mem(void)
{
return vmware_mem;
}
void vmware_shmem_set_vmware_mem_NULL(void)
{
vmware_mem = NULL;
}
ZBX_SHMEM_FUNC_IMPL(__vm, vmware_mem)
VMWARE_SHMEM_VECTOR_CREATE_IMPL(zbx_vector_str_t*, str)
VMWARE_SHMEM_VECTOR_CREATE_IMPL(zbx_vector_vmware_entity_tags_ptr_t*, vmware_entity_tags_ptr)
VMWARE_SHMEM_VECTOR_CREATE_IMPL(zbx_vector_custquery_param_t*, custquery_param)
VMWARE_SHMEM_VECTOR_CREATE_IMPL(zbx_vector_vmware_tag_ptr_t*, vmware_tag_ptr)
VMWARE_SHMEM_VECTOR_CREATE_IMPL(zbx_vector_vmware_perf_counter_ptr_t*, vmware_perf_counter_ptr)
/******************************************************************************
* *
* Purpose: frees shared resources allocated to store performance counter *
* data *
* *
* Parameters: counter - [IN] performance counter data *
* *
******************************************************************************/
void vmware_shmem_perf_counter_free(zbx_vmware_perf_counter_t *counter)
{
vmware_vector_str_uint64_pair_shared_clean(&counter->values);
zbx_vector_str_uint64_pair_destroy(&counter->values);
vmware_shared_strfree(counter->query_instance);
__vm_shmem_free_func(counter);
}
/******************************************************************************
* *
* Purpose: creates new performance counter object in shared memory and *
* adds it to specified vector *
* *
* Parameters: counters - [IN/OUT] vector, created performance counter *
* object should be added to *
* counterid - [IN] performance counter id *
* state - [IN] performance counter first state *
* *
******************************************************************************/
void vmware_perf_counters_add_new(zbx_vector_vmware_perf_counter_ptr_t *counters, zbx_uint64_t counterid,
unsigned char state)
{
zbx_vmware_perf_counter_t *counter;
counter = (zbx_vmware_perf_counter_t *)__vm_shmem_malloc_func(NULL, sizeof(zbx_vmware_perf_counter_t));
counter->counterid = counterid;
counter->state = state;
counter->last_used = 0;
counter->query_instance = NULL;
VMWARE_VECTOR_CREATE(&counter->values, str_uint64_pair);
zbx_vector_vmware_perf_counter_ptr_append(counters, counter);
}