From 4cc3aed1399628f84ee1139a5fa64c01bab4f9e3 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 9 Jul 2017 11:01:00 +0200 Subject: [PATCH] Avoid 2 sec block of Finit when stopping TTYs Signed-off-by: Joachim Nilsson --- src/tty.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tty.c b/src/tty.c index 39f47e98..b07aa8b8 100644 --- a/src/tty.c +++ b/src/tty.c @@ -223,9 +223,13 @@ void tty_stop(finit_tty_t *tty) if (!tty->pid) return; + /* + * XXX: TTY handling should be refactored to regular services, + * XXX: that way we could rely on the state machine to properly + * XXX: send SIGTERM, wait for max 2 sec to collect PID before + * XXX: sending SIGKILL. + */ _d("Stopping TTY %s", tty->name); - kill(tty->pid, SIGTERM); - do_sleep(2); kill(tty->pid, SIGKILL); waitpid(tty->pid, NULL, 0); tty->pid = 0;