summaryrefslogtreecommitdiffstats
path: root/spawn/spawn_server.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:39 +0000
commit89f3604407aff8f4cb2ed958252c61e23c767e24 (patch)
tree7fbf408102cab051557d38193524d8c6e991d070 /spawn/spawn_server.c
parentAdding upstream version 1.34.1. (diff)
downloadnetdata-89f3604407aff8f4cb2ed958252c61e23c767e24.tar.xz
netdata-89f3604407aff8f4cb2ed958252c61e23c767e24.zip
Adding upstream version 1.35.0.upstream/1.35.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'spawn/spawn_server.c')
-rw-r--r--spawn/spawn_server.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/spawn/spawn_server.c b/spawn/spawn_server.c
index 57bcdf99..53b143de 100644
--- a/spawn/spawn_server.c
+++ b/spawn/spawn_server.c
@@ -71,12 +71,15 @@ static void after_pipe_write(uv_write_t *req, int status)
#ifdef SPAWN_DEBUG
fprintf(stderr, "SERVER %s called status=%d\n", __func__, status);
#endif
- freez(req->data);
+ void **data = req->data;
+ freez(data[0]);
+ freez(data[1]);
+ freez(data);
}
static void child_waited_async_cb(uv_async_t *async_handle)
{
- uv_buf_t writebuf[2];
+ uv_buf_t *writebuf;
int ret;
struct spawn_execution_info *exec_info;
struct write_context *write_ctx;
@@ -84,8 +87,13 @@ static void child_waited_async_cb(uv_async_t *async_handle)
(void)async_handle;
while (NULL != (exec_info = dequeue_child_waited_list())) {
write_ctx = mallocz(sizeof(*write_ctx));
- write_ctx->write_req.data = write_ctx;
+ void **data = callocz(2, sizeof(void *));
+ writebuf = callocz(2, sizeof(uv_buf_t));
+
+ data[0] = write_ctx;
+ data[1] = writebuf;
+ write_ctx->write_req.data = data;
write_ctx->header.opcode = SPAWN_PROT_CMD_EXIT_STATUS;
write_ctx->header.handle = exec_info->handle;
@@ -151,14 +159,18 @@ static void wait_children(void *arg)
void spawn_protocol_execute_command(void *handle, char *command_to_run, uint16_t command_length)
{
- uv_buf_t writebuf[2];
+ uv_buf_t *writebuf;
int ret;
avl_t *avl_ret;
struct spawn_execution_info *exec_info;
struct write_context *write_ctx;
write_ctx = mallocz(sizeof(*write_ctx));
- write_ctx->write_req.data = write_ctx;
+ void **data = callocz(2, sizeof(void *));
+ writebuf = callocz(2, sizeof(uv_buf_t));
+ data[0] = write_ctx;
+ data[1] = writebuf;
+ write_ctx->write_req.data = data;
command_to_run[command_length] = '\0';
#ifdef SPAWN_DEBUG
@@ -300,8 +312,8 @@ void spawn_server(void)
{
int error;
- test_clock_boottime();
- test_clock_monotonic_coarse();
+ // initialize the system clocks
+ clocks_init();
// close all open file descriptors, except the standard ones
// the caller may have left open files (lxc-attach has this issue)