I want to write a signal handler to catch SIGSEGV. I protect a block of memory for read or write using
char *buffer; char *p; char a; int pagesize = 4096;
You can recover from SIGSEGV on linux. Also you can recover from segmentation faults on Windows (you'll see a structured exception instead of a signal). But the POSIX standard doesn't guarantee recovery, so your code will be very non-portable.
Take a look at libsigsegv.