Source
int rtc_option_get_process_type(const char *param, size_t *size, int *proc_type, char **error)
/*
** 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.
**/
static int rtc_parse_scope(const char *str, int *scope)
{
if (0 == strcmp(str, "rwlock"))
*scope = ZBX_PROF_RWLOCK;
else if (0 == strcmp(str, "mutex"))
*scope = ZBX_PROF_MUTEX;
else if (0 == strcmp(str, "processing"))
*scope = ZBX_PROF_PROCESSING;
else
return FAIL;
return SUCCEED;
}
/******************************************************************************
* *
* Purpose: get rtc option parameter *
* *
* Parameters: opt - [IN] runtime control option parameter *
* size - [OUT] number of parsed bytes *
* error - [OUT] error message *
* *
* Return value: SUCCEED - parameter was found or not specified *
* FAIL - otherwise *
* *
******************************************************************************/
int rtc_option_get_parameter(const char *param, size_t *size, char **error)
{
switch (*param)
{
case '\0':
*size = 0;
return SUCCEED;
case '=':
/* check for empty parameter */
if ('\0' == param[1])
break;
*size = 1;
return SUCCEED;
}
*error = zbx_dsprintf(*error, "unspecified process identifier or type: \"%s\"", param);
return FAIL;
}
/******************************************************************************
* *
* Purpose: get unsigned value from parameter *
* *
* Parameters: param - [IN] runtime control option parameter *
* size - [OUT] number of parsed bytes *
* value - [OUT] parsed value *
* error - [OUT] error message *
* *
* Return value: SUCCEED - value was parsed or not specified *
* FAIL - otherwise *
* *
******************************************************************************/
static int rtc_option_get_ui64(const char *param, size_t *size, zbx_uint64_t *value)
{
const char *ptr = param;
while (0 != isdigit(*ptr))
ptr++;