#include "kernel/mod2.h"
#include "omalloc/omalloc.h"
#include "reporter/si_signals.h"
#include "Singular/fevoices.h"
#include "misc/options.h"
#include "Singular/tok.h"
#include "Singular/ipshell.h"
#include "Singular/cntrlc.h"
#include "Singular/feOpt.h"
#include "Singular/misc_ip.h"
#include "Singular/links/silink.h"
#include "Singular/links/ssiLink.h"
#include <NTL/version.h>
#include <NTL/tools.h>
#include <time.h>
#include <sys/time.h>
Go to the source code of this file.
◆ CALL_GDB
◆ INTERACTIVE
◆ STACK_TRACE
◆ si_hdl_typ
typedef void(* si_hdl_typ) (int) |
◆ debug()
static void debug |
( |
int |
method | ) |
|
|
static |
Definition at line 408 of file cntrlc.cc.
417 char * args[4] = { (
char*)
"gdb", (
char*)
"Singular",
NULL,
NULL };
423 sprintf (
buf,
"%d", getpid ());
433 fputs (
"\n\nquit with \"p si_stop_stack_trace_x=0\"\n\n\n",stderr);
437 fputs (
"stack_trace\n",stderr);
447 perror (
"could not fork");
◆ debug_stop()
static void debug_stop |
( |
char *const * |
args | ) |
|
|
static |
Definition at line 455 of file cntrlc.cc.
457 execvp (args[0], args);
458 perror (
"exec failed");
◆ init_signals()
init signal handlers and error handling for libraries: NTL, factory
Definition at line 561 of file cntrlc.cc.
565 #if (((NTL_MAJOR_VERSION==9)&&(NTL_MINOR_VERSION>=3))||(NTL_MAJOR_VERSION>=10))
◆ si_set_signal()
meta function for binding a signal to an handler
- Parameters
-
[in] | sig | Signal number |
[in] | signal_handler | Pointer to signal handler |
- Returns
- value of signal()
Definition at line 123 of file cntrlc.cc.
127 if (retval == SIG_ERR)
129 fprintf(stderr,
"Unable to init signal %d ... exiting...\n", sig);
136 struct sigaction new_action,old_action;
137 memset(&new_action, 0,
sizeof(
struct sigaction));
140 new_action.sa_handler = signal_handler;
142 sigemptyset (&new_action.sa_mask);
144 new_action.sa_flags = SA_RESTART;
146 int r=si_sigaction (sig, &new_action, &old_action);
150 fprintf(stderr,
"Unable to init signal %d ... exiting...\n", sig);
◆ sig_pipe_hdl()
void sig_pipe_hdl |
( |
int |
| ) |
|
◆ sig_term_hdl()
void sig_term_hdl |
( |
int |
| ) |
|
◆ sigint_handler()
void sigint_handler |
( |
int |
| ) |
|
Definition at line 311 of file cntrlc.cc.
317 char default_opt=
' ';
319 && ((
char*)(
feOptSpec[FE_OPT_CNTRLC].value))[0])
320 { default_opt=((
char*)(
feOptSpec[FE_OPT_CNTRLC].value))[0]; }
330 else if (default_opt!=
' ')
336 fprintf(stderr,
"// ** Interrupt at cmd:`%s` in line:'%s'\n",
340 fputs(
"abort after this command(a), abort immediately(r), print backtrace(b), continue(c) or quit Singular(q) ?",stderr);
341 fflush(stderr);fflush(stdin);
358 fputs(
"** Warning: Singular should be restarted as soon as possible **\n",stderr);
367 fputs(
"** tried too often, try another possibility **\n",stderr);
380 while (c != EOF && c !=
'\n') c = fgetc(stdin);
◆ sigsegv_handler()
void sigsegv_handler |
( |
int |
sig | ) |
|
Definition at line 279 of file cntrlc.cc.
281 fprintf(stderr,
"Singular : signal %d (v: %d):\n",
286 fprintf(stderr,
"Segment fault/Bus error occurred (r:%d)\n"
287 "please inform the authors\n",
294 fputs(
"trying to restart...\n",stderr);
◆ stack_trace()
static void stack_trace |
( |
char *const * |
args | ) |
|
|
static |
Definition at line 463 of file cntrlc.cc.
471 int sel,
index, state;
475 if ((pipe (in_fd) == -1) || (pipe (out_fd) == -1))
477 perror (
"could open pipe");
484 si_close (0); si_dup2 (in_fd[0],0);
485 si_close (1); si_dup2 (out_fd[1],1);
486 si_close (2); si_dup2 (out_fd[1],2);
488 execvp (args[0], args);
489 perror (
"exec failed");
494 perror (
"could not fork");
499 FD_SET (out_fd[0], &fdset);
501 si_write (in_fd[1],
"backtrace\n", 10);
502 si_write (in_fd[1],
"p si_stop_stack_trace_x = 0\n", 28);
503 si_write (in_fd[1],
"quit\n", 5);
514 sel = si_select (FD_SETSIZE, &readset,
NULL,
NULL, &tv);
518 if ((sel > 0) && (FD_ISSET (out_fd[0], &readset)))
520 if (si_read (out_fd[0], &c, 1))
534 if ((c ==
'\n') || (c ==
'\r'))
537 fputs (buffer,stderr);
553 si_close (out_fd[0]);
554 si_close (out_fd[1]);
◆ defer_shutdown
volatile int defer_shutdown = 0 |
◆ do_shutdown
◆ pipeLastLink
◆ si_restart
◆ si_start_jmpbuf
◆ si_stop_stack_trace_x
volatile int si_stop_stack_trace_x |
◆ sigint_handler_cnt
int sigint_handler_cnt =0 |
◆ singular_in_batchmode
◆ siRandomStart