Ignoring SIGSEGV (was: no subject line)

Greg 'groggy' Lehey grog at FreeBSD.org
Tue Jul 29 16:55:31 PDT 2003


On Tuesday, 29 July 2003 at  9:16:29 +0000, cool46 cool46 wrote:
> how can ignore SEGV signal on Freebsd?

You can't.

> I am not mean setting SEGV's handler to SIG_IGN,this way can prevent
> program to exit,but can't restore environment to continue this
> program,so the program will hang and can't exit for ever.

Of course.  What do you expect to happen?  A SIGSEGV is an indication
that the instruction being executed can't complete.  Ignoring a
signal means going back and continuing with that instruction.  You'll
get the SIGSEGV again.

> I see a way in Linux,you can see
> http://kaizo.us/mirrors/phrack/phrack58/p58-0x03 ,

This page returns an error message: Not a typewriter (ENOTTY).

> but this is depend on OS because it is closed to OS' underlying
> layer and it is not works on Freebsd.Could you give me a
> example?thanks.

There are two things you can do with a SIGSEGV:

1.  Stop it from happening.  This is preferable.
2.  Add a signal handler which performs some alternative function.
    For example, you might print out some information about the state
    of the program before terminating.

Greg
--
When replying to this message, please copy the original recipients.
If you don't, I may ignore the reply or reply to the original recipients.
For more information, see http://www.lemis.com/questions.html
See complete headers for address and phone numbers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030730/e113e698/attachment.bin


More information about the freebsd-questions mailing list