How to write a signal handler to catch SIGSEGV?
问题 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; mprotect(buffer,pagesize,PROT_NONE) This protects pagesize bytes of memory starting at buffer against any reads or writes. Second, I try to read the memory: p = buffer; a = *p This will generate a SIGSEGV, and my handler will be called. So far so good. My problem is that, once the handler is called, I want to change the access write of the