aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-respawn.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-04-18 10:20:49 +0200
committerMattias Andrée <maandree@operamail.com>2015-04-18 10:20:49 +0200
commite34d491ee14d6fc76294296552a070004493af32 (patch)
tree3d3105ad2928c0324ba3428a387c31958299ff22 /src/mds-respawn.c
parenttypo + update todo (diff)
downloadmds-e34d491ee14d6fc76294296552a070004493af32.tar.gz
mds-e34d491ee14d6fc76294296552a070004493af32.tar.bz2
mds-e34d491ee14d6fc76294296552a070004493af32.tar.xz
m doc + iprint and iprintf macros + siginfo on mds, mds-vt and mds-respawn
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-respawn.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/mds-respawn.c b/src/mds-respawn.c
index 014fce3..785eb67 100644
--- a/src/mds-respawn.c
+++ b/src/mds-respawn.c
@@ -64,7 +64,7 @@ static int interval = RESPAWN_TIME_LIMIT_SECONDS;
static size_t servers = 0;
/**
- * Command line arguments, for each server — concatenated, with NULL termination
+ * Command line arguments, for each server — concatenated, with NULL-termination
*/
static char** commands_args = NULL;
@@ -535,3 +535,47 @@ int master_loop(void)
return rc;
}
+
+/**
+ * This function is called when a signal that
+ * signals that the system to dump state information
+ * and statistics has been received
+ *
+ * @param signo The signal that has been received
+ */
+void received_info(int signo)
+{
+ server_state_t state;
+ size_t i, n = servers;
+ char** cmdline;
+ struct timespec now;
+ (void) signo;
+ if (monotone(&now) < 0)
+ iprint("(unable to get current time)");
+ else
+ iprintf("current time: %ji.%09li", (intmax_t)(now.tv_sec), (long)(now.tv_nsec));
+ iprintf("do-not-resuscitate period: %i seconds", interval);
+ iprintf("managed servers: %zu", n);
+ iprintf("alive servers: %zu", live_count);
+ iprintf("reviving: %s", reviving ? "yes" : "no");
+ for (i = 0; i < n; i++)
+ {
+ state = states[i];
+ cmdline = commands[i];
+ iprintf("managed server %zu: pid: %li", i, (long)(state.pid));
+ iprintf("managed server %zu: state: %s", i,
+ state.state == UNBORN ? "not started yet" :
+ state.state == ALIVE ? "up and running" :
+ state.state == DEAD ? "about to be respawn" :
+ state.state == DEAD_AND_BURIED ? "requires SIGUSR2 to respawn" :
+ state.state == CREMATED ? "will never respawn" :
+ "unrecognised state, something is wrong here!");
+ iprintf("managed server %zu: started: %ji.%09li", i,
+ (intmax_t)(state.started.tv_sec),
+ (long)(state.started.tv_nsec));
+ iprintf("managed server %zu: cmdline:", i);
+ while (*cmdline)
+ iprintf(" %z", *cmdline++);
+ }
+}
+