[Vm-dev] patch: improved signal handling (for discussion)
ag at computer.org
Wed Feb 11 12:27:18 UTC 2009
Following on from my last message, here's the first
pass at a patch to replace signal() calls with sigaction().
As you can tell, it's against the 3.10-4 tree.
I'd appreciate any feedback.
- in UnixOSProcessPlugin.c, we replace signal() with
sigaction(). This is the pattern we use.
- in aio.c, I introduced a tiny function, aioShimHandler,
to call forceInterruptCheck. This was to work around a
compiler warning (the function prototypes differed).
It also helped with printf debugging.
- in aio.c, it's not clear to my why SIGPIPE is ignored.
Can anyone explain it? I've updated this code.
- in aio.c, aioFini never used to clear the SIGIO handler.
Why is this? I've done it now, with no obvious ill effects,
but that doesn't count for a lot when dealing with signals.
- in sqUnixMain.c, I've added a default handler for HUP,
USR1, USR2, and TERM. The default action for these
signals is to terminate the VM. This way, they just
complain a little to stderr, unless a handler has been
set in smalltalk. Now, if a signal arrives before the
smalltalk is ready, they just ignore it. Actually, it
would be better to block / queue signals, which would
then be delivered when the handler is installed. Hmmm.
More information about the Vm-dev