diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-06-09 04:52:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-06-09 04:52:39 +0000 |
commit | 89f3604407aff8f4cb2ed958252c61e23c767e24 (patch) | |
tree | 7fbf408102cab051557d38193524d8c6e991d070 /spawn | |
parent | Adding upstream version 1.34.1. (diff) | |
download | netdata-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')
-rw-r--r-- | spawn/spawn_client.c | 14 | ||||
-rw-r--r-- | spawn/spawn_server.c | 26 |
2 files changed, 30 insertions, 10 deletions
diff --git a/spawn/spawn_client.c b/spawn/spawn_client.c index 509c67347..3e37e7967 100644 --- a/spawn/spawn_client.c +++ b/spawn/spawn_client.c @@ -21,7 +21,10 @@ static void after_pipe_write(uv_write_t* req, int status) #ifdef SPAWN_DEBUG info("CLIENT %s called status=%d", __func__, status); #endif - freez(req->data); + void **data = req->data; + freez(data[0]); + freez(data[1]); + freez(data); } static void client_parse_spawn_protocol(unsigned source_len, char *source) @@ -135,11 +138,16 @@ static void on_read_alloc(uv_handle_t* handle, static void spawn_process_cmd(struct spawn_cmd_info *cmdinfo) { int ret; - uv_buf_t writebuf[3]; + uv_buf_t *writebuf; struct write_context *write_ctx; + void **data = callocz(2, sizeof(void *)); + writebuf = callocz(3, sizeof(uv_buf_t)); write_ctx = callocz(1, sizeof(*write_ctx)); - write_ctx->write_req.data = write_ctx; + + data[0] = write_ctx; + data[1] = writebuf; + write_ctx->write_req.data = data; uv_mutex_lock(&cmdinfo->mutex); cmdinfo->flags |= SPAWN_CMD_PROCESSED; diff --git a/spawn/spawn_server.c b/spawn/spawn_server.c index 57bcdf99a..53b143dea 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) |