Subject: Re: commit -- segfault handler on Unix
From: Matthew Kirkwood (weejock@ferret.lmh.ox.ac.uk)
Date: Thu Jul 13 2000 - 04:24:28 CDT
On Thu, 13 Jul 2000, sam th wrote:
> 4) The function I used, signal(), is not the POSIX fuction, which is
> sigaction(). Unfortunately, sigaction() is very complex, but I will
> fix this eventually.
It's not too bad:
signal(SIGSEGV, signalWrapper);
becomes:
struct sigaction sa;
// you can use sa_sigaction if you want more details on
// the exception
sa.sa_handler = signalWrapper;
// I think Netscape does this - it catches SEGV, does
// some cleanup, and then raises SIGBUS to kill itself
sigfillset(&sa.sa_mask);
sigdelset(&sa.sa_mask, SIGBUS);
sa.sa_flags = SA_ONESHOT // nested SEGVs are not
| SA_NOMASK; // worth handling
sigaction(SIGSEGV, sa, NULL);
The behaviour here is probably slightly different to signal(2),
but this interface does offer a lot more flexibility.
Matthew.
This archive was generated by hypermail 2b25 : Thu Jul 13 2000 - 04:24:32 CDT