summaryrefslogtreecommitdiffstats
path: root/collectors/plugins.d/pluginsd_parser.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 11:19:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:07:37 +0000
commitb485aab7e71c1625cfc27e0f92c9509f42378458 (patch)
treeae9abe108601079d1679194de237c9a435ae5b55 /collectors/plugins.d/pluginsd_parser.h
parentAdding upstream version 1.44.3. (diff)
downloadnetdata-b485aab7e71c1625cfc27e0f92c9509f42378458.tar.xz
netdata-b485aab7e71c1625cfc27e0f92c9509f42378458.zip
Adding upstream version 1.45.3+dfsg.upstream/1.45.3+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/collectors/plugins.d/pluginsd_parser.h (renamed from collectors/plugins.d/pluginsd_parser.h)17
1 files changed, 8 insertions, 9 deletions
diff --git a/collectors/plugins.d/pluginsd_parser.h b/src/collectors/plugins.d/pluginsd_parser.h
index 1fce9a89a..d317a77be 100644
--- a/collectors/plugins.d/pluginsd_parser.h
+++ b/src/collectors/plugins.d/pluginsd_parser.h
@@ -112,7 +112,7 @@ typedef struct parser {
struct buffered_reader reader;
struct line_splitter line;
- PARSER_KEYWORD *keyword;
+ const PARSER_KEYWORD *keyword;
struct {
const char *end_keyword;
@@ -123,7 +123,7 @@ typedef struct parser {
struct {
DICTIONARY *functions;
- usec_t smaller_timeout;
+ usec_t smaller_monotonic_timeout_ut;
} inflight;
struct {
@@ -136,9 +136,8 @@ PARSER *parser_init(struct parser_user_object *user, FILE *fp_input, FILE *fp_ou
void parser_init_repertoire(PARSER *parser, PARSER_REPERTOIRE repertoire);
void parser_destroy(PARSER *working_parser);
void pluginsd_cleanup_v2(PARSER *parser);
-void inflight_functions_init(PARSER *parser);
void pluginsd_keywords_init(PARSER *parser, PARSER_REPERTOIRE repertoire);
-PARSER_RC parser_execute(PARSER *parser, PARSER_KEYWORD *keyword, char **words, size_t num_words);
+PARSER_RC parser_execute(PARSER *parser, const PARSER_KEYWORD *keyword, char **words, size_t num_words);
static inline int find_first_keyword(const char *src, char *dst, int dst_size, bool *isspace_map) {
const char *s = src, *keyword_start;
@@ -154,10 +153,10 @@ static inline int find_first_keyword(const char *src, char *dst, int dst_size, b
return dst_size == 0 ? 0 : (int) (s - keyword_start);
}
-PARSER_KEYWORD *gperf_lookup_keyword(register const char *str, register size_t len);
+const PARSER_KEYWORD *gperf_lookup_keyword(register const char *str, register size_t len);
-static inline PARSER_KEYWORD *parser_find_keyword(PARSER *parser, const char *command) {
- PARSER_KEYWORD *t = gperf_lookup_keyword(command, strlen(command));
+static inline const PARSER_KEYWORD *parser_find_keyword(PARSER *parser, const char *command) {
+ const PARSER_KEYWORD *t = gperf_lookup_keyword(command, strlen(command));
if(t && (t->repertoire & parser->repertoire))
return t;
@@ -186,7 +185,7 @@ static inline int parser_action(PARSER *parser, char *input) {
if(buffer_strlen(parser->defer.response) > PLUGINSD_MAX_DEFERRED_SIZE) {
// more than PLUGINSD_MAX_DEFERRED_SIZE of data,
// or a bad plugin that did not send the end_keyword
- internal_error(true, "PLUGINSD: deferred response is too big (%zu bytes). Stopping this plugin.", buffer_strlen(parser->defer.response));
+ nd_log(NDLS_DAEMON, NDLP_ERR, "PLUGINSD: deferred response is too big (%zu bytes). Stopping this plugin.", buffer_strlen(parser->defer.response));
return 1;
}
}
@@ -232,7 +231,7 @@ static inline int parser_action(PARSER *parser, char *input) {
rc = PARSER_RC_ERROR;
if(rc == PARSER_RC_ERROR) {
- CLEAN_BUFFER *wb = buffer_create(PLUGINSD_LINE_MAX, NULL);
+ CLEAN_BUFFER *wb = buffer_create(1024, NULL);
line_splitter_reconstruct_line(wb, &parser->line);
netdata_log_error("PLUGINSD: parser_action('%s') failed on line %zu: { %s } (quotes added to show parsing)",
command, parser->line.count, buffer_tostring(wb));