Anton Ertl wrote:
I wonder if Dennis is compiling with -D_POSIX_SOURCE to avoid a problem with the absence of the signals FPE_INTDIV, FPE_INTOVF, and FPE_FLTSUB in MacOS X that was discussed around August 25. That prevents the definition of SA_SIGINFO, along with just about everything in Dennis's list above, as far as I can see.Dennis Ruffer wrote:Anton, On Jaguar (10.2.1), your changes produce the following errors: signals.c: In function `bsd_signal': signals.c:77: `SA_ONSTACK' undeclared (first use in this function) signals.c:77: (Each undeclared identifier is reported only once signals.c:77: for each function it appears in.) signals.c: In function `install_signal_handlers': signals.c:359: `stack_t' undeclared (first use in this function) signals.c:359: parse error before `sigstack' signals.c:362: `sigstack' undeclared (first use in this function) signals.c:362: `SIGSTKSZ' undeclared (first use in this function) signals.c:365: warning: implicit declaration of function `sigaltstack' signals.c:365: parse error before `)' DaRThanks. Jaguar is a codename for some MacOS X version, right? Looks like there's no sigaltstack() and friends there (nor SA_SIGINFO). I expected this from older Unices, but had hoped that this functionality would be present in all recent systems (after all, it's in Unix 95). Try putting #define _XOPEN_SOURCE 500 #define _XOPEN_SOURCE_EXTENDED #define _POSIX_C_SOURCE 199506L at the start of engine/signals.c and recompile. Let me know if this works or if you find another way to get to sigaltstack(). If not, you will just have to eliminate this stuff and live with this minor unpleasantness (the absensence of SA_SIGINFO causes much more unpleasantness, though: "Invalid memory address" instead of "Stack underflow" etc.).
In signals.c, gforth has
-----------------
#ifdef SA_SIGINFO
static void fpe_handler(int sig, siginfo_t *info, void *_)
/* handler for SIGFPE */
{
int code;
switch(info->si_code) {
case FPE_INTDIV: code=-10; break; /* integer divide by zero */
case FPE_INTOVF: code=-11; break; /* integer overflow */
case FPE_FLTDIV: code=-42; break; /* floating point divide by zero */
case FPE_FLTOVF: code=-43; break; /* floating point overflow */
case FPE_FLTUND: code=-54; break; /* floating point underflow */
case FPE_FLTRES: code=-41; break; /* floating point inexact result */
case FPE_FLTINV: /* invalid floating point operation */
case FPE_FLTSUB: /* subscript out of range */
default: code=-55; break;
}
longjmp(throw_jmp_buf,code);
}
------------------
On the other hand, /usr/include/sys/signals.h only has
----------------------
/* Codes for SIGFPE */
#define FPE_NOOP 0 /* if only I knew... */
#define FPE_FLTDIV 1 /* floating point divide by zero */
#define FPE_FLTOVF 2 /* floating point overflow */
#define FPE_FLTUND 3 /* floating point underflow */
#define FPE_FLTRES 4 /* floating point inexact result */
#define FPE_FLTINV 5 /* invalid floating point operation */
----------------------
That's why I made the suggestion that compiler errors from the nonexistent signals could be avoided by not defining SA_SIGINFO, which is in signals.h like this:
----------------------------
#if !defined(_POSIX_SOURCE)
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
#define SA_RESTART 0x0002 /* restart system on signal return */
#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */
#define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */
#define SA_NODEFER 0x0010 /* don't mask the signal we're delivering */
#define SA_NOCLDWAIT 0x0020 /* don't keep zombies around */
#define SA_SIGINFO 0x0040 /* signal handler with SA_SIGINFO args */
#define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */
#endif
----------------------------
That has the effect of also eliminating the structures, etc., used by sigaltstack(), because they also occur in signal.h in the scope of a "#if !defined(_POSIX_SOURCE)" statement.
I was too ignorant to worry about defining _POSIX_SOURCE.
At any rate, maybe it comes down to what's the best way to get around the missing signals, FPE_INTDIV, FPE_INTOVF, and FPE_FLTSUB.
-- David
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
