X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=os_posix.cpp;h=c072d5da7c4361a216d36e669fc652d6464e1c86;hb=3d9a70ca68c1e0eeeec640e90625deb68245a64e;hp=684ffac40f668dd4398a77e60688c561c9d73791;hpb=ce04047159832b49f55618d76478ef264cbee462;p=apitrace diff --git a/os_posix.cpp b/os_posix.cpp index 684ffac..c072d5d 100644 --- a/os_posix.cpp +++ b/os_posix.cpp @@ -144,13 +144,16 @@ struct Interrupts : set(false), sig_int(NULL), sig_hup(NULL), - sig_term(NULL) + sig_term(NULL), + sig_segv(NULL), + handler(NULL) {} bool set; void (*sig_int)(int); void (*sig_hup)(int); void (*sig_term)(int); + void (*sig_segv)(int); void (*handler)(int); }; @@ -162,17 +165,24 @@ static void InterruptHandler(int sig) interrupts.handler(sig); } if (sig == SIGINT) { - if (!interrupts.sig_int) + if (!interrupts.sig_int) { exit(sig); + } interrupts.sig_int(sig); } else if (sig == SIGHUP) { - if (!interrupts.sig_hup) + if (!interrupts.sig_hup) { exit(sig); + } interrupts.sig_hup(sig); } else if (sig == SIGTERM) { - if (!interrupts.sig_term) + if (!interrupts.sig_term) { exit(sig); + } interrupts.sig_term(sig); + } else if (sig == SIGSEGV) { + if (interrupts.sig_segv) { + interrupts.sig_segv(sig); + } } } @@ -198,6 +208,7 @@ CatchInterrupts(void (*func)(int)) SET_IF_NOT_IGNORED(SIGINT, interrupts.sig_int); SET_IF_NOT_IGNORED(SIGHUP, interrupts.sig_hup); SET_IF_NOT_IGNORED(SIGTERM, interrupts.sig_term); + SET_IF_NOT_IGNORED(SIGSEGV, interrupts.sig_segv); interrupts.set = true; #undef SET_IF_NOT_IGNORED