Re: a segfault-handler?



On Tue, Apr 10, 2001 at 11:33:52AM +0200, Ronald Bultje wrote:
> Hi,
> 
> is it possible to conect a signal handler to a segmentation fault? I would
> like to stop child processes (the pipe-processes, to prevent "ghost
> processes") and release the hardware devices I use before quitting and
> dumping core, since otherwise, the device will report as being busy and you
> need a full restart to correct that (and a message that you need to send
> bug report could come in handy as well here :-) )...
> 
> Ronald

Wow, three replies so far and noone says how to do it :)

The answer is you can connect a callback to a signal with either the signal() (simplistic) or the sigaction() (sophisticated) system calls. Once you've finished doing everything in your handler, change the signal to call the SIG_DFL dummy function and raise() it again, and the program will dump core.

> 
> -- 
> ---------------------------------------------------.
> --   .-.    | Ronald Bultje                        |
> --   /V\    | Running: Linux 2.4.2 and OpenBSD 2.8 |
> --  // \\   | E-mail : rbultje ronald bitfreak net |
> -- /(   )\  | WWW    : http://ronald.bitfreak.net/ |
> --  ^^-^^   |    *** Warning: Unix Addicted ***    |
> ---------------------------------------------------'
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]