signal handling

Andrew Haley aph@cambridge.redhat.com
Mon Jan 28 02:13:00 GMT 2002


Nic Ferrier writes:
 > An idle question: apologies if this seems obvious to people.
 > 
 > 
 > Something I really like about the Sun VM is the SIGQUIT handling
 > (sending a SIGQUIT causes interesting status information to be sent to
 > System.out, interesting stuff like thread stack traces and memory
 > used).
 > 
 > I was just wondering how I might start to implement something
 > similar... I presume that I could start by adding a SIGQUIT handler to
 > the various signal include files (i386-signal.h, etc...)
 > 
 > Is that the right way to go about it? or are those files for hardware
 > signals only?

I presume that SIGQUIT doesn't throw an exception, in which case
there's no special handling required.  If it does throw an exception,
special handling is required if you want to catch that exception.

The xx-signal.h files are the way they are because necessarily some
details of signal handling differ between targets.  However, if
SIGQUIT is portable between systems it doesn't need to be handled that
way.  So, where the code goes depends on whether it can be implemented
portably or not.

Eventually, gcc and/or glibc might transparently support an interface
between signals and exceptions.

Andrew.



More information about the Java mailing list