From 6f2538380a9f374581ddbfeab1bc404ecdfa8cc4 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sun, 2 Sep 2018 20:07:53 -0700 Subject: [PATCH] SCP: Change use of O_NDELAY to O_NONBLOCK for Posix compatibility --- sim_console.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sim_console.c b/sim_console.c index d79d60f2..30befa71 100644 --- a/sim_console.c +++ b/sim_console.c @@ -3818,6 +3818,14 @@ return SCPE_OK; #include #include +#if (!defined(O_NONBLOCK)) && defined(O_NDELAY) +#define O_NONBLOCK O_NDELAY +#else +#if !defined(O_NONBLOCK) +#define O_NONBLOCK FNDELAY +#endif +#endif + struct sgttyb cmdtty,runtty; /* V6/V7 stty data */ struct tchars cmdtchars,runtchars; /* V7 editing */ struct ltchars cmdltchars,runltchars; /* 4.2 BSD editing */ @@ -3828,7 +3836,7 @@ static t_stat sim_os_ttinit (void) sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_ttinit() - BSDTTY\n"); cmdfl = fcntl (fileno (stdin), F_GETFL, 0); /* get old flags and status */ -runfl = cmdfl | FNDELAY; +runfl = cmdfl | O_NONBLOCK; if (ioctl (0, TIOCGETP, &cmdtty) < 0) return SCPE_TTIERR; if (ioctl (0, TIOCGETC, &cmdtchars) < 0) @@ -3963,7 +3971,7 @@ runfl = cmdfl; * this is turned on and off depending on whether simulation * is running or not. */ -runfl = cmdfl | O_NDELAY; +runfl = cmdfl | O_NONBLOCK; if (!isatty (fileno (stdin))) /* skip if !tty */ return SCPE_OK; if (tcgetattr (0, &cmdtty) < 0) /* get old flags */