change Christinas previous patch to only perform the check/logging
[sahlberg/ctdb.git] / common / ctdb_logging.c
index ea4d2716302e8abd2281bd76db1a0dcdc550ec68..dee4dfdb364eda731fea6512a83cb917ef418035 100644 (file)
 */
 
 #include "includes.h"
-#include "lib/events/events.h"
+#include "lib/tevent/tevent.h"
 #include "lib/tdb/include/tdb.h"
 #include "system/time.h"
 #include "../include/ctdb_private.h"
-#include "../include/ctdb.h"
+#include "../include/ctdb_client.h"
 
 int log_ringbuf_size;
 
@@ -144,7 +144,7 @@ static void ctdb_collect_log(struct ctdb_context *ctdb, struct ctdb_get_log_addr
        DEBUG(DEBUG_ERR,("Marshalling log entries into a blob of %d bytes\n", (int)data.dsize));
 
        DEBUG(DEBUG_ERR,("Send log to %d:%d\n", (int)log_addr->pnn, (int)log_addr->srvid));
-       ctdb_send_message(ctdb, log_addr->pnn, log_addr->srvid, data);
+       ctdb_client_send_message(ctdb, log_addr->pnn, log_addr->srvid, data);
 
        talloc_free(data.dptr);
 }
@@ -157,14 +157,14 @@ int32_t ctdb_control_get_log(struct ctdb_context *ctdb, TDB_DATA addr)
        /* spawn a child process to marshall the huge log blob and send it back
           to the ctdb tool using a MESSAGE
        */
-       child = fork();
+       child = ctdb_fork(ctdb);
        if (child == (pid_t)-1) {
                DEBUG(DEBUG_ERR,("Failed to fork a log collector child\n"));
                return -1;
        }
 
        if (child == 0) {
-               if (switch_from_server_to_client(ctdb) != 0) {
+               if (switch_from_server_to_client(ctdb, "log-collector") != 0) {
                        DEBUG(DEBUG_CRIT, (__location__ "ERROR: failed to switch log collector child into client mode.\n"));
                        _exit(1);
                }