static gboolean afprogram_dd_deinit(LogPipe *s) { AFProgramDestDriver *self = (AFProgramDestDriver *) s; GlobalConfig *cfg = log_pipe_get_config(&self->super.super.super); if (self->writer) log_pipe_deinit((LogPipe *) self->writer); child_manager_unregister(self->process_info.pid); if (self->keep_alive) { afprogram_dd_store_reload_store_item(self, cfg); } else { afprogram_dd_kill_child(self); if (self->writer) log_pipe_unref((LogPipe *) self->writer); } if (self->writer) { self->writer = NULL; } return log_dest_driver_deinit_method(s); }
static gboolean afprogram_dd_reopen(AFProgramDestDriver *self) { int fd; afprogram_dd_kill_child(self); if (!afprogram_dd_open_program(self, &fd)) return FALSE; log_writer_reopen(self->writer, log_proto_text_client_new(log_transport_pipe_new(fd), &self->writer_options.proto_options.super)); return TRUE; }
static gboolean afprogram_dd_deinit(LogPipe *s) { AFProgramDestDriver *self = (AFProgramDestDriver *) s; afprogram_dd_kill_child(self); if (self->writer) { log_pipe_deinit(self->writer); log_pipe_unref(self->writer); self->writer = NULL; } if (!log_dest_driver_deinit_method(s)) return FALSE; return TRUE; }
static gboolean afprogram_dd_reopen(AFProgramDestDriver *self) { int fd; afprogram_dd_kill_child(self); msg_verbose("Starting destination program", evt_tag_str("cmdline", self->cmdline->str), NULL); if (!afprogram_popen(self->cmdline->str, G_IO_OUT, &self->pid, &fd)) return FALSE; child_manager_register(self->pid, afprogram_dd_exit, log_pipe_ref(&self->super.super.super), (GDestroyNotify) log_pipe_unref); g_fd_set_nonblock(fd, TRUE); log_writer_reopen(self->writer, log_proto_text_client_new(log_transport_pipe_new(fd), &self->writer_options.proto_options.super)); return TRUE; }