diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2023-04-21 16:50:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-21 16:50:48 +0300 |
commit | 1fa60373300bbcd796201ee576ea11d3711f69e7 (patch) | |
tree | a68e9387ef942de38f493299a1deec2dedc006de /libnetdata | |
parent | 0d2c327ae58af5de35c9cb35a20cce9f59e92b9c (diff) |
Remove netdatacli response size limitation (#14906)
* Dump config
* Add charcat and rawcat
* Build incoming response in an buffer
* Allocate a buffer to hold the command response so that we dont have a 4K char limit
* Add a dumpconfig command to output the current netdata.conf
* Remove -W dumpconfig for now
* Fix typo
* Improve help message
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/buffer/buffer.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libnetdata/buffer/buffer.h b/libnetdata/buffer/buffer.h index 83c2a38dd0..f5f83bc2ae 100644 --- a/libnetdata/buffer/buffer.h +++ b/libnetdata/buffer/buffer.h @@ -152,6 +152,35 @@ static inline void _buffer_json_depth_pop(BUFFER *wb) { wb->json.depth--; } +static inline void buffer_fast_charcat(BUFFER *wb, const char c) { + + buffer_need_bytes(wb, 2); + *(&wb->buffer[wb->len]) = c; + wb->len += 1; + wb->buffer[wb->len] = '\0'; + + buffer_overflow_check(wb); +} + +static inline void buffer_fast_rawcat(BUFFER *wb, const char *txt, size_t len) { + if(unlikely(!txt || !*txt || !len)) return; + + buffer_need_bytes(wb, len + 1); + + const char *t = txt; + const char *e = &txt[len]; + + char *d = &wb->buffer[wb->len]; + + while(t != e) + *d++ = *t++; + + wb->len += len; + wb->buffer[wb->len] = '\0'; + + buffer_overflow_check(wb); +} + static inline void buffer_fast_strcat(BUFFER *wb, const char *txt, size_t len) { if(unlikely(!txt || !*txt || !len)) return; |