Source
/*
** Zabbix
** 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 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.
**/
extern int CONFIG_TIMEOUT;
/******************************************************************************
* *
* Purpose: parse runtime control option *
* *
* Parameters: opt - [IN] the runtime control option *
* len - [IN] the runtime control option length without *
* parameter *
* data - [OUT] the runtime control option result *
* error - [OUT] error message *
* *
* Return value: SUCCEED - the runtime control option was processed *
* FAIL - otherwise *
* *
******************************************************************************/
static int rtc_parse_runtime_parameter(const char *opt, zbx_uint32_t code, size_t len, char **data, char **error)
{
struct zbx_json j;
const char *proc_name;
int pid = 0, proc_num = 0, proc_type = ZBX_PROCESS_TYPE_UNKNOWN, scope = 0;
if (SUCCEED != zbx_rtc_parse_option(opt, len, &pid, &proc_type, &proc_num,
ZBX_RTC_PROF_ENABLE == code ? &scope : NULL, error))
{
return FAIL;
}
if (0 != pid)
{
zbx_json_init(&j, 1024);
zbx_json_addint64(&j, ZBX_PROTO_TAG_PID, pid);
zbx_json_addint64(&j, ZBX_PROTO_TAG_SCOPE, scope);
goto finish;
}