Unix Signal Handling

YAP interface to Unix style signals.

Define:

1. SIG_PROLOG_OFFSET:

1. SIG_EXCEPTION:

1. SIG_GC:

1. SIG_FREECLAUSES:

1. SIG_PLABORT:

Functions:

1. static void my_signal_info(int sig, void *handler):

1. static void my_signal(int sig, void *handler):

1. int Yap_set_sigaction(int sig, void *handler):

1. static void HandleMatherr(int sig, void sipv, void uapv):

1. int Yap_signal_index(const char *name):

1. bool Yap_set_fpu_exceptions(Term flag):

1. static void ReceiveSignal(int s, void x, void y):

1. static Int alar/4(USES_REGS1): : "alarm(Secs, USecs, OldSecs, OldUSecs" )

@class alarm_4

If Secs or Msecs are greater than 0, ask the Operating system to interrupt YAP in the next Secs seconds, USsecs nicrosecds. If an alarm was active, Unify the last two arguments with the time left.

Time is wall-time, so precision may vary.

1. static Int virtual_alarm(USES_REGS1): : "virtual_alarm(Secs, USecs, OldSecs, OldUSecs" )

@class virtual_alarm_4

If Secs or Msecs are greater than 0, ask the Operating system to interrupt YAP in the next user-time Secs seconds, USsecs nicrosecds.

Time is wall-time, so precision may vary.

1. yap_error_number Yap_MathException__(USES_REGS1):

1. bool Yap_InitSIGSEGV(Term enable): : This function implements the sigsegv prolog flag.

It should be called when we want other languages to take over handling this signal.

enableon off return:
should always succeed

1. void Yap_InitOSSignals(int wid): : This routine sets up the signal handlers.

It depends on the flag GLOBAL_PrologShouldHandleInterrupts. Notice that it should only be called if we want to set up interrupt handlers, or if we want to disable ones set up by Prolog. It should not be called if Prolog is in embedded mode.

SIGINT can cause problems, if caught before full initialization

1. static Int enable_interrupts(USES_REGS1):

1. static Int disable_interrupts(USES_REGS1):

1. void Yap_InitSignalPreds(void): : Initialize internal interface predicates.

Var:

1. struct signame signames[][]: