From 7f9e60de587e0e0d9e662244064d894c4d8e6374 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sun, 2 Sep 2018 07:30:02 -0700 Subject: [PATCH] SCP: Use O_NDELAY when putting fd 0 into non blocking mode on Linux --- sim_console.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sim_console.c b/sim_console.c index d33e0f15..d79d60f2 100644 --- a/sim_console.c +++ b/sim_console.c @@ -3955,7 +3955,15 @@ static t_stat sim_os_ttinit (void) sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_ttinit()\n"); cmdfl = fcntl (fileno (stdin), F_GETFL, 0); /* get old flags and status */ -runfl = cmdfl | FNDELAY; +runfl = cmdfl; +/* + * make sure systems with broken termios (that don't honor + * VMIN=0 and VTIME=0) actually implement non blocking reads. + * This will have no negative effect on other systems since + * this is turned on and off depending on whether simulation + * is running or not. + */ +runfl = cmdfl | O_NDELAY; if (!isatty (fileno (stdin))) /* skip if !tty */ return SCPE_OK; if (tcgetattr (0, &cmdtty) < 0) /* get old flags */