[RTEMS Project] #2100: SIGFPE
RTEMS trac
trac at rtems.org
Thu Dec 18 12:26:01 UTC 2014
#2100: SIGFPE
-----------------------------+----------------------------
Reporter: sebastian.huber | Owner: joel.sherrill
Type: defect | Status: new
Priority: low | Milestone: 5.0
Component: cpukit | Version: 4.11
Severity: normal | Resolution:
Keywords: |
-----------------------------+----------------------------
Changes (by sebastian.huber):
* priority: normal => low
* milestone: 4.11 => 5.0
Old description:
> A GCC test uses the following mechanic:
>
> #include <assert.h>
> #include <stdlib.h>
> #include <signal.h>
> #include <pthread.h>
>
> void sigfpe(int signum)
> {
> exit(0);
> }
>
> int main()
> {
> signal(SIGFPE, sigfpe);
>
> #ifdef __rtems__
> sigset_t set;
> sigemptyset(&set);
> sigaddset(&set, SIGFPE);
> pthread_sigmask(SIG_UNBLOCK, &set, NULL);
> #endif
>
> raise(SIGFPE);
>
> assert(0);
> }
>
> The parts in the defined(__rtems__) section are necessary in RTEMS to get
> a behaviour similar to Linux.
>
> This is because RTEMS has a special treatment for some signals (in
> killinfo()):
>
> /*
> * P1003.1c/Draft 10, p. 33 says that certain signals should always
> * be directed to the executing thread such as those caused by
> hardware
> * faults.
> */
> if ( (sig == SIGFPE) || (sig == SIGILL) || (sig == SIGSEGV ) )
> return pthread_kill( pthread_self(), sig );
>
> We should evaluate if this works as intended.
New description:
A GCC test uses the following mechanic:
#include <assert.h>
#include <stdlib.h>
#include <signal.h>
#include <pthread.h>
void sigfpe(int signum)
{
exit(0);
}
int main()
{
signal(SIGFPE, sigfpe);
#ifdef __rtems__
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGFPE);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
#endif
raise(SIGFPE);
assert(0);
}
The parts in the defined(__rtems__) section are necessary in RTEMS to get
a behaviour similar to Linux.
This is because RTEMS has a special treatment for some signals (in
killinfo()):
/*
* P1003.1c/Draft 10, p. 33 says that certain signals should always
* be directed to the executing thread such as those caused by hardware
* faults.
*/
if ( (sig == SIGFPE) || (sig == SIGILL) || (sig == SIGSEGV ) )
return pthread_kill( pthread_self(), sig );
We should evaluate if this works as intended.
--
--
Ticket URL: <http://devel.rtems.org/ticket/2100#comment:4>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list