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

util: New functions ctdb_set_child_info() and ctdb_is_child_process()

Must be called by all child processes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 59b019a97aad9a731f9080ea5be14d0dbdfe03d6)
This commit is contained in:
Martin Schwenke 2013-04-16 11:11:11 +10:00 committed by Amitay Isaacs
parent f07d47a56d
commit 4ede763f3b
2 changed files with 24 additions and 0 deletions

View File

@ -23,6 +23,28 @@
#include "../include/ctdb_private.h"
#include "../common/rb_tree.h"
static bool is_child = false;
void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, ...)
{
is_child = true;
if (child_name_fmt != NULL) {
va_list ap;
char *t;
va_start(ap, child_name_fmt);
t = talloc_vasprintf(mem_ctx, child_name_fmt, ap);
debug_extra = talloc_asprintf(mem_ctx, "%s:", t);
talloc_free(t);
va_end(ap);
}
}
bool ctdb_is_child_process(void)
{
return is_child;
}
/*
* This function forks a child process and drops the realtime
* scheduler for the child process.

View File

@ -1080,6 +1080,8 @@ void ctdb_restore_scheduler(struct ctdb_context *ctdb);
struct tevent_signal *ctdb_init_sigchld(struct ctdb_context *ctdb);
pid_t ctdb_fork(struct ctdb_context *ctdb);
pid_t ctdb_fork_no_free_ringbuffer(struct ctdb_context *ctdb);
void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, ...);
bool ctdb_is_child_process(void);
int ctdb_kill(struct ctdb_context *ctdb, pid_t pid, int signum);
int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,