From 58daab21cd043e1dc37024a7f99b396788372918 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 9 Mar 2024 14:19:48 +0100 Subject: Merging upstream version 1.44.3. Signed-off-by: Daniel Baumann --- libnetdata/libnetdata.h | 121 +++++++----------------------------------------- 1 file changed, 18 insertions(+), 103 deletions(-) (limited to 'libnetdata/libnetdata.h') diff --git a/libnetdata/libnetdata.h b/libnetdata/libnetdata.h index c337b3b5d..d2ecfa156 100644 --- a/libnetdata/libnetdata.h +++ b/libnetdata/libnetdata.h @@ -11,8 +11,8 @@ extern "C" { #include #endif -#ifdef ENABLE_LZ4 -#define ENABLE_RRDPUSH_COMPRESSION 1 +#if defined(ENABLE_BROTLIENC) && defined(ENABLE_BROTLIDEC) +#define ENABLE_BROTLI 1 #endif #ifdef ENABLE_OPENSSL @@ -201,6 +201,8 @@ extern "C" { // ---------------------------------------------------------------------------- // netdata common definitions +#define _cleanup_(x) __attribute__((__cleanup__(x))) + #ifdef __GNUC__ #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif // __GNUC__ @@ -559,7 +561,7 @@ extern int enable_ksm; char *fgets_trim_len(char *buf, size_t buf_size, FILE *fp, size_t *len); -int verify_netdata_host_prefix(); +int verify_netdata_host_prefix(bool log_msg); int recursively_delete_dir(const char *path, const char *reason); @@ -681,108 +683,13 @@ static inline BITMAPX *bitmapX_create(uint32_t bits) { #define bitmap1024_get_bit(ptr, idx) bitmapX_get_bit((BITMAPX *)ptr, idx) #define bitmap1024_set_bit(ptr, idx, value) bitmapX_set_bit((BITMAPX *)ptr, idx, value) - -#define COMPRESSION_MAX_MSG_SIZE 0x4000 -#define PLUGINSD_LINE_MAX (COMPRESSION_MAX_MSG_SIZE - 1024) -int pluginsd_isspace(char c); -int config_isspace(char c); -int group_by_label_isspace(char c); - -extern bool isspace_map_pluginsd[256]; -extern bool isspace_map_config[256]; -extern bool isspace_map_group_by_label[256]; - -static inline size_t quoted_strings_splitter(char *str, char **words, size_t max_words, bool *isspace_map) { - char *s = str, quote = 0; - size_t i = 0; - - // skip all white space - while (unlikely(isspace_map[(uint8_t)*s])) - s++; - - if(unlikely(!*s)) { - words[i] = NULL; - return 0; - } - - // check for quote - if (unlikely(*s == '\'' || *s == '"')) { - quote = *s; // remember the quote - s++; // skip the quote - } - - // store the first word - words[i++] = s; - - // while we have something - while (likely(*s)) { - // if it is an escape - if (unlikely(*s == '\\' && s[1])) { - s += 2; - continue; - } - - // if it is a quote - else if (unlikely(*s == quote)) { - quote = 0; - *s = ' '; - continue; - } - - // if it is a space - else if (unlikely(quote == 0 && isspace_map[(uint8_t)*s])) { - // terminate the word - *s++ = '\0'; - - // skip all white space - while (likely(isspace_map[(uint8_t)*s])) - s++; - - // check for a quote - if (unlikely(*s == '\'' || *s == '"')) { - quote = *s; // remember the quote - s++; // skip the quote - } - - // if we reached the end, stop - if (unlikely(!*s)) - break; - - // store the next word - if (likely(i < max_words)) - words[i++] = s; - else - break; - } - - // anything else - else - s++; - } - - if (likely(i < max_words)) - words[i] = NULL; - - return i; -} - -#define quoted_strings_splitter_query_group_by_label(str, words, max_words) \ - quoted_strings_splitter(str, words, max_words, isspace_map_group_by_label) - -#define quoted_strings_splitter_config(str, words, max_words) \ - quoted_strings_splitter(str, words, max_words, isspace_map_config) - -#define quoted_strings_splitter_pluginsd(str, words, max_words) \ - quoted_strings_splitter(str, words, max_words, isspace_map_pluginsd) - -static inline char *get_word(char **words, size_t num_words, size_t index) { - if (unlikely(index >= num_words)) - return NULL; - - return words[index]; -} +#define COMPRESSION_MAX_CHUNK 0x4000 +#define COMPRESSION_MAX_OVERHEAD 128 +#define COMPRESSION_MAX_MSG_SIZE (COMPRESSION_MAX_CHUNK - COMPRESSION_MAX_OVERHEAD - 1) +#define PLUGINSD_LINE_MAX (COMPRESSION_MAX_MSG_SIZE - 768) bool run_command_and_copy_output_to_stdout(const char *command, int max_line_length); +struct web_buffer *run_command_and_get_output_to_buffer(const char *command, int max_line_length); typedef enum { OPEN_FD_ACTION_CLOSE, @@ -802,6 +709,8 @@ extern char *netdata_configured_host_prefix; #define XXH_INLINE_ALL #include "xxhash.h" +#include "uuid/uuid.h" + #include "libjudy/src/Judy.h" #include "july/july.h" #include "os.h" @@ -811,7 +720,11 @@ extern char *netdata_configured_host_prefix; #include "circular_buffer/circular_buffer.h" #include "avl/avl.h" #include "inlined.h" +#include "line_splitter/line_splitter.h" #include "clocks/clocks.h" +#include "datetime/iso8601.h" +#include "datetime/rfc3339.h" +#include "datetime/rfc7231.h" #include "completion/completion.h" #include "popen/popen.h" #include "simple_pattern/simple_pattern.h" @@ -820,7 +733,9 @@ extern char *netdata_configured_host_prefix; #endif #include "socket/socket.h" #include "config/appconfig.h" +#include "log/journal.h" #include "log/log.h" +#include "buffered_reader/buffered_reader.h" #include "procfile/procfile.h" #include "string/string.h" #include "dictionary/dictionary.h" -- cgit v1.2.3