Merge branch 'master' of git.dcc.fc.up.pt:yap-6.3
This commit is contained in:
commit
b932008946
@ -72,11 +72,11 @@ do_signal(int wid, yap_signals sig USES_REGS)
|
|||||||
UNLOCK(REMOTE_SignalLock(wid));
|
UNLOCK(REMOTE_SignalLock(wid));
|
||||||
#else
|
#else
|
||||||
if (!LOCAL_InterruptsDisabled) {
|
if (!LOCAL_InterruptsDisabled) {
|
||||||
Yap_regp->CreepFlag_ =
|
CreepFlag =
|
||||||
Unsigned(Yap_regp->LCL0_);
|
Unsigned(LCL0);
|
||||||
if (sig != YAP_CREEP_SIGNAL)
|
if (sig != YAP_CREEP_SIGNAL)
|
||||||
Yap_regp->EventFlag_ =
|
EventFlag =
|
||||||
Unsigned(Yap_regp->LCL0_);
|
Unsigned(LCL0);
|
||||||
}
|
}
|
||||||
UInt i = LOCAL_FirstActiveSignal;
|
UInt i = LOCAL_FirstActiveSignal;
|
||||||
if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) {
|
if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) {
|
||||||
|
375
C/sysbits.c
375
C/sysbits.c
@ -1134,7 +1134,7 @@ p_srandom ( USES_REGS1 )
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_SIGNAL
|
#if HAVE_SIGNAL_H
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
@ -1184,7 +1184,9 @@ static struct signame
|
|||||||
#endif
|
#endif
|
||||||
{ SIGILL, "ill", 0},
|
{ SIGILL, "ill", 0},
|
||||||
{ SIGABRT, "abrt", 0},
|
{ SIGABRT, "abrt", 0},
|
||||||
|
#if HAVE_SIGFPE
|
||||||
{ SIGFPE, "fpe", PLSIG_THROW},
|
{ SIGFPE, "fpe", PLSIG_THROW},
|
||||||
|
#endif
|
||||||
#ifdef SIGKILL
|
#ifdef SIGKILL
|
||||||
{ SIGKILL, "kill", 0},
|
{ SIGKILL, "kill", 0},
|
||||||
#endif
|
#endif
|
||||||
@ -1285,8 +1287,6 @@ Yap_signal_index(const char *name)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(__svr4__) || defined(__SVR4))
|
|
||||||
|
|
||||||
#if HAVE_SIGINFO_H
|
#if HAVE_SIGINFO_H
|
||||||
#include <siginfo.h>
|
#include <siginfo.h>
|
||||||
#endif
|
#endif
|
||||||
@ -1294,41 +1294,72 @@ Yap_signal_index(const char *name)
|
|||||||
#include <sys/ucontext.h>
|
#include <sys/ucontext.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void HandleSIGSEGV(int, siginfo_t *, ucontext_t *);
|
#if HAVE_SIGSEGV
|
||||||
static void HandleMatherr, (int, siginfo_t *, ucontext_t *);
|
static void
|
||||||
static void my_signal_info(int, void (*)(int, siginfo_t *, ucontext_t *));
|
SearchForTrailFault(void *ptr, int sure)
|
||||||
static void my_signal(int, void (*)(int, siginfo_t *, ucontext_t *));
|
{
|
||||||
|
|
||||||
|
/* If the TRAIL is very close to the top of mmaped allocked space,
|
||||||
|
then we can try increasing the TR space and restarting the
|
||||||
|
instruction. In the worst case, the system will
|
||||||
|
crash again
|
||||||
|
*/
|
||||||
|
#if OS_HANDLES_TR_OVERFLOW && !USE_SYSTEM_MALLOC
|
||||||
|
if ((ptr > (void *)LOCAL_TrailTop-1024 &&
|
||||||
|
TR < (tr_fr_ptr) LOCAL_TrailTop+(64*1024))) {
|
||||||
|
if (!Yap_growtrail(64*1024, TRUE)) {
|
||||||
|
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "YAP failed to reserve %ld bytes in growtrail", K64);
|
||||||
|
}
|
||||||
|
/* just in case, make sure the OS keeps the signal handler. */
|
||||||
|
/* my_signal_info(SIGSEGV, HandleSIGSEGV); */
|
||||||
|
} else
|
||||||
|
#endif /* OS_HANDLES_TR_OVERFLOW */
|
||||||
|
if (sure)
|
||||||
|
Yap_Error(FATAL_ERROR, TermNil,
|
||||||
|
"tried to access illegal address %p!!!!", ptr);
|
||||||
|
else
|
||||||
|
Yap_Error(FATAL_ERROR, TermNil,
|
||||||
|
"likely bug in YAP, segmentation violation");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This routine believes there is a continuous space starting from the
|
/* This routine believes there is a continuous space starting from the
|
||||||
HeapBase and ending on TrailTop */
|
HeapBase and ending on TrailTop */
|
||||||
static void
|
static void
|
||||||
HandleSIGSEGV(int sig, siginfo_t *sip, ucontext_t *uap)
|
HandleSIGSEGV(int sig, void *sipv, void *uap)
|
||||||
{
|
{
|
||||||
|
void *ptr = TR;
|
||||||
#if !USE_SYSTEM_MALLOC
|
int sure = FALSE;
|
||||||
|
if (LOCAL_PrologMode & ExtendStackMode) {
|
||||||
|
Yap_Error(FATAL_ERROR, TermNil, "OS memory allocation crashed at address %p, bailing out\n",LOCAL_TrailTop);
|
||||||
|
}
|
||||||
|
#if (defined(__svr4__) || defined(__SVR4))
|
||||||
|
siginfo_t *sip = sipv;
|
||||||
if (
|
if (
|
||||||
sip->si_code != SI_NOINFO &&
|
sip->si_code != SI_NOINFO &&
|
||||||
sip->si_code == SEGV_MAPERR &&
|
sip->si_code == SEGV_MAPERR) {
|
||||||
(void *)(sip->si_addr) > (void *)(Yap_HeapBase) &&
|
ptr = sip->si_addr;
|
||||||
(void *)(sip->si_addr) < (void *)(LOCAL_TrailTop+K64)) {
|
sure = TRUE;
|
||||||
Yap_growtrail(K64, TRUE);
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
Yap_Error(FATAL_ERROR, TermNil,
|
|
||||||
"likely bug in YAP, segmentation violation at %p", sip->si_addr);
|
|
||||||
}
|
}
|
||||||
|
#elif __linux__
|
||||||
|
siginfo_t *sip = sipv;
|
||||||
|
ptr = sip->si_addr;
|
||||||
|
sure = TRUE;
|
||||||
|
#endif
|
||||||
|
SearchForTrailFault( ptr, sure );
|
||||||
}
|
}
|
||||||
|
#endif /* SIGSEGV */
|
||||||
|
|
||||||
|
#if HAVE_SIGFPE
|
||||||
static void
|
static void
|
||||||
HandleMatherr(int sig, siginfo_t *sip, ucontext_t *uap)
|
HandleMatherr(int sig, void *sipv, void *uapv)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
yap_error_number error_no;
|
yap_error_number error_no;
|
||||||
|
|
||||||
/* reset the registers so that we don't have trash in abstract machine */
|
/* reset the registers so that we don't have trash in abstract machine */
|
||||||
|
|
||||||
|
#if (defined(__svr4__) || defined(__SVR4))
|
||||||
switch(sip->si_code) {
|
switch(sip->si_code) {
|
||||||
case FPE_INTDIV:
|
case FPE_INTDIV:
|
||||||
error_no = EVALUATION_ERROR_ZERO_DIVISOR;
|
error_no = EVALUATION_ERROR_ZERO_DIVISOR;
|
||||||
@ -1353,76 +1384,7 @@ HandleMatherr(int sig, siginfo_t *sip, ucontext_t *uap)
|
|||||||
}
|
}
|
||||||
set_fpu_exceptions(0);
|
set_fpu_exceptions(0);
|
||||||
Yap_Error(error_no, TermNil, "");
|
Yap_Error(error_no, TermNil, "");
|
||||||
}
|
#elif __linux__
|
||||||
|
|
||||||
|
|
||||||
#if HAVE_SIGSEGV && !defined(THREADS)
|
|
||||||
static void
|
|
||||||
my_signal_info(int sig, void (*handler)(int, siginfo_t *, ucontext_t *))
|
|
||||||
{
|
|
||||||
struct sigaction sigact;
|
|
||||||
|
|
||||||
sigact.sa_handler = handler;
|
|
||||||
sigemptyset(&sigact.sa_mask);
|
|
||||||
sigact.sa_flags = SA_SIGINFO;
|
|
||||||
|
|
||||||
sigaction(sig,&sigact,NULL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
|
||||||
my_signal(int sig, void (*handler)(int, siginfo_t *, ucontext_t *))
|
|
||||||
{
|
|
||||||
struct sigaction sigact;
|
|
||||||
|
|
||||||
sigact.sa_handler=handler;
|
|
||||||
sigemptyset(&sigact.sa_mask);
|
|
||||||
sigact.sa_flags = 0;
|
|
||||||
sigaction(sig,&sigact,NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(__linux__)
|
|
||||||
|
|
||||||
static RETSIGTYPE HandleMatherr(int);
|
|
||||||
#if HAVE_SIGSEGV && !defined(THREADS)
|
|
||||||
static RETSIGTYPE HandleSIGSEGV(int,siginfo_t *,void *);
|
|
||||||
static void my_signal_info(int, void (*)(int,siginfo_t *,void *));
|
|
||||||
#endif
|
|
||||||
static void my_signal(int, void (*)(int));
|
|
||||||
|
|
||||||
/******** Handling floating point errors *******************/
|
|
||||||
|
|
||||||
|
|
||||||
/* old code, used to work with matherror(), deprecated now:
|
|
||||||
char err_msg[256];
|
|
||||||
switch (x->type)
|
|
||||||
{
|
|
||||||
case DOMAIN:
|
|
||||||
case SING:
|
|
||||||
Yap_Error(EVALUATION_ERROR_UNDEFINED, TermNil, "%s", x->name);
|
|
||||||
return(0);
|
|
||||||
case OVERFLOW:
|
|
||||||
Yap_Error(EVALUATION_ERROR_FLOAT_OVERFLOW, TermNil, "%s", x->name);
|
|
||||||
return(0);
|
|
||||||
case UNDERFLOW:
|
|
||||||
Yap_Error(EVALUATION_ERROR_FLOAT_UNDERFLOW, TermNil, "%s", x->name);
|
|
||||||
return(0);
|
|
||||||
case PLOSS:
|
|
||||||
case TLOSS:
|
|
||||||
Yap_Error(EVALUATION_ERROR_UNDEFINED, TermNil, "%s(%g) = %g", x->name,
|
|
||||||
x->arg1, x->retval);
|
|
||||||
return(0);
|
|
||||||
default:
|
|
||||||
Yap_Error(EVALUATION_ERROR_UNDEFINED, TermNil, NULL);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
static RETSIGTYPE
|
|
||||||
HandleMatherr(int sig)
|
|
||||||
{
|
|
||||||
CACHE_REGS
|
|
||||||
#if HAVE_FETESTEXCEPT
|
#if HAVE_FETESTEXCEPT
|
||||||
|
|
||||||
/* This should work in Linux, but it doesn't seem to. */
|
/* This should work in Linux, but it doesn't seem to. */
|
||||||
@ -1443,227 +1405,54 @@ HandleMatherr(int sig)
|
|||||||
/* something very bad happened on the way to the forum */
|
/* something very bad happened on the way to the forum */
|
||||||
set_fpu_exceptions(FALSE);
|
set_fpu_exceptions(FALSE);
|
||||||
Yap_Error(LOCAL_matherror , TermNil, "");
|
Yap_Error(LOCAL_matherror , TermNil, "");
|
||||||
}
|
|
||||||
|
|
||||||
#if HAVE_SIGSEGV && !defined(THREADS)
|
|
||||||
static void
|
|
||||||
my_signal_info(int sig, void (*handler)(int,siginfo_t *,void *))
|
|
||||||
{
|
|
||||||
struct sigaction sigact;
|
|
||||||
|
|
||||||
sigact.sa_sigaction = handler;
|
|
||||||
sigemptyset(&sigact.sa_mask);
|
|
||||||
#if HAVE_SIGINFO
|
|
||||||
sigact.sa_flags = SA_SIGINFO;
|
|
||||||
#else
|
|
||||||
sigact.sa_flags = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sigaction(sig,&sigact,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
#endif /* SIGFPE */
|
||||||
SearchForTrailFault(siginfo_t *siginfo)
|
|
||||||
{
|
|
||||||
void *ptr = siginfo->si_addr;
|
|
||||||
|
|
||||||
/* If the TRAIL is very close to the top of mmaped allocked space,
|
|
||||||
then we can try increasing the TR space and restarting the
|
|
||||||
instruction. In the worst case, the system will
|
|
||||||
crash again
|
|
||||||
*/
|
|
||||||
#if OS_HANDLES_TR_OVERFLOW && !USE_SYSTEM_MALLOC
|
|
||||||
if ((ptr > (void *)LOCAL_TrailTop-1024 &&
|
|
||||||
TR < (tr_fr_ptr) LOCAL_TrailTop+(64*1024))) {
|
|
||||||
if (!Yap_growtrail(64*1024, TRUE)) {
|
|
||||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "YAP failed to reserve %ld bytes in growtrail", K64);
|
|
||||||
}
|
|
||||||
/* just in case, make sure the OS keeps the signal handler. */
|
|
||||||
/* my_signal_info(SIGSEGV, HandleSIGSEGV); */
|
|
||||||
} else
|
|
||||||
#endif /* OS_HANDLES_TR_OVERFLOW */
|
|
||||||
{
|
|
||||||
Yap_Error(FATAL_ERROR, TermNil,
|
|
||||||
"tried to access illegal address %p!!!!", ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static RETSIGTYPE
|
|
||||||
HandleSIGSEGV(int sig, siginfo_t *siginfo, void *context)
|
|
||||||
{
|
|
||||||
if (LOCAL_PrologMode & ExtendStackMode) {
|
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "OS memory allocation crashed at address %p, bailing out\n",LOCAL_TrailTop);
|
|
||||||
}
|
|
||||||
SearchForTrailFault(siginfo);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
|
||||||
my_signal(int sig, void (*handler)(int))
|
|
||||||
{
|
|
||||||
struct sigaction sigact;
|
|
||||||
|
|
||||||
sigact.sa_handler=handler;
|
|
||||||
sigemptyset(&sigact.sa_mask);
|
|
||||||
sigact.sa_flags = 0;
|
|
||||||
|
|
||||||
sigaction(sig,&sigact,NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* if not (defined(__svr4__) || defined(__SVR4)) */
|
|
||||||
|
|
||||||
static RETSIGTYPE HandleMatherr(int);
|
|
||||||
static RETSIGTYPE HandleSIGSEGV(int);
|
|
||||||
static void my_signal_info(int, void (*)(int));
|
|
||||||
static void my_signal(int, void (*)(int));
|
|
||||||
|
|
||||||
/******** Handling floating point errors *******************/
|
|
||||||
|
|
||||||
|
|
||||||
/* old code, used to work with matherror(), deprecated now:
|
|
||||||
char err_msg[256];
|
|
||||||
switch (x->type)
|
|
||||||
{
|
|
||||||
case DOMAIN:
|
|
||||||
case SING:
|
|
||||||
Yap_Error(EVALUATION_ERROR_UNDEFINED, TermNil, "%s", x->name);
|
|
||||||
return(0);
|
|
||||||
case OVERFLOW:
|
|
||||||
Yap_Error(EVALUATION_ERROR_FLOAT_OVERFLOW, TermNil, "%s", x->name);
|
|
||||||
return(0);
|
|
||||||
case UNDERFLOW:
|
|
||||||
Yap_Error(EVALUATION_ERROR_FLOAT_UNDERFLOW, TermNil, "%s", x->name);
|
|
||||||
return(0);
|
|
||||||
case PLOSS:
|
|
||||||
case TLOSS:
|
|
||||||
Yap_Error(EVALUATION_ERROR_UNDEFINED, TermNil, "%s(%g) = %g", x->name,
|
|
||||||
x->arg1, x->retval);
|
|
||||||
return(0);
|
|
||||||
default:
|
|
||||||
Yap_Error(EVALUATION_ERROR_UNDEFINED, TermNil, NULL);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if HAVE_FENV_H
|
|
||||||
#include <fenv.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static RETSIGTYPE
|
|
||||||
HandleMatherr(int sig)
|
|
||||||
{
|
|
||||||
CACHE_REGS
|
|
||||||
#if HAVE_FETESTEXCEPT
|
|
||||||
/* This should work in Linux, but it doesn't seem to. */
|
|
||||||
|
|
||||||
int raised = fetestexcept(FE_ALL_EXCEPT);
|
|
||||||
|
|
||||||
if (raised & FE_OVERFLOW) {
|
|
||||||
LOCAL_matherror = EVALUATION_ERROR_FLOAT_OVERFLOW;
|
|
||||||
} else if (raised & (FE_INVALID|FE_INEXACT)) {
|
|
||||||
LOCAL_matherror = EVALUATION_ERROR_UNDEFINED;
|
|
||||||
} else if (raised & FE_DIVBYZERO) {
|
|
||||||
LOCAL_matherror = EVALUATION_ERROR_ZERO_DIVISOR;
|
|
||||||
} else if (raised & FE_UNDERFLOW) {
|
|
||||||
LOCAL_matherror = EVALUATION_ERROR_FLOAT_UNDERFLOW;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
LOCAL_matherror = EVALUATION_ERROR_UNDEFINED;
|
|
||||||
/* something very bad happened on the way to the forum */
|
|
||||||
set_fpu_exceptions(FALSE);
|
|
||||||
Yap_Error(LOCAL_matherror , TermNil, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
SearchForTrailFault(void)
|
|
||||||
{
|
|
||||||
/* If the TRAIL is very close to the top of mmaped allocked space,
|
|
||||||
then we can try increasing the TR space and restarting the
|
|
||||||
instruction. In the worst case, the system will
|
|
||||||
crash again
|
|
||||||
*/
|
|
||||||
#ifdef DEBUG
|
|
||||||
/* fprintf(stderr,"Catching a sigsegv at %p with %p\n", TR, TrailTop); */
|
|
||||||
#endif
|
|
||||||
#if OS_HANDLES_TR_OVERFLOW && !USE_SYSTEM_MALLOC
|
|
||||||
if ((TR > (tr_fr_ptr)LOCAL_TrailTop-1024 &&
|
|
||||||
TR < (tr_fr_ptr)LOCAL_TrailTop+(64*1024))|| Yap_DBTrailOverflow()) {
|
|
||||||
long trsize = K64;
|
|
||||||
|
|
||||||
while ((CELL)TR > (CELL)LOCAL_TrailTop+trsize) {
|
|
||||||
trsize += K64;
|
|
||||||
}
|
|
||||||
if (!Yap_growtrail(trsize, TRUE)) {
|
|
||||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "YAP failed to reserve %ld bytes in growtrail", K64);
|
|
||||||
}
|
|
||||||
/* just in case, make sure the OS keeps the signal handler. */
|
|
||||||
/* my_signal_info(SIGSEGV, HandleSIGSEGV); */
|
|
||||||
} else
|
|
||||||
#endif /* OS_HANDLES_TR_OVERFLOW */
|
|
||||||
Yap_Error(INTERNAL_ERROR, TermNil,
|
|
||||||
"likely bug in YAP, segmentation violation");
|
|
||||||
}
|
|
||||||
|
|
||||||
static RETSIGTYPE
|
|
||||||
HandleSIGSEGV(int sig)
|
|
||||||
{
|
|
||||||
CACHE_REGS
|
|
||||||
if (LOCAL_PrologMode & ExtendStackMode) {
|
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "OS memory allocation crashed at address %p, bailing out\n",LOCAL_TrailTop);
|
|
||||||
}
|
|
||||||
SearchForTrailFault();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if HAVE_SIGACTION
|
#if HAVE_SIGACTION
|
||||||
|
|
||||||
static void
|
static void
|
||||||
my_signal_info(int sig, void (*handler)(int))
|
my_signal_info(int sig, void (*handler)(int, void *, void *))
|
||||||
{
|
{
|
||||||
struct sigaction sigact;
|
struct sigaction sigact;
|
||||||
|
|
||||||
sigact.sa_handler = handler;
|
sigact.sa_handler = (void *)handler;
|
||||||
sigemptyset(&sigact.sa_mask);
|
sigemptyset(&sigact.sa_mask);
|
||||||
#if HAVE_SIGINFO
|
|
||||||
sigact.sa_flags = SA_SIGINFO;
|
sigact.sa_flags = SA_SIGINFO;
|
||||||
#else
|
|
||||||
sigact.sa_flags = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sigaction(sig,&sigact,NULL);
|
sigaction(sig,&sigact,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
my_signal(int sig, void (*handler)(int))
|
my_signal(int sig, void (*handler)(int, void *, void *))
|
||||||
{
|
{
|
||||||
struct sigaction sigact;
|
struct sigaction sigact;
|
||||||
|
|
||||||
sigact.sa_handler=handler;
|
sigact.sa_handler= (void *)handler;
|
||||||
sigemptyset(&sigact.sa_mask);
|
sigemptyset(&sigact.sa_mask);
|
||||||
sigact.sa_flags = 0;
|
sigact.sa_flags = 0;
|
||||||
|
|
||||||
sigaction(sig,&sigact,NULL);
|
sigaction(sig,&sigact,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static void
|
static void
|
||||||
my_signal(int sig, void (*handler)(int))
|
my_signal(int sig, void (*handler)(int, void *, void *))
|
||||||
{
|
{
|
||||||
signal(sig, handler);
|
signal(sig, (void *)handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
my_signal_info(sig, handler)
|
my_signal_info(sig, handler)
|
||||||
int sig;
|
int sig;
|
||||||
void (*handler)(int);
|
void (*handler)(int, void *, void *);
|
||||||
{
|
{
|
||||||
if(signal(sig, handler) == SIG_ERR)
|
if(signal(sig, (void *)handler) == SIG_ERR)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif /* __linux__ */
|
|
||||||
|
|
||||||
#endif /* (defined(__svr4__) || defined(__SVR4)) */
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1757,12 +1546,8 @@ static int snoozing = FALSE;
|
|||||||
We assume we are within the context of the signal handler, whatever
|
We assume we are within the context of the signal handler, whatever
|
||||||
that might be
|
that might be
|
||||||
*/
|
*/
|
||||||
static RETSIGTYPE
|
static void
|
||||||
#if (defined(__svr4__) || defined(__SVR4))
|
HandleSIGINT (int sig, void *x, void *y)
|
||||||
HandleSIGINT (int sig, siginfo_t *x, ucontext_t *y)
|
|
||||||
#else
|
|
||||||
HandleSIGINT (int sig)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
/* fprintf(stderr,"mode = %x\n",LOCAL_PrologMode); */
|
/* fprintf(stderr,"mode = %x\n",LOCAL_PrologMode); */
|
||||||
@ -1785,10 +1570,6 @@ HandleSIGINT (int sig)
|
|||||||
/* make sure we are not waiting for the end of line */
|
/* make sure we are not waiting for the end of line */
|
||||||
YP_setbuf (stdin, NULL);
|
YP_setbuf (stdin, NULL);
|
||||||
#endif
|
#endif
|
||||||
if (snoozing) {
|
|
||||||
snoozing = FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ProcessSIGINT();
|
ProcessSIGINT();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1796,11 +1577,7 @@ HandleSIGINT (int sig)
|
|||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
/* this routine is called if the system activated the alarm */
|
/* this routine is called if the system activated the alarm */
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
#if (defined(__svr4__) || defined(__SVR4))
|
HandleALRM (int s, void *x, void *y)
|
||||||
HandleALRM (int s, siginfo_t *x, ucontext_t *y)
|
|
||||||
#else
|
|
||||||
HandleALRM(int s)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
my_signal (SIGALRM, HandleALRM);
|
my_signal (SIGALRM, HandleALRM);
|
||||||
/* force the system to creep */
|
/* force the system to creep */
|
||||||
@ -1814,11 +1591,7 @@ HandleALRM(int s)
|
|||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
/* this routine is called if the system activated the alarm */
|
/* this routine is called if the system activated the alarm */
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
#if (defined(__svr4__) || defined(__SVR4))
|
HandleVTALRM (int s, void *x, void *y)
|
||||||
HandleVTALRM (int s, siginfo_t *x, ucontext_t *y)
|
|
||||||
#else
|
|
||||||
HandleVTALRM(int s)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
my_signal (SIGVTALRM, HandleVTALRM);
|
my_signal (SIGVTALRM, HandleVTALRM);
|
||||||
/* force the system to creep */
|
/* force the system to creep */
|
||||||
@ -1836,20 +1609,18 @@ HandleVTALRM(int s)
|
|||||||
|
|
||||||
#if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)
|
#if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
#if (defined(__svr4__) || defined(__SVR4))
|
ReceiveSignal (int s, void *x, void *y)
|
||||||
ReceiveSignal (int s, siginfo_t *x, ucontext_t *y)
|
|
||||||
#else
|
|
||||||
ReceiveSignal (int s)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
switch (s)
|
switch (s)
|
||||||
{
|
{
|
||||||
#ifndef MPW
|
#ifndef MPW
|
||||||
|
#ifdef HAVE_SIGFPE
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
set_fpu_exceptions(FALSE);
|
set_fpu_exceptions(FALSE);
|
||||||
Yap_Error (SYSTEM_ERROR, TermNil, "floating point exception ]");
|
Yap_Error (SYSTEM_ERROR, TermNil, "floating point exception ]");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if !defined(LIGHT) && !defined(_WIN32)
|
#if !defined(LIGHT) && !defined(_WIN32)
|
||||||
/* These signals are not handled by WIN32 and not the Macintosh */
|
/* These signals are not handled by WIN32 and not the Macintosh */
|
||||||
case SIGQUIT:
|
case SIGQUIT:
|
||||||
@ -1929,7 +1700,7 @@ InitSignals (void)
|
|||||||
#else
|
#else
|
||||||
my_signal (SIGINT, HandleSIGINT);
|
my_signal (SIGINT, HandleSIGINT);
|
||||||
#endif
|
#endif
|
||||||
#ifndef MPW
|
#ifdef HAVE_SIGFPE
|
||||||
my_signal (SIGFPE, HandleMatherr);
|
my_signal (SIGFPE, HandleMatherr);
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_SIGSEGV && !defined(THREADS)
|
#if HAVE_SIGSEGV && !defined(THREADS)
|
||||||
@ -2806,7 +2577,7 @@ set_fpu_exceptions(int flag)
|
|||||||
#if HAVE_FETESTEXCEPT
|
#if HAVE_FETESTEXCEPT
|
||||||
feclearexcept(FE_ALL_EXCEPT);
|
feclearexcept(FE_ALL_EXCEPT);
|
||||||
#endif
|
#endif
|
||||||
#ifndef _WIN32
|
#ifdef HAVE_SIGFPE
|
||||||
my_signal (SIGFPE, HandleMatherr);
|
my_signal (SIGFPE, HandleMatherr);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
@ -2823,7 +2594,7 @@ set_fpu_exceptions(int flag)
|
|||||||
int v = _FPU_IEEE;
|
int v = _FPU_IEEE;
|
||||||
_FPU_SETCW(v);
|
_FPU_SETCW(v);
|
||||||
#endif
|
#endif
|
||||||
#ifndef _WIN32
|
#ifdef HAVE_SIGFPE
|
||||||
my_signal (SIGFPE, SIG_IGN);
|
my_signal (SIGFPE, SIG_IGN);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
4
C/text.c
4
C/text.c
@ -25,6 +25,10 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSNLEN
|
||||||
|
#define wcsnlen(S, N) wcslen(S)
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline unsigned char *get_char(unsigned char *p, int *c) { *c = *p; return p+1; }
|
static inline unsigned char *get_char(unsigned char *p, int *c) { *c = *p; return p+1; }
|
||||||
|
|
||||||
static inline wchar_t *get_wchar(wchar_t *p, int *c) { *c = *p; return p+1; }
|
static inline wchar_t *get_wchar(wchar_t *p, int *c) { *c = *p; return p+1; }
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
// SWI Options
|
// SWI Options
|
||||||
#define O_STRING 1
|
#define O_STRING 1
|
||||||
#define O_QUASIQUOTATIONS 1
|
#define O_QUASIQUOTATIONS 1
|
||||||
#if HAVE_LOCALE_H
|
#if HAVE_LOCALE_H && HAVE_SETLOCALE
|
||||||
#define O_LOCALE 1
|
#define O_LOCALE 1
|
||||||
#endif
|
#endif
|
||||||
//#define O_ATOMGC 1
|
//#define O_ATOMGC 1
|
||||||
|
Reference in New Issue
Block a user