diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 11:19:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:53:24 +0000 |
commit | b5f8ee61a7f7e9bd291dd26b0585d03eb686c941 (patch) | |
tree | d4d31289c39fc00da064a825df13a0b98ce95b10 /src/collectors/plugins.d/pluginsd_parser.h | |
parent | Adding upstream version 1.44.3. (diff) | |
download | netdata-b5f8ee61a7f7e9bd291dd26b0585d03eb686c941.tar.xz netdata-b5f8ee61a7f7e9bd291dd26b0585d03eb686c941.zip |
Adding upstream version 1.46.3.
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) | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/collectors/plugins.d/pluginsd_parser.h b/src/collectors/plugins.d/pluginsd_parser.h index 1fce9a89a..6c126964b 100644 --- a/collectors/plugins.d/pluginsd_parser.h +++ b/src/collectors/plugins.d/pluginsd_parser.h @@ -65,7 +65,7 @@ typedef struct parser_user_object { struct { bool parsing_host; - uuid_t machine_guid; + nd_uuid_t machine_guid; char machine_guid_str[UUID_STR_LEN]; STRING *hostname; RRDLABELS *rrdlabels; @@ -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)); |