1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

ctdb-daemon: Remove ctdb_fork_with_logging()

This function has been replaced with ctdb_vfork_with_logging().

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Jan 16 04:05:35 CET 2014 on sn-devel-104
This commit is contained in:
Amitay Isaacs 2013-12-18 14:09:52 +11:00 committed by Martin Schwenke
parent dd98b9df66
commit a92fd11ad1
2 changed files with 0 additions and 65 deletions

View File

@ -1456,11 +1456,6 @@ int32_t ctdb_control_get_log(struct ctdb_context *ctdb, TDB_DATA addr);
int32_t ctdb_control_clear_log(struct ctdb_context *ctdb);
void ctdb_log_ringbuffer_free(void);
struct ctdb_log_state *ctdb_fork_with_logging(TALLOC_CTX *mem_ctx,
struct ctdb_context *ctdb,
const char *log_prefix,
void (*logfn)(const char *, uint16_t, void *),
void *logfn_private, pid_t *pid);
struct ctdb_log_state *ctdb_vfork_with_logging(TALLOC_CTX *mem_ctx,
struct ctdb_context *ctdb,
const char *log_prefix,

View File

@ -468,66 +468,6 @@ static int log_context_destructor(struct ctdb_log_state *log)
return 0;
}
/*
fork(), redirecting child output to logging and specified callback.
*/
struct ctdb_log_state *ctdb_fork_with_logging(TALLOC_CTX *mem_ctx,
struct ctdb_context *ctdb,
const char *log_prefix,
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;
log = talloc_zero(mem_ctx, struct ctdb_log_state);
CTDB_NO_MEMORY_NULL(ctdb, log);
log->ctdb = ctdb;
log->prefix = log_prefix;
log->logfn = logfn;
log->logfn_private = (void *)logfn_private;
if (pipe(p) != 0) {
DEBUG(DEBUG_ERR,(__location__ " Failed to setup for child logging pipe\n"));
goto free_log;
}
*pid = ctdb_fork(ctdb);
/* Child? */
if (*pid == 0) {
close(STDOUT_FILENO);
close(STDERR_FILENO);
dup2(p[1], STDOUT_FILENO);
dup2(p[1], STDERR_FILENO);
close(p[0]);
close(p[1]);
return log;
}
close(p[1]);
/* We failed? */
if (*pid < 0) {
DEBUG(DEBUG_ERR, (__location__ " fork failed for child process\n"));
close(p[0]);
goto free_log;
}
log->pfd = p[0];
set_close_on_exec(log->pfd);
talloc_set_destructor(log, log_context_destructor);
fde = event_add_fd(ctdb->ev, log, log->pfd,
EVENT_FD_READ, ctdb_log_handler, log);
tevent_fd_set_auto_close(fde);
return log;
free_log:
talloc_free(log);
return NULL;
}
/*
* vfork + exec, redirecting child output to logging and specified callback.
*/