summaryrefslogtreecommitdiffstats
path: root/spawn
diff options
context:
space:
mode:
Diffstat (limited to 'spawn')
-rw-r--r--spawn/spawn.c16
-rw-r--r--spawn/spawn_client.c30
2 files changed, 23 insertions, 23 deletions
diff --git a/spawn/spawn.c b/spawn/spawn.c
index f326f8881..a9359da04 100644
--- a/spawn/spawn.c
+++ b/spawn/spawn.c
@@ -219,7 +219,7 @@ int create_spawn_server(uv_loop_t *loop, uv_pipe_t *spawn_channel, uv_process_t
ret = uv_spawn(loop, process, &options); /* execute the netdata binary again as the netdata user */
if (0 != ret) {
- error("uv_spawn (process: \"%s\") (user: %s) failed (%s).", exepath, user, uv_strerror(ret));
+ netdata_log_error("uv_spawn (process: \"%s\") (user: %s) failed (%s).", exepath, user, uv_strerror(ret));
fatal("Cannot start netdata without the spawn server.");
}
@@ -235,14 +235,14 @@ void spawn_init(void)
struct completion completion;
int error;
- info("Initializing spawn client.");
+ netdata_log_info("Initializing spawn client.");
init_spawn_cmd_queue();
completion_init(&completion);
error = uv_thread_create(&thread, spawn_client, &completion);
if (error) {
- error("uv_thread_create(): %s", uv_strerror(error));
+ netdata_log_error("uv_thread_create(): %s", uv_strerror(error));
goto after_error;
}
/* wait for spawn client thread to initialize */
@@ -253,7 +253,7 @@ void spawn_init(void)
if (spawn_thread_error) {
error = uv_thread_join(&thread);
if (error) {
- error("uv_thread_create(): %s", uv_strerror(error));
+ netdata_log_error("uv_thread_create(): %s", uv_strerror(error));
}
goto after_error;
}
@@ -268,15 +268,15 @@ void spawn_init(void)
char cmd[64];
sprintf(cmd, "echo CONCURRENT_STRESS_TEST %d 1>&2", j * CONCURRENT_SPAWNS + i + 1);
serial[i] = spawn_enq_cmd(cmd);
- info("Queued command %s for spawning.", cmd);
+ netdata_log_info("Queued command %s for spawning.", cmd);
}
int exit_status;
time_t exec_run_timestamp;
for (int i = 0; i < CONCURRENT_SPAWNS; ++i) {
- info("Started waiting for serial %llu exit status %d run timestamp %llu.", serial[i], exit_status,
+ netdata_log_info("Started waiting for serial %llu exit status %d run timestamp %llu.", serial[i], exit_status,
exec_run_timestamp);
spawn_wait_cmd(serial[i], &exit_status, &exec_run_timestamp);
- info("Finished waiting for serial %llu exit status %d run timestamp %llu.", serial[i], exit_status,
+ netdata_log_info("Finished waiting for serial %llu exit status %d run timestamp %llu.", serial[i], exit_status,
exec_run_timestamp);
}
}
@@ -285,5 +285,5 @@ void spawn_init(void)
return;
after_error:
- error("Failed to initialize spawn service. The alarms notifications will not be spawned.");
+ netdata_log_error("Failed to initialize spawn service. The alarms notifications will not be spawned.");
}
diff --git a/spawn/spawn_client.c b/spawn/spawn_client.c
index 3e37e7967..8928a468c 100644
--- a/spawn/spawn_client.c
+++ b/spawn/spawn_client.c
@@ -19,7 +19,7 @@ static void after_pipe_write(uv_write_t* req, int status)
{
(void)status;
#ifdef SPAWN_DEBUG
- info("CLIENT %s called status=%d", __func__, status);
+ netdata_log_info("CLIENT %s called status=%d", __func__, status);
#endif
void **data = req->data;
freez(data[0]);
@@ -59,7 +59,7 @@ static void client_parse_spawn_protocol(unsigned source_len, char *source)
cmdinfo->pid = spawn_result->exec_pid;
if (0 == cmdinfo->pid) { /* Failed to spawn */
#ifdef SPAWN_DEBUG
- info("CLIENT %s SPAWN_PROT_SPAWN_RESULT failed to spawn.", __func__);
+ netdata_log_info("CLIENT %s SPAWN_PROT_SPAWN_RESULT failed to spawn.", __func__);
#endif
cmdinfo->flags |= SPAWN_CMD_FAILED_TO_SPAWN | SPAWN_CMD_DONE;
uv_cond_signal(&cmdinfo->cond);
@@ -67,7 +67,7 @@ static void client_parse_spawn_protocol(unsigned source_len, char *source)
cmdinfo->exec_run_timestamp = spawn_result->exec_run_timestamp;
cmdinfo->flags |= SPAWN_CMD_IN_PROGRESS;
#ifdef SPAWN_DEBUG
- info("CLIENT %s SPAWN_PROT_SPAWN_RESULT in progress.", __func__);
+ netdata_log_info("CLIENT %s SPAWN_PROT_SPAWN_RESULT in progress.", __func__);
#endif
}
uv_mutex_unlock(&cmdinfo->mutex);
@@ -84,7 +84,7 @@ static void client_parse_spawn_protocol(unsigned source_len, char *source)
uv_mutex_lock(&cmdinfo->mutex);
cmdinfo->exit_status = exit_status->exec_exit_status;
#ifdef SPAWN_DEBUG
- info("CLIENT %s SPAWN_PROT_CMD_EXIT_STATUS %d.", __func__, exit_status->exec_exit_status);
+ netdata_log_info("CLIENT %s SPAWN_PROT_CMD_EXIT_STATUS %d.", __func__, exit_status->exec_exit_status);
#endif
cmdinfo->flags |= SPAWN_CMD_DONE;
uv_cond_signal(&cmdinfo->cond);
@@ -102,18 +102,18 @@ static void client_parse_spawn_protocol(unsigned source_len, char *source)
static void on_pipe_read(uv_stream_t* pipe, ssize_t nread, const uv_buf_t* buf)
{
if (0 == nread) {
- info("%s: Zero bytes read from spawn pipe.", __func__);
+ netdata_log_info("%s: Zero bytes read from spawn pipe.", __func__);
} else if (UV_EOF == nread) {
- info("EOF found in spawn pipe.");
+ netdata_log_info("EOF found in spawn pipe.");
} else if (nread < 0) {
- error("%s: %s", __func__, uv_strerror(nread));
+ netdata_log_error("%s: %s", __func__, uv_strerror(nread));
}
if (nread < 0) { /* stop stream due to EOF or error */
(void)uv_read_stop((uv_stream_t *)pipe);
} else if (nread) {
#ifdef SPAWN_DEBUG
- info("CLIENT %s read %u", __func__, (unsigned)nread);
+ netdata_log_info("CLIENT %s read %u", __func__, (unsigned)nread);
#endif
client_parse_spawn_protocol(nread, buf->base);
}
@@ -162,7 +162,7 @@ static void spawn_process_cmd(struct spawn_cmd_info *cmdinfo)
writebuf[2] = uv_buf_init((char *)cmdinfo->command_to_run, write_ctx->payload.command_length);
#ifdef SPAWN_DEBUG
- info("CLIENT %s SPAWN_PROT_EXEC_CMD %u", __func__, (unsigned)cmdinfo->serial);
+ netdata_log_info("CLIENT %s SPAWN_PROT_EXEC_CMD %u", __func__, (unsigned)cmdinfo->serial);
#endif
ret = uv_write(&write_ctx->write_req, (uv_stream_t *)&spawn_channel, writebuf, 3, after_pipe_write);
fatal_assert(ret == 0);
@@ -176,7 +176,7 @@ void spawn_client(void *arg)
loop = mallocz(sizeof(uv_loop_t));
ret = uv_loop_init(loop);
if (ret) {
- error("uv_loop_init(): %s", uv_strerror(ret));
+ netdata_log_error("uv_loop_init(): %s", uv_strerror(ret));
spawn_thread_error = ret;
goto error_after_loop_init;
}
@@ -185,14 +185,14 @@ void spawn_client(void *arg)
spawn_async.data = NULL;
ret = uv_async_init(loop, &spawn_async, async_cb);
if (ret) {
- error("uv_async_init(): %s", uv_strerror(ret));
+ netdata_log_error("uv_async_init(): %s", uv_strerror(ret));
spawn_thread_error = ret;
goto error_after_async_init;
}
ret = uv_pipe_init(loop, &spawn_channel, 1);
if (ret) {
- error("uv_pipe_init(): %s", uv_strerror(ret));
+ netdata_log_error("uv_pipe_init(): %s", uv_strerror(ret));
spawn_thread_error = ret;
goto error_after_pipe_init;
}
@@ -200,7 +200,7 @@ void spawn_client(void *arg)
ret = create_spawn_server(loop, &spawn_channel, &process);
if (ret) {
- error("Failed to fork spawn server process.");
+ netdata_log_error("Failed to fork spawn server process.");
spawn_thread_error = ret;
goto error_after_spawn_server;
}
@@ -223,12 +223,12 @@ void spawn_client(void *arg)
}
}
/* cleanup operations of the event loop */
- info("Shutting down spawn client event loop.");
+ netdata_log_info("Shutting down spawn client event loop.");
uv_close((uv_handle_t *)&spawn_channel, NULL);
uv_close((uv_handle_t *)&spawn_async, NULL);
uv_run(loop, UV_RUN_DEFAULT); /* flush all libuv handles */
- info("Shutting down spawn client loop complete.");
+ netdata_log_info("Shutting down spawn client loop complete.");
fatal_assert(0 == uv_loop_close(loop));
return;