#include <kernel/mod2.h>
#include <omalloc/omalloc.h>
#include <reporter/si_signals.h>
#include <Singular/fevoices.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 <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <strings.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
Go to the source code of this file.
| typedef void(* si_hdl_typ) (int) |
Definition at line 575 of file cntrlc.cc.
void sig_chld_hdl(int sig)
additional default signal handler
void sigsegv_handler(int sig)
si_hdl_typ si_set_signal(int sig, si_hdl_typ signal_handler)
meta function for binding a signal to an handler
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 135 of file cntrlc.cc.
139 if (retval == SIG_ERR)
141 fprintf(stderr,
"Unable to init signal %d ... exiting...\n", sig);
148 struct sigaction new_action,old_action;
149 memset(&new_action, 0,
sizeof(
struct sigaction));
152 new_action.sa_handler = signal_handler;
154 sigemptyset (&new_action.sa_mask);
156 new_action.sa_flags = SA_RESTART;
158 int r=si_sigaction (sig, &new_action, &old_action);
162 fprintf(stderr,
"Unable to init signal %d ... exiting...\n", sig);
int int kStrategy strat if(h==NULL) return NULL
#define si_siginterrupt(arg1, arg2)
| void sig_chld_hdl |
( |
int |
| ) |
|
additional default signal handler
some newer Linux version cannot have SIG_IGN for SIGCHLD, so use this nice routine here: SuSe 9.x reports -1 always Redhat 9.x/FC x reports sometimes -1 see also: hpux_system also needed by getrusage (timer etc.)
- Parameters
-
Definition at line 1890 of file ssiLink.cc.
1897 kidpid = si_waitpid(-1, &status, WNOHANG);
1901 if (errno == EINTR)
continue;
1905 else if (kidpid==0)
break;
BOOLEAN ssiOpen(si_link l, short flag, leftv u)
volatile BOOLEAN ssiToBeClosed_inactive
BOOLEAN slClose(si_link l)
| void sig_pipe_hdl |
( |
int |
| ) |
|
Definition at line 80 of file cntrlc.cc.
void WerrorS(const char *s)
BOOLEAN slClose(si_link l)
| void sig_term_hdl |
( |
int |
| ) |
|
Definition at line 93 of file cntrlc.cc.
volatile BOOLEAN do_shutdown
volatile int defer_shutdown
| void sigint_handler |
( |
int |
| ) |
|
Definition at line 325 of file cntrlc.cc.
331 char default_opt=
' ';
333 && ((
char*)(
feOptSpec[FE_OPT_CNTRLC].value))[0])
334 { default_opt=((
char*)(
feOptSpec[FE_OPT_CNTRLC].value))[0]; }
344 else if (default_opt!=
' ')
350 fprintf(stderr,
"// ** Interrupt at cmd:`%s` in line:'%s'\n",
354 fputs(
"abort after this command(a), abort immediately(r), print backtrace(b), continue(c) or quit Singular(q) ?",stderr);fflush(stderr);
371 fputs(
"** Warning: Singular should be restarted as soon as possible **\n",stderr);
377 fputs(
"** tried too often, try another possibility **\n",stderr);
390 while (c != EOF && c !=
'\n') c = fgetc(stdin);
static void * feOptValue(feOptIndex opt)
BOOLEAN singular_in_batchmode
si_hdl_typ si_set_signal(int sig, si_hdl_typ signal_handler)
meta function for binding a signal to an handler
struct fe_option feOptSpec[]
const char * Tok2Cmdname(int tok)
| void sigsegv_handler |
( |
int |
sig | ) |
|
Definition at line 291 of file cntrlc.cc.
293 fprintf(stderr,
"Singular : signal %d (v: %d):\n",
298 fprintf(stderr,
"Segment fault/Bus error occurred (r:%d)\n"
299 "please inform the authors\n",
306 fprintf(stderr,
"trying to restart...\n");
313 if (sig!=SIGINT) debug(STACK_TRACE);
| volatile int defer_shutdown = 0 |
| int sigint_handler_cnt =0 |