aboutsummaryrefslogtreecommitdiff
path: root/initd/supervisor.c
diff options
context:
space:
mode:
Diffstat (limited to 'initd/supervisor.c')
-rw-r--r--initd/supervisor.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/initd/supervisor.c b/initd/supervisor.c
index 8de61c9..6fdaae1 100644
--- a/initd/supervisor.c
+++ b/initd/supervisor.c
@@ -21,6 +21,32 @@ static bool waiting = false;
/*****************************************************************************/
+enum {
+ STATUS_OK = 0,
+ STATUS_FAIL,
+ STATUS_WAIT,
+ STATUS_STARTED,
+};
+
+static const char *status_str[] = {
+ [STATUS_OK] = "\033[22;32m OK \033[0m",
+ [STATUS_FAIL] ="\033[22;31mFAIL\033[0m",
+ [STATUS_WAIT] = "\033[22;33m .. \033[0m",
+ [STATUS_STARTED] ="\033[22;32m UP \033[0m",
+};
+
+static void print_status(const char *msg, int type, bool update)
+{
+ if (update)
+ fputc('\r', stdout);
+
+ printf("[%s] %s", status_str[type], msg);
+
+ if (type != STATUS_WAIT)
+ fputc('\n', stdout);
+ fflush(stdout);
+}
+
static svc_run_data_t *run_time_data_from_pid(pid_t pid)
{
size_t i;