[LCP]SIGFPE

Paul Gearon pag at PISoftware.com
Fri Jul 12 14:18:06 UTC 2002


On Thu, 11 Jul 2002, Jack Lloyd wrote:

> I'm not totally sure that you're allowed to do longjmp inside a signal
> handler (actually, I'm pretty sure it's undefined by POSIX). But I've seen
> it done in several pieces of reasonable portable pieces of software. I've
> never done this for SIGFPE but I've seen it for SIGILL and done it myself
> for SIGPIPE.

Actually POSIX explicitly says that this is one of the acceptable ways of
returning from a signal handler.  Just make damn sure you don't let your
signal handler do the longjmp (or the siglongjmp) a second time without
calling setjmp (or sigsetjmp) again.

(No, I don't have my own copy of the POSIX standard, but Stevens said that
it's in there, so it must be true.  :-)

Regards,
Paul Gearon

Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum
immane mittam.
(Translation from latin: "I have a catapult. Give me all the money,
or I will fling an enormous rock at your head.")






More information about the linuxCprogramming mailing list