remove SIGINT handling which was not functional
add SIGSEGV handler which may be excluded by set nosighandling
This commit is contained in:
parent
8e4994e707
commit
3fcc35799b
|
|
@ -169,6 +169,13 @@ sigsegv(void)
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RETSIGTYPE
|
||||||
|
sigsegvsh(void)
|
||||||
|
{
|
||||||
|
fprintf(cp_err, "\ninternal error -- segmentation violation\n");
|
||||||
|
controlled_exit(EXIT_SEGV);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RETSIGTYPE
|
RETSIGTYPE
|
||||||
sig_sys(void)
|
sig_sys(void)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ RETSIGTYPE sigcont(void);
|
||||||
RETSIGTYPE sigill(void);
|
RETSIGTYPE sigill(void);
|
||||||
RETSIGTYPE sigbus(void);
|
RETSIGTYPE sigbus(void);
|
||||||
RETSIGTYPE sigsegv(void);
|
RETSIGTYPE sigsegv(void);
|
||||||
|
RETSIGTYPE sigsegvsh(void);
|
||||||
RETSIGTYPE sig_sys(void);
|
RETSIGTYPE sig_sys(void);
|
||||||
|
|
||||||
extern JMP_BUF jbuf;
|
extern JMP_BUF jbuf;
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@
|
||||||
#define EXIT_NORMAL 0
|
#define EXIT_NORMAL 0
|
||||||
#define EXIT_BAD 1
|
#define EXIT_BAD 1
|
||||||
#define EXIT_INFO 2
|
#define EXIT_INFO 2
|
||||||
|
#define EXIT_SEGV 3
|
||||||
|
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,6 @@ static int
|
||||||
runc(char* command)
|
runc(char* command)
|
||||||
{
|
{
|
||||||
char buf[1024] = "";
|
char buf[1024] = "";
|
||||||
sighandler oldHandler;
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
#ifndef low_latency
|
#ifndef low_latency
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
|
|
@ -525,20 +524,6 @@ runc(char* command)
|
||||||
strncpy(buf, command, 1024);
|
strncpy(buf, command, 1024);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Catch Ctrl-C to break simulations */
|
|
||||||
#if 1 //!defined(_MSC_VER) /*&& !defined(__MINGW32__) */
|
|
||||||
oldHandler = signal(SIGINT, (SIGNAL_FUNCTION) ft_sigintr);
|
|
||||||
if (SETJMP(jbuf, 1) != 0) {
|
|
||||||
ft_sigintr_cleanup();
|
|
||||||
signal(SIGINT, oldHandler);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
oldHandler = SIG_IGN;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
/* run in the background */
|
/* run in the background */
|
||||||
if (fl_bg && fl_exited) {
|
if (fl_bg && fl_exited) {
|
||||||
|
|
@ -559,7 +544,6 @@ runc(char* command)
|
||||||
} else
|
} else
|
||||||
/* bg_halt (pause) a bg run */
|
/* bg_halt (pause) a bg run */
|
||||||
if (!strcmp(buf, "bg_halt")) {
|
if (!strcmp(buf, "bg_halt")) {
|
||||||
signal(SIGINT, oldHandler);
|
|
||||||
return _thread_stop();
|
return _thread_stop();
|
||||||
/* bg_ctrl prepare running the controls after bg_run */
|
/* bg_ctrl prepare running the controls after bg_run */
|
||||||
} else if (!strcmp(buf, "bg_ctrl")) {
|
} else if (!strcmp(buf, "bg_ctrl")) {
|
||||||
|
|
@ -584,7 +568,6 @@ runc(char* command)
|
||||||
#else
|
#else
|
||||||
cp_evloop(buf);
|
cp_evloop(buf);
|
||||||
#endif /*THREADS*/
|
#endif /*THREADS*/
|
||||||
signal(SIGINT, oldHandler);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -695,7 +678,7 @@ int
|
||||||
ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexit,
|
ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexit,
|
||||||
SendData* sdata, SendInitData* sinitdata, BGThreadRunning* bgtrun, void* userData)
|
SendData* sdata, SendInitData* sinitdata, BGThreadRunning* bgtrun, void* userData)
|
||||||
{
|
{
|
||||||
sighandler old_sigint;
|
sighandler old_sigsegv;
|
||||||
|
|
||||||
pfcn = printfcn;
|
pfcn = printfcn;
|
||||||
/* if caller sends NULL, don't send printf strings */
|
/* if caller sends NULL, don't send printf strings */
|
||||||
|
|
@ -740,9 +723,11 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
|
||||||
#endif
|
#endif
|
||||||
// Id of primary thread
|
// Id of primary thread
|
||||||
main_id = threadid_self();
|
main_id = threadid_self();
|
||||||
signal(SIGINT, sighandler_sharedspice);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!cp_getvar("nosighandling", CP_BOOL, NULL, 0))
|
||||||
|
old_sigsegv = signal(SIGSEGV, (SIGNAL_FUNCTION) sigsegvsh);
|
||||||
|
|
||||||
ft_rawfile = NULL;
|
ft_rawfile = NULL;
|
||||||
ivars(NULL);
|
ivars(NULL);
|
||||||
|
|
||||||
|
|
@ -778,14 +763,6 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
|
||||||
ft_cpinit();
|
ft_cpinit();
|
||||||
|
|
||||||
/* Read the user config files */
|
/* Read the user config files */
|
||||||
/* To catch interrupts during .spiceinit... */
|
|
||||||
old_sigint = signal(SIGINT, (SIGNAL_FUNCTION) ft_sigintr);
|
|
||||||
if (SETJMP(jbuf, 1) == 1) {
|
|
||||||
ft_sigintr_cleanup();
|
|
||||||
fprintf(cp_err, "Warning: error executing .spiceinit.\n");
|
|
||||||
goto bot;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_PWD_H
|
#ifdef HAVE_PWD_H
|
||||||
/* Try to source either .spiceinit or ~/.spiceinit. */
|
/* Try to source either .spiceinit or ~/.spiceinit. */
|
||||||
if (access(".spiceinit", 0) == 0) {
|
if (access(".spiceinit", 0) == 0) {
|
||||||
|
|
@ -836,9 +813,10 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
|
||||||
#endif /* ~ HAVE_PWD_H */
|
#endif /* ~ HAVE_PWD_H */
|
||||||
|
|
||||||
bot:
|
bot:
|
||||||
signal(SIGINT, old_sigint);
|
if (!cp_getvar("nosighandling", CP_BOOL, NULL, 0))
|
||||||
|
signal(SIGSEGV, old_sigsegv);
|
||||||
|
|
||||||
/* initilise display to 'no display at all'*/
|
/* initialize display to 'no display at all'*/
|
||||||
DevInit();
|
DevInit();
|
||||||
|
|
||||||
#ifdef FastRand
|
#ifdef FastRand
|
||||||
|
|
@ -857,7 +835,6 @@ bot:
|
||||||
initw();
|
initw();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// com_version(NULL);
|
|
||||||
fprintf(cp_out,
|
fprintf(cp_out,
|
||||||
"******\n"
|
"******\n"
|
||||||
"** %s-%s shared library\n",
|
"** %s-%s shared library\n",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue