Source
/*
** Zabbix
** Copyright (C) 2001-2023 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.
**/
const int INTERFACE_TYPE_PRIORITY[INTERFACE_TYPE_COUNT] =
{
INTERFACE_TYPE_AGENT,
INTERFACE_TYPE_SNMP,
INTERFACE_TYPE_JMX,
INTERFACE_TYPE_IPMI
};
static ZBX_THREAD_LOCAL volatile sig_atomic_t zbx_timed_out; /* 0 - no timeout occurred, 1 - SIGALRM took place */
char ZABBIX_SERVICE_NAME[ZBX_SERVICE_NAME_LEN] = APPLICATION_NAME;
char ZABBIX_EVENT_SOURCE[ZBX_SERVICE_NAME_LEN] = APPLICATION_NAME;
int __zbx_stat(const char *path, zbx_stat_t *buf)
{
int ret, fd;
wchar_t *wpath;
wpath = zbx_utf8_to_unicode(path);
if (-1 == (ret = _wstat64(wpath, buf)))
goto out;
if (0 != S_ISDIR(buf->st_mode) || 0 != buf->st_size)
goto out;
/* In the case of symlinks _wstat64 returns zero file size. */
/* Try to work around it by opening the file and using fstat. */
ret = -1;
if (-1 != (fd = _wopen(wpath, O_RDONLY)))
{