signal-handling

Where should signal handlers live in a django project?

我只是一个虾纸丫 提交于 2019-11-26 04:05:53
问题 I have just started implementing signal listeners in a django project. While I understand what they are and how to use them. I am having a hard time figuring out where I should put them. The documentation from the django site has this to say: Where should this code live? You can put signal handling and registration code anywhere you like. However, you\'ll need to make sure that the module it\'s in gets imported early on so that the signal handling gets registered before any signals need to be

How to write a signal handler to catch SIGSEGV?

筅森魡賤 提交于 2019-11-25 23:40:26
问题 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