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.
Some notes: - 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.
- Andrew
On 11.02.2009, at 13:27, Andrew Gaylard wrote:
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.
Some notes:
- 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.
- Andrew
A very useful default handler for USR1 is to print a stack trace. This has not made it into the official VM yet but it has reportedly been very useful for debugging. Attached.
- Bert -
vm-dev@lists.squeakfoundation.org