Re: SIGSEGV catching

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

 



Hi, Emilio. Sure is.  In my code, I have this:

#include <signal.h>

void sig_segv(int);

main(int argc, char **argv) {

    signal(SIGSEGV, sig_segv);

}

void sig_segv(int errno) {
	// Re-establish seg fault breakpoint. When this handler is called,
	// SIGSEGV is no longer being captured, least in Solaris. I
	// believe Linux behaves the same way.
	signal(SIGSEGV, sig_segv);

	puts("seg fault!\n");
	// recovery stuff here.

}

---

This is simply userspace code.  


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux