Re: Q: Signal processing

Philip Blundell (Philip.Blundell@pobox.com)
Sun, 08 Aug 1999 00:22:52 +0100


>* Is it necessary to return from a signal handler to the system, or is
>it okay if control stays in my application?

Nothing terribly bad will happen if a signal handler never returns (ie you
won't get a crash). The signal being handled is blocked until you return
so you can't overflow the kernel stack by recursing forever. On the other
hand that may make it somewhat inconvenient to do this.

>* If control has to return to the kernel, is there a way to influence
>what happens in the application *after* the signal handler has been
>left?

Yes; the signal handler can modify the register state (including the program
counter if you so desire) at the instant the signal was delivered. So you can
unthread the signal handler and make control immediately pass somewhere else
without actually returning to the place where the signal was delivered.

See the sigcontext structure for details. Exactly how you get at it is
probably architecture dependent.

p.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/