SCP: Report errno value when starting instruction execution fails
This commit is contained in:
parent
961f5e3285
commit
6ccbfc7381
2 changed files with 10 additions and 6 deletions
12
scp.c
12
scp.c
|
@ -7511,22 +7511,26 @@ for (i = 1; (dptr = sim_devices[i]) != NULL; i++) { /* reposition all */
|
|||
}
|
||||
}
|
||||
if ((r = sim_ttrun ()) != SCPE_OK) { /* set console mode */
|
||||
r = sim_messagef (SCPE_TTYERR, "sim_ttrun() returned: %s - errno: %d - %s\n", sim_error_text (r), errno, strerror (errno));
|
||||
sim_ttcmd ();
|
||||
return sim_messagef (SCPE_TTYERR, "sim_ttrun() returned: %s\n", sim_error_text (r));
|
||||
return r;
|
||||
}
|
||||
if ((r = sim_check_console (30)) != SCPE_OK) { /* check console, error? */
|
||||
r = sim_messagef (r, "sim_check_console () returned: %s - errno: %d - %s\n", sim_error_text (r), errno, strerror (errno));
|
||||
sim_ttcmd ();
|
||||
sim_messagef (r, "sim_check_console () returned: %s\n", sim_error_text (r));
|
||||
return r;
|
||||
}
|
||||
#ifdef SIGHUP
|
||||
if (signal (SIGHUP, int_handler) == SIG_ERR) { /* set WRU */
|
||||
r = sim_messagef (SCPE_SIGERR, "Can't establish SIGHUP: errno: %d - %s", errno, strerror (errno));
|
||||
sim_ttcmd ();
|
||||
return sim_messagef (SCPE_SIGERR, "Can't establish SIGHUP");
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
if (signal (SIGTERM, int_handler) == SIG_ERR) { /* set WRU */
|
||||
r = sim_messagef (SCPE_SIGERR, "Can't establish SIGTERM: errno: %d - %s", errno, strerror (errno));
|
||||
sim_ttcmd ();
|
||||
return sim_messagef (SCPE_SIGERR, "Can't establish SIGTERM");
|
||||
return r;
|
||||
}
|
||||
stop_cpu = FALSE;
|
||||
sim_is_running = TRUE; /* flag running */
|
||||
|
|
|
@ -3988,7 +3988,7 @@ runtty.c_cc[VINTR] = 0; /* OS X doesn't deliver
|
|||
#else
|
||||
runtty.c_cc[VINTR] = sim_int_char; /* in case changed */
|
||||
#endif
|
||||
if (tcsetattr (0, TCSAFLUSH, &runtty) < 0)
|
||||
if (tcsetattr (fileno(stdin), TCSAFLUSH, &runtty) < 0)
|
||||
return SCPE_TTIERR;
|
||||
sim_os_set_thread_priority (PRIORITY_BELOW_NORMAL); /* try to lower pri */
|
||||
return SCPE_OK;
|
||||
|
@ -3999,7 +3999,7 @@ static t_stat sim_os_ttcmd (void)
|
|||
if (!isatty (fileno (stdin))) /* skip if !tty */
|
||||
return SCPE_OK;
|
||||
sim_os_set_thread_priority (PRIORITY_NORMAL); /* try to raise pri */
|
||||
if (tcsetattr (0, TCSAFLUSH, &cmdtty) < 0)
|
||||
if (tcsetattr (fileno(stdin), TCSAFLUSH, &cmdtty) < 0)
|
||||
return SCPE_TTIERR;
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue