From db74ac99477ec0334c8152fb00ec728fc88c8f1e Mon Sep 17 00:00:00 2001 From: Simon Schubert Date: Thu, 7 Jun 2007 22:58:22 +0000 Subject: [PATCH] Try hard to restore the termios state on exit/reboot. tcsetattr() can be interrupted by spurious SIGIO from the kqueue, so try setting the state until it succeeds. Add an EVENTHANDLER so that the tty state will be restored for a possible kernel reboot. --- sys/platform/vkernel/platform/console.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/platform/vkernel/platform/console.c b/sys/platform/vkernel/platform/console.c index 7f6e559b25..493848ec57 100644 --- a/sys/platform/vkernel/platform/console.c +++ b/sys/platform/vkernel/platform/console.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/vkernel/platform/console.c,v 1.15 2007/05/28 05:26:29 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/platform/console.c,v 1.16 2007/06/07 22:58:22 corecode Exp $ */ #include @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -292,7 +293,11 @@ vconswinch(int __unused sig) static void vconscleanup(void) { - tcsetattr(0, TCSAFLUSH, &init_tio); + /* + * We might catch stray SIGIOs, so try hard. + */ + while (tcsetattr(0, TCSAFLUSH, &init_tio) != 0 && errno == EINTR) + /* NOTHING */; } static void @@ -333,6 +338,7 @@ vconsinit_fini(struct consdev *cp) if (i == 0) cp->cn_dev = dev; } + EVENTHANDLER_REGISTER(shutdown_final, vconscleanup, NULL, SHUTDOWN_PRI_LAST); } static void -- 2.11.4.GIT