Re: Floating-point exception handling
Re: Floating-point exception handling
- Subject: Re: Floating-point exception handling
- From: "David N. Williams" <email@hidden>
- Date: Mon, 28 Sep 2009 18:13:14 -0400
- Organization: University of Michigan
David N. Williams wrote:
> [...]
>
> Even so, I still have a problem. When the example is run on
> OS X intel, the only signal code supplied to the handler in the
> si_code field of the siginfo_t structure, when it's invoked on
> SIGFPE, is FPE_NOOP. OS X ppc and GNU/Linux both supply at
> least FPE_FLTDIV and FPE_FLTINV -- other codes not tested yet.
> [...]
>
> So am I doing something wrong?
Nobody seems to have an idea about this? :-( After
experimenting with more cases, AFAICT I'm not doing anything
wrong -- the discrepancy is real.
So let me advocate that the discrepancy be resolved to make the
intel behavior for sigaction() the same as that for ppc and
GNU/Linux.
Is it onerous to implement putting the FPE_xxx code for the
floating-point exception which invokes SIGFPE into the si_code
member of the siginfo_t received by the handler? Without that
or equivalent information, alternate IEEE 754 signal handling
seems crippled.
Doing so seems to be the Single UNIX 3 spec. IANAL, so it's
hard for me to judge whether the [XSI|RTS] label next to the
spec for si_code quoted below means that it's technically
optional.
Am I off base here?
-- David
----------
QUOTE on sigaction() from
http://www.opengroup.org/onlinepubs/000095399/functions/sigaction.html
[XSI|RTS] If SA_SIGINFO is set and the signal is caught, the
signal-catching function shall be entered as:
void func(int signo, siginfo_t *info, void *context);
where two additional arguments are passed to the
signal-catching function. The second argument shall point to
an object of type siginfo_t explaining the reason why the
signal was generated; the third argument can be cast to a
pointer to an object of type ucontext_t to refer to the
receiving thread's context that was interrupted when the
signal was delivered. In this case, the application shall use
the sa_sigaction member to describe the signal-catching
function and the application shall not modify the sa_handler
member.
The si_signo member contains the system-generated signal
number.
[XSI] The si_errno member may contain implementation-defined
additional error information; if non-zero, it contains an
error number identifying the condition that caused the signal
to be generated.
[XSI|RTS] The si_code member contains a code identifying the
cause of the signal.
----------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden