summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-06-24 14:02:53 +1000
committerAmitay Isaacs <amitay@samba.org>2019-07-05 05:03:24 +0000
commit79a7cc3fb976c88a57099fdae239ddd217bcc968 (patch)
treed43a7605fcc643a86e25f83ff118eb22cdb804d6 /ctdb
parent2a93385997912c89fa6b547f8c32fa67283403cb (diff)
downloadsamba-79a7cc3fb976c88a57099fdae239ddd217bcc968.tar.gz
ctdb-daemon: Drop unused function ctdb_vfork_with_logging()
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/include/ctdb_private.h10
-rw-r--r--ctdb/server/ctdb_logging.c96
2 files changed, 0 insertions, 106 deletions
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 7ea7691a36b..2bcc7c94156 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -675,16 +675,6 @@ struct lock_request *ctdb_lock_db(TALLOC_CTX *mem_ctx,
bool ctdb_logging_init(TALLOC_CTX *mem_ctx, const char *logging,
const char *debug_level);
-struct ctdb_log_state *ctdb_vfork_with_logging(TALLOC_CTX *mem_ctx,
- struct ctdb_context *ctdb,
- const char *log_prefix,
- const char *helper,
- int helper_argc,
- const char **helper_argv,
- void (*logfn)(const char *,
- uint16_t, void *),
- void *logfn_private, pid_t *pid);
-
int ctdb_set_child_logging(struct ctdb_context *ctdb);
/* from ctdb_logging_file.c */
diff --git a/ctdb/server/ctdb_logging.c b/ctdb/server/ctdb_logging.c
index e7ca9b2758d..8af787c189f 100644
--- a/ctdb/server/ctdb_logging.c
+++ b/ctdb/server/ctdb_logging.c
@@ -132,102 +132,6 @@ static void ctdb_child_log_handler(struct tevent_context *ev,
}
}
-static int log_context_destructor(struct ctdb_log_state *log)
-{
- /* Flush buffer in case it wasn't \n-terminated. */
- if (log->buf_used > 0) {
- write_to_log(log, log->buf, log->buf_used);
- }
- return 0;
-}
-
-/*
- * vfork + exec, redirecting child output to logging and specified callback.
- */
-struct ctdb_log_state *ctdb_vfork_with_logging(TALLOC_CTX *mem_ctx,
- struct ctdb_context *ctdb,
- const char *log_prefix,
- const char *helper,
- int helper_argc,
- const char **helper_argv,
- void (*logfn)(const char *, uint16_t, void *),
- void *logfn_private, pid_t *pid)
-{
- int p[2];
- struct ctdb_log_state *log;
- struct tevent_fd *fde;
- char **argv;
- int i;
- struct timeval before;
- double delta_t;
-
- log = talloc_zero(mem_ctx, struct ctdb_log_state);
- CTDB_NO_MEMORY_NULL(ctdb, log);
-
- log->prefix = log_prefix;
- log->logfn = logfn;
- log->logfn_private = logfn_private;
-
- if (pipe(p) != 0) {
- DEBUG(DEBUG_ERR, (__location__ " Failed to setup pipe for child logging:"
- " %s\n", strerror(errno)));
- goto free_log;
- }
-
- argv = talloc_array(mem_ctx, char *, helper_argc + 2);
- if (argv == NULL) {
- DEBUG(DEBUG_ERR, (__location__ "Failed to allocate memory for helper\n"));
- goto free_log;
- }
- argv[0] = discard_const(helper);
- argv[1] = talloc_asprintf(argv, "%d", p[1]);
- if (argv[1] == NULL) {
- DEBUG(DEBUG_ERR, (__location__ "Failed to allocate memory for helper\n"));
- talloc_free(argv);
- goto free_log;
- }
-
- for (i=0; i<helper_argc; i++) {
- argv[i+2] = discard_const(helper_argv[i]);
- }
-
- before = timeval_current();
-
- *pid = vfork();
- if (*pid == 0) {
- execv(helper, argv);
- _exit(1);
- }
- close(p[1]);
-
- if (*pid < 0) {
- DEBUG(DEBUG_ERR, (__location__ "vfork failed for helper process\n"));
- close(p[0]);
- goto free_log;
- }
-
- delta_t = timeval_elapsed(&before);
- if (delta_t > 3.0) {
- DEBUG(DEBUG_WARNING, ("vfork() took %lf seconds\n", delta_t));
- }
-
- ctdb_track_child(ctdb, *pid);
-
- log->pfd = p[0];
- set_close_on_exec(log->pfd);
- talloc_set_destructor(log, log_context_destructor);
- fde = tevent_add_fd(ctdb->ev, log, log->pfd, TEVENT_FD_READ,
- ctdb_child_log_handler, log);
- tevent_fd_set_auto_close(fde);
-
- return log;
-
-free_log:
- talloc_free(log);
- return NULL;
-}
-
-
/*
setup for logging of child process stdout
*/